+1 vote
asked by (590 points)

I thought I'd modify the code in this post here to use IQMPS:

int N=100;
auto sites = Hubbard(N,{"ConserveNf",true,"ConserveSz",true});
auto state = InitState(sites);
for(int i=1;i<=50;i+=2){
    state.set(i,"Up");
    state.set(i+1,"Dn");
  }

auto psi = IQMPS(state);
for(int n = 52; n <= N-1; n += 2){
    auto s1 = sites(n);
    auto s2 = sites(n+1);
    auto wf = IQTensor(s1,s2);
    wf.set(s1(1),s2(2), ISqrt2);
    wf.set(s1(2),s2(1), -ISqrt2);
    IQTensor D;
    psi.Aref(n) = IQTensor(s1);
    psi.Aref(n+1) = IQTensor(s2);
    svd(wf,psi.Aref(n),D,psi.Aref(n+1));
    psi.Aref(n) *= D;
  }
Print(totalQN(psi));
auto ampo = AutoMPO(sites);
for(auto i : range1(N)){
    ampo+= 1,"Ntot",i;
  }
auto H = IQMPO(ampo);

cerr << "IQMPO:" << overlap(psi,H,psi) << endl;

The printout I get is:

totalQN(psi) = (Sz=0,Nf=50)

IQMPO:From line 207, file ITensor/itensor/itensor_interface.ih

Wrong number of IndexVals passed to real/cplx (expected 4, got 0)

I expect the quantum number to be Nf=100 instead of 50. Any idea what is going on? While the crash is concerning I'm curious as to how the IQMPS doesn't see the fermions that have been added

1 Answer

0 votes
answered by (70.1k points)

Hi, so the reason for the error message you're getting is that when you initialize the IQMPS from the InitState object "state", the corresponding constructor puts in dimension=1 "link" indices connecting each MPS tensor. The code below that which sets site 52 onwards to be a product of singlets doesn't connect with the link index coming off of the 51st site tensor. So to get a correctly structured MPS, you'll need to modify tensor number 51, or else set up the whole IQMPS in a different way.

I'm not sure why you got exactly the quantum number that was reported, but first you'll need to ensure that the MPS is properly formed before I'd trust the output of totalQN (which assumes a properly formed MPS).

Miles

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.

Categories

...