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
edb3759b
Commit
edb3759b
authored
Sep 13, 2013
by
peastman
Browse files
In rare situations, _matchResidue() would take a very long time to return
parent
15d8a466
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
0 deletions
+21
-0
wrappers/python/simtk/openmm/app/forcefield.py
wrappers/python/simtk/openmm/app/forcefield.py
+21
-0
No files found.
wrappers/python/simtk/openmm/app/forcefield.py
View file @
edb3759b
...
...
@@ -516,6 +516,27 @@ def _matchResidue(res, template, bondedToAtom):
bonds
=
[
renumberAtoms
[
x
]
for
x
in
bondedToAtom
[
atom
.
index
]
if
x
in
renumberAtoms
]
bondedTo
.
append
(
bonds
)
externalBonds
.
append
(
len
([
x
for
x
in
bondedToAtom
[
atom
.
index
]
if
x
not
in
renumberAtoms
]))
# For each unique combination of element and number of bonds, make sure the residue and
# template have the same number of atoms.
residueTypeCount
=
{}
for
i
,
atom
in
enumerate
(
atoms
):
key
=
(
atom
.
element
,
len
(
bondedTo
[
i
]),
externalBonds
[
i
])
if
key
not
in
residueTypeCount
:
residueTypeCount
[
key
]
=
1
residueTypeCount
[
key
]
+=
1
templateTypeCount
=
{}
for
i
,
atom
in
enumerate
(
template
.
atoms
):
key
=
(
atom
.
element
,
len
(
atom
.
bondedTo
),
atom
.
externalBonds
)
if
key
not
in
templateTypeCount
:
templateTypeCount
[
key
]
=
1
templateTypeCount
[
key
]
+=
1
if
residueTypeCount
!=
templateTypeCount
:
return
None
# Recursively match atoms.
if
_findAtomMatches
(
atoms
,
template
,
bondedTo
,
externalBonds
,
matches
,
hasMatch
,
0
):
return
matches
return
None
...
...
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