How to restart iDMRG using the state "psi" from previous run?

0 votes
asked Mar 14 by Zhiyu (280 points)

Hi Miles,

It is considerate of you to add a template in idmrg.h for "restarting idmrg calculations from a previous run". But I still cannot use it. Let me show you my code:

in my own I wrote:

auto res = idmrg(psi, H, sweeps, { Args }); auto res2 = idmrg(psi, H, res, sweeps,{ Args});

The first idmrg runs well, but the second one cannot work—— it stops after printing sweeps and a line:

Sweep=1, HS=1, Bond=(1,2)

which comes from the first step of dmrg in this iDMRG, the exit without error messages.
Could you spot any error here?

Thank you in advance.


commented Mar 14 by Zhiyu (280 points)
The version I am using is V2.0.11

1 Answer

+1 vote
answered Mar 20 by Zhiyu (280 points)
selected Mar 22 by Zhiyu
Best answer

I have solved that.
I think the key point is to add a step to contract "D" from the first idmrg with the initial psi.A(1) in the second idmrg. So I added "D" into the return value of idmrg. Sometimes I want to run another app to measure or continue idmrg starting from a psi stored in the disk. So I also added some codes to write the "res" in idmrg.h into disk.
Besides, I am actually doing adiabatic evolution of a state. So in every idmrg, I have to vary my H by a little, which requires me to reconstruct H every time. This also caused some inconvenience because the indices of the Link on H.A(1) towards HL are random though H's are constructed from the same site. My solution is to identify the indices with an identity matrix.
I am not sure whether it is the best way to tackle the problem, but anyway it works.
Thank you!


commented Mar 22 by miles (14,880 points)
Hi Zhiyu,
Glad that you figured out how to get it working properly. I put that template in once a while ago but haven't used it in a while. It was for some research I was doing so I may have not finished preparing and documenting it for general use. But I am glad you have found it useful.

About the MPO having different virtual/link indices every time, one idea is that you could modify the code that makes the MPO to take a vector of indices that you make once at the beginning (similar to how the code probably makes a vector called "links"; you could move this code outside and run it just once). Then you would pass the same set of link indices to the code every time so it would always use these and keep them the same.

commented Mar 22 by Zhiyu (280 points)
Hi Miles,
This method is much better. Many thanks!

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.