Hi Miles,
I had a error when running the following code to calculate the exited state of a spin-1 chain,
int N = 24;
auto sites = SpinOne(N);
Real J = 0.05;
auto ampo = AutoMPO(sites);
for(int j = 1; j <= N; ++j)
{
ampo += 0.5,"Sz2",j;
ampo += -0.5,"Sz",j;
}
for(int j = 1; j < N; ++j)
{
ampo += -J,"S+",j,"S-",j+1;
ampo += -J,"S+",j+1,"S-",j;
}
auto H = IQMPO(ampo);
auto sweeps = Sweeps(30);
sweeps.maxm() = 10,20,100,100,200;
sweeps.cutoff() = 1E-10;
sweeps.niter() = 2;
sweeps.noise() = 1E-7,1E-8,0.0;
println(sweeps);
auto state = InitState(sites);
for(int i = 1; i <= N; i++)
{
state.set(i, i <= N/2 ? "+" : "0");
}
auto psi0 = IQMPS(state);
auto en0 = dmrg(psi0,H,sweeps,{"Quiet=",true});
auto wfs = std::vector<IQMPS>(1);
wfs.at(0) = psi0;
auto psi1 = IQMPS(state);
auto en1 = dmrg(psi1,H,wfs,sweeps,{"Quiet=",true,"Weight=",20.0});
It always stops after calculating the ground state, with a message "Segmentation fault: 11". When I run it in debug mode, it says
"
From line 87, file itensor_operators.cc
div(T1)=QN(24) must equal div(T2)=QN() when adding T1+T2
div(T1)=QN(24) must equal div(T2)=QN() when adding T1+T2
Abort trap: 6
"
This error looks wired for me because the code works for N <=22. I solved this problem by modifying the initial state
for(int i = 1; i <= N; i++)
{
state.set(i, i%2 == 1 ? "+" : "0");
}
My questions,
Why the former initial state would cause this error?
Why this error appear only for N >= 24?
Many thanks for answering all these questions!
Jin