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
1695878a
Commit
1695878a
authored
Oct 22, 2019
by
João Rodrigues
Browse files
Adds test to check ion addition in addMembrane test. Was untested before
parent
5a613f45
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
6 deletions
+24
-6
wrappers/python/tests/TestModeller.py
wrappers/python/tests/TestModeller.py
+24
-6
No files found.
wrappers/python/tests/TestModeller.py
View file @
1695878a
from
collections
import
defaultdict
import
unittest
import
math
import
sys
from
validateModeller
import
*
from
simtk.openmm.app
import
*
from
simtk.openmm
import
*
from
simtk.unit
import
*
from
collections
import
defaultdict
if
sys
.
version_info
>=
(
3
,
0
):
from
io
import
StringIO
else
:
...
...
@@ -1079,7 +1083,7 @@ class TestModeller(unittest.TestCase):
def
test_addMembrane
(
self
):
"""Test adding a membrane to a realistic system."""
mol
=
PDBxFile
(
'systems/gpcr.cif'
)
modeller
=
Modeller
(
mol
.
topology
,
mol
.
positions
)
ff
=
ForceField
(
'amber14-all.xml'
,
'amber14/tip3p.xml'
)
...
...
@@ -1091,12 +1095,26 @@ class TestModeller(unittest.TestCase):
resCount
=
defaultdict
(
int
)
for
res
in
modeller
.
topology
.
residues
():
resCount
[
res
.
name
]
+=
1
self
.
assertTrue
(
resCount
[
'HOH'
]
>
1
)
self
.
assertTrue
(
resCount
[
'CL'
]
>
1
)
self
.
assertTrue
(
resCount
[
'NA'
]
>
1
)
self
.
assertTrue
(
resCount
[
'CL'
]
>
resCount
[
'NA'
])
# overall negative
self
.
assertEqual
(
16
,
resCount
[
'ALA'
])
self
.
assertEqual
(
226
,
resCount
[
'POP'
])
# 2x128 - overlapping
self
.
assertTrue
(
resCount
[
'HOH'
]
>
1
)
deltaQ
=
resCount
[
'CL'
]
-
resCount
[
'NA'
]
self
.
assertEqual
(
deltaQ
,
10
)
# protein net q: +10
# Check _addIons did the right thing.
expected_ion_fraction
=
1.0
*
molar
/
(
55.4
*
molar
)
total_water
=
resCount
[
'HOH'
]
total_water_ions
=
resCount
[
'HOH'
]
+
resCount
[
'CL'
]
+
resCount
[
'NA'
]
# total_water_ions - protein charge
expected_sodium
=
math
.
floor
((
total_water_ions
-
10
)
*
expected_ion_fraction
+
0.5
)
expected_chlorine
=
expected_sodium
+
10
self
.
assertEqual
(
resCount
[
'CL'
],
expected_chlorine
)
self
.
assertEqual
(
resCount
[
'NA'
],
expected_sodium
)
# Check lipid numbering for repetitions
lipidIdList
=
[(
r
.
chain
.
id
,
r
.
id
)
for
r
in
modeller
.
topology
.
residues
()
...
...
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