Skip to content

fix: respect property cadence during in-memory trajectory reporting - #646

Open
ZenAlexa wants to merge 3 commits into
TorchSim:mainfrom
ZenAlexa:contrib/reporter-cadence
Open

ZenAlexa wants to merge 3 commits into
TorchSim:mainfrom
ZenAlexa:contrib/reporter-cadence

Conversation

@ZenAlexa

@ZenAlexa ZenAlexa commented Nov 14, 2026 •

Copy link
Copy Markdown

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.

View guided diff

Copilot AI balanced review requested due to automatic review settings November 14, 2026 08:26

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Shadow auto-approve: would not auto-approve. Auto-approval skipped because this PR is from an external contributor.

View guided diff | Re-trigger cubic

@ZenAlexa ZenAlexa changed the title respect property cadence during in-memory trajectory reporting fix: respect property cadence during in-memory trajectory reporting Nov 16, 2026
Comment thread torch_sim/trajectory.py Resolved
Signed-off-by: Ziming Wang <zimingwang945@gmail.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants