\(\renewcommand{\AA}{\text{Å}}\)
8.5.13. Adaptive-precision interatomic potentials (APIP)
The PKG-APIP enables use of adaptive-precision potentials as described in (Immel). In the context of this package, precision refers to the accuracy of an interatomic potential.
Modern machine-learning (ML) potentials translate the accuracy of DFT simulations into MD simulations, i.e., ML potentials are more accurate compared to traditional empirical potentials. However, this accuracy comes at a cost: there is a considerable performance gap between the evaluation of classical and ML potentials, e.g., the force calculation of a classical EAM potential is 100-1000 times faster compared to the ML-based ACE method. The evaluation time difference results in a conflict between large time and length scales on the one hand and accuracy on the other. This conflict is resolved by an APIP model for simulations, in which the highest precision is required only locally but not globally.
An APIP model uses a precise but expensive ML potential only for a subset of atoms, while a fast potential is used for the remaining atoms. Whether the precise or the fast potential is used is determined by a continuous switching parameter \(\lambda_i\) that can be defined for each atom \(i\). The switching parameter can be adjusted dynamically during a simulation or kept constant as explained below.
The potential energy \(E_i\) of an atom \(i\) described by an adaptive-precision interatomic potential is given by (Immel)
whereas \(E_i^\text{(fast)}\) is the potential energy of atom \(i\) according to a fast interatomic potential, \(E_i^\text{(precise)}\) is the potential energy according to a precise interatomic potential and \(\lambda_i\in[0,1]\) is the switching parameter that decides how the potential energies are weighted.
Adaptive-precision saves computation time when the computation of the precise potential is not required for many atoms, i.e., when \(\lambda_i=1\) applies for many atoms.
The currently implemented potentials are:
Fast potential |
Precise potential |
---|---|
In theory, any short-range potential can be used for an adaptive-precision interatomic potential. How to implement a new (fast or precise) adaptive-precision potential is explained in here.
The switching parameter \(\lambda_i\) that combines the two potentials can be dynamically calculated during a simulation. Alternatively, one can set a constant switching parameter before the start of a simulation. To run a simulation with an adaptive-precision potential, one needs the following components:
atom_style apip so that the switching parameter \(\lambda_i\) can be stored.
A fast potential: eam/apip or pace/fast/apip.
A precise potential: pace/precise/apip.
pair_style lambda/input/apip to calculate \(\lambda_i^\text{input}\), from which \(\lambda_i\) is calculated.
fix lambda/apip to calculate the switching parameter \(\lambda_i\).
pair_style lambda/zone/apip to calculate the spatial transition zone of the switching parameter.
pair_style hybrid/overlay to combine the previously mentioned pair_styles.
fix lambda_thermostat/apip to conserve the energy when switching parameters change.
fix atom_weight/apip to approximate the load caused by every atom, as the computations of the pair_styles are only required for a subset of atoms.
fix balance to perform dynamic load balancing with the calculated load.
atom_style apip so that the switching parameter \(\lambda_i\) can be stored.
A fast potential: eam/apip or pace/fast/apip.
A precise potential: pace/precise/apip.
set command to set the switching parameter \(\lambda_i\).
pair_style hybrid/overlay to combine the previously mentioned pair_styles.
fix atom_weight/apip to approximate the load caused by every atom, as the computations of the pair_styles are only required for a subset of atoms.
fix balance to perform dynamic load balancing with the calculated load.
Example
Note
How to select the values of the parameters of an adaptive-precision interatomic potential is discussed in detail in (Immel).
Lines like these would appear in the input script:
atom_style apip
comm_style tiled
pair_style hybrid/overlay eam/fs/apip pace/precise/apip lambda/input/csp/apip fcc cutoff 5.0 lambda/zone/apip 12.0
pair_coeff * * eam/fs/apip Cu.eam.fs Cu
pair_coeff * * pace/precise/apip Cu.yace Cu
pair_coeff * * lambda/input/csp/apip
pair_coeff * * lambda/zone/apip
fix 2 all lambda/apip 2.5 3.0 time_averaged_zone 4.0 12.0 110 110 min_delta_lambda 0.01
fix 3 all lambda_thermostat/apip N_rescaling 200
fix 4 all atom_weight/apip 100 eam ace lambda/input lambda/zone all
variable myweight atom f_4
fix 5 all balance 100 1.1 rcb weight var myweight
First, the atom_style apip and the communication style are set.
Note
Note, that comm_style tiled is required for the style rcb of fix balance, but not for APIP. However, the flexibility offered by the balancing style rcb, compared to the balancing style shift, is advantageous for APIP.
An adaptive-precision EAM-ACE potential, for which the switching parameter \(\lambda\) is calculated from the CSP, is defined via pair_style hybrid/overlay. The fixes ensure that the switching parameter is calculated, the energy conserved, the weight for the load balancing calculated and the load-balancing itself is done.
Lines like these would appear in the input script:
atom_style apip
comm_style tiled
pair_style hybrid/overlay eam/fs/apip pace/precise/apip
pair_coeff * * eam/fs/apip Cu.eam.fs Cu
pair_coeff * * pace/precise/apip Cu.yace Cu
# calculate lambda somehow
variable lambda atom ...
set group all apip/lambda v_lambda
fix 4 all atom_weight/apip 100 eam ace lambda/input lambda/zone all
variable myweight atom f_4
fix 5 all balance 100 1.1 rcb weight var myweight
First, the atom_style apip and the communication style are set.
Note
Note, that comm_style tiled is required for the style rcb of fix balance, but not for APIP. However, the flexibility offered by the balancing style rcb, compared to the balancing style shift, is advantageous for APIP.
An adaptive-precision EAM-ACE potential is defined via pair_style hybrid/overlay. The switching parameter \(\lambda_i\) of the adaptive-precision EAM-ACE potential is set via the set command. The parameter is not updated during the simulation. Therefore, the potential is conservative. The fixes ensure that the weight for the load balancing is calculated and the load-balancing itself is done.
Implementing new APIP pair styles
One can introduce adaptive-precision to an existing pair style by modifying the original pair style. One should calculate the force \(F_i = - \nabla_i \sum_j E_j^\text{original}\) for a fast potential or \(F_i = - (1-\nabla_i) \sum_j E_j^\text{original}\) for a precise potential from the original potential energy \(E_j^\text{original}\) to see where the switching parameter \(\lambda_i\) needs to be introduced in the force calculation. The switching parameter \(\lambda_i\) is known for all atoms \(i\) in force calculation routine. One needs to introduce an abortion criterion based on \(\lambda_i\) to ensure that all not required calculations are skipped and compute time can be saved. Furthermore, one needs to provide the number of calculations and measure the computation time. Communication within the force calculation needs to be prevented to allow effective load-balancing. With communication, the load balancer cannot balance few calculations of the precise potential on one processor with many computations of the fast potential on another processor.
All changes in the pair_style pace/apip compared to the pair_style pace are annotated and commented. Thus, the pair_style pace/apip can serve as an example for the implementation of new adaptive-precision potentials.
(Immel) Immel, Drautz and Sutmann, J Chem Phys, 162, 114119 (2025)