# rc3jm.f

          SUBROUTINE RC3JM (L1, L2, L3, M1, M2MIN, M2MAX, THRCOF, NDIM, IER)
    C***BEGIN PROLOGUE  RC3JM
    C***PURPOSE  Evaluate the 3j symbol g(M2) = (L1 L2   L3  )
    C                                           (M1 M2 -M1-M2)
    C            for all allowed values of M2, the other parameters
    C            being held fixed.
    C***LIBRARY   SLATEC
    C***CATEGORY  C19
    C***TYPE      SINGLE PRECISION (RC3JM-S, DRC3JM-D)
    C***KEYWORDS  3J COEFFICIENTS, 3J SYMBOLS, CLEBSCH-GORDAN COEFFICIENTS,
    C             RACAH COEFFICIENTS, VECTOR ADDITION COEFFICIENTS,
    C             WIGNER COEFFICIENTS
    C***AUTHOR  Gordon, R. G., Harvard University
    C           Schulten, K., Max Planck Institute
    C***DESCRIPTION
    C
    C *Usage:
    C
    C        REAL L1, L2, L3, M1, M2MIN, M2MAX, THRCOF(NDIM)
    C        INTEGER NDIM, IER
    C
    C        CALL RC3JM (L1, L2, L3, M1, M2MIN, M2MAX, THRCOF, NDIM, IER)
    C
    C *Arguments:
    C
    C     L1 :IN      Parameter in 3j symbol.
    C
    C     L2 :IN      Parameter in 3j symbol.
    C
    C     L3 :IN      Parameter in 3j symbol.
    C
    C     M1 :IN      Parameter in 3j symbol.
    C
    C     M2MIN :OUT  Smallest allowable M2 in 3j symbol.
    C
    C     M2MAX :OUT  Largest allowable M2 in 3j symbol.
    C
    C     THRCOF :OUT Set of 3j coefficients generated by evaluating the
    C                 3j symbol for all allowed values of M2.  THRCOF(I)
    C                 will contain g(M2MIN+I-1), I=1,2,...,M2MAX-M2MIN+1.
    C
    C     NDIM :IN    Declared length of THRCOF in calling program.
    C
    C     IER :OUT    Error flag.
    C                 IER=0 No errors.
    C                 IER=1 Either L1.LT.ABS(M1) or L1+ABS(M1) non-integer.
    C                 IER=2 ABS(L1-L2).LE.L3.LE.L1+L2 not satisfied.
    C                 IER=3 L1+L2+L3 not an integer.
    C                 IER=4 M2MAX-M2MIN not an integer.
    C                 IER=5 M2MAX less than M2MIN.
    C                 IER=6 NDIM less than M2MAX-M2MIN+1.
    C
    C *Description:
    C
    C     Although conventionally the parameters of the vector addition
    C  coefficients satisfy certain restrictions, such as being integers
    C  or integers plus 1/2, the restrictions imposed on input to this
    C  subroutine are somewhat weaker. See, for example, Section 27.9 of
    C  Abramowitz and Stegun or Appendix C of Volume II of A. Messiah.
    C  The restrictions imposed by this subroutine are
    C       1. L1.GE.ABS(M1) and L1+ABS(M1) must be an integer;
    C       2. ABS(L1-L2).LE.L3.LE.L1+L2;
    C       3. L1+L2+L3 must be an integer;
    C       4. M2MAX-M2MIN must be an integer, where
    C          M2MAX=MIN(L2,L3-M1) and M2MIN=MAX(-L2,-L3-M1).
    C  If the conventional restrictions are satisfied, then these
    C  restrictions are met.
    C
    C     The user should be cautious in using input parameters that do
    C  not satisfy the conventional restrictions. For example, the
    C  the subroutine produces values of
    C       g(M2) = (0.75 1.50   1.75  )
    C               (0.25  M2  -0.25-M2)
    C  for M2=-1.5,-0.5,0.5,1.5 but none of the symmetry properties of the
    C  3j symbol, set forth on page 1056 of Messiah, is satisfied.
    C
    C     The subroutine generates g(M2MIN), g(M2MIN+1), ..., g(M2MAX)
    C  where M2MIN and M2MAX are defined above. The sequence g(M2) is
    C  generated by a three-term recurrence algorithm with scaling to
    C  control overflow. Both backward and forward recurrence are used to
    C  maintain numerical stability. The two recurrence sequences are
    C  matched at an interior point and are normalized from the unitary
    C  property of 3j coefficients and Wigner's phase convention.
    C
    C    The algorithm is suited to applications in which large quantum
    C  numbers arise, such as in molecular dynamics.
    C
    C***REFERENCES  1. Abramowitz, M., and Stegun, I. A., Eds., Handbook
    C                  of Mathematical Functions with Formulas, Graphs
    C                  and Mathematical Tables, NBS Applied Mathematics
    C                  Series 55, June 1964 and subsequent printings.
    C               2. Messiah, Albert., Quantum Mechanics, Volume II,
    C                  North-Holland Publishing Company, 1963.
    C               3. Schulten, Klaus and Gordon, Roy G., Exact recursive
    C                  evaluation of 3j and 6j coefficients for quantum-
    C                  mechanical coupling of angular momenta, J Math
    C                  Phys, v 16, no. 10, October 1975, pp. 1961-1970.
    C               4. Schulten, Klaus and Gordon, Roy G., Semiclassical
    C                  approximations to 3j and 6j coefficients for
    C                  quantum-mechanical coupling of angular momenta,
    C                  J Math Phys, v 16, no. 10, October 1975,
    C                  pp. 1971-1988.
    C               5. Schulten, Klaus and Gordon, Roy G., Recursive
    C                  evaluation of 3j and 6j coefficients, Computer
    C                  Phys Comm, v 11, 1976, pp. 269-278.
    C***ROUTINES CALLED  R1MACH, XERMSG
    C***REVISION HISTORY  (YYMMDD)
    C   750101  DATE WRITTEN
    C   880515  SLATEC prologue added by G. C. Nielson, NBS; parameters
    C           HUGE and TINY revised to depend on R1MACH.
    C   891229  Prologue description rewritten; other prologue sections
    C           revised; MMATCH (location of match point for recurrences)
    C           removed from argument list; argument IER changed to serve
    C           only as an error flag (previously, in cases without error,
    C           it returned the number of scalings); number of error codes
    C           increased to provide more precise error information;
    C           program comments revised; SLATEC error handler calls
    C           introduced to enable printing of error messages to meet
    C           SLATEC standards. These changes were done by D. W. Lozier,
    C           M. A. McClain and J. M. Smith of the National Institute
    C           of Standards and Technology, formerly NBS.
    C   910415  Mixed type expressions eliminated; variable C1 initialized;
    C           description of THRCOF expanded. These changes were done by
    C           D. W. Lozier.
    C***END PROLOGUE  RC3JM