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
213c77eb
Commit
213c77eb
authored
Jul 21, 2014
by
peastman
Browse files
Merge pull request #548 from peastman/master
Created ForceField.loadFile()
parents
8db70d34
039b53b8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
42 deletions
+54
-42
wrappers/python/simtk/openmm/app/forcefield.py
wrappers/python/simtk/openmm/app/forcefield.py
+54
-42
No files found.
wrappers/python/simtk/openmm/app/forcefield.py
View file @
213c77eb
...
...
@@ -100,7 +100,7 @@ class ForceField(object):
"""Load one or more XML files and create a ForceField object based on them.
Parameters:
- files A list of XML files defining the force field. Each entry may
- files
(list)
A list of XML files defining the force field. Each entry may
be an absolute file path, a path relative to the current working
directory, a path relative to this module's data subdirectory
(for built in force fields), or an open file-like object with a
...
...
@@ -113,6 +113,18 @@ class ForceField(object):
self
.
_forces
=
[]
self
.
_scripts
=
[]
for
file
in
files
:
self
.
loadFile
(
file
)
def
loadFile
(
self
,
file
):
"""Load an XML file and add the definitions from it to this FieldField.
Parameters:
- file (string or file) An XML file containing force field definitions. It may
be either an absolute file path, a path relative to the current working
directory, a path relative to this module's data subdirectory
(for built in force fields), or an open file-like object with a
read() method from which the forcefield XML data can be loaded.
"""
try
:
# this handles either filenames or open file-like objects
tree
=
etree
.
parse
(
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