The Elk Code
ylmroty.f90
Go to the documentation of this file.
1 
2 ! Copyright (C) 2008 J. K. Dewhurst, S. Sharma and E. K. U. Gross
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: ylmroty
8 ! !INTERFACE:
9 subroutine ylmroty(beta,lmax,ld,dy)
10 ! !INPUT/OUTPUT PARAMETERS:
11 ! beta : rotation angle about y-axis (in,real)
12 ! lmax : maximum angular momentum (in,integer)
13 ! ld : leading dimension (in,integer)
14 ! dy : rotation matrix for complex spherical harmonics (out,real(ld,*))
15 ! !DESCRIPTION:
16 ! Returns the rotation matrix in the basis of complex spherical harmonics for
17 ! a rotation of angle $\beta$ about the $y$-axis. This matrix is real and is
18 ! given by the formula
19 ! \begin{align*}
20 ! d^l_{m_1m_2}(\beta)=&[(l+m_1)!(l-m_1)!(l+m_2)!(l-m_2)!]^{1/2}\\
21 ! &\times\sum_k(-1)^k\frac{\left(\cos\frac{\beta}{2}\right)^{2(l-k)-m_2+m_1}
22 ! \left(\sin\frac{\beta}{2}\right)^{2k+m_2-m_1}}
23 ! {k!(l+m_1-k)!(l-m_2-k)!(m_2-m_1+k)!},
24 ! \end{align*}
25 ! where $k$ runs through all integer values for which the factorials exist.
26 !
27 ! !REVISION HISTORY:
28 ! Created December 2008 (JKD)
29 !EOP
30 !BOC
31 implicit none
32 ! arguments
33 real(8), intent(in) :: beta
34 integer, intent(in) :: lmax,ld
35 real(8), intent(out) :: dy(ld,*)
36 ! local variables
37 integer j,k,l,m1,m2,lm1,lm2
38 real(8) cb,sb,sm,t1,t2
39 ! external functions
40 real(8), external :: factn
41 t1=0.5d0*beta
42 cb=cos(t1)
43 sb=sin(t1)
44 lm1=0
45 do l=0,lmax
46 ! generate rotation operator for m-components of current l
47  do m1=-l,l
48  lm1=lm1+1
49  t1=factn(l+m1)*factn(l-m1)
50  lm2=l**2
51  do m2=-l,l
52  lm2=lm2+1
53  sm=0.d0
54  do k=0,min(l+m1,l-m2)
55  if (((l+m1-k) >= 0).and.((l-m2-k) >= 0).and.((m2-m1+k) >= 0)) then
56  j=2*(l-k)+m1-m2
57  if (j == 0) then
58  t2=1.d0
59  else
60  t2=cb**j
61  end if
62  j=2*k+m2-m1
63  if (j /= 0) t2=t2*sb**j
64  t2=t2/(factn(k)*factn(l+m1-k)*factn(l-m2-k)*factn(m2-m1+k))
65  if (mod(k,2) /= 0) t2=-t2
66  sm=sm+t2
67  end if
68  end do
69  dy(lm1,lm2)=sqrt(t1*factn(l+m2)*factn(l-m2))*sm
70  end do
71  end do
72 end do
73 end subroutine
74 !EOC
75 
subroutine ylmroty(beta, lmax, ld, dy)
Definition: ylmroty.f90:10