All scalar spherical harmonics for , in one call. Computes ASSOC_LEGENDRE_NORM_ALL once, then fills directly and via the conjugate symmetry rather than a second recurrence pass.
Warning
Inherits ASSOC_LEGENDRE_NORM_ALL's -dependent
stability limit (safe for unconditionally) --
see STABILITY_FINDINGS.md at the repo root.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| complex(kind=dp), | intent(out) | :: | YLM((LMAX+1)**2) | |||
| integer(kind=i4), | intent(in) | :: | LMAX |
Maximum degree, . |
||
| real(kind=dp), | intent(in) | :: | THETA |
Colatitude in radians, . |
||
| real(kind=dp), | intent(in) | :: | PHI |
Longitude in radians, . |
SUBROUTINE SSH_ALL_DP(YLM, LMAX, THETA, PHI) IMPLICIT NONE INTEGER(KIND=i4), INTENT(IN) :: LMAX REAL(KIND=dp), INTENT(IN) :: THETA REAL(KIND=dp), INTENT(IN) :: PHI COMPLEX(KIND=dp), INTENT(OUT) :: YLM((LMAX+1)**2) INTEGER(KIND=i4) :: L, M, PSIZE REAL(KIND=dp), ALLOCATABLE :: PNORM(:) REAL(KIND=dp) :: SIGN_M PSIZE = (LMAX+1)*(LMAX+2)/2 ALLOCATE(PNORM(PSIZE)) CALL ASSOC_LEGENDRE_NORM_ALL(PNORM, LMAX, DCOS(THETA)) DO L = 0, LMAX DO M = 0, L YLM(YLM_INDEX(L, M)) = & PNORM(PLM_INDEX(L, M)) * EXP(j*M*PHI) END DO DO M = 1, L SIGN_M = 1.0_dp - 2.0_dp * MOD(M, 2) YLM(YLM_INDEX(L, -M)) = SIGN_M * & CONJG(YLM(YLM_INDEX(L, M))) END DO END DO DEALLOCATE(PNORM) END SUBROUTINE SSH_ALL_DP