Machine Learning forcefields / interatomic potentials¶
atomate2 includes an interface to a few common machine learning interatomic potentials (MLIPs), also known variously as machine learning forcefields (MLFFs), or foundation potentials (FPs) for universal variants.
Most of Maker classes using the forcefields inherit from atomate2.forcefields.utils.ForceFieldMixin to specify which forcefield to use.
The ForceFieldMixin mixin provides the following configurable parameters:
force_field_name: Name of the forcefield to use.calculator_kwargs: Keyword arguments to pass to the corresponding ASE calculator.
These parameters are passed to atomate2.forcefields.utils.ase_calculator() to instantiate the appropriate ASE calculator.
The force_field_name should be either one of predefined atomate2.forcefields.utils.MLFF (or its string equivalent) or a dictionary decodable as a class or function for ASE calculator as follows.
Using predefined forcefields supported via atomate2.forcefields.utils.MLFF¶
Support is provided for the following models, which can be selected using atomate2.forcefields.utils.MLFF, as shown in the table below (in alphabetical order):
You need only install packages for the forcefields you wish to use.
Forcefield Name |
|
Reference |
Description |
|---|---|---|---|
Allegro |
|
Requires the |
|
CHGNet |
|
Available via the |
|
DeepMD |
|
The Deep Potential model used for this test is |
|
FAIRChem |
|
Proprietary, requires extra authentication. See notes below. |
|
Gaussian Approximation Potential (GAP) |
|
Relies on |
|
M3GNet |
|
Relies on |
|
MACE-MP-0 |
|
Relies on |
|
MACE-MP-0b3 |
|
Relies on |
|
MACE-MPA-0 |
|
Relies on |
|
MatPES-PBE |
|
Relies on |
|
MatPES-r2SCAN |
|
Relies on |
|
MatterSim |
|
Requires the |
|
Neuroevolution Potential (NEP) |
|
Relies on |
|
Neural Equivariant Interatomic Potentials (Nequip) |
|
Relies on the |
|
SevenNet |
|
Relies on the |
Using custom forcefields by dictionary¶
force_field_name also accepts a MSONable dictionary for specifying a custom ASE calculator class or function [1].
For example, a Job created with the following code snippet instantiates chgnet.model.dynamics.CHGNetCalculator as the ASE calculator:
job = ForceFieldStaticMaker(
force_field_name={
"@module": "chgnet.model.dynamics",
"@callable": "CHGNetCalculator",
}
).make(structure)
Notes on FairChem (Meta) models {#fairchem-notes}¶
The FAIRChem models provided by Meta require extra authentication via HuggingFace:
Request access to the UMA models via HuggingFace. You will need to set up a HuggingFace account. You will need to receive approval for the UMA models to proceed.
Install the HuggingFace CLI with
pip install 'huggingface_hub'.Run
huggingface-cli loginfrom a shell to authenticate your session. You will need to set up an access token.You can now use the FAIRChem calculators. The general syntax for setting up a FAIRChem calculator in
atomate2is:
calculator_kwargs = {
"predict_unit": {"model_name": "uma-s-1p1"},
"task_name": "omat",
}
atomate2 will then set up a FAIRChemCalculator:
from atomate2.forcefields.utils import MLFF, _DEFAULT_CALCULATOR_KWARGS
from fairchem.core import FAIRChemCalculator, pretrained_mlip
predict_unit_kwargs = calculator_kwargs.pop(
"predict_unit", _DEFAULT_CALCULATOR_KWARGS[MLFF.FAIRChem]["predict_unit"]
)
calculator = FAIRChemCalculator(
pretrained_mlip.get_predict_unit(predict_unit_kwargs),
**{k: v for k, v in calculator_kwargs.items() if k != "predict_unit"},
)
The default in atomate2 is the OMat24 model with uma-s-1p1.