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
a8bc6f65
"platforms/cuda2/tests/TestCudaCheckpoints.cpp" did not exist on "0e879806cdd38e58b04481ecf7fcd93c44c7dc27"
Commit
a8bc6f65
authored
Mar 30, 2020
by
peastman
Browse files
Fixed errors in adding extra particles with patches
parent
ffe0512f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
8 deletions
+10
-8
wrappers/python/simtk/openmm/app/forcefield.py
wrappers/python/simtk/openmm/app/forcefield.py
+5
-3
wrappers/python/simtk/openmm/app/internal/compiled.pyx
wrappers/python/simtk/openmm/app/internal/compiled.pyx
+4
-4
wrappers/python/simtk/openmm/app/modeller.py
wrappers/python/simtk/openmm/app/modeller.py
+1
-1
No files found.
wrappers/python/simtk/openmm/app/forcefield.py
View file @
a8bc6f65
...
@@ -1295,7 +1295,7 @@ class ForceField(object):
...
@@ -1295,7 +1295,7 @@ class ForceField(object):
return
sys
return
sys
def
_matchAllResiduesToTemplates
(
self
,
data
,
topology
,
residueTemplates
,
ignoreExternalBonds
,
ignoreExtraParticles
=
False
):
def
_matchAllResiduesToTemplates
(
self
,
data
,
topology
,
residueTemplates
,
ignoreExternalBonds
,
ignoreExtraParticles
=
False
,
recordParameters
=
True
):
"""Return a list of which template matches each residue in the topology, and assign atom types."""
"""Return a list of which template matches each residue in the topology, and assign atom types."""
templateForResidue
=
[
None
]
*
topology
.
getNumResidues
()
templateForResidue
=
[
None
]
*
topology
.
getNumResidues
()
unmatchedResidues
=
[]
unmatchedResidues
=
[]
...
@@ -1313,6 +1313,7 @@ class ForceField(object):
...
@@ -1313,6 +1313,7 @@ class ForceField(object):
if
matches
is
None
:
if
matches
is
None
:
unmatchedResidues
.
append
(
res
)
unmatchedResidues
.
append
(
res
)
else
:
else
:
if
recordParameters
:
data
.
recordMatchedAtomParameters
(
res
,
template
,
matches
)
data
.
recordMatchedAtomParameters
(
res
,
template
,
matches
)
templateForResidue
[
res
.
index
]
=
template
templateForResidue
[
res
.
index
]
=
template
...
@@ -1342,6 +1343,7 @@ class ForceField(object):
...
@@ -1342,6 +1343,7 @@ class ForceField(object):
if
matches
is
None
:
if
matches
is
None
:
raise
ValueError
(
'No template found for residue %d (%s). %s'
%
(
res
.
index
+
1
,
res
.
name
,
_findMatchErrors
(
self
,
res
)))
raise
ValueError
(
'No template found for residue %d (%s). %s'
%
(
res
.
index
+
1
,
res
.
name
,
_findMatchErrors
(
self
,
res
)))
else
:
else
:
if
recordParameters
:
data
.
recordMatchedAtomParameters
(
res
,
template
,
matches
)
data
.
recordMatchedAtomParameters
(
res
,
template
,
matches
)
templateForResidue
[
res
.
index
]
=
template
templateForResidue
[
res
.
index
]
=
template
return
templateForResidue
return
templateForResidue
...
...
wrappers/python/simtk/openmm/app/internal/compiled.pyx
View file @
a8bc6f65
...
@@ -99,7 +99,7 @@ def matchResidueToTemplate(res, template, bondedToAtom, bint ignoreExternalBonds
...
@@ -99,7 +99,7 @@ def matchResidueToTemplate(res, template, bondedToAtom, bint ignoreExternalBonds
templateBondedTo
=
{}
templateBondedTo
=
{}
for
i
,
atom
in
enumerate
(
template
.
atoms
):
for
i
,
atom
in
enumerate
(
template
.
atoms
):
if
atom
.
element
is
not
None
:
if
atom
.
element
is
not
None
:
templateBondedTo
[
atom
]
=
[
j
for
j
in
atom
.
bondedTo
if
template
.
atoms
[
j
].
element
is
not
None
]
templateBondedTo
[
atom
]
=
[
templateAtoms
.
index
(
template
.
atoms
[
j
])
for
j
in
atom
.
bondedTo
if
template
.
atoms
[
j
].
element
is
not
None
]
else
:
else
:
templateAtoms
=
template
.
atoms
templateAtoms
=
template
.
atoms
templateBondedTo
=
dict
((
atom
,
atom
.
bondedTo
)
for
atom
in
template
.
atoms
)
templateBondedTo
=
dict
((
atom
,
atom
.
bondedTo
)
for
atom
in
template
.
atoms
)
...
@@ -191,13 +191,13 @@ def matchResidueToTemplate(res, template, bondedToAtom, bint ignoreExternalBonds
...
@@ -191,13 +191,13 @@ def matchResidueToTemplate(res, template, bondedToAtom, bint ignoreExternalBonds
return
None
return
None
def
_getAtomMatchCandidates
(
templateAtoms
,
bondedTo
,
matches
,
candidates
,
position
):
def
_getAtomMatchCandidates
(
templateAtoms
,
bondedTo
,
templateBondedTo
,
matches
,
candidates
,
position
):
"""Get a list of template atoms that are potential matches for the next atom."""
"""Get a list of template atoms that are potential matches for the next atom."""
for
bonded
in
bondedTo
[
position
]:
for
bonded
in
bondedTo
[
position
]:
if
bonded
<
position
:
if
bonded
<
position
:
# This atom is bonded to another one for which we already have a match, so only consider
# This atom is bonded to another one for which we already have a match, so only consider
# template atoms that *that* one is bonded to.
# template atoms that *that* one is bonded to.
return
templateAtoms
[
matches
[
bonded
]]
.
bondedTo
return
templateBondedTo
[
templateAtoms
[
matches
[
bonded
]]
]
return
candidates
[
position
]
return
candidates
[
position
]
...
@@ -206,7 +206,7 @@ def _findAtomMatches(templateAtoms, bondedTo, templateBondedTo, matches, hasMatc
...
@@ -206,7 +206,7 @@ def _findAtomMatches(templateAtoms, bondedTo, templateBondedTo, matches, hasMatc
if
position
==
len
(
matches
):
if
position
==
len
(
matches
):
return
True
return
True
cdef
int
i
cdef
int
i
for
i
in
_getAtomMatchCandidates
(
templateAtoms
,
bondedTo
,
matches
,
candidates
,
position
):
for
i
in
_getAtomMatchCandidates
(
templateAtoms
,
bondedTo
,
templateBondedTo
,
matches
,
candidates
,
position
):
atom
=
templateAtoms
[
i
]
atom
=
templateAtoms
[
i
]
if
not
hasMatch
[
i
]
and
i
in
candidates
[
position
]:
if
not
hasMatch
[
i
]
and
i
in
candidates
[
position
]:
# See if the bonds for this identification are consistent
# See if the bonds for this identification are consistent
...
...
wrappers/python/simtk/openmm/app/modeller.py
View file @
a8bc6f65
...
@@ -1048,7 +1048,7 @@ class Modeller(object):
...
@@ -1048,7 +1048,7 @@ class Modeller(object):
# Identify the template to use for each residue.
# Identify the template to use for each residue.
templates
=
forcefield
.
_matchAllResiduesToTemplates
(
ForceField
.
_SystemData
(
self
.
topology
),
self
.
topology
,
{},
False
,
True
)
templates
=
forcefield
.
_matchAllResiduesToTemplates
(
ForceField
.
_SystemData
(
self
.
topology
),
self
.
topology
,
{},
False
,
True
,
False
)
# Create the new Topology.
# Create the new Topology.
...
...
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