e3x.so3.irreps.spherical_harmonics

e3x.so3.irreps.spherical_harmonics(r, max_degree, r_is_normalized=False, cartesian_order=True, normalization='racah')[source]

Real Cartesian spherical harmonics \(Y_\ell^m(\vec{r})\).

Evaluates \(Y_\ell^m(\vec{r})\) for all \(\ell=0,\dots,L\) and \(m=-\ell,\dots,\ell\) with \(L\) = max_degree. The spherical harmonics are basis functions for irreducible representations of \(\mathrm{SO}(3)\). In total, there are \((L+1)^2\) spherical harmonics for a given \(L\). For example, these are all spherical harmonics for \(L=3\) (blue: positive, red: negative, arrows show the x-, y-, and z-axes, click & drag to rotate):

In general, the real Cartesian spherical harmonics are given by

\[\begin{split}Y_{\ell}^{m}(\vec{r}) = \mathcal{N}\begin{cases} \sqrt{2}\cdot \Pi_\ell^{\lvert m\rvert}(z) \cdot A_{\lvert m \rvert}(x,y) & m < 0 \\ \Pi_\ell^{0}(z) & m = 0 \\ \sqrt{2}\cdot \Pi_\ell^{m}(z) \cdot B_m(x,y) & m > 0 \\ \end{cases}\end{split}\]
\[A_{m}(x,y) = \sum_{k=0}^{ m}\binom{m}{k}x^{k} y^{m-k} \sin\left(\frac{\pi}{2}(m-k)\right)\]
\[B_{m}(x,y) = \sum_{k=0}^{m}\binom{m}{k}x^{k} y^{m-k} \cos\left(\frac{\pi}{2}(m-k)\right)\]
\[\Pi_{\ell}^{m}(z) = \sqrt{\frac{(\ell-m)!}{(\ell+m)!}} \sum_{k=0}^{\lfloor(\ell-m)/2\rfloor} \ \frac{(-1)^k}{2^\ell} \binom{\ell}{k} \binom{2\ell-2k}{\ell}\frac{(\ell-2k)!}{(\ell-2k-m)!} r^{2k-\ell}z^{\ell-2k-m}\]

with \(\vec{r}=[x\ y\ z]^\intercal \in \mathbb{R}^3\) and \(r = \lVert \vec{r} \rVert\). Here, \(\mathcal{N}\) is a normalization constant that depends on the chosen normalization scheme. When normalization is 'racah' or 'schmidt' Racah’s normalization (also known as Schmidt’s semi-normalization) is used (the integral runs over the surface of the unit sphere \(\Omega\)):

\[\mathcal{N} = 1 \qquad \int_{\Omega} Y_\ell^m(\vec{r}) Y_{\ell'}^{m'}(\vec{r}) d\Omega = \frac{4\pi}{2\ell+1}\delta_{\ell\ell'}\delta_{mm'}\,,\]

when normalization is '4pi':

\[\mathcal{N} = \sqrt{2\ell+1} \qquad \int_{\Omega} Y_\ell^m(\vec{r}) Y_{\ell'}^{m'}(\vec{r}) d\Omega = 4\pi\delta_{\ell\ell'}\delta_{mm'}\,,\]

and when normalization is 'orthonormal':

\[\mathcal{N} = \sqrt{\frac{2\ell+1}{4\pi}} \qquad \int_{\Omega} Y_\ell^m(\vec{r}) Y_{\ell'}^{m'}(\vec{r}) d\Omega = \delta_{\ell\ell'}\delta_{mm'}\,.\]
Parameters:
  • r (<class 'Float[Array, '... 3']'>) – Array of shape (..., 3) containing Cartesian vectors \(\vec{r}\).

  • max_degree (int) – Maximum degree \(L\) of the spherical harmonics.

  • r_is_normalized (bool, default: False) – If True, \(\vec{r}\) is assumed to be already normalized.

  • cartesian_order (bool, default: True) – If True, spherical harmonics are returned in Cartesian order.

  • normalization ({'4pi', 'orthonormal', 'racah', 'schmidt'}, default: 'racah') – Which normalization is used for the spherical harmonics.

Return type:

<class 'Float[Array, '... (max_degree+1)**2']'>

Returns:

The values \(Y_\ell^m(\vec{r})\) of all spherical harmonics up to \(\ell\) = max_degree. Values are returned in an Array of shape (..., (max_degree+1)**2) ordered \([Y_{0}^{0}\ Y_{1}^{1}\ Y_{1}^{-1}\ Y_{1}^{0}\ Y_{2}^{2}\ \cdots]\). If cartesian_order = False, values are ordered \([Y_{0}^{0}\ Y_{1}^{-1}\ Y_{1}^{0}\ Y_{1}^{1}\ Y_{2}^{-2}\ \cdots]\) instead.

Raises:
  • ValueError – If r has an invalid shape (not a 3-vector), max_degree

  • is not positive or zero, or normalization has an invalid value.