Thank you so much Miles for your quick response.Below I am attaching the code that I wrote-
for(int i=1;i<N;i++)
{
nav+=1,"Sz",i,"Sz",i+1;
nav+=0.5,"S-",i,"S+",i+1;
nav+=0.5,"S+",i,"S-",i+1;
nav+=1,"S+",i;
nav+=1,"S-",i;
}
nav+=1,"S+",N;
nav+=1,"S-",N;
auto H=MPO(nav);
auto sweeps=Sweeps(50);
sweeps.maxm()=10,20,50,100,200,300,600;
sweeps.cutoff()=1E-10;
sweeps.niter() = 2;
sweeps.noise() = 1E-7,1E-8,1E-5,0.0,0.0,0.0;
auto psi=MPS(sites);
auto energy=dmrg(psi,H,sweeps,{"Quiet=",true});
auto psi0 = psi;
Real tstep = 0.02;
Real ttotal = 2.0;
Real cutoff = 1E-10;
using Gate = BondGate<ITensor>;
auto gates = vector<Gate>();
for(int b = 1; b <= N; ++b)
{
if(b!=N)
{
auto hterm = sites.op("Sz",b)*sites.op("Sz",b+1);
hterm += 0.5*sites.op("S+",b)*sites.op("S-",b+1);
hterm += 0.5*sites.op("S-",b)*sites.op("S+",b+1);
hterm+=sites.op("S+",b)*sites.op("Id",b+1);
hterm+=sites.op("S-",b)*sites.op("Id",b+1);
auto g = Gate(sites,b,b+1,Gate::tReal,tstep/2.,hterm);
gates.push_back(g);
}
else
{
auto hterm=sites.op("Id",b-1)*sites.op("S-",b);
hterm+=sites.op("Id",b-1)*sites.op("S+",b);
auto g = Gate(sites,b-1,b,Gate::tReal,tstep/2.,hterm);
gates.push_back(g);
}
}
for(int b = N; b >= 1; --b)
{
if(b==N)
{
auto hterm=sites.op("Id",b-1)*sites.op("S-",b);
hterm+=sites.op("Id",b-1)*sites.op("S+",b);
auto g = Gate(sites,b-1,b,Gate::tReal,tstep/2.,hterm);
gates.push_back(g);
}
else
{
auto hterm = sites.op("Sz",b)*sites.op("Sz",b+1);
hterm += 0.5*sites.op("S+",b)*sites.op("S-",b+1);
hterm += 0.5*sites.op("S-",b)*sites.op("S+",b+1);
hterm+=sites.op("S+",b)*sites.op("Id",b+1);
hterm+=sites.op("S-",b)*sites.op("Id",b+1);
auto g = Gate(sites,b,b+1,Gate::tReal,tstep/2.,hterm);
gates.push_back(g);
}
}
for(int i=1;i<=2;i++)
{
gateTEvol(gates,ttotal,tstep,psi,{"Cutoff=",cutoff,"Verbose=",true});
cout<<std::abs(overlapC(psi,psi0))<<"\n";
}
I expect that overlap should be close to 1 but as I mentioned it's coming to be very small when there is onsite terms and it becomes more smaller as I increase the ttotal .