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
ac27d6b7
Commit
ac27d6b7
authored
Apr 25, 2018
by
peastman
Browse files
Improved behavior of adding force field directories
parent
acc9e93a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
9 deletions
+15
-9
wrappers/python/simtk/openmm/app/forcefield.py
wrappers/python/simtk/openmm/app/forcefield.py
+15
-9
No files found.
wrappers/python/simtk/openmm/app/forcefield.py
View file @
ac27d6b7
...
...
@@ -6,7 +6,7 @@ Simbios, the NIH National Center for Physics-Based Simulation of
Biological Structures at Stanford, funded under the NIH Roadmap for
Medical Research, grant U54 GM072970. See https://simtk.org.
Portions copyright (c) 2012-201
7
Stanford University and the Authors.
Portions copyright (c) 2012-201
8
Stanford University and the Authors.
Authors: Peter Eastman, Mark Friedrichs
Contributors:
...
...
@@ -49,13 +49,19 @@ from simtk.openmm.app.internal.singleton import Singleton
# Directories from which to load built in force fields.
_dataDirectories
=
[
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'data'
)]
try
:
from
pkg_resources
import
iter_entry_points
for
entry
in
iter_entry_points
(
group
=
'openmm.forcefielddir'
):
_dataDirectories
.
append
(
entry
.
load
()())
except
:
pass
# pkg_resources is not installed
_dataDirectories
=
None
def
_getDataDirectories
():
global
_dataDirectories
if
_dataDirectories
is
None
:
_dataDirectories
=
[
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'data'
)]
try
:
from
pkg_resources
import
iter_entry_points
for
entry
in
iter_entry_points
(
group
=
'openmm.forcefielddir'
):
_dataDirectories
.
append
(
entry
.
load
()())
except
:
pass
# pkg_resources is not installed
return
_dataDirectories
def
_convertParameterToNumber
(
param
):
if
unit
.
is_quantity
(
param
):
...
...
@@ -205,7 +211,7 @@ class ForceField(object):
# this handles either filenames or open file-like objects
tree
=
etree
.
parse
(
file
)
except
IOError
:
for
dataDir
in
_
d
ataDirectories
:
for
dataDir
in
_
getD
ataDirectories
()
:
f
=
os
.
path
.
join
(
dataDir
,
file
)
if
os
.
path
.
isfile
(
f
):
tree
=
etree
.
parse
(
f
)
...
...
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