0 votes
asked by (160 points)

Hello.
I am studying the spin-polarized system(J<0 Heisenberg Chain) by iDMRG.
When I calculate two-site correlator, I met error:

terminate called after throwing an instance of 'std::bad_alloc'
what():  std::bad_alloc

The MPS I'd like to contruct is,

psi.A(2) = 
/--------------IQTensor--------------
r=3 div=QN(0) log(scale)=0
IQIndex("d",1400,Link|364) <Out>
  ("d_0",9,Link|122) QN(1672)
  ("d_1",53,Link|233) QN(1674)
  ("d_2",141,Link|696) QN(1676)
  ("d_3",243,Link|799) QN(1678)
  ("d_4",304,Link|145) QN(1680)
  ("d_5",291,Link|740) QN(1682)
  ("d_6",212,Link|105) QN(1684)
  ("d_7",109,Link|767) QN(1686)
  ("d_8",34,Link|353) QN(1688)
  ("d_9",4,Link|863) QN(1690)

IQIndex("S=1/2 2",2,Site|143) <Out>
  ("Up 2",1,Site|4) QN(1)
  ("Dn 2",1,Site|62) QN(-1)

IQIndex("d",1400,Link|19) <In>
  ("d_0",15,Link|943) QN(1673)
  ("d_1",67,Link|38) QN(1675)
  ("d_2",161,Link|871) QN(1677)
  ("d_3",261,Link|249) QN(1679)
  ("d_4",307,Link|234) QN(1681)
  ("d_5",280,Link|176) QN(1683)
  ("d_6",191,Link|472) QN(1685)
  ("d_7",91,Link|728) QN(1687)
  ("d_8",24,Link|711) QN(1689)
  ("d_9",2,Link|489) QN(1691)
  ("d_10",1,Link|111) QN(1671)
\------------------------------------

and my code is,

Print(psi.A(2));
Print(prime(dag(psi.A(2))));
Print(psi.A(2) * prime(dag(psi.A(2)), Link)); // <- cause error!

. m>=400 always cause this error, but I checked m=200 goes well.
My server has 512GB RAM.
I think that the large QN due to the spin-polarization and the large maxm might cause this problem.
"to_MPS" function does not resolve this issue.

Can I fix this problem? Should I do something like "reset QN"?
Thank you in advance.

1 Answer

0 votes
answered by (160 points)

Hello, I solved this problem.
This problem is due to my little knowledge of the efficient MPS contraction.

The Tensor

  psi.A(2) * prime(dag(psi.A(2))

has a very big index dimension, but what I'd like to do is calculate a correlation function.
So I should do:

lcorr *= psi.A(2);
lcorr *= prime(dag(psi.A(2)), Link);

where "lcorr" follows basic notation in the ITensor code formula.

Thank you every one.

commented by (70.1k points)
Thanks very much for posting this answer. I was planning to reply but was a bit puzzled as to how this issue could be occurring without looking much more closely at your code.

We have been planning to add a feature which, when in debug mode, throws an error if any tensor has too many indices, say 10 indices. This feature would help catch bugs of the type you just encountered. So thanks for the reminder that we should definitely add this bug-catching feature!
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

...