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
4111024b
"platforms/reference/src/SimTKReference/ReferencePME.cpp" did not exist on "351f64554e874d37e79b0c7e73cd2d9d848737c1"
Commit
4111024b
authored
Nov 22, 2017
by
peastman
Browse files
Improvement to processing of includes in force fields
parent
b7fbe622
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
14 deletions
+13
-14
docs-source/usersguide/application.rst
docs-source/usersguide/application.rst
+0
-6
wrappers/python/simtk/openmm/app/forcefield.py
wrappers/python/simtk/openmm/app/forcefield.py
+13
-8
No files found.
docs-source/usersguide/application.rst
View file @
4111024b
...
...
@@ -2959,12 +2959,6 @@ relative either to the directory containing the parent XML file (the one with
the
:
code
:`<
Include
>`
tag
)
or
the
OpenMM
data
directory
(
the
one
containing
built
in
force
fields
).
The
included
file
is
fully
processed
before
any
other
tags
in
the
parent
file
are
processed
,
and
its
definitions
are
added
to
the
force
field
.
This
means
the
parent
file
can
refer
to
atom
types
defined
in
the
included
file
,
but
not
the
other
way
around
.
If
there
are
multiple
:
code
:`<
Include
>`
tags
,
they
are
processed
in
the
order
they
appear
in
the
file
.
Using
Multiple
Files
********************
...
...
wrappers/python/simtk/openmm/app/forcefield.py
View file @
4111024b
...
...
@@ -190,12 +190,16 @@ class ForceField(object):
method from which the forcefield XML data can be loaded.
"""
if
not
isinstance
(
files
,
tuple
):
files
=
(
files
,)
if
isinstance
(
files
,
tuple
):
files
=
list
(
files
)
else
:
files
=
[
files
]
trees
=
[]
for
file
in
files
:
i
=
0
while
i
<
len
(
files
):
file
=
files
[
i
]
tree
=
None
try
:
# this handles either filenames or open file-like objects
...
...
@@ -221,12 +225,12 @@ class ForceField(object):
raise
ValueError
(
'Could not locate file "%s"'
%
file
)
trees
.
append
(
tree
)
i
+=
1
# Process includes.
# Process includes
in this file
.
for
parentFile
,
tree
in
zip
(
files
,
trees
):
if
isinstance
(
parentFile
,
str
):
parentDir
=
os
.
path
.
dirname
(
parentFile
)
if
isinstance
(
file
,
str
):
parentDir
=
os
.
path
.
dirname
(
file
)
else
:
parentDir
=
''
for
include
in
tree
.
getroot
().
findall
(
'Include'
):
...
...
@@ -234,7 +238,8 @@ class ForceField(object):
joined
=
os
.
path
.
join
(
parentDir
,
includeFile
)
if
os
.
path
.
isfile
(
joined
):
includeFile
=
joined
self
.
loadFile
(
includeFile
)
if
includeFile
not
in
files
:
files
.
append
(
includeFile
)
# Load the 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