Hi, everyone in ITensor community!

I am trying to construct a Hamiltonian involving two types of sites, `"Fermion"`

and `"S=1/2"`

.

A similar question has been answered by Miles. Based on it, I have successfully performed some DMRG calculations.

To fix the filling factor of fermions, one may simply add a chemical potential term. **My question is: Is it possible to use conserve_qns=true for "Fermion" sites **

*only*, so that to work directly with a fixed fermion number?

I find that using `conserve_qns=true`

for both types of sites *simultaneously* is allowed, but only applying to one of them returns error. As an example, the following codes seem to work (which is based on this formula)

```
let
N=6
sites = siteinds(n->isodd(n) ? "S=1/2" : "S=1", N; conserve_qns=true)
# H
ampo = OpSum()
for j=1:N-3
ampo += (0.5*J,"S+",j,"S-",j+2,"S+",j+1,"S-",j+3)
ampo += (0.5*J,"S-",j,"S+",j+1,"S-",j+1,"S+",j+3)
ampo += (J,"Sz",j,"Sz",j+2,"Sz",j+1,"Sz",j+3)
end
H = MPO(ampo,sites)
# ψ0
states = [isodd(n) ? "Up" : "Dn" for n in 1:N]
psi0 = MPS(sites,states);
#DMRG
sweeps = Sweeps(10)
setmaxdim!(sweeps,10,10,20,40,80,100,140,180,200)
setcutoff!(sweeps,1E-8)
energy,psi = dmrg(H,psi0,sweeps)
end
```

But if I apply `conserve_qns=true`

only to `S=1`

sites, as follows,

```
let
N=6
sites1 = siteinds("S=1",div(N,2);conserve_qns=true)
sites2 = siteinds("S=1/2",div(N,2);conserve_qns=false)
sites = [
if mod(i,2)==1
replacetags(sites1[div(i+1,2)],
"S=1,Site,n=$(div(i+1,2))",
"S=1,Site,n=$i")
else
replacetags(sites2[div(i,2)],
"S=1/2,Site,n=$(div(i,2))",
"S=1/2,Site,n=$i")
end
for i=1:N]
... # the rest are the same as before
end
```

It then returns error. Note if I choose `conserve_qns=true`

(or `conserve_qns=false`

) for *both* sites in above codes, it again works!

Best,

Junsen