Unverified Commit 4700c52f authored by Matt Thompson's avatar Matt Thompson Committed by GitHub
Browse files

Fix possible bug in `AmberPrmTopFile.createSystem()` (#3489)

* Only call set switching function/distance on nonbonded force(s)

* Also catch CustomNonbondedForce

* Fix logic around setEwaldErrorTolerance
parent a5e42f57
......@@ -290,9 +290,7 @@ class AmberPrmtopFile(object):
for force in sys.getForces():
if isinstance(force, mm.NonbondedForce):
force.setEwaldErrorTolerance(ewaldErrorTolerance)
if removeCMMotion:
sys.addForce(mm.CMMotionRemover())
if isinstance(force, (mm.NonbondedForce, mm.CustomNonbondedForce)):
if switchDistance and nonbondedMethod is not ff.NoCutoff:
# make sure it's legal
if (_strip_optunit(switchDistance, u.nanometer) >=
......@@ -305,4 +303,7 @@ class AmberPrmtopFile(object):
force.setUseSwitchingFunction(True)
force.setSwitchingDistance(switchDistance)
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