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
8d4b23da
Commit
8d4b23da
authored
Jul 02, 2014
by
peastman
Browse files
Made test case more tolerant of numerical differences between platforms
parent
a87df3ad
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
wrappers/python/tests/TestForceField.py
wrappers/python/tests/TestForceField.py
+5
-1
No files found.
wrappers/python/tests/TestForceField.py
View file @
8d4b23da
...
@@ -143,8 +143,12 @@ class TestForceField(unittest.TestCase):
...
@@ -143,8 +143,12 @@ class TestForceField(unittest.TestCase):
context
.
setPositions
(
pdb
.
positions
)
context
.
setPositions
(
pdb
.
positions
)
state1
=
context
.
getState
(
getForces
=
True
)
state1
=
context
.
getState
(
getForces
=
True
)
state2
=
XmlSerializer
.
deserialize
(
open
(
'systems/lysozyme-implicit-forces.xml'
).
read
())
state2
=
XmlSerializer
.
deserialize
(
open
(
'systems/lysozyme-implicit-forces.xml'
).
read
())
numDifferences
=
0
for
f1
,
f2
,
in
zip
(
state1
.
getForces
().
value_in_unit
(
kilojoules_per_mole
/
nanometer
),
state2
.
getForces
().
value_in_unit
(
kilojoules_per_mole
/
nanometer
)):
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
)
diff
=
norm
(
f1
-
f2
)
if
diff
>
0.1
and
diff
/
norm
(
f1
)
>
1e-3
:
numDifferences
+=
1
self
.
assertTrue
(
numDifferences
<
system
.
getNumParticles
()
/
20
)
# Tolerate occasional differences from numerical error
class
AmoebaTestForceField
(
unittest
.
TestCase
):
class
AmoebaTestForceField
(
unittest
.
TestCase
):
"""Test the ForceField.createSystem() method with the AMOEBA forcefield."""
"""Test the ForceField.createSystem() method with the AMOEBA forcefield."""
...
...
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