spherharm#

torchspin.spherharm(L, M, theta, phi, kind='c')[source]#

Spherical harmonic Y_L^M(theta, phi).

Parameters:
  • L (int) – Degree (non-negative integer).

  • M (int) – Order (-L <= M <= L).

  • theta (float or array_like) – Polar angle (colatitude from +z), radians.

  • phi (float or array_like) – Azimuthal angle (longitude from +x), radians.

  • kind ({'c', 'r'}, optional) – 'c' (default): complex spherical harmonics with Condon-Shortley phase. 'r': real spherical harmonics.

Returns:

ndarray or complex – Spherical harmonic value(s). Shape matches theta / phi.

Return type:

ndarray

Notes

Uses scipy.special.sph_harm for complex harmonics. Argument order follows EasySpin: spherharm(L, M, theta, phi) (theta = polar, phi = azimuthal), which is the reverse of scipy’s sph_harm(M, L, phi, theta).

Real harmonics follow Blanco et al. 1997, Table 1 (non-negative near θ=0, φ=0).