"examples/hello/HelloEthane.cpp" did not exist on "9c8db8bfbb8c265a949fae890a496d88d0f9b345"
Commit 9a1b72ff authored by Peter Eastman's avatar Peter Eastman
Browse files

When creating a System, add a CMMotionRemover by default

parent 2586776f
......@@ -9,6 +9,7 @@ from simtk.openmm.app.internal import amber_file_parser
import forcefield as ff
import element as elem
import simtk.unit as unit
import simtk.openmm as mm
# Enumerated values for implicit solvent model
......@@ -63,7 +64,7 @@ class AmberPrmtopFile(object):
top.addBond(bond[0], bond[1])
def createSystem(self, nonbondedMethod=ff.NoCutoff, nonbondedCutoff=1.0*unit.nanometer,
constraints=None, rigidWater=True, implicitSolvent=None):
constraints=None, rigidWater=True, implicitSolvent=None, removeCMMotion=True):
"""Construct an OpenMM System representing the topology described by this prmtop file.
Parameters:
......@@ -74,6 +75,7 @@ class AmberPrmtopFile(object):
Allowed values are None, HBonds, AllBonds, or HAngles.
- rigidWater (boolean=True) If true, water molecules will be fully rigid regardless of the value passed for the constraints argument
- implicitSolvent (object=None) If not None, the implicit solvent model to use
- removeCMMotion (boolean=True) If true, a CMMotionRemover will be added to the System
Returns: the newly created System
"""
methodMap = {ff.NoCutoff:'NoCutoff',
......@@ -103,5 +105,8 @@ class AmberPrmtopFile(object):
implicitString = 'OBC'
else:
raise ValueError('Illegal value for implicit solvent model')
return amber_file_parser.readAmberSystem(prmtop_loader=self.prmtop, shake=constraintString, nonbondedCutoff=nonbondedCutoff,
sys = amber_file_parser.readAmberSystem(prmtop_loader=self.prmtop, shake=constraintString, nonbondedCutoff=nonbondedCutoff,
nonbondedMethod=methodMap[nonbondedMethod], flexibleConstraints=False, gbmodel=implicitString)
if removeCMMotion:
sys.addForce(mm.CMMotionRemover())
return sys
\ No newline at end of file
......@@ -177,7 +177,7 @@ class ForceField(object):
self.length = 0.0
def createSystem(self, topology, nonbondedMethod=NoCutoff, nonbondedCutoff=1.0*unit.nanometer,
constraints=None, rigidWater=True, **args):
constraints=None, rigidWater=True, removeCMMotion=True, **args):
"""Construct an OpenMM System representing a Topology with this force field.
Parameters:
......@@ -188,6 +188,7 @@ class ForceField(object):
- constraints (object=None) Specifies which bonds angles should be implemented with constraints.
Allowed values are None, HBonds, AllBonds, or HAngles.
- rigidWater (boolean=True) If true, water molecules will be fully rigid regardless of the value passed for the constraints argument
- removeCMMotion (boolean=True) If true, a CMMotionRemover will be added to the System
- Arbitrary additional keyword arguments may also be specified. This allows extra parameters to be specified that are specific to
particular force fields.
Returns: the newly created System
......@@ -341,6 +342,8 @@ class ForceField(object):
for force in self._forces:
force.createForce(sys, data, nonbondedMethod, nonbondedCutoff, args)
if removeCMMotion:
sys.addForce(mm.CMMotionRemover())
return sys
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment