Skip to content

Commit 656a22e

Browse files
committed
Merge branch 'main' of github.com:openpathsampling/openpathsampling-cli into sim-setup
2 parents 59b890c + 8217eea commit 656a22e

6 files changed

Lines changed: 53 additions & 13 deletions

File tree

‎paths_cli/commands/contents.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,16 @@
2525

2626
@click.command(
2727
'contents',
28-
short_help="list named objects from an OPS .nc file",
28+
short_help="list named objects from an OPS storage file",
2929
)
3030
@INPUT_FILE.clicked(required=True)
3131
@click.option('--table', type=str, required=False,
3232
help="table to show results from")
3333
def contents(input_file, table):
34-
"""List the names of named objects in an OPS .nc file.
34+
"""List the names of named objects in an OPS storage file.
3535
36-
This is particularly useful when getting ready to use one of simulation
37-
scripts (i.e., to identify exactly how a state or engine is named.)
36+
This is particularly useful when getting ready to use a simulation
37+
command (i.e., to identify exactly how a state or engine is named.)
3838
"""
3939
storage = INPUT_FILE.get(input_file)
4040
print(storage)

‎paths_cli/param_core.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ def get(self, storage, name):
309309
if name is None:
310310
msg = "Couldn't guess which item to use from " + self.store
311311
else:
312-
msg = "Couldn't find {name} is {store}".format(
312+
msg = "Couldn't find {name} in {store}".format(
313313
name=name,
314314
store=self.store
315315
)

‎paths_cli/parameters.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
OUTPUT_FILE = StorageLoader(
9797
param=Option('-o', '--output-file',
9898
type=click.Path(writable=True),
99-
help="output ncfile"),
99+
help="output file"),
100100
mode='w'
101101
)
102102

‎paths_cli/tests/wizard/conftest.py‎

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,31 @@
33
import openpathsampling as paths
44
import mdtraj as md
55

6+
# should be able to remove this try block when we drop OpenMM < 7.6
7+
try:
8+
import openmm as mm
9+
from openmm import unit as u
10+
except ImportError:
11+
try:
12+
from simtk import openmm as mm
13+
from simtk import unit as u
14+
except ImportError:
15+
HAS_OPENMM = False
16+
else: # -no-cov-
17+
HAS_OPENMM = True
18+
else:
19+
HAS_OPENMM = True
20+
621
@pytest.fixture
722
def ad_openmm(tmpdir):
823
"""
924
Provide directory with files to start alanine depeptide sim in OpenMM
1025
"""
11-
mm = pytest.importorskip('simtk.openmm')
12-
u = pytest.importorskip('simtk.unit')
26+
# switch back to importorskip when we drop OpenMM < 7.6
27+
if not HAS_OPENMM:
28+
pytest.skip("could not import openmm")
29+
# mm = pytest.importorskip('simtk.openmm')
30+
# u = pytest.importorskip('simtk.unit')
1331
openmmtools = pytest.importorskip('openmmtools')
1432
md = pytest.importorskip('mdtraj')
1533
testsystem = openmmtools.testsystems.AlanineDipeptideVacuum()

‎paths_cli/tests/wizard/test_openmm.py‎

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,28 @@
88
_load_openmm_xml, _load_topology, openmm, OPENMM_SERIALIZATION_URL
99
)
1010

11+
# should be able to remove this try block when we drop OpenMM < 7.6
12+
try:
13+
import openmm as mm
14+
except ImportError:
15+
try:
16+
from simtk import openmm as mm
17+
except ImportError:
18+
HAS_OPENMM = False
19+
else:
20+
HAS_OPENMM = True # -no-cov-
21+
else:
22+
HAS_OPENMM = True
23+
1124
def test_helper_url():
1225
assert_url(OPENMM_SERIALIZATION_URL)
1326

1427
@pytest.mark.parametrize('obj_type', ['system', 'integrator', 'foo'])
1528
def test_load_openmm_xml(ad_openmm, obj_type):
16-
mm = pytest.importorskip('simtk.openmm')
29+
# switch back to importorskip when we drop OpenMM < 7.6
30+
if not HAS_OPENMM:
31+
pytest.skip("could not import openmm")
32+
# mm = pytest.importorskip("simtk.openmm")
1733
filename = f"{obj_type}.xml"
1834
inputs = [filename]
1935
expected_count = 1

‎paths_cli/wizard/openmm.py‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
11
from paths_cli.wizard.errors import FILE_LOADING_ERROR_MSG, not_installed
22
from paths_cli.wizard.core import get_object
3+
4+
# should be able to simplify this try block when we drop OpenMM < 7.6
35
try:
4-
from simtk import openmm as mm
5-
import mdtraj as md
6+
import openmm as mm
67
except ImportError:
7-
HAS_OPENMM = False
8+
try:
9+
from simtk import openmm as mm
10+
except ImportError:
11+
HAS_OPENMM = False
12+
else: # -no-cov-
13+
HAS_OPENMM = True
814
else:
915
HAS_OPENMM = True
1016

1117
OPENMM_SERIALIZATION_URL=(
1218
"http://docs.openmm.org/latest/api-python/generated/"
13-
"simtk.openmm.openmm.XmlSerializer.html"
19+
"openmm.openmm.XmlSerializer.html"
1420
)
1521

1622
def _openmm_serialization_helper(wizard, user_input): # no-cov

0 commit comments

Comments
 (0)