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
197eac74
Commit
197eac74
authored
Jan 09, 2016
by
Rafal P. Wiewiora
Browse files
rearrange TestPdbFile.py
parent
58d0c548
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
11 deletions
+12
-11
wrappers/python/tests/TestPdbFile.py
wrappers/python/tests/TestPdbFile.py
+12
-11
No files found.
wrappers/python/tests/TestPdbFile.py
View file @
197eac74
...
@@ -70,15 +70,6 @@ class TestPdbFile(unittest.TestCase):
...
@@ -70,15 +70,6 @@ class TestPdbFile(unittest.TestCase):
pdb
=
PDBFile
(
open
(
'systems/triclinic.pdb'
,
'rb'
))
pdb
=
PDBFile
(
open
(
'systems/triclinic.pdb'
,
'rb'
))
self
.
assertEqual
(
len
(
pdb
.
positions
),
8
)
self
.
assertEqual
(
len
(
pdb
.
positions
),
8
)
def
assertVecAlmostEqual
(
self
,
p1
,
p2
,
tol
=
1e-7
):
unit
=
p1
.
unit
p1
=
p1
.
value_in_unit
(
unit
)
p2
=
p2
.
value_in_unit
(
unit
)
scale
=
max
(
1.0
,
norm
(
p1
),)
for
i
in
range
(
3
):
diff
=
abs
(
p1
[
i
]
-
p2
[
i
])
/
scale
self
.
assertTrue
(
diff
<
tol
)
def
test_ExtraParticles
(
self
):
def
test_ExtraParticles
(
self
):
"""Test reading, and writing and re-reading of a file containing extra particle atoms."""
"""Test reading, and writing and re-reading of a file containing extra particle atoms."""
pdb
=
PDBFile
(
'systems/tip5p.pdb'
)
pdb
=
PDBFile
(
'systems/tip5p.pdb'
)
...
@@ -91,8 +82,18 @@ class TestPdbFile(unittest.TestCase):
...
@@ -91,8 +82,18 @@ class TestPdbFile(unittest.TestCase):
pdb
=
PDBFile
(
input
,
extraParticleIdentifier
=
''
)
pdb
=
PDBFile
(
input
,
extraParticleIdentifier
=
''
)
for
atom
in
pdb
.
topology
.
atoms
():
for
atom
in
pdb
.
topology
.
atoms
():
if
atom
.
index
>
2
:
if
atom
.
index
>
2
:
self
.
assertEqual
(
None
,
atom
.
element
)
self
.
assertEqual
(
None
,
atom
.
element
)
def
assertVecAlmostEqual
(
self
,
p1
,
p2
,
tol
=
1e-7
):
unit
=
p1
.
unit
p1
=
p1
.
value_in_unit
(
unit
)
p2
=
p2
.
value_in_unit
(
unit
)
scale
=
max
(
1.0
,
norm
(
p1
),)
for
i
in
range
(
3
):
diff
=
abs
(
p1
[
i
]
-
p2
[
i
])
/
scale
self
.
assertTrue
(
diff
<
tol
)
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