"libraries/asmjit/vscode:/vscode.git/clone" did not exist on "0e0558b9f67c0faf865b9f02ac3eff84322d9c57"
Commit 11877204 authored by Jason Swails's avatar Jason Swails
Browse files

Fix a bug in which the switching function would not get toggled if requested via

the switchDistance argument to CharmmPsfFile.createSystem().

Also add a check to protect against negative switching distances.
parent f5cbd31e
......@@ -1185,6 +1185,9 @@ class CharmmPsfFile(object):
if switchDistance >= nonbondedCutoff:
raise ValueError('switchDistance is too large compared '
'to the cutoff!')
if abs(switchDistance) != switchDistance:
# Detects negatives for both Quantity and float
raise ValueError('switchDistance must be non-negative!')
force.setUseSwitchingFunction(True)
force.setSwitchingDistance(switchDistance)
......@@ -1226,6 +1229,9 @@ class CharmmPsfFile(object):
if switchDistance >= nonbondedCutoff:
raise ValueError('switchDistance is too large compared '
'to the cutoff!')
if abs(switchDistance) != switchDistance:
# Detects negatives for both Quantity and float
raise ValueError('switchDistance must be non-negative!')
force.setUseSwitchingFunction(True)
force.setSwitchingDistance(switchDistance)
......
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