Skip to content

FEAT: build topologies for 2-to-n reactions - #384

Open
grayson-helmholz wants to merge 9 commits into
qn-reaction-infofrom
two-to-n-topologies
Open

grayson-helmholz wants to merge 9 commits into
qn-reaction-infofrom
two-to-n-topologies

Conversation

@grayson-helmholz

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

Copy link
Copy Markdown
Contributor

✨ New features

  • create_isobar_topologies() takes a number_of_initial_states argument. With more than one initial state it builds from $1 \to 2$ decay nodes and $2 \to 1$ production nodes, which yields both $s$-channel topologies, where the initial states annihilate into a single intermediate edge, and $t$- or $u$-channel-like topologies, where they are connected through an exchange edge. See #29. The builder prunes branches that can no longer reach the requested number of final states and rejects node attachments that would create a cycle, which is what keeps the search finite once $2 \to 1$ building blocks are in the node set. Isomorphic topologies are removed from the result.
  • determine_mandelstam_channel() labels an intermediate edge as $s$, $t$, or $u$ by cutting it and inspecting on which side the initial and final states end up, following the convention $t = (p_1 - p_3)^2$ and $u = (p_1 - p_4)^2$. determine_reaction_channel() summarizes a whole topology as a single label, such as "s", "t", or "tt" for a double exchange.
  • ReactionInfo.group_by_channel() and QNReactionInfo.group_by_channel() group transitions by that label, next to the existing group_by_topology().
  • create_problem_sets(), create_qn_problem_sets(), and generate_qn_transitions() accept allowed_channels (for instance ["s"] or ["t", "u"]) to restrict the problem sets to specific Mandelstam channels. The selection is normalized and validated, so a typo raises a ValueError instead of silently matching nothing.
  • The new edge rule g_parity_validity checks that a $G$-parity is consistent with isospin and $C$-parity: it is defined only for integer isospin and satisfies $G = C \cdot (-1)^I$ for the neutral member of the multiplet. For charged states the relation cannot be checked, since their $C$-parity is undefined.

❗ Behavioral changes

  • g_parity_validity is part of the default edge settings, with a priority just below isospin_validity. States whose declared $G$-parity contradicts their isospin and $C$-parity are therefore rejected, where they previously passed.
  • Mass conservation is switched off whenever there is more than one initial state, instead of only when an n-body topology is requested. A production reaction has no well-defined decaying mass, so the rule would reject valid transitions.

🐛 Bug fixes

  • get_originating_node_list() dropped node 0, because it filtered on the truthiness of the node ID rather than on None. This went unnoticed while every topology was a decay chain, but it misgroups the symmetric combinations that the topology builder has to skip.
  • create_initial_facts() assigns the initial and final states to the sorted incoming and outgoing edge IDs. The sets that Topology exposes have no guaranteed iteration order, so the states could otherwise end up on the wrong edges.
  • The conservation rules that assumed a $1 \to 2$ node now also handle the mirrored $2 \to 1$ production node: parity_conservation, parity_conservation_helicity, clebsch_gordan_helicity_to_canonical, and helicity_conservation. In each case the single state and the two-body pair swap roles, and the equation is unchanged, since the $(-1)^L$ factor and the helicity difference both originate from the two-body side. helicity_conservation now requires the spin magnitude on both sides, so that it can read the parent spin from either.

⚙️ Enhancements

  • When collapsing transitions by topology, a quantum-number property map is replaced by a QuantumNumberSignature only after maps that are subsumed by a more determined one are dropped, so a collapsed edge label stays minimal. The signature takes over the $C$-parity only for self-conjugate states and the $G$-parity only for nonstrange non-baryonic states, since those quantum numbers are undefined otherwise.
  • The DOT output aligns the two vertices of each exchange edge at the same rank. Without that constraint, Graphviz draws a $t$- or $u$-channel exchange as if it were time-ordered like a decay chain.

📝 Documentation

  • New usage page usage/production, which walks through a $\gamma p \to p \pi^0$ reaction: building 2-to-n topologies, reading the Mandelstam channels, and restricting the generated transitions to a channel selection.

Squash commit messages

* BEHAVIOR: add g_parity_validity to edge settings
* BEHAVIOR: disable mass conservation for 2 initial states
* DOC: add notebook on production reactions
* ENH: align exchange vertices in DOT rendering
* ENH: render minimal quantum-number signatures
* FEAT: add allowed_channels argument
* FEAT: add group_by_channel methods
* FEAT: classify transitions by Mandelstam channel
* FIX: assign initial facts to sorted edge IDs
* FIX: generalize conservation rules to production nodes
* FIX: keep node 0 in get_originating_node_list

@redeboer
redeboer added this pull request to stack #386 September 15, 2026 14:29
@redeboer redeboer added 📝 Docs Improvements or additions to documentation ❗ Behavior Changes that may affect the framework output ⚙️ Enhancement Improvements and optimizations of existing features ✨ Feature New feature added to the package 🐛 Bug Something isn't working labels Sep 15, 2026
@redeboer
redeboer self-requested a review September 15, 2026 14:41
@redeboer redeboer added this to the 0.11.0 milestone Sep 15, 2026

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 🐛 Bug Something isn't working 📝 Docs Improvements or additions to documentation ⚙️ Enhancement Improvements and optimizations of existing features ✨ Feature New feature added to the package

Projects

None yet

2 participants