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
ab60c418
Commit
ab60c418
authored
Jan 01, 2016
by
John Chodera (MSKCC)
Browse files
Modify TestForceField to use atom types instead of classes.
parent
519d9deb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
14 deletions
+29
-14
wrappers/python/simtk/openmm/app/forcefield.py
wrappers/python/simtk/openmm/app/forcefield.py
+15
-1
wrappers/python/tests/TestForceField.py
wrappers/python/tests/TestForceField.py
+14
-13
No files found.
wrappers/python/simtk/openmm/app/forcefield.py
View file @
ab60c418
...
...
@@ -261,7 +261,21 @@ class ForceField(object):
self
.
_templateGenerators
.
append
(
template_generator
)
def
_findAtomTypes
(
self
,
attrib
,
num
):
"""Parse the attributes on an XML tag to find the set of atom types for each atom it involves."""
"""Parse the attributes on an XML tag to find the set of atom types for each atom it involves.
Parameters
----------
attrib : dict of attributes
The dictionary of attributes for an XML parameter tag.
num : int
The number of atom specifiers (e.g. 'class1' through 'class4') to extract.
Returns
-------
types : list
A list of atom types that match.
"""
types
=
[]
for
i
in
range
(
num
):
if
num
==
1
:
...
...
wrappers/python/tests/TestForceField.py
View file @
ab60c418
...
...
@@ -261,18 +261,19 @@ class TestForceField(unittest.TestCase):
from
uuid
import
uuid4
template_name
=
uuid4
()
# Generate an atom type for each atom.
for
atom
in
residue
.
atoms
():
parameters
=
{
'name'
:
'%s-%s-%s'
%
(
template_name
,
residue
.
name
,
atom
.
name
),
'class'
:
'XXX'
,
'mass'
:
atom
.
element
.
_mass
,
'element'
:
atom
.
element
}
forcefield
.
registerAtomType
(
parameters
)
#
for atom in residue.atoms():
#
parameters = {
#
'name' : '%s-%s-%s' % (template_name, residue.name, atom.name),
#
'class' : 'XXX',
#
'mass' : atom.element._mass,
#
'element' : atom.element
#
}
#
forcefield.registerAtomType(parameters)
# Create residue template.
template
=
ForceField
.
_TemplateData
(
template_name
)
for
atom
in
residue
.
atoms
():
typename
=
'%s-%s-%s'
%
(
template_name
,
residue
.
name
,
atom
.
name
)
#typename = '%s-%s-%s' % (template_name, residue.name, atom.name)
typename
=
'XXX'
atom_template
=
ForceField
.
_TemplateAtomData
(
atom
.
name
,
typename
,
atom
.
element
)
template
.
atoms
.
append
(
atom_template
)
for
(
atom1
,
atom2
)
in
residue
.
internal_bonds
():
...
...
@@ -295,19 +296,19 @@ class TestForceField(unittest.TestCase):
simple_ffxml_contents
=
"""
<ForceField>
<HarmonicBondForce>
<Bond
class
1="XXX"
class
2="XXX" length="0.1409" k="392459.2"/>
<Bond
type
1="XXX"
type
2="XXX" length="0.1409" k="392459.2"/>
</HarmonicBondForce>
<HarmonicAngleForce>
<Angle
class
1="XXX"
class
2="XXX"
class
3="XXX" angle="2.09439510239" k="527.184"/>
<Angle
type
1="XXX"
type
2="XXX"
type
3="XXX" angle="2.09439510239" k="527.184"/>
</HarmonicAngleForce>
<NonbondedForce coulomb14scale="0.833333" lj14scale="0.5">
<Atom
class
="XXX" charge="0.000" sigma="0.315" epsilon="0.635"/>
<Atom
type
="XXX" charge="0.000" sigma="0.315" epsilon="0.635"/>
</NonbondedForce>
</ForceField>"""
simple_ffxml
=
StringIO
(
simple_ffxml_contents
)
#
# Test where we generate
a
parameters for only a ligand.
# Test where we generate parameters for only a ligand.
#
# Load the PDB file.
...
...
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