Hi Marcin,
Thanks for the question. First of all, to see a typical example of how to set up an alternating, mixed type of system for the C++ version of ITensor you can refer to this example:
http://itensor.org/docs.cgi?vers=cppv3&page=formulas/gs_holst_polaron
which shows how to have your sites alternate between the site types included with ITensor.
But for your case of two kinds of bosons and conserving their particle numbers separately, the easiest approach will be to make a custom site set which slightly generalizes the boson.h one included with ITensor. Here are the steps:
make a copy of the file itensor/mps/sites/boson.h and call it something like ab_boson.h
inside that file, rename the type "Boson" everywhere to something else like "ABBoson" so it doesn't conflict with the Boson type included with ITensor
now modify the constructor for ABBoson around line 55 of that file to instead do this logic:
if(n%2==1)
{
qints[n] = QNInt(QN({"NbA",n}),1);
}
else
{
qints[n] = QNInt(QN({"NbB",n}),1);
}
and that should be all you need.
Now just use this site set in your code as usual, meaning that you make your site set as:
auto sites = ABBoson(N);
And then it should "just work" in the sense of always conserving the number of A and B bosons separately. I'd encourage you to check that by computing and summing up the total density of bosons on odd (A) versus even (B) sites at various points in your calculation.
Best regards,
Miles