Hi Miles,
I'm trying to extract the entanglement spectrum from the infinite DMRG ground state wavefunction of Heisenberg model by adding the following code to /sample/idmrg.cc (basically copying from http://itensor.org/docs.cgi?page=formulas/entanglement_mps):
psi.position(Nuc);
auto wf = psi.A(Nuc)*psi.A(Nuc+1);
auto U = psi.A(Nuc);
IQTensor S,V;
auto spectrum = svd(wf,U,S,V);
auto P = spectrum.eigsKept();
Real SvN = 0;
for (auto p : P)
{
if (p > 1e-12)
{
SvN += -p * log(p);
std::cout << "-log p = " << -log(p) << "\n";
}
}
std::cout << "SvN = " << SvN << "\n";
However, the result is not reasonable, with the largest p >> 1 and SvN < 0. The interesting part is that, if I calculate the entanglement between site 0 & 1 (instead of cutting in the middle), I get a plausible result. From my understanding these two approaches should give the same results, so I think maybe I have not really understood what's going on. Can you explain a little bit about this? Thanks very much!
Best,
Chengshu