1C $Id$
2************************************************************************
3*                                                                      *
4      subroutine ecp_t2_init2 (n,ldQ,m_min,m_max,h,
5     &    tol,alpha,beta,gamma,prefactor,temp,x,ind,Q)
6*                                                                      *
7*   Set up values of Q^2_mm, Q^3_m-1m and Q^3_mm-1 to initiate the     *
8*   recursion                                                          *
9*                                                                      *
10*   Argument (status) - description                                    *
11*                                                                      *
12*   n (inp) - number of functions to evaluate                          *
13*   ldQ (inp) - leading dimension of array Q                           *
14*   m_min (inp) - minimum value of m                                   *
15*   m_max (inp) - maximum value of m                                   *
16*   h (inp) switch between alpha and beta for l_b < l_a                *
17*   tol (inp) - maximum relative error in bessel functions             *
18*   alpha (inp) -  a/2sqrt(c)                                          *
19*   beta (inp) - b/2sqrt(c)                                            *
20*   gamma (inp) - 1/sqrt(c)                                            *
21*   prefactor (inp) - exponential prefactor (see calling routine)      *
22*   temp - work array                                                  *
23*   x (scr) - array of values ab/2c                                    *
24*   ind (scr) - index array for bessel driver                          *
25*   Q (out) - uncontracted Q integrals                                 *
26*                                                                      *
27*   Written by K. G. Dyall                                             *
28*                                                                      *
29************************************************************************
30      implicit none
31#include "ecp_consts.fh"
32      integer h,i,ldQ,m,m_max,m_min,n,ind(n)
33      double precision alpha(n),beta(n),gamma(n),temp(n*5),x(n),
34     &    prefactor(n),Q(ldQ,m_min:m_max,2),tol,fac
35*
36*   Set up argument values
37*
38      if (n .eq. 0) return
39      do i = 1,n
40        x(i) = two*alpha(i)*beta(i)
41      end do
42*
43*   Evaluate bessel functions for Q^2_{mm} with m = m_max, m_max-1
44*
45      do m = m_max,max(m_max-1,m_min),-1
46        call ecp_bessel (n,m,x,Q(1,m,1),temp,ind,tol)
47*
48*   Multiply by (sqrt{pi}/4) c^{-3/2} and prefactor
49*
50        do i = 1,n
51          Q(i,m,1) = qpirt*prefactor(i)*Q(i,m,1)*gamma(i)**3
52        end do
53      end do
54*
55*   Downward recursion for lower Q^2.
56*
57      do m = m_max-2, m_min, -1
58        fac = m+m+3
59        do i = 1,n
60          Q(i,m,1) = Q(i,m+2,1)+fac*Q(i,m+1,1)/x(i)
61        end do
62      end do
63      if (m_min .eq. m_max) return
64*
65*   Odd k recursion to obtain Q^3_{m+1m} or Q^3_{mm+1}
66*
67      call ecp_up_k (m_min,m_max,1,1,h,n,ldQ,alpha,beta,gamma,
68     &    Q(1,m_min,1),Q(1,m_min,1),Q(1,m_min,2))
69*
70      return
71      end
72