Symmetryfunctions
Overview¶
There are several types of symmetry functions available in RuNNer. A detailed description of most of them can be found in J. Behler, J. Chem. Phys. 2011, 134, 074106. For high-dimensional neural network potentials there are radial and angular symmetry functions, which are all many-body functions and not to be confused with two- and three-body functions. In addition, spin-dependent atom-centered symmetry functions proposed in M. Eckhoff, J. Behler, npj Comput. Mater. 2021, 7, 170 take atomic spin degrees of freedom into account to represent different magnetic orders of collinear spin-polarized atoms. For systems with many different chemical elements, weighted symmetry functions are adapted from M. Eckhoff, M. Reiher, J Chem. Theory Comput. 2023, 19, 3509.
The Cutoff Function¶
The cutoff function is a central part of any symmetry function, because it
defines the local atomic environments. In RuNNer there are several cutoff
functions available, which are selected by the keywords
Cosine and hypertangent are well tested and recommended for applications. The other cutoff functions currently have an experimental status only and should be used with care.
For fc_cosine
the function
is used, where \(r_{ci}\) is the inner cutoff radius and \(r_{co}\) is the outer cutoff radius.
For fc_hypertangent
it is the function
where \(r_{ci}\) is the inner cutoff radius and \(r_{co}\) is the outer cutoff radius.
fc_hard is a step function where the cutoff function that abruptly transitions from 1 to 0 at the cutoff radius.
This cutoff function has no smooth transition region.
Mathematical Formula:
where \(r_{co}\) is the cutoff radius.
fc_polynomial
defines a polynomial cutoff function with smooth transition to zero at the cutoff radius. This cutoff function uses a polynomial function to smoothly decay from 1 to 0.
Mathematical Formula:
where \(r_{co}\) is the cutoff radius and \(n\) is the polynomial exponent (default: \(n = 2\)).
Defines a van der Waals cutoff function with inner and outer cutoff radii and buffer zones. This specialized cutoff function is designed for van der Waals interactions with flexible transition regions.
Mathematical Formula:
where: - \(r_{bi} = \frac{r_{ij} - r_{ci}}{d_{bi}}\) (inner buffer region) - \(r_{bo} = \frac{r_{ij} - r_{co} + d_{bo}}{d_{bo}}\) (outer buffer region) - \(r_{ci}\) is the inner cutoff radius, \(r_{co}\) is the outer cutoff radius - \(d_{bi}\) is the inner buffer width, \(d_{bo}\) is the outer buffer width
Usually, the inner cutoff \(r_{ci}\) is set to zero.
The following table shows a list of the functional forms of all cutoff functions within the cutoff radius and without the inner cutoff radius. Outside the cutoff radius the values are zero. In addition, please be aware that the inner cutoff radius must be smaller than the shortest bond length in the system in order to avoid losing information about the close atomic environment.
| keyword | Name | Formula |
|---|---|---|
| fc_hard | hard function | 1 |
| fc_cosine | cosine function | \(\frac{1}{2} [\cos(\frac{\pi(r_{ij} - r_{ci})}{r_{co} - r_{ci}})+1]\) |
| fc_hypertangent | hypertangent function | \(\tanh^3\left(1 - \frac{r_{ij}}{r_{co}}\right)\) |
| fc_hypertangent_approx | approximate hypertangent function | \(\left[x \frac{27 + x^2}{27 + 9x^2}\right]^3, \; x = 1 - \frac{r_{ij}}{r_{co}}\) |
| fc_polynomial | polynomial function | \(\left(1 - \frac{r_{ij}^2}{r_{co}^2}\right)^n \;\text{if } r_{ij} \le r_{co}\) |
| fc_vdw | vdw | \(3 r_{bi}^2 - 2 r_{bi}^3\) |
Symmetry Functions¶
RuNNer has a variety of symmetry functions that transform the geometric information of the input structures to neural network-readable feature vectors. There are the radial and angular atom centered symmetry functions which also have modified versions for magnetic spin or element weighted symmetry functions. Another type of symmetry functions is the overlap matrix.
Radial Symmetry Functions¶
The radial functions describe the radial distribution of neighboring atoms of a specified element with respect to the central atom \(i\). They can often be interpreted as continuous coordination numbers of the central atom.
Radial Function Type 1¶
For the description of the environment of atom \(i\) type 1 is the plain cutoff
function of
fc_cosine 1.
(no other cutoff type can be used here):
For \(R_{ij} < R_{\mathrm{c}}\) we then have
This symmetry function has a non-zero derivative with respect to the coordinates
of the reference atom \(x_i\), \(y_i\), \(z_i\) and with respect to the coordinates of
all atoms \(j\), \(x_j\), \(y_j\) and \(z_j\). The derivative dGdxyz with respect
to a coordinate \(\alpha\) is then
where \(\alpha\) can be any of \(x_i\), \(y_i\), \(z_i\), \(x_j\), \(y_j\) or \(z_j\). With the definition of \(R_{ij}\)
we then have
and
For the derivatives \(\frac{\partial G^{\mu}_i}{\partial \alpha}\) in
RuNNer the array
feature_derivatives(num_funcvalues, num_neighbors, 3) is used.
Field 2 defines the number of the symmetry function (not its type
number!), field 3 specifies the number of neighbors of the central atom, i.e., the
atom that is characterized by the symmetry function, and
field 1 specifies the coordinate of the derivative, so field 1 and 3
together define \(\alpha\).
The use of this function is discouraged, because for small cutoffs there can be problems in the accuracy of energies and forces. Therefore, the symmetry function has not yet been generalized to automatically adapt to the chosen cutoff type.
Radial Function Type 2¶
This function is the most important radial function. It is a sum of shifted Gaussians multiplied by the cutoff function. The result is a "shell" around the atom at a certain radius determined by the shift \(R_s\). The width of the Gaussian is determined by the parameter \(\eta\).
The derivative dGdxyz with respect to a coordinate \(\alpha\) is
A good starting point is to first try \(R_s=0\).
Radial Spin-dependent Functions¶
Spin-dependent atom-centered symmetry functions can distinguish different collinear atomic spin arrangements for the construction of magnetic high-dimensional neural network potentials. To represent the magnetic order, the atomic spin coordinate,
with
is used. \(M_S\) equals the difference between the numbers of spin-up \(n_i^\uparrow\) and spin-down electrons \(n_i^\downarrow\) at an atom site \(i\) multiplied by the spin of an electron \(\tfrac{1}{2}\,\hbar\). The threshold \(M_S^\mathrm{thres}\) is set to \(0.25\,\hbar\). If the atomic spin is not smaller than \(M_S^\mathrm{thres}\), the atomic spin coordinate will be the sign of \(M_S\), i.e., \(-1\) or 1.
The radial spin-dependent symmetry functions are based on radial symmetry function type 2, but contain in addition a radial spin augmentation function \(M^\mathrm{x}\),
Radial Spin-dependent Function Type 21 (\(M^\mathrm{0^*}\))¶
The radial spin-dependent symmetry function type 21 uses the spin augmentation function
This spin augmentation function represents only non-magnetic interactions.
Radial Spin-dependent Function Type 22 (\(M^\mathrm{+}\))¶
The radial spin-dependent symmetry function type 22 uses the spin augmentation function
This spin augmentation function represents ferromagnetic interactions between a magnetic central atom and a magnetic neighbor atom.
Radial Spin-dependent Function Type 23 (\(M^\mathrm{-}\))¶
The radial spin-dependent symmetry function type 23 uses the spin augmentation function
This spin augmentation function represents antiferromagnetic interactions between a magnetic central atom and a magnetic neighbor atom.
Weighted Radial Function Type 32 (weighted)¶
Element weighted radial symmetry functions can be used as a remedy for the combinatorial explosion if too many element species exist in one dataset. Typically, the cost of the weighted symmetry functions have a break even point at 5 different elements. Radial function type 32 is based on the radial function type 2 and introduces weights \(H_{ij}^{rad}\) depending on the valence electron structure of the neighbor atom \(j\). For scaling reasons a factor of \(\frac{1}{H_{max,i}^{rad}}\) is used.
Angular Symmetry Functions¶
Angular Function Type 3¶
The angular terms are constructed for all triplets of atoms by summing the cosine values of the angles \(\theta_{ijk}=\frac{\bf{R}_{ij}\cdot\bf{R}_{ik}}{R_{ij} R_{ik}}\) centered at atom \(i\), with \(\bf{R}_{ij}=\bf{R}_i-\bf{R}_j\),
\(\lambda\) can only have the values +1 and -1. The derivative
dGdxyz with respect to a coordinate \(\alpha\) is
Angular Function Type 8¶
This is an angular function with maxima at arbitrary angles, which is symmetric with respect to \(\alpha=\pi\) and \(\alpha=2\pi\).
Angular Function Type 9¶
This symmetry function is closely related to angular symmetry function 3, but is missing the terms depending on \(R_{jk}\).
Due to the missing multiplication by \(f_{\mathrm{c} }\left(R_{jk}\right)\) also triples with distances between \(j\) and \(k\) being larger than the cutoff radius will be considered. Therefore the numerical values of this symmetry function will be generally larger.
Angular Spin-dependent Functions¶
The angular spin-dependent symmetry functions are based on angular symmetry function type 3, but contain in addition an angular spin augmentation function \(M^\mathrm{xx}\),
Note: The sum over \(j\) and \(k\neq j\) takes into account all contributions of a \(j\times k\) matrix except for diagonal contributions (self-interaction). Therefore, \(2^{-\zeta}\) is used as prefactor instead of \(2^{1-\zeta}\) which is employed for the sum over \(j\) and \(k>j\). In the latter case only the upper triangular (all entries above the main diagonal) are used and multiplied by an additional factor \(2\) of the prefactor because these are typically identical to the lower triangular. The only exception is the angular spin-dependent symmetry function type 27 which requires to take into account all contributions explicitly.
Angular Spin-dependent Function Type 24 (\(M^\mathrm{00^*}\))¶
The angular spin-dependent symmetry function type 24 uses the spin augmentation function
This spin augmentation function represents only non-magnetic interactions of the central atom with its neighbor atoms.
Angular Spin-dependent Function Type 25 (\(M^\mathrm{++}\))¶
The angular spin-dependent symmetry function type 25 uses the spin augmentation function
This spin augmentation function represents interactions between three magnetic atoms of the same atomic spin coordinate. In addition, it describes ferromagnetic interactions between a magnetic central atom, one magnetic neighbor atom, and one non-magnetic neighbor atom.
Angular Spin-dependent Function Type 26 (\(M^\mathrm{--}\))¶
The angular spin-dependent symmetry function type 26 uses the spin augmentation function
This spin augmentation function represents interactions between three magnetic atoms, whereby the atomic spin coordinate of the central atom is different to those of the neighbor atoms. In addition, it describes antiferromagnetic interactions between a magnetic central atom, one magnetic neighbor atom, and one non-magnetic neighbor atom.
Angular Spin-dependent Function Type 27 (\(M^\mathrm{+-}\))¶
The angular spin-dependent symmetry function type 27 uses the spin augmentation function
This spin augmentation function represents interactions between three magnetic atoms, whereby the two neighbor atoms exhibit different atomic spin coordinates.
Angular Spin-dependent Function Type 28 (\(M^\mathrm{2++}\))¶
The angular spin-dependent symmetry function type 28 uses the spin augmentation function
This spin augmentation function represents ferromagnetic interactions between a magnetic central atom, one magnetic neighbor atom, and one non-magnetic neighbor atom.
Angular Spin-dependent Function Type 29 (\(M^\mathrm{3++}\))¶
The angular spin-dependent symmetry function type 29 uses the spin augmentation function
This spin augmentation function represents interactions between three atoms of the same atomic spin coordinate.
Angular Spin-dependent Function Type 30 (\(M^\mathrm{2--}\))¶
The angular spin-dependent symmetry function type 30 uses the spin augmentation function
This spin augmentation function represents antiferromagnetic interactions between a magnetic central atom, one magnetic neighbor atom, and one non-magnetic neighbor atom.
Angular Spin-dependent Function Type 31 (\(M^\mathrm{3--}\))¶
The angular spin-dependent symmetry function type 31 uses the spin augmentation function
This spin augmentation function represents interactions between three magnetic atoms, whereby the atomic spin coordinate of the central atom is different to those of the neighbor atoms.
Weighted Angular Function Type 33 (weighted)¶
where
with \(\gamma_i = ± 1\) and \(H_{ij}^{\mathrm{rad}}\) from weighted radial function 32 and
so
Technical Notes on the Implementation of the Symmetry Functions¶
For each symmetry function specified in the input.nn file there is one
symmetry function value per atom in case of a monocomponent system. In
case of a general multicomponent system also all cross-terms have to be
specified. The number of cross-terms is different for the radial and the
angular symmetry functions. For a radial function there is one function
value for each element in the system. For an angular function all
permutations have to be considered, i.e., for a three-component system
with the elements A, B and C we have the angular functions describing
the angles A-A-A, A-B-B, A-C-C, A-A-B=A-B-A, A-A-C=A-C-A, and
A-B-C=A-C-B, where the first letter indicates the central atom of the
angle. For a system containing \(N_\mathrm{elem}\) elements we have
symmetry functions. In RuNNer the symmetry functions and their derivatives are stored in the 'AtomicDescriptor' object for each atom. Symmetry functions are stored in the
array
features(num_features), where num_features
specifies \(N_\mathrm{G}\). For a given structure the functions are
calculated in the subroutine calculate_features or calculate_features_first_derivative of the FeatureCalculator. The calculation of
the symmetry functions is done block-wise for a chunk of
structures, where chunksize is the maximum
number of structures being stored in the memory at the same time. The
array storing the symmetry functions for a full set of structures for forward passing is
called features(max_num_features_of_central_atoms, size(central_atom_ids_on_process)) and is
constructed in pack_features_allocated from the symmetry function arrays of
the individual atoms.
Scaling of the Symmetry Functions¶
For numerical reasons it may be advantageous to scale and/or center the
range of symmetry function values. This is done with the keywords
scale_feature_maps and center_feature_maps.
If the symmetry functions are just scaled (scale_feature_maps=.true. and
center_feature_maps=.false.) then the range of values for each symmetry
function is between 0 and 1 and the values are calculated according to
If the symmetry functions are just centered (scale_feature_maps=.false. and
center_feature_maps=.true.) then the average value of the centered symmetry
function values is zero.
If the symmetry functions are centered and scaled (scale_feature_maps=.true.
and center_feature_maps=.true.) then the symmetry functions are
and there are positive and negative values (the range is not -1 to 1!)
If the symmetry functions are scaled, also the derivatives dGdxyz
have to be scaled to keep the gradients consistent with the original
function.