fix: respect property cadence during in-memory trajectory reporting

ZE
4d ago
+152-5

November 16 mainline integration

The November 16 revision 6cff69e48cfe includes main@e3edf1bb995c through a normal merge. The new mainline contribution rules are included and the trajectory/reporting implementation remains unchanged.

The November 16 merge did not rerun the runtime or device checks.

Summary

In-memory reporting currently runs every property calculator before filtering its returned values by frequency. Stateful calculators therefore consume off-grid simulation states. With a real LJ/NVE trajectory, frequency 3 and a VACF window of 4, the returned window counts at steps 0, 3, 6 and 9 are [0, 1, 1, 2], and the expected counts are [0, 0, 0, 1]. The in-memory path also drops force=True, so an off-grid forced report returns empty properties.

Check which systems are due before invoking each calculator. The public report(force=True) keyword passes bypass_cadence=True to the private batched path. A calculator runs once on the complete batch when any system is due, then its results are selected by each system's step. force=True returns all enabled properties, and frequency 0 remains disabled.

The batched fast path from #441 remains in place with no SimState.split() or calculator cloning. Partially due batches keep their existing single whole-batch callback semantics, and this change doesn't add independent per-system sampling clocks. File writing, append/truncation handling and the VACF algorithm stay unchanged.

Verification

On 745a79152eb7 (main@869fb7103961), all five reporter cadence cases passed on Linux with PyTorch 2.14.1+cpu. They include an off-grid forced report and a file-backed VACF comparison.

Earlier macOS checks

  • Five new persistent scenarios fail on main at b219bd037e290fda16f6bf867f805057f9f77870 and pass with this patch. They exercise real LJ/NVE integration, stateful VACF, single and multiple systems, file output and readback, partial cadence, forced output and disabled calculators.
  • The candidate's single-system VACF matches a file-backed reference. An additional unequal-size Ar3/Ar4 case matches a direct time-domain correlation calculation with a maximum absolute difference of approximately 1.11e-16, with window counts [[0,0], [0,0], [0,0], [1,1]].
  • Forced reporting at step 10 produces the expected properties and file steps [0, 3, 6, 9, 10]. Callback traces cover multiple frequencies and scalar, per-system and per-atom outputs, with zero state splitting.
  • The new scenarios plus trajectory and correlations regressions give 83 passed and 7 CUDA skips. The selected static-runner regressions give 6 passed and 32 deselected.
  • Ruff 0.17.1, ty 0.0.48, Python compilation and git diff --check pass.

Execution used macOS CPU, Python 3.12.14 and PyTorch 2.14.1. CUDA and the remaining platform/minimum-dependency matrix remain unrun. Three existing PyTables unclosed-file warnings also occur on the original revision, and the new scenarios close their files through ExitStack.

Checklist

  • Docstrings describe the cadence and force behavior in the existing Google format.
  • Ruff checks pass on the changed files.
  • Behavior scenarios cover the fixes and existing batch semantics.