+1 vote
asked by (160 points)
edited by


I want to define a new siteset with two "colors" (A and B) of spin 1/2. We can assume that in a chain lattice odd sites=A and that even sites=B. In my system, @@S^z_\mathrm{tot}@@ of A and B spin is conserved separately. This also means that @@S^z_\mathrm{tot}(A+B)=S^z_\mathrm{tot}(A)+S^z_\mathrm{tot}(B)@@ is conserved.

Using the standard "SpinHalf" siteset would only lead to @@S^z_\mathrm{tot}(A+B)@@ conservation. So I've implemented a new one with two QNs where the only difference with the standard one is

SpinHalfABSite(int n, Args const& args = Args::global())
    if(n%2 == 1)
        s = IQIndex{nameint("S=1/2 (A) ",n),
               Index(nameint("Up ",n),1,Site),QN(+1, 0),
               Index(nameint("Dn ",n),1,Site),QN(-1, 0)};
        s = IQIndex{nameint("S=1/2 (B) ",n),
               Index(nameint("Up ",n),1,Site),QN(0, +1),
               Index(nameint("Dn ",n),1,Site),QN(0, -1)};

I think that at this point, it is correct. The problem is when I want to build an IQMPO through the AutoMPO builder for my specific Hamiltonian,

auto ampo = AutoMPO(sites);
for(int i = 1; i < sites.N(); i += 2)
    for(int j = 1; j < sites.N(); j += 2)
       if(i < j)
            ampo += 1.0,"S+",i,"S-",i+1,"S-",j,"S+",j+1;
            ampo += 1.0,"S-",i,"S+",i+1,"S+",j,"S-",j+1;
auto ham = IQMPO(ampo);

where @@S^\alpha_{i,j}@@ acts on the A spins and @@S^\alpha_{i+1,j+1}@@ on the B ones. However, this leads to the following error,

I = IQIndex(Hl4,2,Link,901) <Out>
  (hl4_0,2,Link,628) QN()
qn = QN(-4,4)
From line 514, file iqindex.cc
IQIndex does not contain given QN block.
IQIndex does not contain given QN block.
Abort trap: 6

I do not get this error when working with only one color of spin (and the same Hamiltonian). The error happens inside the 'compressMPO' function, when making the compressed MPO for the fourth site (no matter the system size, it always happens at the fourth one).

I'm trying to figure out a bit more this part of the ITensor code but if you have any idea of what could be wrong!

1 Answer

0 votes
answered by (70.1k points)
selected by
Best answer

Hi, thanks for reporting this. I think what's going on here is actually two separate bugs, one within ITensor and one in your code.

  1. The bug within ITensor, now fixed, is that for efficiency AutoMPO was assuming that operators with the same name also carried the same quantum numbers. But that is not the case for your site set and wouldn't be the case e.g. for a site set with different spin types, like a lattice with both spin half and spin one sites. So now AutoMPO doesn't assume that anymore. Please pull the latest version of ITensor from GitHub and recompile and you'll have this fixed version.

  2. I believe there's a bug within your code too: you have terms containing things like "S+",i,"S-",i+1 but would not that process fail to conserve A and B total Sz separately? I think maybe you meant for the site to be i and i+2 instead of i and i+1. I could be wrong about this second bug, though, because I didn't do a careful study of it so please just think about it and see if you agree or disagree.

Please let me know if the new version still doesn't work for you. Thanks for pointing out this serious issue!


commented by (160 points)
Hi Miles,

Thanks for your answer and the fix! About point 2, I think that the current code is correct, because the Hamiltonian has four-body terms (S+/S- on i/j (odd) sites of color A and S+/S- on i+1/j+1 (even) sites of color B).

Welcome to ITensor Support Q&A, where you can ask questions and receive answers from other members of the community.

Formatting Tips:
  • To format code, indent by four spaces
  • To format inline LaTeX, surround it by @@ on both sides
  • To format LaTeX on its own line, surround it by $$ above and below
  • For LaTeX, it may be necessary to backslash-escape underscore characters to obtain proper formatting. So for example writing \sum\_i to represent a sum over i.
If you cannot register due to firewall issues (e.g. you cannot see the capcha box) please email Miles Stoudenmire to ask for an account.

To report ITensor bugs, please use the issue tracker.