I'm a bit confused about what is going on here. I ran the following minimal code on v3:
int N = 5;
auto sites = SpinHalf(N,{"ConserveQNs",false});
auto ampo = AutoMPO(sites);
for(auto j : range1(N-1))
{
ampo += 0.5,"S+",j,"S-",j+1;
ampo += 0.5,"S-",j,"S+",j+1;
ampo += "Sz",j,"Sz",j+1;
}
auto H = toMPO(ampo);
auto psi = randomMPS(sites);
auto H2 = nmultMPO(prime(H), H);
PrintData(inner(psi, H2, psi) - inner(H, psi, H, psi));
and it runs fine (note that `inner(H, psi, H, psi)` is an alternative way to calculate `inner(psi, H2, psi)` without using `nmultMPO`). After I change that line in mpoalgs.cc as you suggested (which I believe is correct), the code above also runs correctly. Either way, all of the unit tests pass.
Could you give a more complete minimal code that is showing issues? Before making the change, I would like to test if it fixes the issue you are seeing (or if perhaps you have another issue).