Verified Commit 22bf4a51 authored by Chris Kerr's avatar Chris Kerr

Fix sign of Gaunt coefficients

N.B. Python parses
    -1 ** x
as
    -(1 ** x)
parent c04ae832
......@@ -73,7 +73,7 @@ def _gaunt_ksum(l_1, l_2, l_3, m, *, factorials):
def kpart(k):
return Fraction(
-1 ** k,
(-1) ** k,
prod((
factorials[k],
factorials[k + l_3 + m - l_1],
......@@ -139,7 +139,10 @@ def _modified_gaunt_squared(l_1, l_2, l_3, m, *, factorials=None):
def modified_gaunt(l_1, l_2, l_3, m, *, factorials=None):
"""Modified Gaunt coefficient used in the Z translation matrix."""
return math.sqrt(_modified_gaunt_squared(l_1, l_2, l_3, m, factorials=factorials))
sign = (-1) ** ((l_1 + l_2 - l_3) // 2)
return sign * math.sqrt(
_modified_gaunt_squared(l_1, l_2, l_3, m, factorials=factorials)
)
def shzmat(LMAX):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment