mm - The mm Module


The module provides a wrapper around the OpenMM molecular mechanics library to provide basic molecular dynamics (MD) capabilities fully embedded into the OpenStructure universe. The heart of every simulation is the Topology describing how the particles of an EntityHandle interact. The Simulation class connects the EntityHandle with a Topology and allows you to perform energy minimizations or move the simulation through time using an Integrator. A Topology can either be built from scratch by adding one interaction after the other or automatically using the TopologyCreator. The process of Topology building and setting up a Simulation gets controlled with the Settings.

Latest Publication of OpenMM: P. Eastman, J. Swails, J. D. Chodera, R. T. McGibbon, Y. Zhao, K. A. Beauchamp, L.-P. Wang, A. C. Simmonett, M. P. Harrigan, C. D. Stern, R. P. Wiewiora, B. R. Brooks, and V. S. Pande. “OpenMM 7: Rapid development of high performance algorithms for molecular dynamics.” PLOS Comp. Biol. 13(7): e1005659. (2017)


If you are compiling OpenStructure from source, you need to specifically enable support for OpenMM. You do this by enabling the ENABLE_MM flag and setting the OPEN_MM_INCLUDE_DIR, OPEN_MM_LIBRARY and OPEN_MM_PLUGIN_DIR flags when calling cmake. See here for details and examples.

Setting up a simple simulation

from ost.mol import mm


#set up the simulation
settings = mm.Settings()
settings.integrator = mm.LangevinIntegrator(310,1,0.002)
settings.forcefield = mm.LoadCHARMMForcefield()
sim = mm.Simulation(prot,settings)

#minimize it
sim.ApplySD(tolerance = 1.0, max_iterations = 200)

#create a trajectory observer and register it to the simulation
#every 10 steps, the actual positions will be written down to disk
observer = mm.TrajWriter(10,"example_traj.pdb","example_traj.dcd")

#run the simulation

#Trajectory Observer needs to finalize, otherwise you might get a corrupt dcd file

Doing more sophisticated stuff

You want to create your own BuildingBlock to parameterize custom residues? Or even generate your own custom Forcefield? Check out the mm dir in the examples/code_fragments directory.



Enter search terms or a module, class or function name.


Documentation is available for the following OpenStructure versions:

(Currently viewing dev) / 2.8 / 2.7 / 2.6 / 2.5 / 2.4 / 2.3.1 / 2.3 / 2.2 / 2.1 / 2.0 / 1.9 / 1.8 / 1.7.1 / 1.7 / 1.6 / 1.5 / 1.4 / 1.3 / 1.2 / 1.11 / 1.10 / 1.1

This documentation is still under heavy development!
If something is missing or if you need the C++ API description in doxygen style, check our old documentation for further information.