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
1a67542e
Unverified
Commit
1a67542e
authored
Sep 24, 2025
by
Evan Pretti
Committed by
GitHub
Sep 24, 2025
Browse files
Make distinct parameter dictionaries for _TemplateAtomData by default (#5091)
parent
05472c9a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
2 deletions
+5
-2
wrappers/python/openmm/app/forcefield.py
wrappers/python/openmm/app/forcefield.py
+2
-2
wrappers/python/tests/TestForceField.py
wrappers/python/tests/TestForceField.py
+3
-0
No files found.
wrappers/python/openmm/app/forcefield.py
View file @
1a67542e
...
@@ -744,11 +744,11 @@ class ForceField(object):
...
@@ -744,11 +744,11 @@ class ForceField(object):
class
_TemplateAtomData
(
object
):
class
_TemplateAtomData
(
object
):
"""Inner class used to encapsulate data about an atom in a residue template definition."""
"""Inner class used to encapsulate data about an atom in a residue template definition."""
def
__init__
(
self
,
name
,
type
,
element
,
parameters
=
{}
):
def
__init__
(
self
,
name
,
type
,
element
,
parameters
=
None
):
self
.
name
=
name
self
.
name
=
name
self
.
type
=
type
self
.
type
=
type
self
.
element
=
element
self
.
element
=
element
self
.
parameters
=
parameters
self
.
parameters
=
{}
if
parameters
is
None
else
parameters
self
.
bondedTo
=
[]
self
.
bondedTo
=
[]
self
.
externalBonds
=
0
self
.
externalBonds
=
0
...
...
wrappers/python/tests/TestForceField.py
View file @
1a67542e
...
@@ -804,6 +804,9 @@ class TestForceField(unittest.TestCase):
...
@@ -804,6 +804,9 @@ class TestForceField(unittest.TestCase):
forcefield
=
ForceField
(
'amber99sb.xml'
,
'tip3p.xml'
,
StringIO
(
simple_ffxml_contents
))
forcefield
=
ForceField
(
'amber99sb.xml'
,
'tip3p.xml'
,
StringIO
(
simple_ffxml_contents
))
# Get list of unique unmatched residues.
# Get list of unique unmatched residues.
[
templates
,
residues
]
=
forcefield
.
generateTemplatesForUnmatchedResidues
(
pdb
.
topology
)
[
templates
,
residues
]
=
forcefield
.
generateTemplatesForUnmatchedResidues
(
pdb
.
topology
)
# Make sure template atom parameter dictionaries are distinct objects.
parameters
=
[
atom
.
parameters
for
template
in
templates
for
atom
in
template
.
atoms
]
self
.
assertEqual
(
len
(
set
(
map
(
id
,
parameters
))),
len
(
parameters
))
# Add residue templates to forcefield.
# Add residue templates to forcefield.
for
template
in
templates
:
for
template
in
templates
:
# Replace atom types.
# Replace atom types.
...
...
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