nikolasibalic / ARC-Alkali-Rydberg-Calculator

Object-oriented Python library for computation of properties of highly-excited Rydbeg states of alkali and divalent atoms.
https://atomcalc.org
BSD 3-Clause "New" or "Revised" License
90 stars 80 forks source link

Issue with Look-up of Wigner6J Table #42

Closed pbanner closed 4 years ago

pbanner commented 4 years ago

The calculation of 6-J symbols in the wigner module includes a look-up table that appears to make assumptions that certain inputs are integers, though they need not be. Thus many symbols, such as wigner.Wigner6j(1/2,1/2,1,2,1,3/2), will throw errors as those inputs are not integers. Specifically, line 215,

return wignerPrecal6j[j1,
                      2 + j1 - J3,
                      int(roundPy2(2 + 2*(j3-j1))),
                      int(roundPy2(2 + 2*(J1-J3))),
                      J2 - 1,
                      int(roundPy2(2 * j2))],

throws the error.

nikolasibalic commented 4 years ago

Hi @pbanner

Thank you for issue submission. I have run

from arc import *
print(wigner.Wigner6j(0.5,0.5,1,2,1,1.5))

and have got

0.28867513459481287

I get same when I run wigner.Wigner6j(1/2,1/2,1,2,1,3/2) (note that this is same only on Python 3.*, in Python 2 division is assumed to be integer and this would render to wigner.Wigner6j(0,0,1,2,1,1) throwing error that symbol is not triangular).

Line 215 should not be the problem since there is a condition before in line 211

abs(roundPy2(j1)-j1) < 0.1

that should evaluate to False for your test case, forcing module not to use pre calculated look-up table. So I am bit confused why you see the error.

@pbanner could you please let me know which Python you are using, on which OS, and share complete error trace that Python returns? Also could you please confirm that you are running latest ARC.

pbanner commented 4 years ago

Hi, Nikola,

Thanks for looking into this. I just upgraded ARC, and it now works fine. For some reason I didn't think to do that. I'll tell my lab mates to do the same; a couple of them tried the calculation and got the same error message.

Thanks again, -Patrick

On Mon, Mar 30, 2020 at 5:41 PM Nikola Šibalić notifications@github.com wrote:

Hi @pbanner https://github.com/pbanner

Thank you for issue submission. I have run

from arc import *print(wigner.Wigner6j(0.5,0.5,1,2,1,1.5))

and have got

0.28867513459481287

I get same when I run wigner.Wigner6j(1/2,1/2,1,2,1,3/2) (note that this is same only on Python 3.*, in Python 2 division is assumed to be integer and this would render to wigner.Wigner6j(0,0,1,2,1,1) throwing error that symbol is not triangular).

Line 215 should not be the problem since for your test case there is a condition before in line 211

abs(roundPy2(j1)-j1) < 0.1)

that should evaluate to false, forcing module not to used precalculated look-up table. So I am bit confused why you see the error.

@pbanner https://github.com/pbanner could you please let me know which Python you are using, on which OS, and share complete error trace that Python returns? Also could you please confirm that you are running latest ARC.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/nikolasibalic/ARC-Alkali-Rydberg-Calculator/issues/42#issuecomment-606266618, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMYQ6SDVHEVFY7M46QW6Z5TRKEGYZANCNFSM4LW45UUQ .

nikolasibalic commented 4 years ago

Hi Patrick,

Great, thank you! And don't hesitate to submit issue if you encounter any problems of even if you have question. With complicated programs like this, input from users is irreplaceable for tracking down all edge cases.

Best wishes, Nikola