Skip to content

Commit

Permalink
Added removeCMMotion argument to createSystem (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
JMorado authored May 11, 2024
1 parent 61b08a8 commit 185b444
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions openmmml/mlpotential.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,16 @@ def __init__(self, name: str, **args):
potential functions for more information.
"""
self._impl = MLPotential._implFactories[name].createImpl(name, **args)
def createSystem(self, topology: openmm.app.Topology, **args) -> openmm.System:

def createSystem(self, topology: openmm.app.Topology, removeCMMotion: bool = True, **args) -> openmm.System:
"""Create a System for running a simulation with this potential function.
Parameters
----------
topology: Topology
the Topology for which to create a System
removeCMMotion: bool
if true, a CMMotionRemover will be added to the System.
args:
particular potential functions may define additional arguments that can
be used to customize them. See the documentation on the specific
Expand All @@ -185,6 +187,8 @@ def createSystem(self, topology: openmm.app.Topology, **args) -> openmm.System:
else:
system.addParticle(atom.element.mass)
self._impl.addForces(topology, system, None, 0, **args)
if removeCMMotion:
system.addForce(openmm.CMMotionRemover())
return system

def createMixedSystem(self,
Expand Down

0 comments on commit 185b444

Please sign in to comment.