0 votes
asked by (310 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 idmrg.cc 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 by (310 points)
The version I am using is V2.0.11
commented by (240 points)
I have a similar question. To be specific, I calculated the ground state energy starting from an 8-site unit cell. After 20 idmrg steps the system size became 160 sites and I wrote the result auto res = idmrg(psi, H, sweeps, { Args }) to the file. Then I want to read the result from the file and keep increasing system size (start from 160 sites) and do more idmrg steps. What code should I use? I read the idmrg.h file (I'm a C++ beginner), and it seems that "idmrgRVal<Tensor> const& last_res" only takes the information about the edge tensor of previous run but the idmrg template still run from a single unit cell size? Also, I had the same problem about the link index mismatch (shown as error). I read your discussion with Miles but I'm sorry I cannot fully understand your explanation.

To Miles: I remembered once you said you have a draft about the idmrg code explanation (with tensor graphs) could you send it to me?

To Zhiyu: It seems you understand Miles's explanation and you solved the problem. Could you help me with it? Thank you very much.

1 Answer

+1 vote
answered by (310 points)
selected by
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 by (70.1k 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 by (310 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.