Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tsoc
openmm
Commits
56f9f6f6
Commit
56f9f6f6
authored
Jul 14, 2014
by
peastman
Browse files
Merge pull request #530 from swails/longrange
Update default long-range option and expand test
parents
fcba92a6
2a3658d6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
2 deletions
+34
-2
wrappers/python/simtk/openmm/app/internal/amber_file_parser.py
...ers/python/simtk/openmm/app/internal/amber_file_parser.py
+1
-0
wrappers/python/tests/TestAmberPrmtopFile.py
wrappers/python/tests/TestAmberPrmtopFile.py
+33
-2
No files found.
wrappers/python/simtk/openmm/app/internal/amber_file_parser.py
View file @
56f9f6f6
...
...
@@ -889,6 +889,7 @@ def readAmberSystem(prmtop_filename=None, prmtop_loader=None, shake=None, gbmode
if
nonbondedMethod
in
(
'PME'
,
'Ewald'
,
'CutoffPeriodic'
):
cforce
.
setNonbondedMethod
(
cforce
.
CutoffPeriodic
)
cforce
.
setCutoffDistance
(
nonbondedCutoff
)
cforce
.
setUseLongRangeCorrection
(
True
)
elif
nonbondedMethod
==
'CutoffNonPeriodic'
:
cforce
.
setNonbondedMethod
(
cforce
.
CutoffNonPeriodic
)
cforce
.
setCutoffDistance
(
nonbondedCutoff
)
...
...
wrappers/python/tests/TestAmberPrmtopFile.py
View file @
56f9f6f6
...
...
@@ -145,8 +145,38 @@ class TestAmberPrmtopFile(unittest.TestCase):
totalMass2
=
sum
([
system2
.
getParticleMass
(
i
)
for
i
in
range
(
system2
.
getNumParticles
())]).
value_in_unit
(
amu
)
self
.
assertAlmostEqual
(
totalMass1
,
totalMass2
)
def
test_NBFIX
(
self
):
"""Test that prmtop files with modified off-diagonal LJ elements are treated properly"""
# def test_NBFIX_LongRange(self):
# """Test prmtop files with NBFIX LJ modifications w/ long-range correction"""
# system = prmtop3.createSystem(nonbondedMethod=PME,
# nonbondedCutoff=8*angstroms)
# # Check the forces
# has_nonbond_force = has_custom_nonbond_force = False
# nonbond_exceptions = custom_nonbond_exclusions = 0
# for force in system.getForces():
# if isinstance(force, NonbondedForce):
# has_nonbond_force = True
# nonbond_exceptions = force.getNumExceptions()
# elif isinstance(force, CustomNonbondedForce):
# has_custom_nonbond_force = True
# custom_nonbond_exceptions = force.getNumExclusions()
# self.assertTrue(has_nonbond_force)
# self.assertTrue(has_custom_nonbond_force)
# self.assertEqual(nonbond_exceptions, custom_nonbond_exceptions)
# integrator = VerletIntegrator(1.0*femtoseconds)
# # Use reference platform, since it should always be present and
# # 'working', and the system is plenty small so this won't be too slow
# sim = Simulation(prmtop3.topology, system, integrator, Platform.getPlatformByName('Reference'))
# # Check that the energy is about what we expect it to be
# sim.context.setPeriodicBoxVectors(*inpcrd3.boxVectors)
# sim.context.setPositions(inpcrd3.positions)
# ene = sim.context.getState(getEnergy=True, enforcePeriodicBox=True).getPotentialEnergy()
# ene = ene.value_in_unit(kilocalories_per_mole)
# # Make sure the energy is relatively close to the value we get with
# # Amber using this force field.
# self.assertAlmostEqual(-7099.44989739/ene, 1, places=3)
def
test_NBFIX_noLongRange
(
self
):
"""Test prmtop files with NBFIX LJ modifications w/out long-range correction"""
system
=
prmtop3
.
createSystem
(
nonbondedMethod
=
PME
,
nonbondedCutoff
=
8
*
angstroms
)
# Check the forces
...
...
@@ -159,6 +189,7 @@ class TestAmberPrmtopFile(unittest.TestCase):
elif
isinstance
(
force
,
CustomNonbondedForce
):
has_custom_nonbond_force
=
True
custom_nonbond_exceptions
=
force
.
getNumExclusions
()
force
.
setUseLongRangeCorrection
(
False
)
self
.
assertTrue
(
has_nonbond_force
)
self
.
assertTrue
(
has_custom_nonbond_force
)
self
.
assertEqual
(
nonbond_exceptions
,
custom_nonbond_exceptions
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment