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
4e4db1f1
Commit
4e4db1f1
authored
May 04, 2014
by
John Chodera (MSKCC)
Browse files
Added AMOEBA test system and tests for ForceField fin setting up AMOEBA system.
parent
aac359dc
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
721 additions
and
1 deletion
+721
-1
wrappers/python/tests/TestForceField.py
wrappers/python/tests/TestForceField.py
+69
-1
wrappers/python/tests/systems/amoeba-ion-in-water.pdb
wrappers/python/tests/systems/amoeba-ion-in-water.pdb
+652
-0
No files found.
wrappers/python/tests/TestForceField.py
View file @
4e4db1f1
...
...
@@ -18,7 +18,8 @@ class TestForceField(unittest.TestCase):
self
.
forcefield1
=
ForceField
(
'amber99sb.xml'
,
'tip3p.xml'
)
self
.
topology1
=
self
.
pdb1
.
topology
self
.
topology1
.
setUnitCellDimensions
(
Vec3
(
2
,
2
,
2
))
# alalnine dipeptide with implicit water
self
.
pdb2
=
PDBFile
(
'systems/alanine-dipeptide-implicit.pdb'
)
self
.
forcefield2
=
ForceField
(
'amber99sb.xml'
,
'amber99_obc.xml'
)
...
...
@@ -38,6 +39,18 @@ class TestForceField(unittest.TestCase):
f
.
getNonbondedMethod
()
==
methodMap
[
method
]
for
f
in
forces
))
def
test_DispersionCorrection
(
self
):
"""Test to make sure the nonbondedCutoff parameter is passed correctly."""
for
useDispersionCorrection
in
[
True
,
False
]:
system
=
self
.
forcefield1
.
createSystem
(
self
.
pdb1
.
topology
,
nonbondedCutoff
=
2
*
nanometer
,
useDispersionCorrection
=
useDispersionCorrection
)
for
force
in
system
.
getForces
():
if
isinstance
(
force
,
NonbondedForce
):
self
.
assertEqual
(
useDispersionCorrection
,
force
.
getUseDispersionCorrection
())
def
test_Cutoff
(
self
):
"""Test to make sure the nonbondedCutoff parameter is passed correctly."""
...
...
@@ -120,6 +133,61 @@ class TestForceField(unittest.TestCase):
totalMass2
=
sum
([
system2
.
getParticleMass
(
i
)
for
i
in
range
(
system2
.
getNumParticles
())]).
value_in_unit
(
amu
)
self
.
assertAlmostEqual
(
totalMass1
,
totalMass2
)
class
AmoebaTestForceField
(
unittest
.
TestCase
):
"""Test the ForceField.createSystem() method with the AMOEBA forcefield."""
def
setUp
(
self
):
"""Set up the tests by loading the input pdb files and force field
xml files.
"""
self
.
pdb1
=
PDBFile
(
'systems/amoeba-ion-in-water.pdb'
)
self
.
forcefield1
=
ForceField
(
'amoeba2009.xml'
)
self
.
topology1
=
self
.
pdb1
.
topology
def
test_NonbondedMethod
(
self
):
"""Test all five options for the nonbondedMethod parameter."""
methodMap
=
{
NoCutoff
:
mm
.
AmoebaMultipoleForce
.
NoCutoff
,
PME
:
mm
.
AmoebaMultipoleForce
.
PME
}
for
method
in
methodMap
:
system
=
self
.
forcefield1
.
createSystem
(
self
.
pdb1
.
topology
,
nonbondedMethod
=
method
)
forces
=
system
.
getForces
()
self
.
assertTrue
(
any
(
isinstance
(
f
,
AmoebaMultipoleForce
)
and
f
.
getNonbondedMethod
()
==
methodMap
[
method
]
for
f
in
forces
))
def
test_Cutoff
(
self
):
"""Test to make sure the nonbondedCutoff parameter is passed correctly."""
for
method
in
[
NoCutoff
,
PME
]:
system
=
self
.
forcefield1
.
createSystem
(
self
.
pdb1
.
topology
,
nonbondedMethod
=
method
,
nonbondedCutoff
=
7
*
angstroms
,
constraints
=
None
)
cutoff_distance
=
0.0
*
nanometer
cutoff_check
=
0.7
*
nanometer
for
force
in
system
.
getForces
():
if
isinstance
(
force
,
AmoebaNonbondedForce
)
or
isinstance
(
force
,
AmoebaMultipoleForce
):
cutoff_distance
=
force
.
getCutoffDistance
()
self
.
assertEqual
(
cutoff_distance
,
cutoff_check
)
def
test_DispersionCorrection
(
self
):
"""Test to make sure the nonbondedCutoff parameter is passed correctly."""
for
useDispersionCorrection
in
[
True
,
False
]:
system
=
self
.
forcefield1
.
createSystem
(
self
.
pdb1
.
topology
,
nonbondedCutoff
=
7
*
angstroms
,
useDispersionCorrection
=
useDispersionCorrection
)
for
force
in
system
.
getForces
():
if
isinstance
(
force
,
AmoebaNonbondedForce
):
self
.
assertEqual
(
useDispersionCorrection
,
force
.
getUseDispersionCorrection
())
if
__name__
==
'__main__'
:
unittest
.
main
()
...
...
wrappers/python/tests/systems/amoeba-ion-in-water.pdb
0 → 100644
View file @
4e4db1f1
This diff is collapsed.
Click to expand it.
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