ASE calculator

MACE models can run molecular dynamics or geometry optimisation through the ASE calculator. The ASE calculator is a Python module that can be used to run MD simulations or geometry optimisations.

The native ASE neighbour list being slow, it is recommended to use the matscipy branch. Note that the matscipy branch is not compatible with non-periodic systems.

Running MD simulations

The ASE calculator can be used to run MD simulations with MACE. The following example shows how to run a MD simulation of a 3BPA molecule in vacuum.

from ase import units
from import Langevin
from import read, write
import numpy as np
import time

from mace.calculators import MACECalculator

calculator = MACECalculator(model_path='/content/checkpoints/MACE_model_run-123.model', device='cuda')
init_conf = read('BOTNet-datasets/dataset_3BPA/', '0')

dyn = Langevin(init_conf, 0.5*units.fs, temperature_K=310, friction=5e-3)
def write_frame():
        dyn.atoms.write('', append=True)
dyn.attach(write_frame, interval=50)
print("MD finished!")

To get the model and the data associated with this example, please run the colab tutorial here.