# Extrapolation with truncation error

Hi Miles,

Thank you for your wonderful work on the ITensor package. I had a few questions about the truncation error in connection with extrapolating the energy E with \epsilon as described in your paper [arXiv: 1105.1374]:

1. Calling the function dmrg returns the ground-state energy and the wavefunction, but is there an easy way to return the truncation error as well? I see that \epsilon is printed out (but not returned) as a part of the function call and I was wondering if there is a more direct way of obtaining it.

2. Suppose we set sweeps.cutoff() = 1E-12. Then, would the correct extrapolation technique be to gradually increase m in sweeps.maxm() and for each case, record the energies together with the errors (which should be less than 1E-12)? However, if m is initially not large enough, how does the algorithm ensure that the truncation error is always < 10^{-12}?

3. Finally, in your paper, you mention that normally a linear extrapolation of E versus \epsilon is best. Do the excited state energies also scale the same way, i.e. linearly?

Thanks a lot for your time!

Best,
R.

Hi R.,

1 & 2:
The best practice for extrapolating in truncation error is to do two sweeps at a fixed maximum MPS bond dimension "m", then use the energy from the last half-sweep (the last of the four half-sweeps making up the two sweeps) and the corresponding truncation error computed at the central bond of the MPS. This is what is reported by our DMRG code by default, so if you set up your Sweeps object to do two sweeps of each bond dimension, then use the energy and truncation error reported for the second of each sweep, that should be what you need for extrapolation purposes.

If you want to get more detail, just turn off the "Quiet" named argument to DMRG or set it to false. Then you should get a report of the truncation error at every single step.

3: I don't actually know the answer to this - it's a good question. I think it would be a good exercise to convince yourself of why a linear extrapolation is justified by imagining you have a state which is within epsilon of the true ground state using the Euclidean norm / distance. And assume there is a gap to all excited states. Then you can probably recover the argument of the energy error scaling as epsilon to leading order. Then try repeating the argument for excited states (maybe just the first excited state) to see how much of it goes through.

Best regards,
Miles

commented by (200 points)
Hi Miles,

Thanks very much for your answer. As regards question 1, I understand that the dmrg function prints the truncation error, but can it return it as well? For instance, I can call dmrg and say auto en = dmrg(psi,H,sweeps1) so that it assigns the energy to the variable en. Is there a similar way to store the truncation error in a variable from the DMRG function call? I was unable to find this in the documentation.

Thank you and apologies for the confusion; I really appreciate you taking the time to answer my questions.

Best regards,
R.
commented by (70.1k points)
Hi, so theoretically it could return some value of the truncation error (though it might be confusing as to which truncation error it should return; the last sweep only? the center bond or some other bond?). But the issue here is that we can only return so many things from the dmrg function and in the current design we just return the energy. In version 3 we return the energy and optimized wavefunction. Perhaps we should have returned a struct with many different pieces of information in it; we'll consider that seriously in the future.

But I think your best course of action is this: the dmrg function uses an object called DMRGObserver which monitors the wavefunction throughout the calculation and is what does the printing of the truncation error, etc. You can make your own special case of DMRGObserver (or just modify the one in itensor/mps/DMRGObserver.h) to print out more information.

However, the code already does print out the truncation error after each step if you set Quiet=false. Is there some more information that you need beyond that? Just trying to understand - thanks!

Miles
commented by (200 points)
Hi Miles,

Thanks for your quick reply and sorry for the back and forth. In short, what I would like to do is to *store* only the truncation error (last sweep, center bond) and the corresponding ground-state energy in a file. Ideally, I was thinking that the file would be structured as a two-column table, which I can read in later with Mathematica or some other program.

So, setting Quiet=false does give me the information about the truncation error but does not (if I understand correctly) enable me to write the same to a file in the format I had in mind. If there was a direct way to assign the error to a variable after a dmrg function call, that would be helpful for this purpose.

I will try looking at the DMRGObserver as you suggested to see if it can be modified in any way for this purpose. Thank you once again!

Best,
R.