Esempio n. 1
0
        // ( 3/2  J2  J3 )
        // ( M1   M2  M3 )
        private static double ThreeJ_ThreeHalvesJ(SpinState s1, SpinState s2, SpinState s3)
        {
            Debug.Assert(s1.TwoJ == 3);

            if (s1.TwoM < 0)
            {
                // m1 is negative; invert the m's
                double r = ThreeJ_ThreeHalvesJ(s1.Invert(), s2.Invert(), s3.Invert());
                // fix sign!
                return(r);
            }
            else if (s1.TwoM == 1)
            {
                // m1 = 1/2
                if (s3.TwoJ == (s2.TwoJ + 1))
                {
                    // j3 = j2 + 1/2
                    double r = (s2.JMinusM - s2.TwoM) * Math.Sqrt(1.0 * (s2.JPlusM + 1) / s2.TwoJ / (s2.TwoJ + 1) / (s2.TwoJ + 2) / (s2.TwoJ + 3));
                    if (s2.JMinusM % 2 != 0)
                    {
                        r = -r;
                    }
                    return(r);
                }
                else
                {
                    // j3 = j2 + 3/2
                    double r = Math.Sqrt(3.0 * (s2.JPlusM + 1) * (s2.JPlusM + 2) * (s2.JMinusM + 1) / (s2.TwoJ + 1) / (s2.TwoJ + 2) / (s2.TwoJ + 3) / (s2.TwoJ + 4));
                    if (s2.JMinusM % 2 != 0)
                    {
                        r = -r;
                    }
                    return(r);
                }
            }
            else
            {
                // m1 = 3/2
                if (s3.TwoJ == (s2.TwoJ + 1))
                {
                    // j3 = j2 + 1/2
                    double r = -Math.Sqrt(3.0 * (s2.JPlusM + 1) * (s2.JPlusM + 2) * (s2.JMinusM) / s2.TwoJ / (s2.TwoJ + 1) / (s2.TwoJ + 2) / (s2.TwoJ + 3));
                    if (s2.JMinusM % 2 != 0)
                    {
                        r = -r;
                    }
                    return(r);
                }
                else
                {
                    // j3 = j2 + 3/2
                    double r = -Math.Sqrt(1.0 * (s2.JPlusM + 1) * (s2.JPlusM + 2) * (s2.JPlusM + 3) / (s2.TwoJ + 1) / (s2.TwoJ + 2) / (s2.TwoJ + 3) / (s2.TwoJ + 4));
                    if (s2.JMinusM % 2 != 0)
                    {
                        r = -r;
                    }
                    return(r);
                }
            }
        }
Esempio n. 2
0
        // ( 1/2  J2   J+1/2 )
        // ( M1   M2  -M1-M2 )
        private static double ThreeJ_HalfJ(SpinState s1, SpinState s2)
        {
            Debug.Assert(s1.TwoJ == 1);

            if (s1.TwoM < 0)
            {
                // m1 = -1/2
                // invert to turn into m1 = +1/2 case
                double r = ThreeJ_HalfJ(s1.Invert(), s2.Invert());
                if (s2.TwoJ % 2 == 0)
                {
                    r = -r;
                }
                return(r);
            }
            else
            {
                // m1 = +1/2
                double r = -Math.Sqrt((s2.JPlusM + 1.0) / (s2.TwoJ + 1.0) / (s2.TwoJ + 2.0));
                if (s2.JMinusM % 2 != 0)
                {
                    r = -r;
                }
                return(r);
            }
        }
Esempio n. 3
0
        // ( J1 J2 M1 M2 | J M ) =
        // (-1)^{J1-J2+M} * Sqrt(2J+1) *
        // ( J1  J2   J )
        // ( M1  M1  -M )

        /// <summary>
        /// Computes a Clebsch-Gordon coefficient.
        /// </summary>
        /// <param name="s1">The first spin state.</param>
        /// <param name="s2">The second spin state.</param>
        /// <param name="s">The total spin state.</param>
        /// <returns>The Clebsch-Gordon coefficient measuring the contribution of the given first and
        /// second spin states to the given total spin state.</returns>
        public static double ClebschGodron(SpinState s1, SpinState s2, SpinState s)
        {
            double f = Math.Sqrt(s.TwoJ + 1);

            if (s1.JPlusM % 2 != 0)
            {
                f = -f;
            }
            if (s2.JMinusM % 2 != 0)
            {
                f = -f;
            }
            return(f * ThreeJ(s1, s2, s.Invert()));
        }
Esempio n. 4
0
        // ( 1   J2  J3 )
        // ( M1  M2  M3 )
        private static double ThreeJ_OneJ(SpinState s1, SpinState s2, SpinState s3)
        {
            Debug.Assert(s1.TwoJ == 2);

            if (s1.TwoM < 0)
            {
                // m1 = -1
                double r = ThreeJ_OneJ(s1.Invert(), s2.Invert(), s3.Invert());
                if ((s1.TwoJ + s2.TwoJ + s3.TwoJ) / 2 % 2 != 0)
                {
                    r = -r;
                }
                return(r);
            }
            else if (s1.TwoM == 0)
            {
                // m1 = 0
                if (s3.TwoJ == s2.TwoJ)
                {
                    // j3 = j2
                    double r = s2.TwoM / Math.Sqrt(s2.TwoJ * (s2.TwoJ + 1) * (s2.TwoJ + 2));
                    if ((s2.JMinusM % 2) != 0)
                    {
                        r = -r;
                    }
                    return(r);
                }
                else
                {
                    // j3 = j2 + 1
                    double r = -Math.Sqrt(2.0 * (s2.JPlusM + 1) * (s2.JMinusM + 1) / (s2.TwoJ + 1) / (s2.TwoJ + 2) / (s2.TwoJ + 3));
                    if ((s2.JMinusM % 2) != 0)
                    {
                        r = -r;
                    }
                    return(r);
                }
            }
            else
            {
                // m1 = 1
                if (s3.TwoJ == s2.TwoJ)
                {
                    // j3 = j2
                    double r = Math.Sqrt(2.0 * s2.JMinusM * (s2.JPlusM + 1) / s2.TwoJ / (s2.TwoJ + 1) / (s2.TwoJ + 2));
                    if ((s2.JMinusM % 2) != 0)
                    {
                        r = -r;
                    }
                    return(r);
                }
                else
                {
                    // j3 = j2 + 1
                    double r = Math.Sqrt(1.0 * (s2.JPlusM + 1) * (s2.JPlusM + 2) / (s2.TwoJ + 1) / (s2.TwoJ + 2) / (s2.TwoJ + 3));
                    if ((s2.JMinusM % 2) != 0)
                    {
                        r = -r;
                    }
                    return(r);
                }
            }
        }