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
a4481f54
Commit
a4481f54
authored
Jan 20, 2016
by
John Chodera (MSKCC)
Browse files
Fix docstrings, docs, and method names.
parent
f7b56fdf
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
17 deletions
+25
-17
docs-source/usersguide/application.rst
docs-source/usersguide/application.rst
+9
-3
wrappers/python/simtk/openmm/app/forcefield.py
wrappers/python/simtk/openmm/app/forcefield.py
+10
-8
wrappers/python/tests/TestForceField.py
wrappers/python/tests/TestForceField.py
+6
-6
No files found.
docs-source/usersguide/application.rst
View file @
a4481f54
...
@@ -1965,7 +1965,7 @@ Missing residue templates
...
@@ -1965,7 +1965,7 @@ Missing residue templates
=========================
=========================
..
CAUTION
::
..
CAUTION
::
Th
is
feature
is
experimental
,
and
its
API
is
subject
to
change
.
Th
ese
feature
s
are
experimental
,
and
its
API
is
subject
to
change
.
You
can
use
the
:
method
:`
getUnmatchedResidues
()`
method
to
get
a
list
of
residues
You
can
use
the
:
method
:`
getUnmatchedResidues
()`
method
to
get
a
list
of
residues
in
the
provided
:
code
:`
topology
`
object
that
do
not
currently
have
a
matching
in
the
provided
:
code
:`
topology
`
object
that
do
not
currently
have
a
matching
...
@@ -1981,12 +1981,18 @@ with residue template definitions, or identifying which additional residues need
...
@@ -1981,12 +1981,18 @@ with residue template definitions, or identifying which additional residues need
to
be
parameterized
.
to
be
parameterized
.
As
a
convenience
for
parameterizing
new
residues
,
you
can
also
get
a
list
of
As
a
convenience
for
parameterizing
new
residues
,
you
can
also
get
a
list
of
residues
and
empty
residue
templates
using
:
method
:`
ge
tUnique
UnmatchedResidues
`
residues
and
empty
residue
templates
using
:
method
:`
ge
nerateTemplatesFor
UnmatchedResidues
`
::
::
pdb
=
PDBFile
(
'input.pdb'
)
pdb
=
PDBFile
(
'input.pdb'
)
forcefield
=
ForceField
(
'amber99sb.xml'
,
'tip3p.xml'
)
forcefield
=
ForceField
(
'amber99sb.xml'
,
'tip3p.xml'
)
[
residues
,
templates
]
=
forcefield
.
getUniqueUnmatchedResidues
(
topology
)
[
templates
,
residues
]
=
forcefield
.
generateTemplatesForUnmatchedResidues
(
topology
)
#
Se
the
atom
types
for
template
in
templates
:
for
atom
in
template
.
atoms
:
atom
.
type
=
...
#
set
the
atom
types
here
#
Register
the
template
with
the
forcefield
.
forcefield
.
registerResidueTemplate
(
template
)
<
HarmonicBondForce
>
<
HarmonicBondForce
>
===================
===================
...
...
wrappers/python/simtk/openmm/app/forcefield.py
View file @
a4481f54
...
@@ -602,7 +602,7 @@ class ForceField(object):
...
@@ -602,7 +602,7 @@ class ForceField(object):
Returns
Returns
-------
-------
unmatched_residues : list of Residue
unmatched_residues : list of Residue
List of
r
esidue
template
s from `topology` for which no forcefield residue templates are available.
List of
R
esidue
object
s from `topology` for which no forcefield residue templates are available.
Note that multiple instances of the same residue appearing at different points in the topology may be returned.
Note that multiple instances of the same residue appearing at different points in the topology may be returned.
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.
...
@@ -620,8 +620,8 @@ class ForceField(object):
...
@@ -620,8 +620,8 @@ class ForceField(object):
return
unmatched_residues
return
unmatched_residues
def
ge
tUnique
UnmatchedResidues
(
self
,
topology
):
def
ge
nerateTemplatesFor
UnmatchedResidues
(
self
,
topology
):
"""
Returns a unique list of Residue objects from
specified topology for which no forcefield templates are available.
"""
Generate forcefield residue templates for residues in
specified topology for which no forcefield templates are available.
Parameters
Parameters
----------
----------
...
@@ -630,11 +630,13 @@ class ForceField(object):
...
@@ -630,11 +630,13 @@ class ForceField(object):
Returns
Returns
-------
-------
unmatched_residues : list of Residue
templates : list of _TemplateData
List of residue templates from `topology` for which no forcefield residue templates are available.
List of forcefield residue templates corresponding to residues in `topology` for which no forcefield templates are currently available.
Note that only a single instances each missing residue type will be returned.
Atom types will be set to `None`, but template name, atom names, elements, and connectivity will be taken from corresponding Residue objects.
residues : list of Residue
List of Residue objects that were used to generate the templates.
`residues[index]` is the Residue that was used to generate the template `templates[index]`
This method may be of use in generating missing residue templates.
"""
"""
# 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
)
...
@@ -659,7 +661,7 @@ class ForceField(object):
...
@@ -659,7 +661,7 @@ class ForceField(object):
signatures
.
add
(
signature
)
signatures
.
add
(
signature
)
templates
.
append
(
template
)
templates
.
append
(
template
)
return
[
unique_unmatched_residues
,
templates
]
return
[
templates
,
unique_unmatched_residues
]
def
createSystem
(
self
,
topology
,
nonbondedMethod
=
NoCutoff
,
nonbondedCutoff
=
1.0
*
unit
.
nanometer
,
def
createSystem
(
self
,
topology
,
nonbondedMethod
=
NoCutoff
,
nonbondedCutoff
=
1.0
*
unit
.
nanometer
,
constraints
=
None
,
rigidWater
=
True
,
removeCMMotion
=
True
,
hydrogenMass
=
None
,
**
args
):
constraints
=
None
,
rigidWater
=
True
,
removeCMMotion
=
True
,
hydrogenMass
=
None
,
**
args
):
...
...
wrappers/python/tests/TestForceField.py
View file @
a4481f54
...
@@ -365,8 +365,8 @@ class TestForceField(unittest.TestCase):
...
@@ -365,8 +365,8 @@ class TestForceField(unittest.TestCase):
self
.
assertEqual
(
unmatched_residues
[
0
].
chain
.
id
,
'X'
)
self
.
assertEqual
(
unmatched_residues
[
0
].
chain
.
id
,
'X'
)
self
.
assertEqual
(
unmatched_residues
[
0
].
id
,
'1'
)
self
.
assertEqual
(
unmatched_residues
[
0
].
id
,
'1'
)
def
test_g
etUnique
UnmatchedResidues
(
self
):
def
test_g
generateTemplatesFor
UnmatchedResidues
(
self
):
"""Test
retrieval of list of residues for which no templates are available
."""
"""Test
generation of blank forcefield residue templates for unmatched residues
."""
#
#
# Test where we generate parameters for only a ligand.
# Test where we generate parameters for only a ligand.
#
#
...
@@ -377,12 +377,12 @@ class TestForceField(unittest.TestCase):
...
@@ -377,12 +377,12 @@ class TestForceField(unittest.TestCase):
forcefield
=
ForceField
(
'tip3p.xml'
)
forcefield
=
ForceField
(
'tip3p.xml'
)
# Get list of unmatched residues.
# Get list of unmatched residues.
unmatched_residues
=
forcefield
.
getUnmatchedResidues
(
pdb
.
topology
)
unmatched_residues
=
forcefield
.
getUnmatchedResidues
(
pdb
.
topology
)
[
unique_unmatched_residues
,
templates
]
=
forcefield
.
getUnique
UnmatchedResidues
(
pdb
.
topology
)
[
templates
,
residues
]
=
forcefield
.
generateTemplatesFor
UnmatchedResidues
(
pdb
.
topology
)
# Check results.
# Check results.
self
.
assertEqual
(
len
(
unmatched_residues
),
24
)
self
.
assertEqual
(
len
(
unmatched_residues
),
24
)
self
.
assertEqual
(
len
(
unique_unmatched_
residues
),
2
)
self
.
assertEqual
(
len
(
residues
),
2
)
self
.
assertEqual
(
len
(
templates
),
2
)
self
.
assertEqual
(
len
(
templates
),
2
)
unique_names
=
set
([
residue
.
name
for
residue
in
unique_unmatched_
residues
])
unique_names
=
set
([
residue
.
name
for
residue
in
residues
])
self
.
assertTrue
(
'HOH'
not
in
unique_names
)
self
.
assertTrue
(
'HOH'
not
in
unique_names
)
self
.
assertTrue
(
'NA'
in
unique_names
)
self
.
assertTrue
(
'NA'
in
unique_names
)
self
.
assertTrue
(
'CL'
in
unique_names
)
self
.
assertTrue
(
'CL'
in
unique_names
)
...
@@ -419,7 +419,7 @@ class TestForceField(unittest.TestCase):
...
@@ -419,7 +419,7 @@ class TestForceField(unittest.TestCase):
# Create a ForceField object.
# Create a ForceField object.
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.
[
residues
,
templat
es
]
=
forcefield
.
ge
tUnique
UnmatchedResidues
(
pdb
.
topology
)
[
templates
,
residu
es
]
=
forcefield
.
ge
nerateTemplatesFor
UnmatchedResidues
(
pdb
.
topology
)
# 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