cutoff and bond dimensions


I am using ITensor in Julia language to calculate the ground state properties of a two-leg ladder model.
My questions are as follows

  1. Generally, we write cut off in this way


But how to write different cutoff for different bond dimension, e.g cutoff= 10^{-9} for 60 bond dimension and cutoff= 10^{-10} for 200 bond dimensions?
Similarly how to write different cutoffs for different sweeps?

2)I want to plot a graph of energy vs maxim bond dimension, Is there any way to save these data, or I have to do it by giving the values manually?


Good question - you can do something similar in the cutoff! function as in the maxdim! function, which is to provide a comma-separated list of cutoff values for each sweep. So like


which would use 1E-9 for the first two sweeps, then 1E-10 for the third sweep, then 1E-12 for the fourth and all remaining sweeps.

Thanks for the answer,

But let’s say I have to give 100 maxim bond dimensions for 50 sweeps. So, other than writing it 50 times is there any other way to do it?
the same question goes for the cutoff also.

It’s a good question. Fortunately we have a new dmrg interface that is already working, but we have just not publicized it enough. It’s a good reminder for us to start switching the examples to use this new interface and putting it into the documentation.

Here is a simple example of this new interface:

  # Plan to do 5 DMRG sweeps:
  nsweeps = 5
  maxdim = [10,20,100,100,200]
  cutoff = [1E-11]

  # Run the DMRG algorithm, returning energy and optimized MPS
  energy, psi = dmrg(H, psi0; nsweeps, maxdim, cutoff)

where you can see that there is now no Sweeps object and the parameters such as nsweeps, maxdim, and cutoff (there is also optionally mindim and noise) can be passed as just arrays.

With either interface, if one of the arrays is shorter than the number of sweeps, all remaining sweeps will use the last value in the array. So cutoff = [1E-8, 1E-11] would do 1E-8 for the first sweep, then 1E-11 for the second and all remaining sweeps.

Finally, in terms of how this addresses your question, you can use “array comprehension” tools and other base library features in Julia to easily make arrays. So if you want an array with the entry “50” repeating 100 times you can do:

maxdim = fill(50,100)

and of course you can do more complicated things like maxdim = [f(n) for n=1:nsweeps] for any function f you like.

1 Like

Thanks for the quick reply. However, when I put this in the code it shows the following error

Can you tell me how to fix it?

Hm I don’t get that kind of error when I try similar code. Could you please post a more complete example code that reproduces this error message?

I am able to run it now.

Thanks for quick responses.

1 Like