# Error "Mismatched mod factors" and question about QN intializer list

+1 vote

This is a relevant question of a former one : http://itensor.org/support/357/problems-about-1-d-bose-fermi-mixture-when-using-dmrg and now it is fixed by miles (thanks). But I still have some questions about the definition of IQIndex and QN in this siteset file. I shall describe it in details in the following :
The correct definition of IQIndex (without "Mismatched mod factors" error and dmrg works) given by miles is

BoseFermiSite(int n, Args const& args = Args::global())
{
if(n%2==1) //spinless fermion
{
is_fermi = true;
s = IQIndex(nameint("site=",n),
Index(nameint("Em",n),1,Site),QN({0,-1},{0,1}),
Index(nameint("f1",n),1,Site),QN({1,-1},{0,1}));
}
else       //spinless boson
{
is_fermi = false;
s = IQIndex(nameint("site=",n),
Index(nameint("Em",n),1,Site),QN({0,-1},{0,1}),
Index(nameint("b1",n),1,Site),QN({0,-1},{1,1}),
Index(nameint("b2",n),1,Site),QN({0,-1},{2,1}),
Index(nameint("b3",n),1,Site),QN({0,-1},{3,1}));
}
}


while my original setsite file defines the IQIndex and QN as follows (have "Mismatched mod factors" in debug mode, but dmrg still works)

BoseFermiSite(int n, Args const& args = Args::global())
{
if(n%2==1) //spinless fermion
{
s = IQIndex(nameint("site=",n),
Index(nameint("Em",n),1,Site),QN("Sz=",0,"Nf=",0),
Index(nameint("f1",n),1,Site),QN("Sz=",0,"Nf=",1)
);
}
else       //spinless boson
{
is_fermi = false;
s = IQIndex(nameint("site=",n),
Index(nameint("Em",n),1,Site),QN("Sz=",0,"Nb=",0),
Index(nameint("b1",n),1,Site),QN("Sz=",0,"Nb=",1),
Index(nameint("b2",n),1,Site),QN("Sz=",0,"Nb=",2),
Index(nameint("b3",n),1,Site),QN("Sz=",0,"Nb=",3)
);
}
}


the difference is that I use explicit expression "Sz=", "Nb=","Nf=" to define QN. But it incurs "Mismatched mod factors" error. I once thought that ("Sz=",0,"Nf=",1) is equivalent to initializer list ({0,1},{1,-1}) where -1 indicates fermion flag, and ("Sz=",0,"Nb=",1) is equivalent to ({0,1},{1,1}) for boson. So why the correct initializer list is not as what I once thought ? For example, minus sign of mod factor appears in boson QN object. I think I may misunderstand QN and it seems that some non-trivial modification is needed for Bose-Fermi mixture.
Thanks.

+1 vote
answered Mar 1 by (14,880 points)

Hi Junjie,
Good question. Your understanding of everything is correct up to a point. However, what you are missing is that in the way our IQTensor system works, the QN objects must be the same globally. So you can't have some QNs where the second "slot" has a mod factor of +1 and other QNs where the second slot has a mod factor of -1. These can be different between two different programs, but within the same program the meaning of the different slot has to be consistent, even across different sites. So the solution is for all of the sites to have both a boson and fermion number in separate slots (in the code I sent you, the first code above you'll see I ignored the Sz quantum number since it is always zero which means it is not being used).

There isn't a shorthand version of the design I described above, by which I mean there's no QN("Nf=",nf,"Nb=",nb) constructor for the QN objects, although I could add one if it becomes a common case. So the best thing to do is to use the constructor where the mod factors are explicitly given as in the code I sent (the first code above).

I hope that answer makes sense to you, if not let's continue to discuss and I can clarify.

Miles

commented Mar 1 by (340 points)
thanks, miles. In the answer, you mentioned that the "Sz" quantum number is ignored in boson IQIndex because it is always zero and make no sense. Is it also the reason you put minus sign mod factor at "Sz" instead of boson particle number "Nb" ? If it is so, I may have some problem in spinor mixture because "Sz" can be non-zero and make sense in calculation.
commented Mar 1 by (14,880 points)
Hi, so I see what you are asking, but the slot where I put the minus sign factor is not Sz. It is Nf. So in my design the first slot is Nf and the second slot is Nb and there is no slot for Sz because it is not used (the particles are spinless). If you want to have particles with spin, then you would need to add a third slot that represents Sz and would have mod factor of +1.
commented Mar 1 by (340 points)
I see, thanks
commented Mar 1 by (14,880 points)
Great. If you want to have an Sz slot for one of the particle types (the fermions, say) but not for the other particle type, then put the slot there for both types but just set its value to zero for all of the QNs corresponding to the spinless particle.
commented Mar 1 by (340 points)
thanks, I got another question : Does the following two definitions of IQIndex equivalent to each other

s1 = IQIndex("s1",
Index(2, Site), QN(1)) ;

s1= IQIndex("s1",
Index(1,Site),QN(1)
Index(1,Site),QN(1));
that is separate a size-2 index into 2 size-1 index.
commented Mar 1 by (14,880 points)
No, the first IQIndex has one sector and the second IQIndex has two sectors. So they are conceptually different. But I agree that the "physics" of both are the same. Generally, I would discourage you from making an IQIndex where two sectors have the same QN (although there are some rare situations where it might make sense to do so). So the first definition is better.