+1 vote
asked by (280 points)

Is it possible to read a state (IQMPS) calculated with one Hamiltonian, and then load it as an initial guess for a DMRG with a slightly different Hamiltonian?

If I try to simply load the IQMPS and apply the new Hamiltonian in the DMRG function, I get an error that they don't match.

1 Answer

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

Good question. The Hamiltonian MPO and your MPS (or IQMPO and IQMPS) must have the same "site" or "physical" indices in order to be compatible. This is one of the reasons there is a separate site set object, such as "SpinHalf" or "Hubbard" to keep track of the site indices.

So to answer your question, you will need to write your site set object (usually called "sites" in the sample codes) to disk alongside your IQMPS.

Here is some sample code showing how to do that:
http://itensor.org/docs.cgi?page=formulas/readwrite_mps

Then you need to read your site set back in before making your new Hamiltonian, and use this previous site set when you initialize (construct) the AutoMPO object. This will ensure that the Hamiltonian has the same sites as your MPS.

If that doesn't solve your problem please let me know and we can troubleshoot further.

Best regards,
Miles

commented by (280 points)
Thank you - now I understand. The following works (e.g. for a Hubbard system):

    auto sites Hubbard(N);
    readFromFile(siteFile, sites);
    IQMPS psi(sites);
    readFromFile(stateFile, psi);

Then I can set up the Hamiltonian and do DMRG. (Does code format not work in comments?)
commented by (70.1k points)
Great. As a bit of a refinement, what I often do in my codes is to use the function fileExists(siteFile) which returns true if there is a file named siteFile in the current directory. Then if the file is present, I read in the site set; otherwise I create a new one. Up to you, but I find this is a nice way to work.
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.

Categories

...