Skip to content

BREAK: remove spin projections from states - #385

Open
grayson-helmholz wants to merge 8 commits into
two-to-n-topologiesfrom
remove-spin-projections
Open

grayson-helmholz wants to merge 8 commits into
two-to-n-topologiesfrom
remove-spin-projections

Conversation

@grayson-helmholz

@grayson-helmholz grayson-helmholz commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Interface changes

Spin projections disappear from the states, the settings, and the workflow. A transition now carries Particle instances on its edges, and the initial and final state are plain particle names. The projections are not lost as a concept: they can be re-enabled explicitly on a QNProblemSet, as the new usage/spin-projections page shows.

Old name New name
State removed, StateTransition is now a FrozenTransition[Particle, InteractionProperties]
StateDefinition, StateDefinitionInput, StateWithSpins removed, the initial and final state are sequences of particle names
as_state_definition(), to_state_definitions() removed
create_initial_facts(...) -> list[InitialFacts] create_initial_facts(...) -> InitialFacts, without expand_spin_projections
create_interaction_settings(formalism, ...) create_interaction_settings(..., ls_couplings=True)
create_edge_properties(particle, spin_projection) create_edge_properties(particle)
find_particle(...) -> ParticleWithSpin find_particle(...) -> Particle
strip_spin_projections() removed, problem sets no longer contain projections to strip
create_qn_problem_sets(spin_projections=..., merge_spin_projections=...) removed, ls_couplings takes their place
merge_qn_problem_sets(problem_sets, merge_qns=None) merge_qn_problem_sets(problem_sets, merge_qns), the quantum numbers are now required
qrules.io.build_state() removed, a serialized state is a particle

SpinFormalism no longer selects conservation rules or quantum-number domains. It only determines which interaction properties are kept in the output: "helicity" filters the $L$ and $S$ magnitudes from the nodes, while "canonical" and "canonical-helicity" keep them. As a consequence the default node settings no longer contain helicity_conservation, parity_conservation_helicity, clebsch_gordan_helicity_to_canonical, identical_particle_symmetrization, or ls_spin_validity, the edge settings no longer contain spin_validity, and there is no spin_projection or parity_prefactor domain.

✨ New features

  • generate_transitions(), generate_qn_transitions(), StateTransitionManager, create_qn_problem_sets(), and create_interaction_settings() take an ls_couplings argument. With ls_couplings=False the settings declare no $L$ and $S$ domains at all, so the solver never enumerates $LS$-combinations. The allowed combinations can be reconstructed from the spins and parities of the solutions afterwards.
  • That mode is backed by four new existence rules, SpinCoupling, SpinParityCoupling, CParityCoupling, and GParityCoupling. Rather than constraining a given $(L, S)$ pair, each checks whether some combination up to max_angular_momentum couples the spins, parities, $C$-parities, or $G$-parities of the node.
  • remove_dominated_qn_problem_sets() drops problem sets that cannot contribute solutions of their own. Problem sets with equal initial facts and equal domains solve over the same variables, so one whose rule sets contain another's can only yield a subset of that other's solutions. In practice this removes the interaction-type combinations that merely add rules on top of a weaker type, such as the strong settings extending the EM ones by isospin and $G$-parity conservation.
  • find_qn_transitions() takes a number_of_threads argument and solves the remaining problem sets over a process pool, defaulting to NumberOfThreads.

❗ Behavioral changes

  • collapse="spin" no longer means "combine transitions that differ only in their spin projections", since there are none. It now hides the interaction properties, such as the $LS$-couplings, and deduplicates the result, which leaves the unique graphs with particle names on their edges.
  • check_reaction_violations() no longer checks clebsch_gordan_helicity_to_canonical and identical_particle_symmetrization, which both need spin projections to be meaningful.
  • The CSPSolver initializes every edge and node of the topology in a solution, so a node for which nothing was solved (as happens with ls_couplings=False) still appears, with an empty property map.

⚙️ Enhancements

  • $C$- and $G$-parity conservation is checked for particle-antiparticle pairs even without explicit $LS$-couplings: CParityCoupling and GParityCoupling derive the composite parity of such a pair from the couplings that conserve parity, so these rules keep their discriminating power in the projection-free workflow.

📝 Documentation

  • New usage page usage/spin-projections, which shows how to put spin projections back into a QNProblemSet and solve with them, now that they are no longer part of the default workflow.
  • The usage/production page gains three-body double-exchange examples.

Squash commit messages

* BREAK: drop formalism argument from settings creation
* DOC: add notebook on re-enabling spin projections
* ENH: conserve C and G parity without LS couplings
* ENH: drop dominated QN problem sets before solving
* ENH: make enumeration of LS couplings optional
* ENH: solve QN problem sets in parallel
* FEAT: add SpinCoupling and parity coupling rules

@redeboer
redeboer added this pull request to stack #386 September 15, 2026 14:29
@redeboer redeboer changed the title BREAK: remove spin projections from states and workflow BREAK: remove spin projections from states Sep 15, 2026
@redeboer redeboer added ⚙️ Enhancement Improvements and optimizations of existing features ❗ Behavior Changes that may affect the framework output ✨ Feature New feature added to the package 📝 Docs Improvements or additions to documentation ⚠️ Interface Breaking changes to the API labels Sep 15, 2026
@redeboer redeboer added this to the 0.11.0 milestone Sep 15, 2026
@redeboer
redeboer self-requested a review September 15, 2026 14:41

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

❗ Behavior Changes that may affect the framework output 📝 Docs Improvements or additions to documentation ⚙️ Enhancement Improvements and optimizations of existing features ✨ Feature New feature added to the package ⚠️ Interface Breaking changes to the API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove formalism type from QRules

2 participants