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
1c604fe4
Commit
1c604fe4
authored
Jul 02, 2014
by
peastman
Browse files
Added a test case to make sure future changes to ForceField do not change forces
parent
3769792d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2627 additions
and
1 deletion
+2627
-1
wrappers/python/tests/TestForceField.py
wrappers/python/tests/TestForceField.py
+13
-1
wrappers/python/tests/systems/lysozyme-implicit-forces.xml
wrappers/python/tests/systems/lysozyme-implicit-forces.xml
+2614
-0
No files found.
wrappers/python/tests/TestForceField.py
View file @
1c604fe4
...
@@ -119,7 +119,19 @@ class TestForceField(unittest.TestCase):
...
@@ -119,7 +119,19 @@ class TestForceField(unittest.TestCase):
totalMass1
=
sum
([
system1
.
getParticleMass
(
i
)
for
i
in
range
(
system1
.
getNumParticles
())]).
value_in_unit
(
amu
)
totalMass1
=
sum
([
system1
.
getParticleMass
(
i
)
for
i
in
range
(
system1
.
getNumParticles
())]).
value_in_unit
(
amu
)
totalMass2
=
sum
([
system2
.
getParticleMass
(
i
)
for
i
in
range
(
system2
.
getNumParticles
())]).
value_in_unit
(
amu
)
totalMass2
=
sum
([
system2
.
getParticleMass
(
i
)
for
i
in
range
(
system2
.
getNumParticles
())]).
value_in_unit
(
amu
)
self
.
assertAlmostEqual
(
totalMass1
,
totalMass2
)
self
.
assertAlmostEqual
(
totalMass1
,
totalMass2
)
def
test_Forces
(
self
):
"""Compute forces and compare them to ones generated with a previous version of OpenMM to ensure they haven't changed."""
pdb
=
PDBFile
(
'systems/lysozyme-implicit.pdb'
)
system
=
self
.
forcefield2
.
createSystem
(
pdb
.
topology
)
integrator
=
VerletIntegrator
(
0.001
)
context
=
Context
(
system
,
integrator
)
context
.
setPositions
(
pdb
.
positions
)
state1
=
context
.
getState
(
getForces
=
True
)
state2
=
XmlSerializer
.
deserialize
(
open
(
'systems/lysozyme-implicit-forces.xml'
).
read
())
for
f1
,
f2
,
in
zip
(
state1
.
getForces
().
value_in_unit
(
kilojoules_per_mole
/
nanometer
),
state2
.
getForces
().
value_in_unit
(
kilojoules_per_mole
/
nanometer
)):
self
.
assertTrue
(
norm
(
f1
-
f2
)
<
0.1
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
unittest
.
main
()
unittest
.
main
()
...
...
wrappers/python/tests/systems/lysozyme-implicit-forces.xml
0 → 100644
View file @
1c604fe4
This source diff could not be displayed because it is too large. You can
view the blob
instead.
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