Spherical Harmonics module written by Son, Sang-Kil in Jun. 2006 the derivatives of the real spherical harmonics have been added by Ludger Inhester Apr. 2017 Notation convention: r : radius theta : polar angle (latitude) phi : azimuthal angle (longitude)
2l+1 (l-m)!
Y_l^m(theta,phi) = sqrt{ ---- ------ } P_l^m( cos theta ) exp( i m phi ) 4pi (l+m)!
Y_l^(-m)(theta,phi) = (-1)^m conjg( Y_l^m(theta,phi) )
Be careful for a phase sign: many texts use a different phase convention.
complex spherical harmonics
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | l | |||
integer, | intent(in) | :: | m | |||
real(kind=long), | intent(in) | :: | theta | |||
real(kind=long), | intent(in) | :: | phi |
calculate real spherical harmonics: this is closely connected to sph_harmonics_prefactor() in molecular_grid.f90 sph_harmonics_real( l, m, theta, phi ) := G%Y_lm_prefactor(lm) * (2l+1) / 4pi * associated_Legendre_P( l, |m|, cos(theta) ) * [ ... ] [ ... ] = 1 for m = 0 = cos( |m| * phi ) for m > 0 = sin( |m| * phi ) for m < 0
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | l | |||
integer, | intent(in) | :: | m | |||
real(kind=long), | intent(in) | :: | theta | |||
real(kind=long), | intent(in) | :: | phi |
gradient of real sph harmonic
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | l | |||
integer, | intent(in) | :: | m | |||
real(kind=long), | intent(in) | :: | theta | |||
real(kind=long), | intent(in) | :: | phi |
factorial(n,m) = m! / n! for n < m = 1 otherwise thus, factorial(1,2) = 2; factorial(2,1) = 1
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | n | |||
integer, | intent(in), | optional | :: | n2 |
translates x,y,z into r, theta, phi
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=long), | intent(in) | :: | x | |||
real(kind=long), | intent(in) | :: | y | |||
real(kind=long), | intent(in) | :: | z | |||
real(kind=long), | intent(out) | :: | r | |||
real(kind=long), | intent(out) | :: | theta | |||
real(kind=long), | intent(out) | :: | phi |