My model is the following: I have a 1D-lattice with L sites. Each site can be occupied by either one or zero atoms. The Hamiltonian looks as follows: $$H = T\sum(b^\dagger_i b_{i+1} + h.c.) + V\sum n_i n_{i+1}$$
My question is now of a rather basic quantum mechanical nature. I want to make sure what I'm doing is right and that I really understand it. (I'm programming all of this so I want to make sure the reason why my model isn't working doesn't lie on the physical side of things.)
First I've set up the hamiltonian's matrix regarding the Fock states (for example $|010011101001\rangle$): I've created a list of all possible states (there are $2^L$ states since every position can be either zero or one). Say state $|a\rangle$ results in two states, $|a\rangle$ itself and $|b\rangle$: $$H|a\rangle = x|a\rangle + y |b\rangle$$ then I looked at column belonging to $|a\rangle$ and wrote $x$ and $y$ in the lines belonging to $|a\rangle$ and $|b\rangle$ respectively. That way I got my Hamiltonian matrix. (It has block-diagonal form since the total number of atoms is conserved, that means there's a block for each possible total atom number from $0$ to $L$.) Up to this point I have no difficulties.
Now I diagonalize the Hamiltonian. I'm doing this by calculating its eigenvectors and eigenstates (since it has diagonal block form I can do this for each block separately, minimizing the calculation time). Next I plot the expectation value of some $\hat n _i$ operator against energy (using a scatter plot) with $i$ lying somewhere between $1$ and $L$. (The $\hat n _i$ operator on a Fock state returns the state itself with an eigenvalue of the occupation number of the site $i$, so $\hat n _2 |011\rangle = 1\cdot|011\rangle$ and $\hat n _2 |001\rangle = 0\cdot|001\rangle$.)
Now comes the part where I'm not sure on how to proceed. How do I calculate the expectation value, i.e. $ \langle \hat n _i \rangle$, and how do I calculate the energy? I've got the eigenstates in a representation of $2^L$ dimensional vectors, where each line corresponds to a specific Fock state (the first line is all lattice places empty the last line is all filled and those in between have some other occupational setup. That means I have the eigenvectors in the basis of my possible Fock states. How do I now calculate the expectation value?
I know that the eigenvalues are the energies corresponding to my eigenvectors but I don't know how the operator affects the eigenvectors, so my idea was to decompose the eigenvectors in my Fock basis so if I for now just call my different Fock states by the number of it's corresponding line in the Hamiltonian, and my eigenstate looks for a example like $(x,y,z)$ then I decompose it into $$(x,y,z) = x|1\rangle + y|2\rangle + z |3\rangle .$$ Since I know how my operator acts on the Fock states I could now calculate the expectation value by just the dot product between the old $x,y,z$ eigenvector and the new, changed eigenvector. I could also just calculate the Fock states' energies but since this problem scales up very fast this wouldn't be computationally feasible, I think, and one also wouldn't make use of the diagonalization.
I'm really not quite sure if this is correct, and if this is really how one makes use of the diagonalized Hamilton, maybe someone can shed some light on my problem and explain if my approach is correct or where my faults lie.