# IQMPS singlet product state doesn't update quantum number

+1 vote

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

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