This is a high level API for using machine learning models in OpenMM simulations. With just a few lines of code, you can set up a simulation that uses a standard, pretrained model to represent some or all of the interactions in a system.
The current release of OpenMM-ML supports the following potential functions.
-
MACE models, including the pre-trained MACE-OFF23, MACE-MPA-0, MACE-OMAT-0, and MACE-OMOL-0 models, utilizing the MACE implementation.
-
The pretrained AIMNet2 model.
-
Models generated with TorchMD-Net, including the pretrained AceFF models.
-
Models generated with FeNNol, including the pretrained FeNNix-Bio1 models.
-
Pretrained Orb models.
-
Models generated by NequIP. Models generated by Allegro are also supported by this interface.
-
The pretrained ANI-1ccx and ANI-2x models, using the implementations in TorchANI.
-
Models generated by DeePMD-kit.
In addition to its built in support for the models listed above, OpenMM-ML can use any model implemented with an ASE Calculator. A very wide range of machine learning and quantum chemistry packages provide interfaces in this format, allowing them to be used with OpenMM-ML.
See the documentation for details on using each of these model types.
You can find the current documentation at https://openmm.github.io/openmm-ml.
The stable version of OpenMM-ML can be installed with pip.
pip install openmmml
This installs only OpenMM-ML itself, not the packages that provide specific models. Those must be installed separately by following the instructions from the package developers.
OpenMM-ML can also be installed with conda or mamba.
mamba install -c conda-forge openmm-mlHowever, we generally recommend using pip because most of the packages that provide models are only available with pip, not conda.
To use this package, create a MLPotential object, specifying the name of the potential function to use. You can then call createSystem() to create a System object for a simulation. For example,
from openmmml import MLPotential
potential = MLPotential('ani2x')
system = potential.createSystem(topology)Alternatively, you can use createMixedSystem() to create a System where part is modeled with this potential and the rest is modeled with a conventional force field. As an example, suppose the Topology contains three chains. Chain 0 is a protein, chain 1 is a ligand, and chain 2 is solvent. The following code creates a System in which the internal energy of the ligand is computed with ANI2x, while everything else (including interactions between the ligand and the rest of the System) is computed with Amber14.
forcefield = ForceField('amber14-all.xml', 'amber14/tip3pfb.xml')
mm_system = forcefield.createSystem(topology)
chains = list(topology.chains())
ml_atoms = [atom.index for atom in chains[1].atoms()]
potential = MLPotential('ani2x')
ml_system = potential.createMixedSystem(topology, mm_system, ml_atoms)