The Elk Code
lopzflm.f90
Go to the documentation of this file.
1 
2 ! Copyright (C) 2002-2005 J. K. Dewhurst, S. Sharma and C. Ambrosch-Draxl.
3 ! This file is distributed under the terms of the GNU Lesser General Public
4 ! License. See the file COPYING for license details.
5 
6 !BOP
7 ! !ROUTINE: lopzflm
8 ! !INTERFACE:
9 pure subroutine lopzflm(lmax,zflm,ld,zlflm)
10 ! !INPUT/OUTPUT PARAMETERS:
11 ! lmax : maximum angular momentum (in,integer)
12 ! zflm : coefficients of input spherical harmonic expansion
13 ! (in,complex((lmax+1)**2))
14 ! ld : leading dimension (in,integer)
15 ! zlflm : coefficients of output spherical harmonic expansion
16 ! (out,complex(ld,3))
17 ! !DESCRIPTION:
18 ! Applies the angular momentum operator $\hat{\bf L}$ to a function expanded
19 ! in terms of complex spherical harmonics. This makes use of the identities
20 ! \begin{align*}
21 ! (L_x+iL_y)Y_{lm}(\theta,\phi)&=\sqrt{(l-m)(l+m+1)}Y_{lm+1}(\theta,\phi)\\
22 ! (L_x-iL_y)Y_{lm}(\theta,\phi)&=\sqrt{(l+m)(l-m+1)}Y_{lm-1}(\theta,\phi)\\
23 ! L_zY_{lm}(\theta,\phi)&=mY_{lm}(\theta,\phi).
24 ! \end{align*}
25 !
26 ! !REVISION HISTORY:
27 ! Created March 2004 (JKD)
28 !EOP
29 !BOC
30 implicit none
31 ! arguments
32 integer, intent(in) :: lmax
33 complex(8), intent(in) :: zflm(*)
34 integer, intent(in) :: ld
35 complex(8), intent(out) :: zlflm(ld,3)
36 ! local variables
37 integer l,m,lm
38 real(8) t1
39 complex(8) z1
40 lm=0
41 do l=0,lmax
42  do m=-l,l
43  lm=lm+1
44  if (m == -l) then
45  zlflm(lm,1)=0.d0
46  zlflm(lm,2)=0.d0
47  end if
48  if (m < l) then
49  t1=0.5d0*sqrt(dble((l-m)*(l+m+1)))
50  z1=t1*zflm(lm)
51  zlflm(lm+1,1)=z1
52  zlflm(lm+1,2)=cmplx(z1%im,-z1%re,8)
53  end if
54  if (m > -l) then
55  t1=0.5d0*sqrt(dble((l+m)*(l-m+1)))
56  z1=t1*zflm(lm)
57  zlflm(lm-1,1)=zlflm(lm-1,1)+z1
58  zlflm(lm-1,2)=zlflm(lm-1,2)+cmplx(-z1%im,z1%re,8)
59  end if
60  if (m /= 0) then
61  zlflm(lm,3)=dble(m)*zflm(lm)
62  else
63  zlflm(lm,3)=0.d0
64  end if
65  end do
66 end do
67 end subroutine
68 !EOC
69 
pure subroutine lopzflm(lmax, zflm, ld, zlflm)
Definition: lopzflm.f90:10