Wigner3j( J123, M123) calculates the Wigner 3j-symbol according to Racah formula.
The Wigner 3j symbol is useful for multiplication of Spherical Harmonics (and their generalizations) and for addition of angular momentum.
The are related to the Clebsch-Gordan coefficients by:
Wigner3j( J123, M123 ) = <J1,J2,M1,M2| J1,J2,J3,-M3> * (-1)^(J1-J2-M3) * (2*J3+1)^(-1/2).
This function is not limited to the factorial limitation (170), so it can be useful for any value of J.
thanks, it's the best code for wigner 3j symbol!
thanks ，very generous for share
Does exactly what I need. Thanks!
Instead of returning zero when the triangle rule abs(j1-j2)<=j3<=(j1+j2) or the projection addition rule m1+m2=m3, this program instead returns an error message. In my opinion this is not how a Three-J script should work, since many programers will want to apply a Three-J even in cases where it is trivially zero. The script should be modified to return zero when the Three-J is trivially equal to zero.
Please replace "m3 does not match m1 + m2" and the triangle condition by returning 0 instead of an error message
On line 35, to the check if m1+m2 = m3, you should use:
m1 + m2 - m3 ~= 0
(1) Zero value replaces the error massages for the selection rules: m1+m2+m3~=0, j3 > |j1-j2|, j3 > j1+j2, |mi| > ji.
(2) Warning massages are identified.