


















































































































 


































































































































































 











































































































































































































 



















































 










 








































































































































































































































 










                                
                                

                                
                                

                                
                                

                                





































module NullSHRE_modSchYlm

  contains

  subroutine  SchYlm (l, m, nq, np, qs, ps, pp, Ylm)

     implicit none

     INTEGER*4, intent(in) :: l, m, nq, np
     REAL*8, dimension(nq, np), intent(in) :: qs, ps, pp
     COMPLEX*16, dimension(nq, np, 2) :: Ylm
     REAL*8, parameter ::&
        pi = 3.1415926535897932384626433832795d0
     COMPLEX*16 :: ii
   
     ii = dcmplx(0.,1.)

     if (l.lt.0 ) then
       call CCTK_Warn(0,22,"NullSHRE_modSchYlm.F90","NullSHRExtract", "Ylm ERROR: l < 0 ")
     endif
   
     if (l.gt.3 ) then
       call CCTK_Warn(0,26,"NullSHRE_modSchYlm.F90","NullSHRExtract", "Ylm not implemented: l > 3 ")
     endif

     if (abs(m).gt.l)  then
       call CCTK_Warn(0,30,"NullSHRE_modSchYlm.F90","NullSHRExtract", "Ylm ERROR: abs(m) > l")
     endif


     if (l.eq.0) then      
        Ylm(:,:,1) = 1/sqrt(pi)/2
        Ylm(:,:,2) = 1/sqrt(pi)/2
     endif


     if (l.eq.1) then

       if (m.eq.-1) then       
          Ylm(:,:,1) = -sqrt(6.D0)*(-qs+ii*ps)/pp/sqrt(pi)/2
          Ylm(:,:,2) = sqrt(6.D0)/sqrt(pi)/pp*(qs+ii*ps)/2

       else if (m.eq.0) then
          Ylm(:,:,1) = -sqrt(3.D0)*(-1+qs**2+ps**2)/sqrt(pi)/pp/2
          Ylm(:,:,2) = sqrt(3.D0)*(-1+qs**2+ps**2)/sqrt(pi)/pp/2

       else if (m.eq.1) then
          Ylm(:,:,1) = -sqrt(6.D0)/sqrt(pi)/pp*(qs+ii*ps)/2
          Ylm(:,:,2) = sqrt(6.D0)*(-qs+ii*ps)/sqrt(pi)/pp/2
       endif
     endif


     if (l.eq.2) then

       if (m.eq.-2) then
          Ylm(:,:,1) = sqrt(30.D0)*(-qs+ii*ps)**2/pp**2/sqrt(pi)/2
          Ylm(:,:,2) = sqrt(30.D0)/sqrt(pi)/pp**2*(qs+ii*ps)**2/2

       else if (m.eq.-1) then
          Ylm(:,:,1) = sqrt(30.D0)*(-1+qs**2+ps**2)&
                        *(-qs+ii*ps)/pp**2/sqrt(pi)/2 
          Ylm(:,:,2) = sqrt(30.D0)/sqrt(pi)/pp**2&
                        *(-1+qs**2+ps**2)*(qs+ii*ps)/2

       else if (m.eq.0) then
          Ylm(:,:,1) = sqrt(5.D0)/sqrt(pi)&
                *(1-4*qs**2-4*ps**2+qs**4+2*qs**2*ps**2+ps**4)/pp**2/2
          Ylm(:,:,2) = sqrt(5.D0)/sqrt(pi)&
                *(1-4*qs**2-4*ps**2+qs**4+2*qs**2*ps**2+ps**4)/pp**2/2

       else if (m.eq.1) then 
          Ylm(:,:,1) = sqrt(30.D0)*(-1+qs**2+ps**2)&
                           *(qs+ii*ps)/sqrt(pi)/pp**2/2
          Ylm(:,:,2) = sqrt(30.D0)*(-1+qs**2+ps**2)&
                           *(-qs+ii*ps)/sqrt(pi)/pp**2/2

       else if (m.eq.2) then
          Ylm(:,:,1) = sqrt(30.D0)/sqrt(pi)/pp**2*(qs+ii*ps)**2/2
          Ylm(:,:,2) = sqrt(30.D0)*(-qs+ii*ps)**2/sqrt(pi)/pp**2/2
       end if
     end if
	 
  end subroutine SchYlm	 


  subroutine  Sch1Ylm (l, m, nq, np, qs, ps, pp, Y1lm)

     implicit none

     INTEGER*4, intent(in) :: l, m, nq, np
     REAL*8, dimension(nq, np), intent(in) :: qs, ps, pp
     COMPLEX*16, dimension(nq, np, 2) :: Y1lm
     REAL*8, parameter ::&
        pi = 3.1415926535897932384626433832795d0
     COMPLEX*16 :: ii
   
     ii = dcmplx(0.,1.)

     if (l.lt.0 ) then
       call CCTK_Warn(0,104,"NullSHRE_modSchYlm.F90","NullSHRExtract", "Y1lm ERROR: l < 0 ")
     endif
   
     if (l.gt.3 ) then
       call CCTK_Warn(0,108,"NullSHRE_modSchYlm.F90","NullSHRExtract", "Y1lm not implemented: l > 3 ")
     endif

     if (abs(m).gt.l)  then
       call CCTK_Warn(0,112,"NullSHRE_modSchYlm.F90","NullSHRExtract", "Y1lm ERROR: abs(m) > l")
     endif


     if (l.eq.0) then      
        Y1lm(:,:,1) = 0.d0 
        Y1lm(:,:,2) = 0.d0
     endif


     if (l.eq.1) then

       if (m.eq.-1) then       
          Y1lm(:,:,1) = sqrt(3.D0)/pp/sqrt(pi)/2 
          Y1lm(:,:,2) = -sqrt(3.D0)*(qs+dcmplx(0.D0,1.D0)*ps)**2/pp/sqrt(pi)/2

       else if (m.eq.0) then
          Y1lm(:,:,1) = -sqrt(3.D0)*sqrt(2.D0)*(qs+dcmplx(0.D0,1.D0)*ps)&
                       /pp/sqrt(pi)/2 
          Y1lm(:,:,2) = sqrt(3.D0)*sqrt(2.D0)*(qs+dcmplx(0.D0,1.D0)*ps)&
                       /pp/sqrt(pi)/2

       else if (m.eq.1) then
          Y1lm(:,:,1) = sqrt(3.D0)*(qs+dcmplx(0.D0,1.D0)*ps)**2/pp/sqrt(pi)/2 
          Y1lm(:,:,2) = -sqrt(3.D0)/pp/sqrt(pi)/2
       endif
     endif


     if (l.eq.2) then

       if (m.eq.-2) then
          Y1lm(:,:,1) = sqrt(5.D0)*(qs+dcmplx(0.D0,-1.D0)*ps)/pp**2/sqrt(pi) 
          Y1lm(:,:,2) = -sqrt(5.D0)*(qs+dcmplx(0.D0,1.D0)*ps)**3/pp**2/sqrt(pi)

       else if (m.eq.-1) then
          Y1lm(:,:,1) = -sqrt(5.D0)*(-1+3*qs**2+3*ps**2)/pp**2/sqrt(pi)/2
          Y1lm(:,:,2) = -sqrt(5.D0)*(qs+dcmplx(0.D0,1.D0)*ps)**2&
                        *(qs**2+ps**2-3)/pp**2/sqrt(pi)/2

       else if (m.eq.0) then
          Y1lm(:,:,1) = (-1+qs**2+ps**2)*(qs+dcmplx(0.D0,1.D0)*ps)&
                       *sqrt(5.D0)*sqrt(6.D0)/pp**2/sqrt(pi)/2
          Y1lm(:,:,2) = (-1+qs**2+ps**2)*(qs+dcmplx(0.D0,1.D0)*ps)&
                       *sqrt(5.D0)*sqrt(6.D0)/pp**2/sqrt(pi)/2

       else if (m.eq.1) then 
          Y1lm(:,:,1) = -sqrt(5.D0)*(qs+dcmplx(0.D0,1.D0)*ps)**2&
                        *(qs**2+ps**2-3)/pp**2/sqrt(pi)/2
          Y1lm(:,:,2) = -sqrt(5.D0)*(-1+3*qs**2+3*ps**2)/pp**2/sqrt(pi)/2 

       else if (m.eq.2) then
          Y1lm(:,:,1) = -sqrt(5.D0)*(qs+dcmplx(0.D0,1.D0)*ps)**3/pp**2/sqrt(pi)
          Y1lm(:,:,2) = sqrt(5.D0)*(qs+dcmplx(0.D0,-1.D0)*ps)/pp**2/sqrt(pi)
       end if
     end if
	 
   end subroutine Sch1Ylm	 

end  module NullSHRE_modSchYlm
