I am currently trying to calculate the charge gap \( E_c = E^{0}(N+1) + E^{0}(N-1) - 2 E^{0}(N) \) and the neutral gap \( E_n = E^{1}(N) - E^{0}(N) \) of the extended Boson Hubbard model in one dimension. (\( E^{1}(N) \) is the energy of the first excited state ,\( E^{0}(N) \) is the energy of the ground state. N is the number of bosons). The Hamiltonian of the model is given as:

\( H=-t \sum_{i} \left (b_{i}^{\dagger} b_{i+1}+\text { H.c. }\right)+ \frac{U}{2} \sum_{i} n_{i} \left(n_{i}-1\right)+\sum_{ \langle i,j \rangle} V n_{i} n_{j} \)

In order to prevent the effect of edge states on the calculations of the gap, I need to fix the number of bosons on the leftmost site to 0 and the number of bosons on the rightmost site to be 2 throughout the dmrg calculation. I am confused as to how do I implement this. I am using open boundary conditions.

## Keeping number of particles fixed at edges

### Re: Keeping number of particles fixed at edges

The answer comes probably a bit too late, but anyways:

How do you want to "fix" the states outside? If you imagine to project them to the local basis states with exactly 0/2 sites, you would have a product state with the rest. The hopping term wouldn't contribute, and you can just calculate the U/V terms by knowing the n_i at the boundaries.

However, I'm not sure if this is really what you mean here?

You could also try to explicitly add some terms to your Hamiltonian only at the boundaries, in order to fix the particle numbers there.

The corresponding TeNPy function would be add_local_term.

How do you want to "fix" the states outside? If you imagine to project them to the local basis states with exactly 0/2 sites, you would have a product state with the rest. The hopping term wouldn't contribute, and you can just calculate the U/V terms by knowing the n_i at the boundaries.

However, I'm not sure if this is really what you mean here?

You could also try to explicitly add some terms to your Hamiltonian only at the boundaries, in order to fix the particle numbers there.

The corresponding TeNPy function would be add_local_term.