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
58d0c548
Commit
58d0c548
authored
Jan 09, 2016
by
Rafal P. Wiewiora
Browse files
tests
parent
101c3cfa
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
2 deletions
+23
-2
wrappers/python/tests/TestPdbFile.py
wrappers/python/tests/TestPdbFile.py
+15
-2
wrappers/python/tests/systems/tip5p.pdb
wrappers/python/tests/systems/tip5p.pdb
+8
-0
No files found.
wrappers/python/tests/TestPdbFile.py
View file @
58d0c548
...
...
@@ -70,7 +70,6 @@ class TestPdbFile(unittest.TestCase):
pdb
=
PDBFile
(
open
(
'systems/triclinic.pdb'
,
'rb'
))
self
.
assertEqual
(
len
(
pdb
.
positions
),
8
)
def
assertVecAlmostEqual
(
self
,
p1
,
p2
,
tol
=
1e-7
):
unit
=
p1
.
unit
p1
=
p1
.
value_in_unit
(
unit
)
...
...
@@ -79,7 +78,21 @@ class TestPdbFile(unittest.TestCase):
for
i
in
range
(
3
):
diff
=
abs
(
p1
[
i
]
-
p2
[
i
])
/
scale
self
.
assertTrue
(
diff
<
tol
)
def
test_ExtraParticles
(
self
):
"""Test reading, and writing and re-reading of a file containing extra particle atoms."""
pdb
=
PDBFile
(
'systems/tip5p.pdb'
)
for
atom
in
pdb
.
topology
.
atoms
():
if
atom
.
index
>
2
:
self
.
assertEqual
(
None
,
atom
.
element
)
output
=
StringIO
()
PDBFile
.
writeFile
(
pdb
.
topology
,
pdb
.
positions
,
output
)
input
=
StringIO
(
output
.
getvalue
())
pdb
=
PDBFile
(
input
,
extraParticleIdentifier
=
''
)
for
atom
in
pdb
.
topology
.
atoms
():
if
atom
.
index
>
2
:
self
.
assertEqual
(
None
,
atom
.
element
)
if
__name__
==
'__main__'
:
unittest
.
main
()
wrappers/python/tests/systems/tip5p.pdb
0 → 100644
View file @
58d0c548
CRYST1 30.000 30.000 30.000 90.00 90.00 90.00 P 1 1
ATOM 1 O HOH A 1 20.612 20.351 16.218 1.00 0.00 O
ATOM 2 H1 HOH A 1 20.565 20.405 15.264 1.00 0.00 H
ATOM 3 H2 HOH A 1 21.273 19.679 16.387 1.00 0.00 H
ATOM 4 D1 HOH A 1 20.808 20.964 16.492 1.00 0.00 EP
ATOM 5 D2 HOH A 1 19.994 20.162 16.486 1.00 0.00 EP
TER 6 HOH A 1
END
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