fix(lammps): emit valid spin atom style sections#1032
Conversation
Mark data files with spin vectors as Atoms # spin and teach automatic parsing about the official spin atom style. Add a LAMMPS integration regression; the previous test only inspected text while the atomic header made LAMMPS reject the extra columns. Coding-Agent: Codex Codex-Version: codex-cli 0.144.4 Model: gpt-5.6-sol Reasoning-Effort: xhigh
|
Warning Review limit reached
Next review available in: 59 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Merging this PR will not alter performance
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1032 +/- ##
=======================================
Coverage 86.87% 86.87%
=======================================
Files 89 89
Lines 8266 8269 +3
=======================================
+ Hits 7181 7184 +3
Misses 1085 1085 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
wanghan-iapcm
left a comment
There was a problem hiding this comment.
The #885 fix looks correct and matches LAMMPS's atom_style spin layout (id type x y z spx spy spz sp), and the assertIn("Atoms # spin", ...) test genuinely fails on pre-fix code (which emitted # atomic). One coordination note with the open PR #1020, which modifies the same get_spins guard -- see inline.
|
|
||
|
|
||
| def get_spins(lines: list[str], atom_style: str = "atomic") -> np.ndarray | None: | ||
| if atom_style not in {"atomic", "spin"}: |
There was a problem hiding this comment.
Heads-up: the still-open PR #1020 (fix/issue-995) adds this exact guard (if atom_style not in {"atomic", "spin"}: return None) -- only the comment placement differs. They branch from a shared merge-base, so git merge-tree shows one add/add conflict right here; whichever of #1020 / #1032 merges second will hit it (cosmetic -- identical logic).
This PR is the natural completion of #1020: #1020's whitelist references "spin" but never registered it in ATOM_STYLE_COLUMNS, so that arm was dead code -- the "spin" entry added here (line 25) makes it live, and emitting Atoms # spin fixes the # spin-labeled-file regression #1020 introduced. Suggest sequencing them: merge one, then rebase the other and drop the duplicate guard hunk (keep #1020's detect_atom_style neutral-charge fix + tests, keep #1032's dict entry + writer).
There was a problem hiding this comment.
Agreed on the sequencing. No code change is appropriate until either #1020 or #1032 merges. After the first PR lands, the other branch should be rebased and the duplicate get_spins guard hunk dropped while preserving #1020's detection fixes and #1032's real spin-style definition and writer support. I am leaving this thread unresolved until that coordination step can be completed.
Coding agent: Codex
Codex version: codex-cli 0.144.6
Model: gpt-5.6-sol
Reasoning effort: xhigh
Fixes #885.
Mark spin-vector data as
Atoms # spin, support automatic spin-style parsing, and validate the generated file with LAMMPS.Tests:
cd tests && python -m unittest test_lammps_spin(LAMMPS integration skips when the executable/package is unavailable).Why existing tests missed it: The previous test only inspected text; it emitted nine-column spin rows under an atomic-style header that LAMMPS rejects.
Coding agent: Codex
Codex version: codex-cli 0.144.4
Model: gpt-5.6-sol
Reasoning effort: xhigh