Hi guys,
I just joined the forum I wanted to share an issue I was having (I am using version 0.7.2). When running DMRG (or time evolution for that matter), I would sometimes get the error
TeNPy/tenpy/networks/mps.py RuntimeWarning: divide by zero encountered in reciprocal
S = S**form_diff
However, the output was fine, i.e., there did not actually seem to be an error. This was confirmed by printing out S (before applying the problematic line of code) and seeing that there are no small values. I realize there is another post on this forum about this same error, but it is not clear to me whether it was caused by the the same issue (in that case, the issue was solved by setting update_env = 0 in the DMRG parameters, which did not help for me), so I am posting this separately.
It simply turns out that
Code: Select all
S = S**form_diff
with form_diff = -1 gives the above error. If I instead use "S = 1./S", I get no error, although it is doing exactly the same thing. I guess that this if-clause only ever gets called if form_diff = -1, correct? If so, replacing this line of code by "S = 1./S" seems to have no downsides and gets ride of the issue.
Am I the only one who was getting this fake error message?
Cheers,
Ruben