8.3. LAMMPS commands
8.3.1. Enable DeePMD-kit plugin (plugin mode)
If you are using the plugin mode, enable DeePMD-kit package in LAMMPS with
plugin load libdeepmd_lmp.so
After LAMMPS version
patch_24Mar2022, another way to load plugins is to set the environmental variable
$deepmd_root is the directory to install C++ interface.
The built-in mode doesn’t need this step.
The DeePMD-kit package provides the pair_style
pair_style deepmd models ... keyword value ...
deepmd = style of this pair_style
models = frozen model(s) to compute the interaction. If multiple models are provided, then only the first model serves to provide energy and force prediction for each timestep of molecular dynamics, and the model deviation will be computed among all models every
keyword = out_file or out_freq or fparam or atomic or relative
out_file value = filename filename = The file name for the model deviation output. Default is model_devi.out out_freq value = freq freq = Frequency for the model deviation output. Default is 100. fparam value = parameters parameters = one or more frame parameters required for model evaluation. atomic = no value is required. If this keyword is set, the model deviation of each atom will be output. relative value = level level = The level parameter for computing the relative model deviation
pair_style deepmd graph.pb pair_style deepmd graph.pb fparam 1.2 pair_style deepmd graph_0.pb graph_1.pb graph_2.pb out_file md.out out_freq 10 atomic relative 1.0
This pair style takes the deep potential defined in a model file that usually has the .pb extension. The model can be trained and frozen by package DeePMD-kit.
The model deviation evalulate the consistency of the force predictions from multiple models. By default, only the maximal, minimal and averge model deviations are output. If the key
atomic is set, then the model deviation of force prediction of each atom will be output.
By default, the model deviation is output in absolute value. If the keyword
relative is set, then the relative model deviation will be output. The relative model deviation of the force on atom
i is defined by
|Df_i| Ef_i = ------------- |f_i| + level
Df_i is the absolute model deviation of the force on atom
|f_i| is the norm of the the force and
level is provided as the parameter of the keyword
deepmdpair style is provided in the USER-DEEPMD package, which is compiled from the DeePMD-kit, visit the DeePMD-kit website for more information.
8.3.3. Compute tensorial properties
The DeePMD-kit package provide the compute
deeptensor/atom for computing atomic tensorial properties.
compute ID group-ID deeptensor/atom model_file
ID: user-assigned name of the computation
group-ID: ID of the group of atoms to compute
deeptensor/atom: the style of this compute
model_file: the name of the binary model file.
compute dipole all deeptensor/atom dipole.pb
The result of the compute can be dump to trajctory file by
dump 1 all custom 100 water.dump id type c_dipole c_dipole c_dipole
deeptensor/atomcompute is provided in the USER-DEEPMD package, which is compiled from the DeePMD-kit, visit the DeePMD-kit website for more information.
8.3.4. Long-range interaction
The reciprocal space part of the long-range interaction can be calculated by LAMMPS command
kspace_style. To use it with DeePMD-kit, one writes
pair_style deepmd graph.pb pair_coeff kspace_style pppm 1.0e-5 kspace_modify gewald 0.45
Please notice that the DeePMD does nothing to the direct space part of the electrostatic interaction, because this part is assumed to be fitted in the DeePMD model (the direct space cut-off is thus the cut-off of the DeePMD model). The splitting parameter
gewald is modified by the
8.3.5. Use of the centroid/stress/atom to get the full 3x3 “atomic-virial”
The DeePMD-kit allows also the computation of per-atom stress tensor defined as:
Where is the atomic position of nth atom, velocity of atom and the derivative of the atomic energy.
In LAMMPS one can get the per-atom stress using the command
compute ID group-ID centroid/stress/atom NULL virial
see LAMMPS doc page for more detailes on the meaning of the keywords.
In order of computing the 9-component per-atom stress
compute stress all centroid/stress/atom NULL virial
c_stress is an array with 9 component in the order
If you use this feature please cite D. Tisi, L. Zhang, R. Bertossa, H. Wang, R. Car, S. Baroni - arXiv preprint arXiv:2108.10850, 2021
8.3.6. Computation of heat flux
Using per-atom stress tensor one can, for example, compute the heat flux defined as:
to compute the heat flux with LAMMPS:
compute ke_ID all ke/atom compute pe_ID all pe/atom compute stress_ID group-ID centroid/stress/atom NULL virial compute flux_ID all heat/flux ke_ID pe_ID stress_ID
compute ke all ke/atom compute pe all pe/atom compute stress all centroid/stress/atom NULL virial compute flux all heat/flux ke pe stress
c_flux is a global vector of length 6. The first three components are the
z components of the full heat flux vector. The others are the components of the so-called convective portion, see LAMMPS doc page for more detailes.
If you use these features please cite D. Tisi, L. Zhang, R. Bertossa, H. Wang, R. Car, S. Baroni - arXiv preprint arXiv:2108.10850, 2021