Skip to content

Commit 399c82c

Browse files
committed
Use NPT_MTK and very_slow marker in WiSE MD reference
- Switch NPT (Melchionna) -> NPT_MTK (Martyna-Tobias-Klein) so the janus reference matches the LAMMPS fix npt formulation used in production. Pass thermostat_chain=3 and barostat_chain=3 explicitly, matching the LAMMPS default chain length. - Replace pytest.mark.skip with pytest.mark.very_slow per Joseph's review on PR ddmms#445: the reference protocol is now opt-in via --run-very-slow rather than unconditionally skipped, so it can be exercised when validating new models.
1 parent 916485b commit 399c82c

1 file changed

Lines changed: 23 additions & 20 deletions

File tree

ml_peg/calcs/wise_electrolytes/md_reference/calc_md_reference.py

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,22 @@
22
Reference MD protocol for the WiSE 21 m LiTFSI/H2O benchmark.
33
44
This script reproduces, with janus-core, the same MD protocol used to
5-
generate the production trajectories analysed by the density, rdf, and
6-
xray_sf sub-benchmarks. Production trajectories were run externally
5+
generate the production trajectories analysed by the consolidated
6+
litfsi_h2o_21m benchmark. Production trajectories were run externally
77
with LAMMPS + MACE (symmetrix/Kokkos) on Adastra (MI250X); the driving
88
scripts are ``in.pipeline_cpu.lmp`` (Min -> NVT -> NPT) and
99
``in.nvt_continue.lmp`` (NVT continuation) on the Adastra workdir.
1010
11-
The protocol is recast here for:
11+
Integrators are matched to LAMMPS where janus-core exposes a choice:
1212
13-
* transparent, version-pinned documentation of the simulation settings,
14-
* optional ml-peg-native replication on smaller systems or shorter windows.
13+
* NVT: Nosé-Hoover chain (``NVT_NH``) -- equivalent to LAMMPS ``fix nvt``.
14+
* NPT: Martyna-Tobias-Klein chain (``NPT_MTK``) -- the same formulation
15+
used by LAMMPS ``fix npt``. (``NPT`` in janus is Melchionna and would
16+
*not* match.)
1517
16-
It is intentionally marked ``pytest.mark.skip`` in the default test run:
17-
at ~1500 atoms and 250+ ps of cumulative MD, a Janus/ASE run would take
18-
days of GPU time per registered model. Run manually with
18+
The protocol is intentionally marked ``pytest.mark.very_slow``: at ~1500
19+
atoms and 250+ ps of cumulative MD, an ASE/Janus run takes a day of GPU
20+
time per registered model. Run manually with
1921
2022
python calc_md_reference.py <model_name>
2123
@@ -24,12 +26,14 @@
2426
Protocol summary
2527
----------------
2628
System : 64 LiTFSI + 170 H2O (1534 atoms, 21 m)
27-
Ensembles : Min (FIRE) -> NVT 50 ps (NH) -> NPT 200 ps (NH, iso) ->
28-
optional NVT continuation 50 ps (NH)
29+
Ensembles : Min (FIRE) -> NVT 50 ps (NH chain) ->
30+
NPT 200 ps (MTK chain, iso) ->
31+
optional NVT continuation 50 ps (NH chain)
2932
Temperature: 298.15 K
3033
Pressure : 1.01325 bar (1 atm)
3134
Timestep : 0.5 fs
3235
TDAMP/PDAMP: 50 fs / 500 fs (100*dt / 1000*dt, Nosé-Hoover damping)
36+
NH chains : length 3 for both thermostat and barostat (LAMMPS default)
3337
Dump cadence: every 0.1 ps (= 200 steps)
3438
References : Gilbert et al., JCED 62, 2056 (2017);
3539
Watanabe et al., JPCB 125, 7477 (2021).
@@ -133,7 +137,7 @@ def run_reference_md(
133137
# Lazy imports: janus_core pulls in torch, which may be absent in
134138
# environments that only run the analysis stack.
135139
from janus_core.calculations.geom_opt import GeomOpt
136-
from janus_core.calculations.md import NPT, NVT_NH
140+
from janus_core.calculations.md import NPT_MTK, NVT_NH
137141

138142
model.default_dtype = "float64"
139143
calc = model.get_calculator()
@@ -167,15 +171,20 @@ def run_reference_md(
167171
file_prefix=model_out / "nvt_equil",
168172
).run()
169173

170-
# -- NPT production, 200 ps (isotropic Nosé-Hoover; density sampling) -----
171-
NPT(
174+
# -- NPT production, 200 ps (isotropic MTK chain; density + structure) ----
175+
# NPT_MTK uses the Martyna-Tobias-Klein chain integrator -- the same
176+
# formulation as LAMMPS `fix npt iso`. Chain length 3 is the LAMMPS
177+
# default for both the thermostat and barostat sub-chains.
178+
NPT_MTK(
172179
struct=struct,
173180
temp=TEMPERATURE_K,
174181
pressure=PRESSURE_GPA,
175182
timestep=TIMESTEP_FS,
176183
steps=NPT_STEPS,
177184
thermostat_time=THERMOSTAT_TIME_FS,
178185
barostat_time=BAROSTAT_TIME_FS,
186+
thermostat_chain=3,
187+
barostat_chain=3,
179188
stats_every=STATS_EVERY,
180189
traj_every=TRAJ_EVERY,
181190
seed=SEED,
@@ -197,13 +206,7 @@ def run_reference_md(
197206
).run()
198207

199208

200-
@pytest.mark.skip(
201-
reason=(
202-
"Reference protocol only — production MD is run externally with "
203-
"LAMMPS+symmetrix on Adastra (see module docstring). Running this in "
204-
"pytest would take days of GPU per model."
205-
)
206-
)
209+
@pytest.mark.very_slow
207210
@pytest.mark.parametrize("mlip", MODELS.items())
208211
def test_md_reference(mlip: tuple[str, Any]) -> None:
209212
"""

0 commit comments

Comments
 (0)