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:

ρiα(r)=jαNσ(rrij)=nlmαnm|XiBnlm(r),

where α is a tag refers to the species of the considered atoms, jα defines a sum over the neighbours of atom i of species α, Nσ a Gaussian centered around 0 and variance σ2, Bnlm(r)=Rn(r)Ym(r^) defines a complete orthonormal basis set, Ym a spherical harmonic (SH), r=r and r^=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 S2 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 IR3 in spherical coordinates using rrij2=r2+rij22rrijcosθ:

αnm|Xi=jαcnmij=jαIR3exp[a(rrij)2]Bnlm(r)=jα0r2exp[a(r2+rij2)]gn(r)11d(cosθ)02πdϕexp[2arrijcosθ]Ym(R^q^),

where R^=R^ZYZ(αij,βij,0) is the ZYZ-Euler matrix that rotate e^z onto qij, a=12σ2. Note that global normalization constants are omitted because of a normalization at the end.

We use the following convention for the SH
Ym(r^)=Ym(θ,ϕ)=AmeimϕPm(cosθ),

where Am=(m)!(2l+1)4π(+m)! and q^ is the direction vector defined by the angle θ and ϕ. Note that the phase factor (1) 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 (lmax+1)2.

The integration over the angular part yields

11d(cosθ)exp[arrijcosθ]02πdϕYm(R^(αij,βij,0)q^)=4πYm(βij,αij)i(arrij),=Ym(r^ij)i(arrij),

where i stands for the modified spherical Bessel function of the first kind. The intermediate steps are detailed in the following paragraphs.

Integration over ϕ

The integration over the polar angle cancels out all orders of m from the SH

02πdϕYm(θ,ϕ)=π(2l+1)Pm(cosθ)δm0,

since

02πdϕexp[imϕ]=2πδ0m.

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 R^.

Ym(R^r^)=m=Dmm(R^)Ym(r^),Dm0(α,β,γ)=4π2l+1Ylm(β,α).

Thus, the polar integral over the rotated SH simplifies into

02πdϕYm(R^r^)=m=Dmm(αij,βij,0)π(2l+1)Pm(cosθ)δm0=2πYm(βij,αij)P0(cosθ).

Integration over θ

The modified spherical Bessel function of the first kind (MSBF) admit the following integral representation

in(z)=1211dxexp(zx)Pn0(x),

which can be shown using the reference relations 1 2 3:

jn(z)=(i)n211dxexp[izx]Pn0(x),in(z)=(i)njn(iz),in(z)=(1)nin(z),
1

http://dlmf.nist.gov/10.54.E2

2

http://dlmf.nist.gov/10.47.E12

3

http://dlmf.nist.gov/10.47.E16

jn is the spherical Bessel function of the first kind. The integral over the polar angle is then given by

11d(cosθ)exp[2arrijcosθ]P0(cosθ)=2i(2arrij).

Density coefficients: Radial integration

Summing up the results from the previous section:

cnmij=4πYm(r^ij)exp[arij2]0drr2Rn(r)ear2i(2arrij)=Inij,

we identify Inij 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

RnGTO(r)=Nn rnexp[br2],

where b=12σn2, σn=(rcutδrcut)max(n,1)/nmax and the normalization factor is given by

Nn2=2(1)σn2n+3Γ(n+3/2).

The overlap between GTO radial basis is:

0RnGTO(r)RnGTO(r)dr=2(12σn2+12σn2)12(3+n+n)Γ(3+n+n2)

This equals what we use in the implementation

0RnGTO(r)RnGTO(r)dr=NnNn(12σn2+12σn2)12(3+n+n)Γ(3+n+n2)

The radial integral becomes

InlijGTO=Nnπ4Γ(n++k+32)Γ(+32)arij(a+b)n+k++321F1(n++k+32,+32,a2rij2a+b),

which yields the following expression for the neighbour contribution

cnmijGTO=(π)32NnΓ(n++32)Γ(+32)(a+b)n++32Ym(r^ij)exp[arij2](arij)1F1(n++32,+32,a2rij2a+b).

where Γ is the Gamma function, and 1F1 is the confluent hypergeometric function of the first kind.

The neighbour contribution is calculated in
file librascal/src/representations/ representation_manager_spherical_expansion.hh,
function compute_neighbour_contribution, line 338.

The steps of the derivation are detailed in the next paragraph.

Analytic radial integral

We write an integral representation of the confluent hypergeometric function 1F1(a,b,z) (CHF) in terms of MSBF:

1F1(a,+32,x)=2x2πΓ(+32)Γ(a)0etta12i(2xt)dt,

using these relations 4 5 6

1F1(a,b,z)=1Γ(a)0etta10F1(b,zt)dt,Il(z)=(z2)Γ(l+1)0F1(+1,z24),i(z)=π2zI+1/2(z),i(z)=π4(z2)Γ(+32)0F1(+32,z24),0F1(+32,xt)=4πΓ(+32)x2t2i(2xt),
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 is the modified Bessel function and 0F1(b,z) is the limit conflent hypergeometric function.

The module for calculating 1F1(..,..,..) is located in librascal/src/math/hyp1f1.hh.

The radial integral with GTO radial basis function is:

InlijGTO=0drr2+kgnGTO(r)er22σ2i(rrij/σ2)=Nn0drr2+k+ner2(a+b)i(2arrij),

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]:

t=r2(a+b),dt=2rdr(a+b),x=a2rij2a+b,

to change the integrand of the radial integral

InlijGTO=Nn0dt2(a+b)(a+b)n+k+12tn+k+12eti(2xt),

and identify the last term

a=n++k+32.

Numerical Integration of the Radial Integral

The numerical integration does not rely on a specific form of the radial basis

Inij=k=1Kωkrk2Rn(rk)eark2i(2arkrij),

where the ωk are the quadrature weights evaluated at the quadrature nodes rk. Depending on the quadrature rule, the following shifting formula is useful,

abf(x)dxba2i=1nwif(ba2xi+a+b2).
Discrete Variable Representation

In the special case of the the DVR radial basis 7 with Gauss-Legendre quadrature rule, the radial integral simplifies into:

Inij=rc2ωnxn2eaxn2i(2axnrij),

where xn=rc2rn+rc2.

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 (Inij) and the rest:

cnmij=Ym(r^ij)exp[arij2]Inij=DmijCijInij,

where Cij is the Gaussian exponential factor and D¯mij=Y¯,m(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:

icαnmij=2acαnmijrij+CD¯mijiInij+NnAnBCiD¯,mij,

where iD¯,mij=iY¯,m(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
dCijdrij=2arijCij
Length

So for the radial terms, we just use the derivatives of the radius rij wrt the Cartesian coordinates:

drijd{xi,yi,zi}={xij,yij,zij}rijirij=rijrijwhere rij=rjri
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:

Dmzi=1u22r(eiϕ(+m)(m+1)Ylm1(r^)eiϕ(m)(+m+1)Ylm+1(r^))=sinθ2rij(cos(mϕ)+isin(mϕ))((+m)(m+1)2+14π(m+1)!(+m1)!Plm1(cosθ)(m)(+m+1)2+14π(m1)!(+m+1)!Plm+1(cosθ))

But remember, we’re actually using the real spherical harmonics:

[eq:real-spherical-harmonics]

Y¯m(r^ij)=cos(mϕ)P¯m(cosθ)Y¯,m(r^ij)=sin(mϕ)P¯m(cosθ)} for m>0Y¯,0(r^ij)=12P¯0(cosθ)

where

P¯m(cosθ)=2+12π(m)!(+m)!Pm(cosθ).

So we can write

D¯mzi=sinθ2rijcos(mϕ)((+m)(m+1)P¯m1(cosθ)(m)(+m+1)P¯m+1(cosθ))D¯,mzi=sinθ2rijsin(mϕ)((+m)(m+1)P¯m1(cosθ)(m)(+m+1)P¯m+1(cosθ))D¯,0zi=sinθrij(+1)2P¯1(cosθ))

(the last one comes from the identity (+m)!(m)!Pm=(1)m(m)!(+m)!Plm(cosθ) with m=1).

The x component is:

D¯mxi=msinϕxij2+yij2D¯,m+cosϕcosθ2rijcos(mϕ)((+m)(m+1)P¯m1(cosθ)(m)(+m+1)P¯m+1(cosθ))D¯,mxi=msinϕxij2+yij2D¯,m+cosϕcosθ2rijsin(mϕ)((+m)(m+1)P¯m1(cosθ)(m)(+m+1)P¯m+1(cosθ))D¯,0xi=cosϕcosθrij(+1)2P¯1(cosθ)

and for the y component, similarly:

D¯myi=mcosϕxij2+yij2D¯,m+sinϕcosθ2rijcos(mϕ)((+m)(m+1)P¯m1(cosθ)(m)(+m+1)P¯m+1(cosθ))D¯,myi=mcosϕxij2+yij2D¯,m+sinϕcosθ2rijsin(mϕ)((+m)(m+1)P¯m1(cosθ)(m)(+m+1)P¯m+1(cosθ))D¯,0yi=sinϕcosθrij(+1)2P¯1(cosθ)

The formulæ above have a singularity at the poles for m0, so use the following identity:

mxij2+yij2(Y¯,m(r^ij)Y¯,m(r^ij))=12zij(sin(mϕ)cos(mϕ))((+m)(m+1)P¯m1(cosθ)+(m)(+m+1)P¯m+1(cosθ))

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]

InlijGTO=NnAnB,

where B=rij, An=1F1(n++32,+32,a2rij2a+b), Nn=Nn4a(a+b)n++32Γ(n++32)Γ(32+), Nn=2σn2n+3Γ(n+32). Note that some constant multiplying factors of π have been omitted.

B
dBdrij=rijB
CHF

for the hypergeometric term:

dAndrij=n++32(+32)2a2rija+b1F1(n++52,+52,a2rij2a+b)

which is not proportional to An, or even to An+1,+1 – so just recompute it explicitly.

GTO formula for practical computation

Finally, putting the radial and angular components together, we get:

icαnmij=cαnmij(rij2+2a)rij+NnBCD¯mn++32(+32)2a2a+b1F1(n++52,+52,a2rij2a+b)rij+NnAnBCiD¯,m

where the gradient of the spherical harmonic has already been computed separately using the equations above.

Gradient of the coefficients is calculated in feat/soap_gradients branch,
file librascal/src/representations/representation_manager_spherical_expansion.hh,
function compute_neighbour_derivative, line 420.

Numerical Integration

Using the recurrence relation of the MSBF 6:

di(x)dx=12+1[i1(x)+(+1)i+1(x)],

the gradient of the radial integral becomes:

iInij=2a2+1k=1Kωkrk3Rn(rk)eark2[i1(2arkrij)+(+1)i+1(2arkrij)]r^ij.

In the case of the DVR radial basis:

Inij=2aωn2+1rc2xn3eaxn2[i1(2axnrij)+(+1)i+1(2axnrij)]r^ij,

where xn=rc2rn+rc2.

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