I get the following error when calculating expectation values with an infinite temperature thermal state
"MPS or MPO has missing/null link index"
Everything is fine if I use gates to cool the state down from infinite temperature, but not at infinite temperature. The code was working fine before updating itensor today, it's probably been months since my last update. The following code reproduces the error.
auto sites = SpinHalf(4);
auto state = MPS(sites);
auto N = sites.length();
for(int n = 1; n <= N; n += 2)
{
auto s1 = sites(n);
auto s2 = sites(n+1);
auto wf = ITensor(s1,s2);
wf.set(s1(1),s2(2), ISqrt2);
wf.set(s1(2),s2(1), -ISqrt2);
ITensor D;
state.ref(n) = ITensor(s1);
state.ref(n+1) = ITensor(s2);
svd(wf,state.ref(n),D,state.ref(n+1));
state.ref(n) *= D;
}
Print(inner(state,state));
The error occurs in the call to inner, it seems like it comes from the "linkInds" call in the line in inner of the form
psidag.replaceLinkInds(sim(linkInds(psidag)));
Also, here is what I get if I call Print(state)
ITensor ord=2:
(dim=2|id=798|"n=1,Site,S=1/2") <Out>
1: 1 QN({"Sz",1})
2: 1 QN({"Sz",-1})
(dim=2|id=617|"V,Link") <Out>
1: 1 QN({"Sz",-1})
2: 1 QN({"Sz",1})
{norm=1.00 (QDense Real)}
ITensor ord=2:
(dim=2|id=243|"n=2,Site,S=1/2") <Out>
1: 1 QN({"Sz",1})
2: 1 QN({"Sz",-1})
(dim=2|id=617|"V,Link") <In>
1: 1 QN({"Sz",-1})
2: 1 QN({"Sz",1})
{norm=1.41 (QDense Real)}
ITensor ord=2:
(dim=2|id=773|"n=3,Site,S=1/2") <Out>
1: 1 QN({"Sz",1})
2: 1 QN({"Sz",-1})
(dim=2|id=610|"V,Link") <Out>
1: 1 QN({"Sz",-1})
2: 1 QN({"Sz",1})
{norm=1.00 (QDense Real)}
ITensor ord=2:
(dim=2|id=781|"n=4,Site,S=1/2") <Out>
1: 1 QN({"Sz",1})
2: 1 QN({"Sz",-1})
(dim=2|id=610|"V,Link") <In>
1: 1 QN({"Sz",-1})
2: 1 QN({"Sz",1})
{norm=1.41 (QDense Real)}
As you can see, site 1 is connected to 2, and site 3 is connected to 4, but there is no link connected site 2 to 3, and I'm thinking this is the source of the error.
I'm wondering if this is a bug, or if I should be initializing the link indices somehow? Thank you for your time.
Best,
Nick