OpenMM 8: Molecular Dynamics Simulation with Machine Learning Potentials

Peter K. Eastman, Raimondas Galvelis, Raúl P. Peláez, Charlles R. A. Abreu, Stephen E. Farr, Emilio Gallicchio, Anton Gorenko, Michael M. Henry, Frank Hu, Jing Huang, Andreas Krämer, Julien Michel, Joshua A. Mitchell, Vijay S. Pande, João P. G. L. M. Rodrigues, Jaime Rodríguez-Guerra, Andrew C. Simmonett, Jason M. Swails, Ivy Zhang, John D. Chodera, Gianni De Fabritiis, Thomas E. MarklandThe Journal of Physical Chemistry B 2023

TL;DR

OpenMM 8, a leading molecular dynamics toolkit, now seamlessly integrates arbitrary PyTorch machine learning models for calculating forces and energies. This release significantly lowers the barrier to entry for using ML potentials in simulations, enabling researchers to achieve higher accuracy at a manageable computational cost.

What Problem Does This Paper Address?

Molecular dynamics (MD) simulations are crucial for understanding molecular behavior, but their accuracy is often limited by classical force fields. High-accuracy quantum chemistry (QC) methods are computationally prohibitive for large systems. Machine learning potentials (MLPs) offer a promising intermediate, bridging the gap by learning complex interactions from QC data, thus achieving near-QC accuracy at a fraction of the cost. However, integrating these MLPs into existing MD workflows has been challenging, hindering their widespread adoption for complex systems and production simulations. This paper addresses this by introducing robust MLP support into OpenMM, making it as straightforward to use ML potentials as traditional force fields.

Methods

The core of OpenMM 8's MLP integration lies in two new modules:

  • OpenMM-Torch: This module allows users to embed arbitrary PyTorch models directly into OpenMM simulations. These models take atomic positions as input and compute potential energy and forces (either explicitly or via backpropagation). The models must be compilable to TorchScript for efficient execution. This provides a flexible environment for researchers developing new MLPs.
  • OpenMM-ML: This module offers a higher-level interface for using pre-trained, general-purpose MLPs. Users can easily create systems using established potentials like ANI-1ccx and ANI-2x. Crucially, it also supports hybrid ML/MM simulations, where specific parts of a system are modeled with ML while the rest uses classical force fields, with automatic handling of interactions between regions.

To accelerate these MLPs, OpenMM 8 introduces NNPOps, a module containing optimized CUDA kernels and custom PyTorch operations for bottleneck computations common in MLPs, such as symmetry functions and electrostatic interactions.

Datasets

  • SPICE (Small-Molecule/Protein Interaction Chemical Energies) dataset: This dataset, newly created by the authors, comprises a large collection of molecular forces and energies for drug-like small molecules interacting with proteins. It includes 15 elements, charged and neutral molecules, various conformations, and diverse interactions, aiming to facilitate the development of new pretrained MLPs.
  • Training data for GFP chromophore MLP: This was generated from ab initio molecular dynamics (AIMD) and ab initio path integral molecular dynamics (AI-PIMD) trajectories of the anionic GFP chromophore in water. Forces were evaluated using DFT with specific functionals and dispersion corrections.

Key Insights and Ideas

  • Democratizing ML potentials: OpenMM 8's integration makes MLPs accessible to a broader user base, moving them from specialized research tools to practical components of molecular simulations.
  • Bridging the accuracy-cost gap: MLPs, especially when optimized, offer a compelling trade-off, providing significantly higher accuracy than classical force fields at a manageable cost increase, making them suitable for complex systems.
  • Hybrid ML/MM simulations are key: The ability to combine ML potentials with classical force fields is crucial for simulating large systems efficiently while retaining accuracy in critical regions.
  • Optimization is critical for practicality: The NNPOps module demonstrates that significant speedups are achievable for MLPs, making them competitive with classical methods for certain applications.
  • The future is flexible: OpenMM's architecture allows for the easy integration of new ML models and force fields, fostering community-driven development.

Key Results

  • Speedup with NNPOps: The NNPOps module accelerated the ANI-2x potential by a factor of 5.7 compared to the standard TorchANI implementation. Using a single ANI-2x model instead of the full ensemble provided an additional 1.9x speedup.
  • MLP vs. Classical Simulation Cost: Simulating a 53-atom inhibitor bound to CDK8 with ANI-2x (ensemble) was 2.7 times slower than a fully classical simulation using OpenFF 2.0.0 with the same timestep. This cost is considered reasonable given the potential for improved accuracy.
  • GFP Chromophore Simulation: An MLP trained for the anionic GFP chromophore in water showed excellent agreement with AIMD trajectories for oxygen-oxygen radial distribution functions and dihedral angle distributions.
  • AIMD vs. MLP Timings: For the GFP chromophore system, AIMD force calculations took 13.2 seconds on multi-core CPUs, while the MLP evaluated forces in 8.7 ms on a GPU, a speedup of 1517 times.

Limitations and Future Work

  • Immature MLP field: The authors note that MLPs are still an immature field with a limited number of pretrained, general-purpose potentials. Those that exist have restricted applicability (e.g., limited elements, no charged molecules for ANI-1ccx/ANI-2x).
  • Need for more potentials: The authors intend to expand the list of supported MLPs as new ones are developed.
  • Hybrid ML/MM improvements: Future work on hybrid ML/MM simulations could include electrostatic embedding for more accurate interactions between ML and MM regions, which would require ML models capable of predicting atomic partial charges.
  • Community effort: Developing a diverse range of potentials with varying tradeoffs between speed, accuracy, and applicability is seen as an important community project.

Summary updated

BibTeX
@misc{eastman2023openmm,
  author = {Peter K. Eastman and Raimondas Galvelis and Raúl P. Peláez and Charlles R. A. Abreu and Stephen E. Farr and Emilio Gallicchio and Anton Gorenko and Michael M. Henry and Frank Hu and Jing Huang and Andreas Krämer and Julien Michel and Joshua A. Mitchell and Vijay S. Pande and João P. G. L. M. Rodrigues and Jaime Rodríguez-Guerra and Andrew C. Simmonett and Jason M. Swails and Ivy Zhang and John D. Chodera and Gianni De Fabritiis and Thomas E. Markland},
  title = {{OpenMM 8: Molecular Dynamics Simulation with Machine Learning Potentials}},
  year = {2023},
  eprint = {2310.03121},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2310.03121},
}
Figure