Skip to content

fix(match): Kabsch alignment for free frames and a ConFrame adapter - #1

Merged
HaoZeke merged 3 commits into
mainfrom
fix/kabsch-and-frames
Oct 11, 2026
Merged

HaoZeke merged 3 commits into
mainfrom
fix/kabsch-and-frames

Conversation

@HaoZeke

@HaoZeke HaoZeke commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

The old bond alignment left a twist about atoms 0 and 1 and skipped an antiparallel bond.
internal_motion now superimposes a non-periodic frame with a mass-weighted Kabsch rotation (Kabsch 1976), keeping a proper rotation through the determinant-sign guard.
Thirty random rigid motions are recovered to an unweighted RMSD below 1e-12 angstrom.
A collinear frame reports the undefined axis and does not choose a spin about it, including an antiparallel bond.
A periodic frame, including one with no pbc, loses only the mean minimum-image translation, and an open axis is not wrapped.
as_frame accepts a pyeonclient frame or a readcon.ConFrame.
CON v3.1 D4 and D12 apply here: a zero-atom frame is a legal input, missing pbc means periodic in all three directions, and lattice_vectors replace the length-angle cell.
The other CON decisions are codec rules, and this package does not read or write files.
The docs follow the tutorial, how-to, reference and explanation layout, and CI now runs pytest, ruff and the Sphinx build.
CI passed on 3a1a0c2 in https://github.com/lode-org/readcon-ops/actions/runs/38144354846.


Note

Medium Risk
internal_motion is a breaking behavioral change (return type and alignment math) for callers that relied on bond-based alignment or periodic rotation; extensive new tests mitigate regression risk.

Overview
Replaces the old two-atom bond alignment in internal_motion with mass-weighted Kabsch superposition for non-periodic frames, returning an AlignedFrame with rotation, rmsd, and undefined_axis for collinear/antiparallel cases. Periodic inputs (including missing pbc, CON D12) only remove the mean minimum-image translation; mixed pbc leaves open axes unwrapped.

Adds as_frame, Frame, and AlignedFrame in frames.py so identical, spacegroup, rotational_match, and alignment accept pyeonclient frames or readcon.ConFrame (cell/metadata pbc, lattice_vectors).

Ships Org-mode → Sphinx docs, CITATION.cff, ruff config, and GitHub Actions (pytest, ruff, docs build with pandoc export).

Reviewed by Cursor Bugbot for commit 3a1a0c2. Bugbot is set up for automated code reviews on this repo. Configure here.

The bond alignment left a twist about atoms 0 and 1 and skipped an antiparallel bond.
Non-periodic frames now use a weighted Kabsch SVD with the determinant-sign guard.
Collinear frames report the undefined axis and do not choose a spin about it.
Periodic frames lose only the mean minimum-image translation, and an open axis is not wrapped.
as_frame accepts a pyeonclient frame or a readcon.ConFrame.
D4: a zero-atom frame is a legal input.
D12: missing pbc is periodic, and lattice_vectors replace the length-angle cell.
D1, D2, D3, D5, D6, D7, D8, D9, D10, D11, D13, D14, D15, D16, and D17 are CON codec rules.
This package does not read or write a file.
The readme states that spacegroup calls spglib and cites the minimage commit pin.
Org sources follow the tutorial, how-to, reference, and explanation layout.
The citation page lists Rohit Goswami's papers first.
CITATION.cff records ORCID 0000-0002-2393-8056.
Exported rst is not committed.
Actions are pinned to commit SHAs.
The docs job exports org with pandoc and builds HTML with Sphinx.
@HaoZeke
HaoZeke merged commit 39787cc into main Oct 11, 2026
7 checks passed
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