+1 vote
asked by (250 points)

Dear ITesnor,

I recently compiled and ran the code formula here: http://itensor.org/docs.cgi?vers=cppv3&page=formulas/excited_dmrg

But upon running the line
auto [en1,psi1] = dmrg(H,wfs,randomMPS(sites),sweeps,{"Quiet=",true,"Weight=",20.0});,

the code throws the error message
"From line 1604, file itensor.cc

div(ITensor) not defined for non QN conserving ITensor

div(ITensor) not defined for non QN conserving ITensor"

Do you know how to solve this error?

Thanks!
Yantao

commented by (70.1k points)
Hi Yantao, we have had a similar error in the past but I had thought I successfully fixed it. I’ll definitely take a look so thanks for reporting this bug.

However, I won’t be able to reproduce this bug without more context. Could you please provide me with a minimal code that gives the same bug? (E.g. the error could be having to do with how the sites object is made, etc so I will need that information too.)

Miles
commented by (250 points)
Dear Miles,

Thanks for the reply. I just found the error. So in the dmrg.h, around line 250 to line 261, one can comment off the lines involving quantum numbers:

251 //      auto psi_qn = totalQN(psi);
252 //      for(auto n : range(psis))
253 //          {
254 //          auto qn_n = totalQN(psis[n]);
255 //          if(qn_n != psi_qn)
256 //              {
257 //              printfln("totalQN of initial state:  %s",psi_qn);
258 //              printfln("totalQN of state n=%d (n is 0-indexed): %s",n,qn_n);
259 //              Error("Excited-state DMRG intended for states with same totalQN");
260 //              }
261 //          }

Once this is is done, the code runs successfully.

Yantao
commented by (250 points)
This is the in function

244 Real inline
245 dmrg(MPS& psi,
246      MPO const& H,
247      std::vector<MPS> const& psis,
248      Sweeps const& sweeps,
249      Args const& args = Args::global())
commented by (250 points)
I think this is due to that in the code formula, the model is the transverse-field Ising model which has  no conserved QNs:
auto sites = SpinHalf(N,{"ConserveQNs=",false}); //make a chain of N spin 1/2's
commented by (70.1k points)
Hi Yantao,
Yes thanks for pointing that out. However, I think that is in an older version of the ITensor library because I am looking at the newest version and I added code to fix that exact bug.

Have you upgraded to the newest version by doing a “git pull” and recompiling? I should probably also go ahead and tag a new numbered version since this bugfix happened after version 3.1.2.

Best,
Miles
commented by (70.1k points)
Actually my mistake: this bug fix is already present in the numbered version v3.1.3. So please upgrade either to that version or the latest v3 branch by doing a “git pull” and a recompile and it should be fixed.
commented by (250 points)
Thanks! I will git pull.

1 Answer

0 votes
answered by (70.1k points)

(Question answered in discussion comments 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

...