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
58b2a321
Commit
58b2a321
authored
Jun 05, 2025
by
Evan Pretti
Browse files
Add test case for relative import within data directory
parent
d942cf62
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
0 deletions
+19
-0
wrappers/python/tests/TestForceField.py
wrappers/python/tests/TestForceField.py
+19
-0
No files found.
wrappers/python/tests/TestForceField.py
View file @
58b2a321
...
@@ -6,6 +6,8 @@ from openmm.unit import *
...
@@ -6,6 +6,8 @@ from openmm.unit import *
import
openmm.app.element
as
elem
import
openmm.app.element
as
elem
import
openmm.app.forcefield
as
forcefield
import
openmm.app.forcefield
as
forcefield
import
math
import
math
import
shutil
import
tempfile
import
textwrap
import
textwrap
try
:
try
:
from
cStringIO
import
StringIO
from
cStringIO
import
StringIO
...
@@ -1254,6 +1256,23 @@ class TestForceField(unittest.TestCase):
...
@@ -1254,6 +1256,23 @@ class TestForceField(unittest.TestCase):
self
.
assertTrue
(
'spce-O'
in
forcefield
.
_atomTypes
)
self
.
assertTrue
(
'spce-O'
in
forcefield
.
_atomTypes
)
self
.
assertTrue
(
'HOH'
in
forcefield
.
_templates
)
self
.
assertTrue
(
'HOH'
in
forcefield
.
_templates
)
def
test_IncludesFromDataDirectory
(
self
):
"""Test relative include paths from subdirectories of the data directory."""
oldDataDirs
=
forcefield
.
_dataDirectories
try
:
with
tempfile
.
TemporaryDirectory
()
as
tempDataDir
:
forcefield
.
_dataDirectories
=
forcefield
.
_getDataDirectories
()
+
[
tempDataDir
]
os
.
mkdir
(
os
.
path
.
join
(
tempDataDir
,
'subdir'
))
for
testFileName
in
[
'ff_with_includes.xml'
,
'test_amber_ff.xml'
]:
shutil
.
copyfile
(
os
.
path
.
join
(
'systems'
,
testFileName
),
os
.
path
.
join
(
tempDataDir
,
'subdir'
,
testFileName
))
ff
=
ForceField
(
os
.
path
.
join
(
'subdir'
,
'ff_with_includes.xml'
))
self
.
assertTrue
(
len
(
ff
.
_atomTypes
)
>
10
)
self
.
assertTrue
(
'spce-O'
in
ff
.
_atomTypes
)
self
.
assertTrue
(
'HOH'
in
ff
.
_templates
)
finally
:
forcefield
.
_dataDirectories
=
oldDataDirs
def
test_ImpropersOrdering
(
self
):
def
test_ImpropersOrdering
(
self
):
"""Test correctness of the ordering of atom indexes in improper torsions
"""Test correctness of the ordering of atom indexes in improper torsions
and the torsion.ordering parameter.
and the torsion.ordering parameter.
...
...
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