OpenMM – easy to learn, highly flexible molecular dynamics in Python

When I came to OPIG this past March I realized I had a novel opportunity – there was no one to tell me which molecular dynamics (MD) program I had to use! Usually, researchers do not have much choice in the matter due to a number of practical concerns. Conflicts between input and output file formats, forces, velocities, and basically everything else between MD suites make having multiple programs flying around tenuous at best if you want group members to be able to help one another. After weighing my options, I settled on OpenMM – and so far I am very happy with the decision.

OpenMM was created by the Pande and Chodera labs with funding and support from the United States National Institutes of Health. It is open source and can be readily added to an existing Python3 installation and then loaded like any other module. OpenMM does not have its own energy function like CHARMM, AMBER, and many other MD suites. Instead, it serves as a platform for simulation in all of the common forcefields, and makes switching between them as simple as changing a function argument. Even better, OpenMM can read and write most file formats from the major molecular dynamics programs by default. So, for example, if you are currently using CHARMM you can keep your same carefully equilibrated and solvated structures and jump right into OpenMM – and even use the same forcefield while taking advantage of many quality of life improvements provided by OpenMM.

Perhaps the most useful and novel aspect of OpenMM is the ability to create custom forcefield terms in your script by typing them in as a string. Adding new forcefield terms to MD programs typically requires weeks or months and many emails back and forth with the original authors of the source code. With OpenMM, however, it takes a few minutes to create a new forcefield term that can be run in parallel or on GPUs with no additional effort on your part. These terms can be added to existing forcefields (e.g., add a custom non-bonded term representing native contacts to the AMBER all-atom forcefield) or used to build a completely new forcefield from scratch.

The flexibility of OpenMM makes it particularly useful when designing a coarse-grain model. Coarse graining typically feels like tricking an all-atom simulation program to ignore the terrible things you are doing to it. With OpenMM, the ability to create custom residue definitions and forcefield terms is simplified by the straightforward forcefield file format. And when things do inevitably go wrong, you get easily understood error messages that you can trace back to the beautifully written and comment-filled Python3 source code. This is, in my experience, much preferable to error messages which simply point you in the general direction of a 20,000-line DYNAMICS.f77 file.

Most MD suites have a steep learning curve and, due to their complex and non-interchangeable terminology and commands, often feel like learning new programming languages in their own right. OpenMM feels like doing MD with Python. This above all else is the main selling point, and if you can download a PDB file, install Python, and read the online tutorial, you can run molecular simulations in a few hours thanks to OpenMM.

Author