9pure subroutine genylmv(t4pil,lmax,v,ylm)
35logical,
intent(in) :: t4pil
36integer,
intent(in) :: lmax
37real(8),
intent(in) :: v(3)
38complex(8),
intent(out) :: ylm(*)
40integer l,m,lm1,lm2,lm3,lm4
41real(8),
parameter :: eps=1.d-14
42real(8),
parameter :: fourpi=12.566370614359172954d0
45complex(8),
parameter :: zi=(0.d0,1.d0),zmi=(0.d0,-1.d0)
47ylm(1)=0.28209479177387814347d0
49r=sqrt(v(1)**2+v(2)**2+v(3)**2)
55 else if (t1 <= -1.d0)
then
62 if ((abs(v(1)) > eps).or.(abs(v(2)) > eps))
then
63 t1=1.d0/sqrt(v(1)**2+v(2)**2)
77ylm(3)=0.48860251190291992159d0*ct
78ylm(4)=-0.34549414947133547927d0*st*z1
85 ylm(lm1)=-st*sqrt(dble(2*l+1)/dble(2*l))*z1*ylm(lm2)
86 if (mod(l,2) == 0)
then
87 ylm(lm4)=conjg(ylm(lm1))
89 ylm(lm4)=-conjg(ylm(lm1))
92 ylm(lm1)=ct*sqrt(dble(2*l+1))*ylm(lm2)
94 if (mod(l-1,2) == 0)
then
95 ylm(lm4)=conjg(ylm(lm1))
97 ylm(lm4)=-conjg(ylm(lm1))
99 t1=ct*sqrt(dble((2*l-1)*(2*l+1)))
100 t2=sqrt(dble((2*l+1))/dble(2*l-3))
102 lm1=lm1-1; lm2=lm2-1; lm3=lm3-1; lm4=lm4+1
103 t3=1.d0/sqrt(dble((l-m)*(l+m)))
104 t4=t2*sqrt(dble((l-m-1)*(l+m-1)))
105 ylm(lm1)=t3*(t1*ylm(lm2)-t4*ylm(lm3))
106 if (mod(m,2) == 0)
then
107 ylm(lm4)=conjg(ylm(lm1))
109 ylm(lm4)=-conjg(ylm(lm1))
112 lm1=lm1-1; lm2=lm2-1; lm3=lm3-1
115 ylm(lm1)=t3*(t1*ylm(lm2)-t4*ylm(lm3))
121 lm1=l**2+1; lm2=lm1+2*l
122 select case(mod(l,4))
124 ylm(lm1:lm2)=fourpi*ylm(lm1:lm2)
126 ylm(lm1:lm2)=fourpi*zmi*ylm(lm1:lm2)
128 ylm(lm1:lm2)=-fourpi*ylm(lm1:lm2)
130 ylm(lm1:lm2)=fourpi*zi*ylm(lm1:lm2)