+1 vote
asked by (680 points)

Hi Miles,

I am trying to calculate something like <psi|U^\dagger H U|psi> in infinite dmrg. As a first step I want to calculate <psi|H|psi> and compare it with the dmrg output. I tried the following code:

auto E = overlap(psi, H, psi);

and it doesn't work. I think it might have something to do with the "edge vectors" of the Hamiltonian as well as the MPS. What's the right way of handling this? Thanks!


1 Answer

0 votes
answered by (70.1k points)
selected by
Best answer

Hi Chengshu,
Sorry about the slow reply.

The overlap(psi,H,psi) method is intended for finite, open boundary MPS and finite, open boundary MPOs.

To get the energy from infinite DMRG, one way is to get the energy from the result object:
auto res = idmrg(...);


To actually evaluate the energy from an MPO takes more explanation and it's hard to type it all out here. But basically the kind of MPOs that idmrg expects have left and right boundary vectors stored in H.A(0) and H.A(N+1) (where N = H.N() is the number of sites of the MPO).

The MPS returned from idmrg (meaning the value of psi which is passed by reference after idmrg returns) is in a right-orthogonal gauge, meaning all of it's tensors obey the right orthogonality condition. The tensor psi.A(0) contains the "center matrix" of the MPS, so to construct part of the infinite wavefunction you must multiply psi.A(0)* psi.A(1) to get the orthogonality center tensor on site 1. See the sample/idmrg.cc sample code to see an example of this. Then one can extend the MPS by continuing to multiply by psi.A(2), psi.A(3), ..., psi.(N), psi.A(1), psi.A(2), etc for as many unit cells as needed e.g. to compute correlation functions and or matrix elements of part of the Hamiltonian or an MPO.

Finally, in the result object the idmrg algorithm returns, there are two tensors res.HL and res.HR which are the left and right "Hamiltonian environment" tensors computed as the idmrg algorithm grows the system longer and longer. These are the MPO projected into the semi-infinite "wings" or left and right basis of the infinite MPS. You can use these together with one unit cell of the MPO and MPS to compute the same energy that idmrg reports.

At some point I plan to write a detailed documentation with figures about the idmrg algorithm in ITensor. There is a draft of one written by a couple students but it may have some inaccuracies. It is a fairly complex algorithm to explain, but it follows pretty closely to the algorithm as explained by Schollwock in his review article. I hope what I wrote above gives you the information you need. Also I'd encourage you to read through the idmrg code itself and draw diagrams and/or take notes on how it works for yourself and you can learn a lot this way about its inner workings and the algorithm.


commented by (680 points)
Hi Miles,

Thank you very much for the very informative reply! I think I know how to perform the calculations now. I agree that reading the code+review article will be very helpful for understaning the idmrg algorithm and also the data structure of infinite MPS/MPO.

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.