+1 vote
asked by (210 points)
reopened by

Hi
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);
       indexMPO.push_back(siteIndexSet[1]);
}

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 (210 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.
http://itensor.org/docs.cgi?vers=cppv3&page=formulas/readwrite_mps
commented by (52.6k 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?

Thanks,
Miles
commented by (210 points)
Yes, this solved my problem.

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

1 Answer

0 votes
answered by (52.6k 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.

Categories

...