+1 vote
asked by (230 points)

I'm using AutoMPO to implement the following hamiltonian. Here is a snippet of my code

int N = 12;

int Nc = N/2;

auto ampo = AutoMPO(sites);

auto Npart = N;

auto t1 = 1;

auto t2 = 0.5;

auto sites = Electron(N);

for(int b = 1; b < N; ++b)
    ampo += t1,"Cdagup",b+1,"Cup",b;
    ampo += -t1,"Cdagdn",b+1,"Cdn",b;
    ampo += -t1,"Cdagup",b,"Cup",b+1;
    ampo += t1,"Cdagdn",b,"Cdn",b+1;

ampo += t2,"Nup",Nc;
ampo += t2,"Ndn",Nc;
ampo += t2,"Cdagup",Nc,"Cdn",Nc;
ampo += t2,"Cdagdn",Nc,"Cup",Nc;

auto H = toMPO(ampo);

When I run my code I get the following error: "Index does not contain given QN block". When I remove the part containing the terms with 't2' the code runs fine. Is this due to some bug in AutoMPO or am I making some mistake when I do this? Is there anyway to get around this problem?

Best Regards

1 Answer

0 votes
answered by (70.1k points)

Hi Nikhil,
Thanks for the question. If I'm not mistaken, the terms you are adding at the end of your code do not conserve total Sz of the electrons. However, by default the site indices produced by the Electron site set do conserve Sz. So you'll have to turn off Sz conservation if you want to add those particular terms to your Hamiltonian.

The way to do this is to change the call to Electron to be Electron(N,{"ConserveSz=",false});.

If you do want to conserve Sz, though, then there may just be an error in how you defined those terms.

Finally, I noticed that your t1 hopping terms don't appear to be Hermitian. You can look at the sample/exthubbard.cc sample code included with the ITensor source to see an example of a Hermitian electron hopping term. There are other ways to define it, some of which do involve minus signs, but I think your definition is not Hermitian at a glance.

Happy to discuss more -


commented by (230 points)
Hi Miles,
     Thanks for the reply. It works now. I realised that I don't need to conserve Sz. Also I had mistakenly set t1 to be 1 in the question but actually the t1 hopping parameter is imaginary, so my Hamiltonian is Hermitian and now my code works fine. Thanks again.

Best Regards,
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.