I used Groupedsites for constructing the list of site

Code: Select all

```
def init_sites(self, model_params):
cons_N = model_params.get('cons_N', 'N')
cons_Sz = model_params.get('cons_Sz', 'Sz')
site1 = SpinHalfFermionSite(cons_N = cons_N, cons_Sz = cons_Sz)
site2 = SpinHalfFermionSite(cons_N = cons_N, cons_Sz = cons_Sz)
site3 = SpinHalfFermionSite(cons_N = cons_N, cons_Sz = cons_Sz)
sites = GroupedSite([site1, site2, site3], labels = ['a', 'b', 'c'], charges = 'same')
return sites
```

Code: Select all

```
def init_terms(self, model_params):
t1 = model_params.get('t1', 0)
t2 = model_params.get('t2', 0)
t3 = model_params.get('t3', 0)
t4 = model_params.get('t4', 0)
mu1 = model_params.get('mu1', 0)
mu2 = model_params.get('mu2', 0)
mu3 = model_params.get('mu3', 0)
U = model_params.get('U', 0)
self.add_coupling(-t4, 0, 'Cdua', 0, 'Cub', dx = 1, plus_hc = True)
self.add_coupling(-t4, 0, 'Cdda', 0, 'Cdb', dx = 1, plus_hc = True)
self.add_coupling(-t3, 0, 'Cdub', 0, 'Cuc', dx = 1, plus_hc = True)
self.add_coupling(-t3, 0, 'Cddb', 0, 'Cdc', dx = 1, plus_hc = True)
self.add_onsite(-t1, 0, 'Cdub Cua', plus_hc = True)
self.add_onsite(-t1, 0, 'Cddb Cda', plus_hc = True)
self.add_onsite(-t2, 0, 'Cduc Cub', plus_hc = True)
self.add_onsite(-t2, 0, 'Cddc Cdb', plus_hc = True)
self.add_onsite(mu1, 0, 'Ntota')
#self.add_onsite(mu1, 0, 'Nda')
self.add_onsite(mu2, 0, 'Ntotb')
#self.add_onsite(mu2, 0, 'Ndb')
self.add_onsite(mu3, 0, 'Ntotc')
#self.add_onsite(mu3, 0, 'Ndc')
self.add_onsite(U, 0, 'NuNda')
self.add_onsite(U, 0, 'NuNdb')
self.add_onsite(U, 0, 'NuNdc')
```

Code: Select all

```
L = 10
model_params = {
't1' : 1.,#which means the strength of [latex]b_i^\dagger a_i[/latex]
't2' : 0,#which means the strength of [latex]b_i^\dagger c_i[/latex]
't3' : 0,#which means the strength of [latex]b_i^\dagger c_{i+1}[/latex]
't4' : 1,#which means the strength of [latex]b_i^\dagger a_{i+1}[/latex]
'mu1' : 1,
'mu2' : 1.,
'mu3' : 0,
'U' : 0.,
'L' : L,
'cons_N' : 'N',
'bc_MPS' : 'finite',
#'bc_x' : 'periodic',
}
M = DChain(model_params)
pstate = ['up_a up_b empty_c'] * (L//2) +['empty_a empty_b empty_c'] * (L//2)
psi = MPS.from_product_state(M.lat.mps_sites(),pstate)
```

Code: Select all

`print(psi.expectation_value('Nuc'))`