fix: conjugate right operand in co-rep a0.u construction#289
Conversation
The co-rep multiplication law Gamma(a) . Gamma(u)^* = omega(a, u) . Gamma(a.u)
(a anti-linear, u in D) gives Gamma(a.u) = conj(omega(a, u)) . U . conj(Gamma(u))
once |omega| = 1 is used -- an assumption that holds for every factor system
spgrep builds (non-symmorphic exp(-2pi i g.w) is unit-modulus; spinor factor
takes values in {-1, +1}).
All three xi in {+1, -1, 0} branches of
`_enumerate_small_corepresentations_with_factor_system` applied the right
operand without the complex conjugation, violating the co-rep law whenever
the underlying unitary-subgroup irrep Gamma(u) has non-real entries. The
spinor path `enumerate_spinor_small_corepresentations` reuses this helper, so
the bug affected it too.
The bug was invisible to the existing tests because every fixture happened to
produce real Gamma(u) matrices; conj(Gamma(u)) = Gamma(u) masked the
error. SG 221 Pm-3m at k = (1/4, 1/4, 1/4) with the 2-dim E irrep of D_3
triggers it (72/144 pairs fail before the fix).
- `src/spgrep/corep.py`: add `np.conj(...)` on the right operand in all
three xi branches.
- `docs/formulation/irreps/corep.md`: add `^*` on Gamma-tilde(u) in each
Gamma-tilde(a_0 u) formula to match the corrected code.
- `tests/test_corep.py`: add `_assert_corep_composition_law` helper; add
`test_corep_composition_law_pm3m_lambda` regression using the reproducer
from the issue; extend spinor co-rep test to assert the composition law
on every produced co-irrep.
Address PR review: identify the group by ITA number rather than the Hermann-Mauguin symbol in both the test name and docstring.
Add the standard Keep a Changelog preamble and restructure the Unreleased section into the conventional categorized subsections (Added, Changed, Fixed, ...). Historical version entries are left untouched.
Update the release-workflow note to mention the Unreleased-section pattern introduced with the Keep a Changelog format. Add two conventions: changelog format/policy, and the co-representation multiplication-law rule that explains why the right operand is conjugated in `corep.py`.
There was a problem hiding this comment.
Pull request overview
Fixes co-representation construction in spgrep.corep by correctly complex-conjugating the right operand in the anti-linear multiplication rule, and adds documentation + regression tests to prevent recurrence.
Changes:
- Correct
_enumerate_small_corepresentations_with_factor_systemto use@ np.conj(...)when formingΓ(a₀u)across all Frobenius–Schur indicator branches. - Add/extend tests to assert the co-representation multiplication law (including a targeted non-real irrep regression for SG 221 at k = (1/4,1/4,1/4)).
- Update theory docs and changelog/release guidance to reflect the correct
Γ(u)^*convention and Keep-a-Changelog structure.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src/spgrep/corep.py |
Fixes the co-rep extension formula by conjugating the right operand for anti-linear composition. |
tests/test_corep.py |
Adds a reusable assertion for the co-rep law and introduces a regression test that fails without the fix. |
docs/formulation/irreps/corep.md |
Updates formulas to include the required conjugation on \tilde{\Gamma}(u). |
docs/changelog.md |
Adds an Unreleased/Fixed entry describing the bug fix under Keep a Changelog structure. |
CLAUDE.md |
Updates release instructions and documents the co-representation multiplication convention used in the codebase. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Codex Review: Didn't find any major issues. Breezy! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
_enumerate_small_corepresentations_with_factor_system: the right operand was applied without complex conjugation, violating the co-rep multiplication lawΓ(a) · Γ(u)^* = ω(a, u) · Γ(a · u)whenever the unitary-subgroup irrepΓ(u)has non-real entries. Solving forΓ(a · u)with|ω| = 1(unit-modulus for every factor system spgrep builds) givesconj(ω(a, u)) · U · conj(Γ(u)).enumerate_spinor_small_corepresentationsreuses this helper, so the same bug affected the spinor path.docs/formulation/irreps/corep.mdby adding^*onΓ̃(u)in eachΓ̃(a₀u)formula.Γ(u)matrices (soconj(Γ(u)) = Γ(u)masked the error). A dedicated test on SG 221 Pm-3m atk = (1/4, 1/4, 1/4)-- where the 2-dimEirrep ofD₃appears and is non-real -- reproduces the bug (72/144 pairs fail before the fix). The spinor co-rep test is also extended to assert the multiplication law on every co-irrep it produces.Test plan
uv run pytest tests/test_corep.py-- new regression passes; extended spinor test still passes.uv run pytest tests/-- full suite (132 passed, 1 skipped).prek run --files src/spgrep/corep.py tests/test_corep.py docs/formulation/irreps/corep.md-- ruff / mypy / format clean.uv run sphinx-build docs docs_build) shows no new warnings.[Claude Code] Generated with Claude Code