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
54788ac1
Commit
54788ac1
authored
Jun 29, 2016
by
peastman
Committed by
GitHub
Jun 29, 2016
Browse files
Merge pull request #1528 from peastman/matching
Further optimization to template matching
parents
040890d5
4bd3fb5c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
+9
-4
wrappers/python/simtk/openmm/app/forcefield.py
wrappers/python/simtk/openmm/app/forcefield.py
+9
-4
No files found.
wrappers/python/simtk/openmm/app/forcefield.py
View file @
54788ac1
...
@@ -39,6 +39,7 @@ import xml.etree.ElementTree as etree
...
@@ -39,6 +39,7 @@ import xml.etree.ElementTree as etree
import
math
import
math
from
math
import
sqrt
,
cos
from
math
import
sqrt
,
cos
from
copy
import
deepcopy
from
copy
import
deepcopy
from
heapq
import
heappush
,
heappop
import
simtk.openmm
as
mm
import
simtk.openmm
as
mm
import
simtk.unit
as
unit
import
simtk.unit
as
unit
from
.
import
element
as
elem
from
.
import
element
as
elem
...
@@ -1296,21 +1297,25 @@ def _matchResidue(res, template, bondedToAtom):
...
@@ -1296,21 +1297,25 @@ def _matchResidue(res, template, bondedToAtom):
searchOrder
=
[]
searchOrder
=
[]
atomsToOrder
=
set
(
range
(
numAtoms
))
atomsToOrder
=
set
(
range
(
numAtoms
))
efficientAtoms
=
set
()
efficientAtomSet
=
set
()
efficientAtomHeap
=
[]
while
len
(
atomsToOrder
)
>
0
:
while
len
(
atomsToOrder
)
>
0
:
if
len
(
efficientAtom
s
)
==
0
:
if
len
(
efficientAtom
Set
)
==
0
:
fewestNeighbors
=
numAtoms
+
1
fewestNeighbors
=
numAtoms
+
1
for
i
in
atomsToOrder
:
for
i
in
atomsToOrder
:
if
len
(
candidates
[
i
])
<
fewestNeighbors
:
if
len
(
candidates
[
i
])
<
fewestNeighbors
:
nextAtom
=
i
nextAtom
=
i
fewestNeighbors
=
len
(
candidates
[
i
])
fewestNeighbors
=
len
(
candidates
[
i
])
else
:
else
:
nextAtom
=
efficientAtoms
.
pop
()
nextAtom
=
heappop
(
efficientAtomHeap
)[
1
]
efficientAtomSet
.
remove
(
nextAtom
)
searchOrder
.
append
(
nextAtom
)
searchOrder
.
append
(
nextAtom
)
atomsToOrder
.
remove
(
nextAtom
)
atomsToOrder
.
remove
(
nextAtom
)
for
i
in
bondedTo
[
nextAtom
]:
for
i
in
bondedTo
[
nextAtom
]:
if
i
in
atomsToOrder
:
if
i
in
atomsToOrder
:
efficientAtoms
.
add
(
i
)
if
i
not
in
efficientAtomSet
:
efficientAtomSet
.
add
(
i
)
heappush
(
efficientAtomHeap
,
(
len
(
candidates
[
i
]),
i
))
inverseSearchOrder
=
[
0
]
*
numAtoms
inverseSearchOrder
=
[
0
]
*
numAtoms
for
i
in
range
(
numAtoms
):
for
i
in
range
(
numAtoms
):
inverseSearchOrder
[
searchOrder
[
i
]]
=
i
inverseSearchOrder
[
searchOrder
[
i
]]
=
i
...
...
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