Skip to content

Commit 8049e6b

Browse files
test openmm flows for compat with newer mdanalysis
1 parent dffba1a commit 8049e6b

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ forcefields = [
6565
ase = ["ase>=3.23.0"]
6666
ase-ext = ["tblite>=0.3.0; platform_system=='Linux'"]
6767
openmm = [
68-
"mdanalysis>=2.7.0",
68+
"mdanalysis>=2.8.0",
6969
"openmm-mdanalysis-reporter>=0.1.0",
7070
"openmm>=8.1.0",
7171
]
@@ -122,7 +122,6 @@ strict-openff = [
122122
"openmm-mdanalysis-reporter==0.1.0",
123123
"openmm==8.1.1",
124124
"pymatgen==2024.11.13", # TODO: open ff is extremely sensitive to pymatgen version
125-
"mdanalysis==2.9.0"
126125
]
127126
strict-forcefields = [
128127
"calorine==3.0",

src/atomate2/openmm/jobs/base.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -317,12 +317,6 @@ def _add_reporters(
317317
if traj_file_type in ("h5md", "nc", "ncdf", "json"):
318318
writer_kwargs["velocities"] = report_velocities
319319
writer_kwargs["forces"] = False
320-
elif report_velocities and traj_file_type != "trr":
321-
raise ValueError(
322-
f"File type {traj_file_type} does not support velocities as"
323-
f"of MDAnalysis 2.7.0. Select another file type"
324-
f"or do not attempt to report velocities."
325-
)
326320

327321
traj_file = dir_name / f"{traj_file_name}.{traj_file_type}"
328322

@@ -341,15 +335,23 @@ def _add_reporters(
341335
else:
342336
if report_velocities:
343337
# assert package version
344-
345-
kwargs["writer_kwargs"] = writer_kwargs
346338
warnings.warn(
347339
"Reporting velocities is only supported with the"
348340
"development version of MDAnalysis, >= 2.8.0, "
349341
"proceed with caution.",
350342
stacklevel=1,
351343
)
352-
traj_reporter = MDAReporter(**kwargs)
344+
345+
try:
346+
traj_reporter = MDAReporter(**kwargs, writer_kwargs=writer_kwargs)
347+
except TypeError:
348+
warnings.warn(
349+
"The current version of `openmm-mdanalysis-reporter` "
350+
"does not support `writer_kwargs`. To use these features, "
351+
"pip install this package from the github source.",
352+
stacklevel=2,
353+
)
354+
traj_reporter = MDAReporter(**kwargs)
353355

354356
sim.reporters.append(traj_reporter)
355357

0 commit comments

Comments
 (0)