+1 vote
asked by (680 points)

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):

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!


1 Answer

+1 vote
answered by (70.1k points)
selected by
Best answer

Hi Chengshu,
So this involves a feature of ITensor that's not well documented yet. It has to do with the return value of the idmrg function. The wavefunction that is returned is in a fully right-orthogonal gauge, with the center tensor (singular values when doing an SVD of an MPS) stored in the tensor psi.A(0). So to properly gauge the MPS you have to multiply psi.A(0) into the first MPS tensor, then use SVDs to move the gauge to other sites (or call the .position method after doing psi.Aref(1) *= psi.A(0)).

The reason the singular values are separated off into psi.A(0) is so that you can chain the returned MPS into a longer wavefunction that repeats infinitely. See for example the sample idmrg code (in the sample/ folder). Toward the end it computes a correlation function to a much longer distance than the size of the MPS returned by idmrg. Note how the code puts psi.A(0) into the tensor that is used to compute the correlator.

Hope that helps -


commented by (680 points)
Thanks for your fast reply! Now it works perfectly well.
Welcome to ITensor Support Q&A, where you can ask questions and receive answers from other members of the community.

Formatting Tips:
  • To format code, indent by four spaces
  • To format inline LaTeX, surround it by @@ on both sides
  • To format LaTeX on its own line, surround it by $$ above and below
  • For LaTeX, it may be necessary to backslash-escape underscore characters to obtain proper formatting. So for example writing \sum\_i to represent a sum over i.
If you cannot register due to firewall issues (e.g. you cannot see the capcha box) please email Miles Stoudenmire to ask for an account.

To report ITensor bugs, please use the issue tracker.