GAP

This is an implementation of the sparse Gaussian Approximation Potential (GAP) [1] using Smooth Overlap of Atomic Positions (SOAP) [2] implemented in featomic.

The GAP model in metatrain can only train on CPU, but evaluation is also supported on GPU.

Installation

To install this architecture along with the metatrain package, run:

pip install metatrain[gap]

where the square brackets indicate that you want to install the optional dependencies required for gap.

Default Hyperparameters

The description of all the hyperparameters used in gap is provided further down this page. However, here we provide you with a yaml file containing all the default hyperparameters, which might be convenient as a starting point to create your own hyperparameter files:

architecture:
  name: gap
  model:
    soap:
      cutoff:
        radius: 5.0
        smoothing:
          type: ShiftedCosine
          width: 1.0
      density:
        type: Gaussian
        center_atom_weight: 1.0
        width: 0.3
        scaling:
          type: Willatt2018
          rate: 1.0
          scale: 2.0
          exponent: 7.0
      basis:
        type: TensorProduct
        max_angular: 6
        radial:
          type: Gto
          max_radial: 7
    krr:
      degree: 2
      num_sparse_points: 500
    zbl: false
  training:
    regularizer: 0.001
    regularizer_forces: null

Model hyperparameters

The parameters that go under the architecture.model section of the config file are the following:

ModelHypers.soap: SOAPHypers = {'basis': {'max_angular': 6, 'radial': {'max_radial': 7, 'type': 'Gto'}, 'type': 'TensorProduct'}, 'cutoff': {'radius': 5.0, 'smoothing': {'type': 'ShiftedCosine', 'width': 1.0}}, 'density': {'center_atom_weight': 1.0, 'scaling': {'exponent': 7.0, 'rate': 1.0, 'scale': 2.0, 'type': 'Willatt2018'}, 'type': 'Gaussian', 'width': 0.3}}
ModelHypers.krr: KRRHypers = {'degree': 2, 'num_sparse_points': 500}
ModelHypers.zbl: bool = False

with the following definitions needed to fully understand some of the parameters:

class metatrain.gap.documentation.KRRHypers[source]

Hyperparameters for the KRR model.

degree: Literal[2] = 2

Degree of the kernel. For now, only 2 is allowed.

num_sparse_points: int = 500

Number of sparse points to use during the training, it select the number of actual samples to use during the training. The selection is done with the Further Point Sampling (FPS) algorithm. The optimal number of sparse points depends on the system. Increasing it might impreve the accuracy, but it also increase the memory and time required for training.

class metatrain.gap.documentation.SOAPHypers[source]

Configuration for the SOAP descriptors.

cutoff: SOAPCutoffHypers = {'radius': 5.0, 'smoothing': {'type': 'ShiftedCosine', 'width': 1.0}}

Spherical cutoff (Å) to use for atomic environments.

density: SOAPDensityHypers = {'center_atom_weight': 1.0, 'scaling': {'exponent': 7.0, 'rate': 1.0, 'scale': 2.0, 'type': 'Willatt2018'}, 'type': 'Gaussian', 'width': 0.3}
basis: SOAPBasisHypers = {'max_angular': 6, 'radial': {'max_radial': 7, 'type': 'Gto'}, 'type': 'TensorProduct'}
class metatrain.gap.documentation.SOAPCutoffHypers[source]

Cutoff configuration for the SOAP descriptor.

radius: float = 5.0

This should be set to a value after which most of the interactions between atoms is expected to be negligible.

smoothing: SOAPCutoffSmoothingHypers = {'type': 'ShiftedCosine', 'width': 1.0}
class metatrain.gap.documentation.SOAPCutoffSmoothingHypers[source]

Smoothing configuration for the SOAP descriptor cutoff.

type: Literal['ShiftedCosine'] = 'ShiftedCosine'

Cutoff function used to smooth the behavior around the cutoff radius.

Currently, only the Shifted Cosine function is supported, which is defined as f(r) = 1/2 * (1 + cos(π (r- cutoff + width) / width )).

width: float = 1.0
class metatrain.gap.documentation.SOAPDensityHypers[source]

Density configuration for the SOAP descriptor.

type: Literal['Gaussian'] = 'Gaussian'

Currently, we only support a Gaussian type orbitals (GTO) as radial basis functions and radial integrals.

center_atom_weight: float = 1.0

Weight of the central atom contribution to the features. If 1.0 the center atom contribution is weighted the same as any other contribution. If 0.0 the central atom does not contribute to the features at all.

width: float = 0.3

Width of the atom-centered gaussian creating the atomic density.

scaling: SOAPDensityScalingHypers = {'exponent': 7.0, 'rate': 1.0, 'scale': 2.0, 'type': 'Willatt2018'}

Radial scaling can be used to reduce the importance of neighbor atoms further away from the center, usually improving the performance of the model.

class metatrain.gap.documentation.SOAPDensityScalingHypers[source]

Density scaling configuration for the SOAP descriptor.

type: Literal['Willatt2018'] = 'Willatt2018'

Type of scaling, currently only one type is supported. It uses a long-range algebraic decay and smooth behavior at \(r\rightarrow 0\): as introduced by Willatt et al.[3] as f(r) = rate / (rate + (r / scale) ^ exponent).

rate: float = 1.0
scale: float = 2.0
exponent: float = 7.0
class metatrain.gap.documentation.SOAPBasisHypers[source]

Basis configuration for the SOAP descriptor.

type: Literal['TensorProduct'] = 'TensorProduct'
max_angular: int = 6

Maximum angular channels of the spherical harmonics when computing the SOAP descriptors. In general, increasing this hyperparameter might lead to better accuracy, especially on larger datasets, at the cost of increased training and evaluation time.

radial: SOAPBasisRadialHypers = {'max_radial': 7, 'type': 'Gto'}
class metatrain.gap.documentation.SOAPBasisRadialHypers[source]

Radial basis configuration for the SOAP descriptor.

type: Literal['Gto'] = 'Gto'
max_radial: int = 7

Maximum radial channels of the spherical harmonics when computing the SOAP descriptors. In general, increasing this hyperparameter might lead to better accuracy, especially on larger datasets, at the cost of increased training and evaluation time.

Trainer hyperparameters

The parameters that go under the architecture.trainer section of the config file are the following:

TrainerHypers.regularizer: float = 0.001

Value of the regularizer for the energy. It should be tuned depending on the specific dataset. If it is too small might lead to overfitting, if it is too big might lead to bad accuracy.

TrainerHypers.regularizer_forces: float | None = None

Value of the regularizer for the forces. It has a similar effect as regularizer. If None, it is set equal to regularizer. It might be changed to have better accuracy.

References