MACE calculator

MACE is an equivariant message-passing neural-network-based MLIP.

Below are the instructions on how to initialize the MACE calculator, to run dynamics simulations within NQCDynamics.jl using ASE interface.

The following instructions will include Julia-based code.

We start with importing NQCDynamics.jl packages and PyCall which allows importing Python-based packages.

using NQCDynamics
using PyCall
using NQCModels

# Importing Python modules with PyCall
io = pyimport("ase.io")
mace_calc = pyimport("mace.calculators")

Now, we specify the cutoff distance, paths to the model, and Atoms objects. Then we read the ASE atoms object and we convert it to NQCDynamics object.

pes_model_path = "path/to/ace/model/MACE_model_swa.model"
atoms_path = "path/to/atoms.xyz"
ase_atoms = io.read(atoms_path)
atoms, positions, cell = NQCDynamics.convert_from_ase_atoms(ase_atoms)

We then set up our MACE calculator and create NQCModels AdiabaticASEModel object that includes the model.

calculator = mace_calc.MACECalculator(
    model_path=pes_model_path, 
    device="cpu", 
    default_dtype="float32") # device = "cpu" or "cuda"
ase_atoms.set_calculator(calculator)
pes_model = AdiabaticASEModel(ase_atoms)

Finally, we can use the model to e.g. initialize Simulation object that is employed to run MD simulations.

sim = Simulation{Classical}(atoms, pes_model, cell=cell)

References

I. Batatia, D. P. Kovács, G. N. C. Simm, C. Ortner, G. Csányi, MACE: Higher order equivariant message passing neural networks for fast and accurate force fields, NeurIPS 2022