SOAP Theory
- Authors
Felix Musil, Max Veit, Michael Willatt, Klim Goldshtein
- Last updated
15 Aug 2020
The mathematics behind the analytical radial integrals, and Cartesian gradients, of the SOAP descriptor 8 is described below.
From the density to the density expansion
Density expansion:
where \(\alpha\) is a tag refers to the species of the considered atoms, \(\sum_{j \in \alpha}\) defines a sum over the neighbours of atom \(i\) of species \(\alpha\), \(\mathcal{N}_{\sigma}\) a Gaussian centered around \(0\) and variance \(\sigma^2\), \(B_{nlm}(\mathbf{r}) = R_n(r) Y_{\ell}^m(\hat{\mathbf{r}})\) defines a complete orthonormal basis set, \(Y_{\ell}^m\) a spherical harmonic (SH), \(r=\norm{\mathbf{r}}\) and \(\hat{\mathbf{r}}=\mathbf{r}/r\).
The following derivation aims at deriving expressions for the coefficients of the density expansion and their derivative with respect to atomic coordinate for several basis sets.
Density coefficients: angular integration
Spherical harmonics are the only orthonormal basis set of \(S^2\) so this part should apply except for real space basis.
We use the orthonormality of the basis set to compute the expressiont for the density coefficients and express the resulting integral over \(\rm I\!R^3\) in spherical coordinates using \(\norm{\mathbf{r}-\mathbf{r}_{ij}}^2=\mathbf{r}^2+\mathbf{r}_{ij}^2-2\norm{\mathbf{r}}\norm{\mathbf{r}_{ij}}\cos{\theta}\):
where \(\hat{\mathrm{R}} = \hat{\mathrm{R}}_{ZYZ}\left(\alpha_{ij},\beta{ij},0\right)\) is the ZYZ-Euler matrix that rotate \(\hat{e}_z\) onto \(\bm{q}_{ij}\), \(a=\frac{1}{2\sigma^2}\). Note that global normalization constants are omitted because of a normalization at the end.
\[Y_{\ell}^{m}\left(\hat{\mathbf{r}}\right)=Y_{\ell}^{m}\left(\theta,\phi\right)=A_{\ell}^{m}e^{im\phi}P^{m}_{\ell}\left(\cos\theta\right),\]
where \(A_{\ell}^{m} =\sqrt{\frac{(\ell-m)!(2l+1)}{4\pi(\ell+m)!}}\) and \(\hat{q}\) is the direction vector defined by the angle \(\theta\) and \(\phi\). Note that the phase factor \((-1)^\ell\) is included in the definition of the Associated Legendre Polynomials (ALPs). The set of spherical harmonics is calculated in the | librascal/src/math/spherical_harmonics.cc file, which is provided with explanations. The total number of SH in the set is \((l_{max} +1)^2\).
The integration over the angular part yields
where \(\mathsf{i}_{\ell}\) stands for the modified spherical Bessel function of the first kind. The intermediate steps are detailed in the following paragraphs.
Integration over \(\phi\)
The integration over the polar angle cancels out all orders of \(m\) from the SH
since
Nevertheless, the rotation of the spherical harmonic breaks down into a linear combination of spherical harmonics. The coefficents are the entries of the Wigner D-matrix constructed from the Euler angles of the rotation matrix \(\hat{R}\).
Thus, the polar integral over the rotated SH simplifies into
Integration over \(\theta\)
The modified spherical Bessel function of the first kind (MSBF) admit the following integral representation
which can be shown using the reference relations 1 2 3:
\(j_n\) is the spherical Bessel function of the first kind. The integral over the polar angle is then given by
Density coefficients: Radial integration
Summing up the results from the previous section:
we identify \(\text{I}_{n\ell}^{ij}\) as the last term to simplify for particular choices of radial basis functions.
GTO like radial basis
The Gaussian Type Orbital radial basis is defined
where \(b=\frac{1}{2\sigma_n^2}\), \(\sigma_n = (r_\text{cut}-\delta r_\text{cut}) \max(\sqrt{n},1)/n_\text{max}\) and the normalization factor is given by
The overlap between GTO radial basis is:
This equals what we use in the implementation
The radial integral becomes
which yields the following expression for the neighbour contribution
where \(\Gamma\) is the Gamma function, and \({}_1F_1\) is the confluent hypergeometric function of the first kind.
The steps of the derivation are detailed in the next paragraph.
Analytic radial integral
We write an integral representation of the confluent hypergeometric function \(\CHF{a}{b}{z}\) (CHF) in terms of MSBF:
- 4
http://functions.wolfram.com/HypergeometricFunctions/Hypergeometric1F1/07/01/01/0002/ http://dlmf.nist.gov/16.5.E3
- 5
https://en.wikipedia.org/wiki/Generalized_hypergeometric_function#The_series_0F1
- 6(1,2)
http://mathworld.wolfram.com/ModifiedSphericalBesselFunctionoftheFirstKind.html
where \(I_\ell\) is the modified Bessel function and \(\CHLF{b}{z}\) is the limit conflent hypergeometric function.
The module for calculating \(\CHF{..}{..}{..}\) is located in librascal/src/math/hyp1f1.hh.
The radial integral with GTO radial basis function is:
with \(k\) an additional power of \(r\) that will be non zero for the derivative. We partially identify the terms between [eq:chf-int] and [eq:rad-int-gto-0]:
to change the integrand of the radial integral
and identify the last term
Numerical Integration of the Radial Integral
The numerical integration does not rely on a specific form of the radial basis
where the \(\omega_k\) are the quadrature weights evaluated at the quadrature nodes \(r_k\). Depending on the quadrature rule, the following shifting formula is useful,
Discrete Variable Representation
In the special case of the the DVR radial basis 7 with Gauss-Legendre quadrature rule, the radial integral simplifies into:
where \(x_n=\frac{r_c}{2}r_n+\frac{r_c}{2}\).
- 7
Light, J. C., & Carrington, T. (2007). Discrete-Variable Representations and their Utilization (pp. 263–310). John Wiley & Sons, Ltd. https://doi.org/10.1002/9780470141731.ch4
Gradient of the density coefficients with respect to the Cartesian coordinates
The density coefficients can be split into two parts: one that depends on the choice of radial basis function (\(\text{I}_{n\ell}^{ij}\)) and the rest:
where \(C^{ij}\) is the Gaussian exponential factor and \(\bar{D}^{ij}_{\ell m} = \bar{Y}_{\ell,m}(\hat{r}_{ij})\) is the spherical harmonic, see eq. [eq:real-spherical-harmonics]. Note the constant factors are omitted.
The following derivations end up with this formula that does not depend on the radial basis:
where \(\grad_i\bar{D}^{ij}_{\ell,m} = \grad_i \bar{Y}_{\ell,m}(\hat{r}_{ij})\) is defined in [eq:dbx0,eq:dbx1,eq:dbx2,eq:dby0,eq:y1,eq:dby2,eq:dbz0,eq:dbz1,eq:dbz2].
Terms common to the different radial basis
Gaussian
Length
So for the radial terms, we just use the derivatives of the radius \(r_{ij}\) wrt the Cartesian coordinates:
Spherical Harmonics
The derivative of the spherical harmonic can be expressed in a few different ways. The versions below are in terms of the original harmonic with possibly different \(m\) values. The \(z\) component is:
But remember, we’re actually using the real spherical harmonics:
[eq:real-spherical-harmonics]
where
So we can write
(the last one comes from the identity \(\sqrt{\frac{(\ell+m)!}{(\ell-m)!}}P_\ell^{-m} = (-1)^m \sqrt{\frac{(\ell - m)!}{(\ell + m)!}}P_l^m(\cos\theta)\) with \(m=1\)).
The \(x\) component is:
and for the \(y\) component, similarly:
The formulæ above have a singularity at the poles for \(m \neq 0\), so use the following identity:
to shift the singularity to the equator (\(z=0\)). In the code derivatives of spherical harmonics is computed in the feat/soap_gradients branch, librascal/src/math/spherical_harmonics.hh
GTO like radial basis
We rewrite [eq:rad-int-gto-1]
where \(B_{\ell} = r_{ij}^{\ell}\), \(A_{n\ell} = \CHF{\frac{n + \ell + 3}{2}}{\ell+\frac{3}{2}}{\frac{a^2 r_{ij}^2}{a+b}}\), \(N_{n \ell} = \frac{\mathcal{N}_n}{4} a^\ell\left(a+b\right)^{-\frac{n + \ell + 3}{2}} \frac{\Gamma\left(\frac{n + \ell + 3}{2}\right)}{\Gamma\left(\frac{3}{2} + \ell\right)}\), \(\mathcal{N}_n = \sqrt{\frac{2}{\sigma_n^{2n+3}\Gamma\left(n + \frac{3}{2}\right)}}\). Note that some constant multiplying factors of \(\pi\) have been omitted.
\(B_{\ell}\)
CHF
for the hypergeometric term:
which is not proportional to \(A_{n \ell}\), or even to \(A_{n+1,\ell + 1}\) – so just recompute it explicitly.
GTO formula for practical computation
Finally, putting the radial and angular components together, we get:
where the gradient of the spherical harmonic has already been computed separately using the equations above.
Numerical Integration
Using the recurrence relation of the MSBF 6:
the gradient of the radial integral becomes:
In the case of the DVR radial basis:
where \(x_n=\frac{r_c}{2}r_n+\frac{r_c}{2}\).
Beyond SOAP
SOAP can be seen as one of the simplest members of a hierarchy of “density correlation features”,
that are obtained by appropriately symmetrizing tensor products of the neighbor density.
The formalism, first introduced in Ref. 9, leads to formulas to evaluate discretized
versions of these features as a combination of the density expansion coefficients, and includes
also equivariant features, that transform as spherical harmonics under rotation 10.
A comparatively simple expression to compute these higher-order features iteratively, based
on an angular momentum combination relation has been discussed in Ref. 11, as part
of the N-body iterative contraction of equivariants (NICE) framework.
Even though these higher-order features are not the main focus of librascal
, you can find
some utilities that compute them starting from the expansion coefficients. These are
part of the of the bindings/rascal/utils/cg_utils.py
, and are demonstrated and tersely
documented in the example notebooks examples/equivariant_demo.ipynb
and
examples/nice_demo.ipynb
.
- 8
A. P. Bartók, R. Kondor, and G. Csányi (2013) On representing chemical environments. Physical Review B 87(18), 184115. https://doi.org/10.1103/PhysRevB.87.184115
- 9
M. J. Willatt, F. Musil, and M. Ceriotti (2019) Atom-density representations for machine learning. Journal of Chemical Physics 150(15), 154110. https://doi.org/10.1063/1.5090481
- 10
A. Grisafi, D. M. Wilkins, G. Csányi, and M. Ceriotti (2018) Symmetry-Adapted Machine Learning for Tensorial Properties of Atomistic Systems. Physical Review Letters 120(3), 036002. https://doi.org/10.1103/PhysRevLett.120.036002
- 11
J. Nigam, S. Pozdnyakov, and M. Ceriotti (2020) Recursive evaluation and iterative contraction of N -body equivariant features. J. Chem. Phys. 153(12), 121101. https://doi.org/10.1063/5.0021116