Hello Miles,
I have attached my entire code below. You said your code worked after lowering the prime level; however, it's not working for me and I don't understand why. Its possible I might be doing something wrong but I don't see it. Please suggest me the correct solution.
#include "itensor/all.h"
using namespace itensor;
int main(int argc, char* argv[])
{
auto Nx = 3,
Ny = 3;
auto N = Nx*Ny;
auto sites = Electron(N);
auto t = atof(argv[1]);
auto U = atof(argv[2]);
auto ampo = AutoMPO(sites);
auto lattice = squareLattice(Nx,Ny,{"YPeriodic=",true});
printfln("square lattice NN pairs");
for(auto& bnd : lattice)
{
printfln("Bond from site %d -> %d",bnd.s1,bnd.s2);
}
for(auto j : lattice)
{
ampo += -t,"Cdagup",j.s1,"Cup",j.s2;
ampo += -t,"Cdagup",j.s2,"Cup",j.s1;
ampo += -t,"Cdagdn",j.s1,"Cdn",j.s2;
ampo += -t,"Cdagdn",j.s2,"Cdn",j.s1;
}
for(auto j : range1(N))
{
ampo += U,"Nupdn",j;
}
auto H = toMPO(ampo);
auto Hn = toMPO(ampo);
auto HH = MPO{};
nmultMPO(prime(H),Hn,HH,{"MaxDim",1000,"Cutoff",1E-14});
HH.mapPrime(2,1);
//Print(HH.A(1).inds());
//auto s3 = sites(3);
//Print(hasInds(HH(3),{s3,prime(s3,1)}));
auto state = InitState(sites);
for(auto j : range1(N)){state.set(j,(j%2==1 ? "Up" : "Dn")); }
auto psi0 = MPS(state);
PrintData(inner(psi0,HH,psi0)); //for comparison
PrintData(inner(H,psi0,H,psi0));
auto sweeps = Sweeps(5);
sweeps.maxdim() = 10,20,100,100,200;
sweeps.noise() = 1E-7,1E-8,1E-10,0;
sweeps.cutoff() = 1E-6;
auto [energy,psi] = dmrg(HH,psi0,sweeps,{"Quiet=",true});
printfln("GS energy = ",energy);
return 0;
}
Thanks a lot.
-Prakash.