+1 vote
asked by (210 points)


I'm trying to use DMRG to calculate the ground state of a Bose-Hubbard model. I created my own site type of spinless bosons and followed some DMRG examples to perform QN conserved DMRG with randomMPS with specific QN. It worked pretty well.

The problem happens when I saved the ground state psi in an hdf5 file and then tried to load this psi and use it as the initial state psi0 to run the same DMRG. However, I got the error saying the order of this tensor is greater than or equal to the ITensor order warning threshold 14. I made sure the maxlinkdim is 200 starting from the first sweep. It's a warning but it seems dmrg is not running as what I expected like with just randomMPS initial state.

I have two related questions:

  1. Is there a limit on what initial state I can use for dmrg? I thought it would be more efficient if I use the ground state of the same model but slightly different parameters as the initial state of the next DMRG run, instead of having a completely cold start.
  2. If I have the ground state at hand but somehow lost the energy (it's actually how I started to see this problem), what would be the most efficient way of calculating the energy of this state?


commented by (50.7k points)
Hi Sherry, are you making the "sites" array when you run the DMRG code each time? Or are you also writing and re-reading the array of site indices when you write and read back from disk?
commented by (210 points)
Hi Miles,
Yes, I make the sites array which is used to construct the Hamiltonian H = MPO(ampo, sites). The initial state is directly read from the hdf5 file as psi0 = read(f, "name", MPS) and dmrg(H, psi0, sweeps).
commented by (9.8k points)
You probably need to make sure the `sites` you are using are the same as those for the MPS, i.e.:

    psi0 = read(f, "name", MPS)
    sites = siteinds(psi0)
    H = MPO(ampo, sites)
    dmrg(H, psi0, sweeps)

otherwise the site indices of the MPO and MPS will have different Index ids and won't be considered to be "the same" by ITensor.

We should probably add a check for this and throw a good error message.
commented by (210 points)
I see. I'll try that later. Thanks!
Btw, is this the most efficient way of calculating the energy of a given state?
commented by (50.7k points)
Hi Sherry, when you ask if "this" is the most efficient way, which method do you mean by "this" ?

A good general way to calculate the energy of some state psi is by calling `inner(psi,H,psi)` for a Hamiltonian MPO H.
commented by (210 points)
Hi Miles, right. I forgot about this function at that point. So here, H also needs to be constructed like this?
    psi0 = read(f, "name", MPS)
    sites = siteinds(psi0)
    H = MPO(ampo, sites)
commented by (50.7k points)
Yes, that looks correct. Please try that and let us know if it doesn't work. I think I'll add a note about this to the "Code Formula" for reading MPS from disk.

commented by (50.7k points)
I just added some more info about your case to this documentation page - hope it helps:

commented by (210 points)
It works. Thanks for pinpointing the problem and updating the documentation!
commented by (50.7k points)
Glad it helped!

1 Answer

+1 vote
answered by (50.7k points)
selected by
Best answer

Please see the discussion above. The key take-away of the discussion is that the same array of site indices used to originally make an MPS must be used to make a compatible MPO or other MPS. This array of site indices can be conveniently obtained from an existing MPS psi by calling:

sites = siteinds(psi)
commented by (9.8k points)
Also note that I've added checks in `inner`, `dot`, and `dmrg` so that an error is thrown if the input MPS/MPO don't have common site indices, which should make these issues easier to catch in the future.
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.