Skip to content

feat: preserve constituent data in magnetic CIF exports - #20

Merged
lan496 merged 3 commits into
mainfrom
feat/mixed-cif-exports
Oct 12, 2026
Merged

lan496 merged 3 commits into
mainfrom
feat/mixed-cif-exports

Conversation

@lan496

@lan496 lan496 commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

Summary

Mixed magnetic sites could not be exported faithfully. Both writers now consume
ordinary pymatgen Structure data with complete constituent chemistry,
Cartesian magmom, and an optional boolean magnetic property. Use coincident
rows for partial magnetic selection. SpinCifWriter.from_structure matches
these rows to the SSA model and accepts proper or improper spin frames;
from_oriented preserves the supplied chemistry. Published array and occupancy
interfaces remain supported.

The reader preserves constituent rows, including unequal coincident moments and
explicit magnetic zeros. Writers group equivalent rows for their symmetry
backends and require a shared selected vector. Typed species identities and
lossless decimal output preserve fractional oxidation states, occupancies, weak
moments, and general-origin translations. Caller tolerances control position,
moment, and frame checks. Malformed loops and loss during pymatgen conversion
raise explicit errors.

Test plan

  • Full core suite: 269 passed.
  • All 122 MCIF/spinCIF tests passed under python -O.
  • Independent checks cover fractional-charge collisions, selected-zero
    read/write preservation, equivalent constituent partitions, trace occupancy
    loss, reordered SSA matching, legacy occupancy overrides, nonzero-k
    antitranslations, and proper/improper frames.
  • Strict translation reproduction now has zero displacement at
    symprec=1e-11, versus 4e-9 before replacement. Weak 1e-10 components
    survive serialization.
  • All pre-commit hooks passed; documented mixed-site example executed.

…orts

Co-Authored-By: Codex <noreply@openai.com>
@lan496
lan496 marked this pull request as ready for review October 12, 2026 11:45
@lan496 lan496 self-assigned this Oct 12, 2026
lan496 and others added 2 commits October 13, 2026 07:29
Co-Authored-By: Codex <noreply@openai.com>
Replace parallel chemistry arguments with Structure metadata, preserve reader rows, and honor caller tolerances through symmetry and serialization.

Co-Authored-By: Codex <noreply@openai.com>
@lan496 lan496 changed the title Preserve mixed sites and explicit spin frames in CIF exports feat: preserve constituent data in magnetic CIF exports Oct 12, 2026
@lan496
lan496 merged commit 9f4ab67 into main Oct 12, 2026
12 checks passed
@lan496
lan496 deleted the feat/mixed-cif-exports branch October 12, 2026 23:01
@github-actions github-actions Bot mentioned this pull request Sep 6, 2026
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.

1 participant