The mm Module¶
Introduction¶
The mol.mm 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)
Installation¶
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 prot=io.LoadPDB('1crn',remote=True) #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") sim.Register(observer) #run the simulation sim.Steps(10000) #Trajectory Observer needs to finalize, otherwise you might get a corrupt dcd file observer.Finalize()
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.
Documentation¶
- Interactions
- The FuncType enum
- Interaction Parametrization
- The Interaction Class
Interaction
Interaction.SetTypes()
Interaction.SetNames()
Interaction.SetParam()
Interaction.GetTypes()
Interaction.GetNames()
Interaction.GetParam()
Interaction.GetAtoms()
Interaction.GetFuncType()
Interaction.ReplaceAtom()
Interaction.MatchTypes()
Interaction.MatchNames()
Interaction.HasName()
Interaction.HasType()
Interaction.IsParametrized()
Interaction.HasTypeWildcard()
Interaction.HasNameWildcard()
- Blocks
- The BuildingBlock Class
BuildingBlock
BuildingBlock.Match()
BuildingBlock.Connect()
BuildingBlock.AddAtom()
BuildingBlock.RemoveAtom()
BuildingBlock.ReplaceAtom()
BuildingBlock.RemoveInteractionsToPrev()
BuildingBlock.RemoveInteractionsToNext()
BuildingBlock.AddBond()
BuildingBlock.AddAngle()
BuildingBlock.AddDihedral()
BuildingBlock.AddImproper()
BuildingBlock.AddExclusion()
BuildingBlock.AddCMap()
BuildingBlock.AddConstraint()
BuildingBlock.GetType()
BuildingBlock.GetCharge()
BuildingBlock.GetMass()
BuildingBlock.GetAtoms()
BuildingBlock.GetTypes()
BuildingBlock.GetCharges()
BuildingBlock.GetMasses()
BuildingBlock.GetBonds()
BuildingBlock.GetAngles()
BuildingBlock.GetDihedrals()
BuildingBlock.GetImpropers()
BuildingBlock.GetCMaps()
BuildingBlock.GetExclusions()
BuildingBlock.GetConstraints()
- Block Modifiers
BlockModifier
GromacsBlockModifier
GromacsBlockModifier.ApplyOnBuildingBlock()
GromacsBlockModifier.ApplyOnResidue()
GromacsBlockModifier.AddReplaceRule()
GromacsBlockModifier.AddAddRule()
GromacsBlockModifier.AddDeleteAtom()
GromacsBlockModifier.AddBond()
GromacsBlockModifier.AddAngle()
GromacsBlockModifier.AddDihedral()
GromacsBlockModifier.AddImproper()
GromacsBlockModifier.AddCMap()
- Hydrogen Constructors
- The BuildingBlock Class
- Forcefields
- Loading the standard forcefields provided by OpenStructure
- Reading forcefields
- Generating forcefields with Antechamber
- The Forcefield Class
Forcefield
Forcefield.Save()
Forcefield.Load()
Forcefield.AddBond()
Forcefield.AddAngle()
Forcefield.AddDihedral()
Forcefield.AddImproper()
Forcefield.AddCMap()
Forcefield.AddImplicitGenborn()
Forcefield.AddLJ()
Forcefield.AddLJPair()
Forcefield.AddConstraint()
Forcefield.AddMass()
Forcefield.SetFudgeLJ()
Forcefield.SetFudgeQQ()
Forcefield.SetGenPairs()
Forcefield.AddResidueRenamingRule()
Forcefield.AddAtomRenamingRule()
Forcefield.AddBuildingBlock()
Forcefield.AddHydrogenConstructor()
Forcefield.AddBlockModifier()
Forcefield.SetStandardCTer()
Forcefield.SetStandardNTer()
Forcefield.AssignFFSpecificNames()
Forcefield.GetBond()
Forcefield.GetAngle()
Forcefield.GetDihedrals()
Forcefield.GetImpropers()
Forcefield.GetCMap()
Forcefield.GetImplicitGenborn()
Forcefield.GetLJ()
Forcefield.GetLJ()
Forcefield.GetConstraint()
Forcefield.GetMass()
Forcefield.GetFudgeLJ()
Forcefield.GetFudgeQQ()
Forcefield.GetAtomType()
Forcefield.GetHydrogenConstructor()
Forcefield.GetBuildingBlock()
Forcefield.GetBuildingBlockNames()
Forcefield.GetBlockModifier()
Forcefield.GetNTerModifier()
Forcefield.GetCTerModifier()
- The Molecular Mechanics Settings
Settings
Settings.add_bonds
Settings.add_angles
Settings.add_dihedrals
Settings.add_impropers
Settings.add_cmaps
Settings.add_exclusions
Settings.add_nonbonded
Settings.add_gbsa
Settings.constrain_hbonds
Settings.constrain_bonds
Settings.rigid_water
Settings.strict_interactions
Settings.ideal_bond_length_constraints
Settings.fix_heavy_atoms
Settings.kill_electrostatics
Settings.generate_disulfid_bonds
Settings.nonbonded_method
Settings.nonbonded_cutoff
Settings.remove_cmm_motion
Settings.cmm_frequency
Settings.periodic_box_extent
Settings.init_temperature
Settings.forcefield
Settings.termini_exceptions
Settings.platform
Settings.reference_properties
Settings.cpu_properties
Settings.opencl_properties
Settings.cuda_properties
Settings.add_thermostat
Settings.thermostat_temperature
Settings.thermostat_collision_frequency
Settings.add_barostat
Settings.barostat_temperature
Settings.barostat_pressure
Settings.barostat_frequency
Settings.integrator
Settings.solvent_dielectric
Settings.solute_dielectric
Settings.reaction_field_dielecric
Settings.use_dispersion_correction
Settings.keep_ff_specific_naming
Settings.openmm_plugin_directory
Settings.custom_plugin_directory
TerminiExceptions
- Topology
- Automatically create topologies
- The Topology Class
Topology
Topology.Save()
Topology.Load()
Topology.Merge()
Topology.Merge()
Topology.AddHarmonicBond()
Topology.AddHarmonicAngle()
Topology.AddUreyBradleyAngle()
Topology.AddPeriodicDihedral()
Topology.AddPeriodicImproper()
Topology.AddHarmonicImproper()
Topology.AddCMap()
Topology.AddLJPair()
Topology.AddDistanceConstraint()
Topology.AddExclusion()
Topology.AddPositionConstraint()
Topology.AddHarmonicPositionRestraint()
Topology.AddHarmonicDistanceRestraint()
Topology.ResetPositionConstraints()
Topology.ResetExclusions()
Topology.SetSigmas()
Topology.SetSigma()
Topology.SetEpsilons()
Topology.SetEpsilon()
Topology.SetGBSARadii()
Topology.SetGBSARadius()
Topology.SetOBCScalings()
Topology.SetOBCScaling()
Topology.SetCharges()
Topology.SetCharge()
Topology.SetMasses()
Topology.SetMass()
Topology.SetFudgeQQ()
Topology.SetFudgeLJ()
Topology.GetHarmonicBondParameters()
Topology.GetHarmonicAngleParameters()
Topology.GetUreyBradleyAngleParameters()
Topology.GetPeriodicDiheralParameters()
Topology.GetPeriodicImproperParameters()
Topology.GetHarmonicImproperParameters()
Topology.GetCMapParameters()
Topology.GetLJPairParameters()
Topology.GetDistanceConstraintParameters()
Topology.GetHarmonicPositionRestraintParameters()
Topology.GetHarmonicDistanceRestraintParameters()
Topology.SetHarmonicBondParameters()
Topology.SetHarmonicAngleParameters()
Topology.SetPeriodicDiheralParameters()
Topology.SetPeriodicImproperParameters()
Topology.SetHarmonicImproperParameters()
Topology.SetCMapParameters()
Topology.SetLJPairParameters()
Topology.SetDistanceConstraintParameters()
Topology.SetHarmonicPositionRestraintParameters()
Topology.SetHarmonicDistanceRestraintParameters()
Topology.GetSigmas()
Topology.GetEpsilons()
Topology.GetGBSARadii()
Topology.GetOBCScalings()
Topology.GetCharges()
Topology.GetMasses()
Topology.GetSigma()
Topology.GetEpsilon()
Topology.GetGBSARadius()
Topology.GetOBCScaling()
Topology.GetCharge()
Topology.GetMass()
Topology.GetHarmonicBondIndices()
Topology.GetHarmonicAngleIndices()
Topology.GetUreyBradleyAngleIndices()
Topology.GetPeriodicDihedralIndices()
Topology.GetPeriodicImpropersIndices()
Topology.GetHarmonicImpropersIndices()
Topology.GetCMapIndices()
Topology.GetLJPairIndex()
Topology.GetDistanceConstraintIndex()
Topology.GetHarmonicBondIndices()
Topology.GetHarmonicAngleIndices()
Topology.GetUreyBradleyAngleIndices()
Topology.GetPeriodicDihedralIndices()
Topology.GetPeriodicImproperIndices()
Topology.GetHarmonicImproperIndices()
Topology.GetCMapIndices()
Topology.GetLJPairIndices()
Topology.GetDistanceConstraintIndices()
Topology.GetHarmonicPositionRestraintIndices()
Topology.GetHarmonicDistanceRestraintIndices()
Topology.GetNumParticles()
Topology.GetNumHarmonicBonds()
Topology.GetNumHarmonicAngles()
Topology.GetNumUreyBradleyAngles()
Topology.GetNumPeriodicDihedrals()
Topology.GetNumPeriodicImpropers()
Topology.GetNumHarmonicImpropers()
Topology.GetNumCMaps()
Topology.GetNumLJPairs()
Topology.GetNumDistanceConstraints()
Topology.GetNumPositionConstraints()
Topology.GetNumHarmonicPositionRestraints()
Topology.GetNumHarmonicDistanceRestraints()
Topology.GetNumExclusions()
- Observers
- Integrators
Integrator
- Verlet Dynamics
- Langevin Dynamics
LangevinIntegrator
VariableLangevinIntegrator
VariableLangevinIntegrator.GetTemperature()
VariableLangevinIntegrator.SetTemperature()
VariableLangevinIntegrator.GetFriction()
VariableLangevinIntegrator.SetFriction()
VariableLangevinIntegrator.GetRandomNumberSeed()
VariableLangevinIntegrator.SetRandomNumberSeed()
VariableLangevinIntegrator.GetErrorTolerance()
VariableLangevinIntegrator.SetErrorTolerance()
- Brownian Dynamics
- Simulation
Simulation
Simulation
Simulation.Save()
Simulation.Load()
Simulation.IsPlatformAvailable()
Simulation.ApplyLBFGS()
Simulation.ApplySD()
Simulation.Steps()
Simulation.GetPositions()
Simulation.SetPositions()
Simulation.UpdatePositions()
Simulation.GetVelocities()
Simulation.GetForces()
Simulation.SetVelocities()
Simulation.GetEntity()
Simulation.GetEnergy()
Simulation.GetPotentialEnergy()
Simulation.GetKineticEnergy()
Simulation.GetTopology()
Simulation.GetPeriodicBoxExtents()
Simulation.SetPeriodicBoxExtents()
Simulation.Register()
Simulation.AddPositionConstraint()
Simulation.AddPositionConstraints()
Simulation.ResetPositionConstraints()
Simulation.ResetHarmonicBond()
Simulation.ResetHarmonicAngle()
Simulation.ResetUreyBradleyAngle()
Simulation.ResetPeriodicDihedral()
Simulation.ResetPeriodicImproper()
Simulation.ResetHarmonicImproper()
Simulation.ResetLJPair()
Simulation.ResetDistanceConstraint()
Simulation.ResetHarmonicPositionRestraint()
Simulation.ResetHarmonicDistanceRestraint()
Simulation.ResetLJ()
Simulation.ResetGBSA()
Simulation.ResetCharge()
Simulation.ResetMass()