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
5fd130f4
Commit
5fd130f4
authored
Mar 27, 2012
by
Peter Eastman
Browse files
Support <Script> tag in force field files
parent
dce2d427
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
0 deletions
+11
-0
wrappers/python/simtk/openmm/app/forcefield.py
wrappers/python/simtk/openmm/app/forcefield.py
+11
-0
No files found.
wrappers/python/simtk/openmm/app/forcefield.py
View file @
5fd130f4
...
@@ -46,6 +46,7 @@ class ForceField(object):
...
@@ -46,6 +46,7 @@ class ForceField(object):
self
.
_templateSignatures
=
{
None
:[]}
self
.
_templateSignatures
=
{
None
:[]}
self
.
_atomClasses
=
{
''
:
set
()}
self
.
_atomClasses
=
{
''
:
set
()}
self
.
_forces
=
[]
self
.
_forces
=
[]
self
.
_scripts
=
[]
for
file
in
files
:
for
file
in
files
:
try
:
try
:
tree
=
etree
.
parse
(
file
)
tree
=
etree
.
parse
(
file
)
...
@@ -111,6 +112,11 @@ class ForceField(object):
...
@@ -111,6 +112,11 @@ class ForceField(object):
if
child
.
tag
in
parsers
:
if
child
.
tag
in
parsers
:
parsers
[
child
.
tag
](
child
,
self
)
parsers
[
child
.
tag
](
child
,
self
)
# Load scripts
for
node
in
tree
.
getroot
().
findall
(
'Script'
):
self
.
_scripts
.
append
(
node
.
text
)
def
_findAtomTypes
(
self
,
node
,
num
):
def
_findAtomTypes
(
self
,
node
,
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."""
types
=
[]
types
=
[]
...
@@ -397,6 +403,11 @@ class ForceField(object):
...
@@ -397,6 +403,11 @@ class ForceField(object):
force
.
createForce
(
sys
,
data
,
nonbondedMethod
,
nonbondedCutoff
,
args
)
force
.
createForce
(
sys
,
data
,
nonbondedMethod
,
nonbondedCutoff
,
args
)
if
removeCMMotion
:
if
removeCMMotion
:
sys
.
addForce
(
mm
.
CMMotionRemover
())
sys
.
addForce
(
mm
.
CMMotionRemover
())
# Execute scripts found in the XML files.
for
script
in
self
.
_scripts
:
exec
script
return
sys
return
sys
...
...
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