0 votes
asked by (120 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){

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);
    psi.Aref(n) *= D;
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

Please log in or register to answer this question.

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.