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
c82f3c18
"...ssh:/git@developer.sourcefind.cn:2222/tsoc/openmm.git" did not exist on "0c661886092b73833e6b3b4324f46f0804231d65"
Commit
c82f3c18
authored
Oct 26, 2015
by
John Chodera (MSKCC)
Browse files
Update deepcopy test
parent
1289d16d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
7 deletions
+16
-7
wrappers/python/tests/TestPickle.py
wrappers/python/tests/TestPickle.py
+16
-7
No files found.
wrappers/python/tests/TestPickle.py
View file @
c82f3c18
...
@@ -26,8 +26,15 @@ class TestPickle(unittest.TestCase):
...
@@ -26,8 +26,15 @@ class TestPickle(unittest.TestCase):
self
.
pdb2
=
PDBFile
(
'systems/alanine-dipeptide-implicit.pdb'
)
self
.
pdb2
=
PDBFile
(
'systems/alanine-dipeptide-implicit.pdb'
)
self
.
forcefield2
=
ForceField
(
'amber99sb.xml'
,
'amber99_obc.xml'
)
self
.
forcefield2
=
ForceField
(
'amber99sb.xml'
,
'amber99_obc.xml'
)
def
test_system_integrator_deepcopy
(
self
):
def
test_force_deepcopy
(
self
):
"""Test that serialization/deserialization of system and integrator works (via deepcopy)."""
"""Test that deep copying of forces works correctly."""
force
=
NonbondedForce
()
force_copy
=
copy
.
deepcopy
(
force
)
# Check class name is same.
self
.
assertEqual
(
force
.
__class__
.
__name__
,
force_copy
.
__class__
.
__name__
)
def
test_deepcopy
(
self
):
"""Test that serialization/deserialization works (via deepcopy)."""
system
=
self
.
forcefield1
.
createSystem
(
self
.
pdb1
.
topology
)
system
=
self
.
forcefield1
.
createSystem
(
self
.
pdb1
.
topology
)
integrator
=
VerletIntegrator
(
2
*
femtosecond
)
integrator
=
VerletIntegrator
(
2
*
femtosecond
)
...
@@ -47,11 +54,13 @@ class TestPickle(unittest.TestCase):
...
@@ -47,11 +54,13 @@ class TestPickle(unittest.TestCase):
del
context
,
integrator
del
context
,
integrator
def
test_force_deepcopy
(
self
):
# Check deep copy of each force.
"""Test that deep copying of forces works correctly."""
forces
=
[
system
.
getForce
(
index
)
for
index
in
range
(
system
.
getNumForces
())
]
force
=
NonbondedForce
()
for
force
in
forces
:
force_copy
=
copy
.
deepcopy
(
force
)
force_copy
=
copy
.
deepcopy
(
force
)
self
.
assertEqual
(
force
.
__class__
.
__name__
,
'NonbondedForce'
)
# Check class name is same.
self
.
assertEqual
(
force
.
__class__
.
__name__
,
force_copy
.
__class__
.
__name__
)
# TODO: Check to make sure all force data properly copied?
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
unittest
.
main
()
unittest
.
main
()
...
...
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