+1 vote
asked by (270 points)
reopened by

I tried to use the wave function obtained form previous calculation as an initial wave function of dmrg calculation(I stored the wave function in the hard disk "./Wave/Psi", but the MPO is not stored), and I obtained MPO via AutoMPO by using the same rules as before. The id in site-indices of MPO is different form the ones of MPS read form disk, I met some problems in replacing the site-indices of MPO by the ones of MPS. The key code is as follow

auto psi = readFromFile<MPS>("./Wave/Psi");
auto newIndexSet = siteInds(psi);

vector<Index> indexMPO;
for (auto i : range1(length(H)))
       auto siteIndexSet = siteInds(H, i);

auto oldIndexSet = IndexSet(indexMPO);

H.replaceSiteInds(oldIndexSet, newIndexSet);      // out arrow indices of MPO
H.replaceSiteInds(oldIndexSet.dag(), newIndexSet.dag()); // in arrow indices of MPO

But the code do not change the id in site-indices of MPO, could you give me some help?, thanks .

commented by (270 points)
I  achieved the same purpose by storing MPS and SiteSet simultaneously.  I read SiteSet  form disk at first when continue to optimizeļ¼Œ and then initialize MPS and MPO by the SiteSet.
commented by (70.1k points)
Great! That is what I was going to recommend doing. Does this now solve your problem to write and read the site set also?

commented by (270 points)
Yes, this solved my problem.

Best regards
ZHOU Zongsheng
commented by (70.1k points)
Great- I will post below to mark the question as answered.

1 Answer

0 votes
answered by (70.1k points)

(Please see discussion above.)

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.