I got the following question by email:

I encountered some difficulties when setting conserved quantities. I filled two types of bosons in a two-dimensional bosonsite, and I want to control the filling numbers for each boson. Usually, I control the filling number by controlling their chemical potential, for example, for a two-dimensional bosonsite with Lx=20 and Ly=4, the upper part with Lx=20 and Ly=2 is set to chemical potential \(\mu_{up}\), and the other part is set to \(\mu_{down}\).

However, controlling the filling through chemical potential is always inconvenient. The spinhalf model in the fermion system can directly achieve different fillings between different fermions through Sz conservation. But the boson system in the two-dimensional bosonsite is difficult to transform to spinhalf model through the Jordan Wigner transformation. So I want to ask if there are any good ways to control the filling number of different bosons separately or set their corresponding particle number conservation, and if you could help me?

## controlling particle number of independent species

### Re: controlling particle number of independent species

I'm not sure what your Hamiltonian is, here - do you have boson hopping between the upper and lower part where you set \(\mu_{up}\) and \(\mu_{down}\), respectively, or is there only a density-density interaction?

You can only use charge conservation to preserve the respective fillings if H commutes with

In other words, you should have a Hamiltonian (omitting pre-factors for the different terms) of the form

\[H = \sum_{<i,j>, i,j \in A} b^\dagger_i b_j + \sum_{<i,j>, i,j \in B} b^\dagger_i b_j + \sum \mathrm{interactions~with~}n_i\mathrm{~or~}n_i n_j\]

where A and B are the regions of the different species - but you can't have terms of the form

\[ \sum_{i \in A, j \in B} b^\dagger_i b_j\].

If you have that form, you can indeed conserve the particle number (or Sz, if you write it with spins) of the individual regions.

To acchieve that, you typically need to call tenpy.networks.site.set_common_charges in the Model's

The default [tenpyclass=tenpy.models.model.CouplingMPOModel]init_lattice[/tenpyclass will initialize such a MultiSpeciesLattice, if the init_sites returns a tuple of (sites, species_names) instead of just the sites.

You can only use charge conservation to preserve the respective fillings if H commutes with

`N_up = sum_{i in upper region} n_i[inline] and [inline]N_down = sum_{i in down region} n_i `

, respectively.In other words, you should have a Hamiltonian (omitting pre-factors for the different terms) of the form

\[H = \sum_{<i,j>, i,j \in A} b^\dagger_i b_j + \sum_{<i,j>, i,j \in B} b^\dagger_i b_j + \sum \mathrm{interactions~with~}n_i\mathrm{~or~}n_i n_j\]

where A and B are the regions of the different species - but you can't have terms of the form

\[ \sum_{i \in A, j \in B} b^\dagger_i b_j\].

If you have that form, you can indeed conserve the particle number (or Sz, if you write it with spins) of the individual regions.

To acchieve that, you typically need to call tenpy.networks.site.set_common_charges in the Model's

`init_sites()`

which you define, and then use a tenpy.models.lattice.MultiSpeciesLattice, see details in the examples there.The default [tenpyclass=tenpy.models.model.CouplingMPOModel]init_lattice[/tenpyclass will initialize such a MultiSpeciesLattice, if the init_sites returns a tuple of (sites, species_names) instead of just the sites.