Hello,
I stumbled upon some very unexpected behavior when doing time evolution with ITensors or IQTensors. I am trying to make use of a symmetry and hence a conserved quantity with IQTensors to speed up the calculations. However, what I found is the complete opposite!
Time evolution with IQTensors is slower than with ITensors.
I originally asked this in the comments in the thread http://itensor.org/support/1391/conserving-difference-of-two-bosonic-species but I have now reproduced the problem with a different SiteSet (one provided with ITensor) so it seems that it is a more generic problem and warrants its own thread.
Here is a minimal example that exhibits the problem. It is a simple chain of spin-1/2 that conserves the total @@Sz@@, and I start with a state with a well-defined @@Sz@@.
#include "itensor/all.h"
#include <iostream>
using namespace itensor;
int main(int argc, char* argv[])
{
int N = 100;
auto sites = SpinHalf(N);
auto ampo = AutoMPO(sites);
for(int j = 1; j < N; ++j)
{
ampo += "S+",j,"S-",j+1;
ampo += "S-",j,"S+",j+1;
}
int spin_up = 50;
auto state = InitState(sites);
for(int i = 1; i <= N; ++i)
{
if(i == spin_up) state.set(i,"Up");
else state.set(i,"Dn");
}
//auto psi = MPS(state);
auto psi = IQMPS(state);
double tstep = 0.01;
double tcutoff = 1E-12;
int tmaxm = 15;
double ttime = 100;
double tau = 1;
//Real time evolution
//auto expH1 = toExpH<ITensor>(ampo,Cplx_i*tstep*0.5*(1+Cplx_i));
//auto expH2 = toExpH<ITensor>(ampo,Cplx_i*tstep*0.5*(1-Cplx_i));
auto expH1 = toExpH<IQTensor>(ampo,Cplx_i*tstep*0.5*(1+Cplx_i));
auto expH2 = toExpH<IQTensor>(ampo,Cplx_i*tstep*0.5*(1-Cplx_i));
auto args = Args("Cutoff=",tcutoff,"Maxm=",tmaxm);
auto nt = int(ttime/tstep+(1e-9*(ttime/tstep)));
for(int n = 0; n < nt; ++n)
{
psi = exactApplyMPO(expH1,psi,args);
//normalize(phi);
psi = exactApplyMPO(expH2,psi,args);
normalize(psi);
if (n % int(tau/tstep) == 0){
Print(n);
Print(averageM(psi));
Print(maxM(psi));
}
}
return 0;
}
Thanks