Skip to content

Commit

Permalink
wigner: add similar messaging to triangularity test
Browse files Browse the repository at this point in the history
No problems with the logic in the triangularity test.  This commit just adds
messaging in the same vein as the integer check.
  • Loading branch information
petermao committed May 10, 2023
1 parent 1b9eb26 commit 5a5b1d8
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions arc/wigner.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,16 +228,24 @@ def Wigner6j(j1, j2, j3, J1, J2, J3):

# Check if the 4 triads ( (j1 j2 j3), (j1 J2 J3), (J1 j2 J3), (J1 J2 j3) )
# satisfy the triangular inequalities
if (
(abs(j1 - j2) > j3)
| (j1 + j2 < j3)
| (abs(j1 - J2) > J3)
| (j1 + J2 < J3)
| (abs(J1 - j2) > J3)
| (J1 + j2 < J3)
| (abs(J1 - J2) > j3)
| (J1 + J2 < j3)
):
IsTriangle = True
msg = ''
if ((abs(j1 - j2) > j3) | (j1 + j2 < j3)):
IsTriangle = False
msg += '(%.1f, %.1f, %.1f) is not triangular\n'%(j1,j2,j3)
if ((abs(j1 - J2) > J3) | (j1 + J2 < J3)):
IsTriangle = False
msg += '(%.1f, %.1f, %.1f) is not triangular\n'%(j1,J2,J3)
if ((abs(J1 - j2) > J3) | (J1 + j2 < J3)):
IsTriangle = False
msg += '(%.1f, %.1f, %.1f) is not triangular\n'%(J1,j2,J3)
if ((abs(J1 - J2) > j3) | (J1 + J2 < j3)):
IsTriangle = False
msg += '(%.1f, %.1f, %.1f) is not triangular\n'%(J1,J2,j3)
if not IsTriangle:
msg = "WARNING!!\n" + msg
msg += "For the 6j-Symbol:\n %3.1f %3.1f %3.1f\n %3.1f %3.1f %3.1f"%(j1,j2,j3,J1,J2,J3)
print(msg)
raise ValueError("6j-Symbol is not triangular!")

# Check if the sum of the elements of each traid is an integer
Expand Down

0 comments on commit 5a5b1d8

Please sign in to comment.