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