Dear LAMMPS users,
I’m encountering an issue when trying to combine the MACE machine learning potential with dispersion corrections through the pair_style hybrid/overlay
command. The MACE potential works fine on its own. I compiled my version of LAMMPS by following the instructions on the MACE website (MACE in LAMMPS — mace 0.3.12 documentation), and I have a working LAMMPS installation that can use the MACE potential.
Unfortunately, this LAMMPS fork does not include the necessary routines for dispersion corrections, but I hope that future versions will support them natively.
As a workaround, I manually copied the last version of the files pair_dispersion_d3.cpp
and pair_dispersion_d3.h
into the EXTRA-PAIR
folder and recompiled LAMMPS to include that package. However, when I try to use the pair_style hybrid/overlay
command to combine the ML potential with dispersion corrections, I encounter the following error:
ERROR: Pair_style dispersion/d3 needs 4 arguments (src/EXTRA-PAIR/pair_dispersion_d3.cpp:133)
Last command: pair_style hybrid/overlay mace no_domain_decomposition dispersion/d3 zero pbe 40.0 20.0
Here is the code I’m using to simulate a box of water molecules:
####################################################################
# Initialization
####################################################################
units real
boundary p p p
atom_style atomic
atom_modify map yes
newton on
####################################################################
# Atom definition
####################################################################
read_data water.data
replicate 2 2 2
mass 1 1.00794 # Hydrogen
mass 2 15.9994 # Oxygen
group hydrogen type 1
group oxygen type 2
####################################################################
# Settings: force field, simulation parameters, output options
####################################################################
pair_style hybrid/overlay mace no_domain_decomposition dispersion/d3 zero pbe 40.0 20.0
#pair_style mace no_domain_decomposition # ML potential works alone
pair_coeff * * small.model-lammps.pt H O
timestep 1.0
### output options
thermo_style custom step temp etotal pe ke
thermo 50
log log.prod
####################################################################
# Run simulations
####################################################################
### Simulation 1: Equilibration run by rescaling velocities
# initial velocities following distribution of 300 K
velocity all create 300.0 1234
fix integrate all nve
fix rescaling all temp/rescale 1 300.0 300.0 0.05 1.0
fix removeMomentum all momentum 1 linear 1 1 1
run 500
### Simulation 2: Langevin dynamics
unfix rescaling
unfix removeMomentum
fix 1 all langevin 300.0 300.0 100.0 48279
run 1000