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
dd432501
Commit
dd432501
authored
Jan 19, 2016
by
John Chodera (MSKCC)
Browse files
Fix omitted construction of bondedToAtom
parent
a773f1c7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
9 deletions
+25
-9
wrappers/python/simtk/openmm/app/forcefield.py
wrappers/python/simtk/openmm/app/forcefield.py
+25
-9
No files found.
wrappers/python/simtk/openmm/app/forcefield.py
View file @
dd432501
...
@@ -569,13 +569,34 @@ class ForceField(object):
...
@@ -569,13 +569,34 @@ class ForceField(object):
break
break
return
[
template
,
matches
]
return
[
template
,
matches
]
def
_buildBondedToAtomList
(
self
,
topology
):
"""Build a list of which atom indices are bonded to each atom.
Parameters
----------
topology : Topology
The Topology whose bonds are to be indexed.
Returns
-------
bondedToAtom : list of set of int
bondedToAtom[index] is the set of atom indices bonded to atom `index`
"""
bondedToAtom
=
[]
for
atom
in
topology
.
atoms
():
bondedToAtom
.
append
(
set
())
for
bond
in
topology
.
bonds
():
bondedToAtom
[
bond
.
atom1
.
index
].
add
(
bond
.
atom2
.
index
)
bondedToAtom
[
bond
.
atom2
.
index
].
add
(
bond
.
atom1
.
index
)
def
getUnmatchedResidues
(
self
,
topology
):
def
getUnmatchedResidues
(
self
,
topology
):
"""Return a list of Residue objects from specified topology for which no forcefield templates are available.
"""Return a list of Residue objects from specified topology for which no forcefield templates are available.
Parameters
Parameters
----------
----------
topology : Topology
topology : Topology
The Topology
for which to create a System
The Topology
whose residues are to be checked against the forcefield residue templates.
Returns
Returns
-------
-------
...
@@ -586,6 +607,7 @@ class ForceField(object):
...
@@ -586,6 +607,7 @@ class ForceField(object):
This method may be of use in generating missing residue templates or diagnosing parameterization failures.
This method may be of use in generating missing residue templates or diagnosing parameterization failures.
"""
"""
# Find the template matching each residue, compiling a list of residues for which no templates are available.
# Find the template matching each residue, compiling a list of residues for which no templates are available.
bondedToAtom
=
self
.
_buildBondedToAtomList
(
topology
)
unmatched_residues
=
list
()
# list of unmatched residues
unmatched_residues
=
list
()
# list of unmatched residues
for
chain
in
topology
.
chains
():
for
chain
in
topology
.
chains
():
for
res
in
chain
.
residues
():
for
res
in
chain
.
residues
():
...
@@ -603,7 +625,7 @@ class ForceField(object):
...
@@ -603,7 +625,7 @@ class ForceField(object):
Parameters
Parameters
----------
----------
topology : Topology
topology : Topology
The Topology
for which to create a System
The Topology
whose residues are to be checked against the forcefield residue templates.
Returns
Returns
-------
-------
...
@@ -615,14 +637,8 @@ class ForceField(object):
...
@@ -615,14 +637,8 @@ class ForceField(object):
"""
"""
# Get a non-unique list of unmatched residues.
# Get a non-unique list of unmatched residues.
unmatched_residues
=
self
.
getUnmatchedResidues
(
topology
)
unmatched_residues
=
self
.
getUnmatchedResidues
(
topology
)
# Record which atoms are bonded to each other atom
bondedToAtom
=
[]
for
atom
in
topology
.
atoms
():
bondedToAtom
.
append
(
set
())
for
bond
in
topology
.
bonds
():
bondedToAtom
[
bond
.
atom1
.
index
].
add
(
bond
.
atom2
.
index
)
bondedToAtom
[
bond
.
atom2
.
index
].
add
(
bond
.
atom1
.
index
)
# Generate a unique list of unmatched residues by comparing fingerprints.
# Generate a unique list of unmatched residues by comparing fingerprints.
bondedToAtom
=
self
.
_buildBondedToAtomList
(
topology
)
unique_unmatched_residues
=
list
()
unique_unmatched_residues
=
list
()
signatures
=
set
()
signatures
=
set
()
for
residue
in
unmatched_residues
:
for
residue
in
unmatched_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