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
fd948b0d
Commit
fd948b0d
authored
Sep 11, 2017
by
peastman
Browse files
Ignore duplicate patch specifications
parent
546ec2fd
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
8 deletions
+11
-8
wrappers/python/simtk/openmm/app/forcefield.py
wrappers/python/simtk/openmm/app/forcefield.py
+2
-2
wrappers/python/tests/TestPatches.py
wrappers/python/tests/TestPatches.py
+9
-6
No files found.
wrappers/python/simtk/openmm/app/forcefield.py
View file @
fd948b0d
...
@@ -426,8 +426,8 @@ class ForceField(object):
...
@@ -426,8 +426,8 @@ class ForceField(object):
def
registerTemplatePatch
(
self
,
residue
,
patch
,
patchResidueIndex
):
def
registerTemplatePatch
(
self
,
residue
,
patch
,
patchResidueIndex
):
"""Register that a particular patch can be used with a particular residue."""
"""Register that a particular patch can be used with a particular residue."""
if
residue
not
in
self
.
_templatePatches
:
if
residue
not
in
self
.
_templatePatches
:
self
.
_templatePatches
[
residue
]
=
[]
self
.
_templatePatches
[
residue
]
=
set
()
self
.
_templatePatches
[
residue
].
a
ppen
d
((
patch
,
patchResidueIndex
))
self
.
_templatePatches
[
residue
].
a
d
d
((
patch
,
patchResidueIndex
))
def
registerScript
(
self
,
script
):
def
registerScript
(
self
,
script
):
"""Register a new script to be executed after building the System."""
"""Register a new script to be executed after building the System."""
...
...
wrappers/python/tests/TestPatches.py
View file @
fd948b0d
...
@@ -67,8 +67,9 @@ class TestPatches(unittest.TestCase):
...
@@ -67,8 +67,9 @@ class TestPatches(unittest.TestCase):
self
.
assertEqual
(
0
,
patch
.
addedExternalBonds
[
0
].
residue
)
self
.
assertEqual
(
0
,
patch
.
addedExternalBonds
[
0
].
residue
)
self
.
assertEqual
(
'C'
,
patch
.
deletedExternalBonds
[
0
].
name
)
self
.
assertEqual
(
'C'
,
patch
.
deletedExternalBonds
[
0
].
name
)
self
.
assertEqual
(
0
,
patch
.
deletedExternalBonds
[
0
].
residue
)
self
.
assertEqual
(
0
,
patch
.
deletedExternalBonds
[
0
].
residue
)
self
.
assertEqual
(
'Test'
,
ff
.
_templatePatches
[
'RES'
][
0
][
0
])
patch
=
list
(
ff
.
_templatePatches
[
'RES'
])[
0
]
self
.
assertEqual
(
0
,
ff
.
_templatePatches
[
'RES'
][
0
][
1
])
self
.
assertEqual
(
'Test'
,
patch
[
0
])
self
.
assertEqual
(
0
,
patch
[
1
])
def
testParseMultiresiduePatch
(
self
):
def
testParseMultiresiduePatch
(
self
):
"""Test parsing a <Patch> tag that affects two residues."""
"""Test parsing a <Patch> tag that affects two residues."""
...
@@ -110,10 +111,12 @@ class TestPatches(unittest.TestCase):
...
@@ -110,10 +111,12 @@ class TestPatches(unittest.TestCase):
self
.
assertEqual
(
0
,
patch
.
addedBonds
[
0
][
0
].
residue
)
self
.
assertEqual
(
0
,
patch
.
addedBonds
[
0
][
0
].
residue
)
self
.
assertEqual
(
'B'
,
patch
.
addedBonds
[
0
][
1
].
name
)
self
.
assertEqual
(
'B'
,
patch
.
addedBonds
[
0
][
1
].
name
)
self
.
assertEqual
(
1
,
patch
.
addedBonds
[
0
][
1
].
residue
)
self
.
assertEqual
(
1
,
patch
.
addedBonds
[
0
][
1
].
residue
)
self
.
assertEqual
(
'Test'
,
ff
.
_templatePatches
[
'RESA'
][
0
][
0
])
patchA
=
list
(
ff
.
_templatePatches
[
'RESA'
])[
0
]
self
.
assertEqual
(
0
,
ff
.
_templatePatches
[
'RESA'
][
0
][
1
])
self
.
assertEqual
(
'Test'
,
patchA
[
0
])
self
.
assertEqual
(
'Test'
,
ff
.
_templatePatches
[
'RESB'
][
0
][
0
])
self
.
assertEqual
(
0
,
patchA
[
1
])
self
.
assertEqual
(
1
,
ff
.
_templatePatches
[
'RESB'
][
0
][
1
])
patchB
=
list
(
ff
.
_templatePatches
[
'RESB'
])[
0
]
self
.
assertEqual
(
'Test'
,
patchB
[
0
])
self
.
assertEqual
(
1
,
patchB
[
1
])
def
testApplyPatch
(
self
):
def
testApplyPatch
(
self
):
"""Test applying a patch to a template."""
"""Test applying a patch to a template."""
...
...
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