conservation_rules¶
import qrules.conservation_rules
Collection of quantum number conservation rules for particle reactions.
This module is the place where the ‘expert’ defines the rules that verify quantum numbers of the reaction.
A rule is a function that takes quantum numbers as input and outputs a boolean. There are three different types of rules:
GraphElementRule
that work on individual graph edges or nodes.EdgeQNConservationRule
that work on the interaction level, which use ingoing edges, outgoing edges as arguments. E.g.:ChargeConservation
.ConservationRule
that work on the interaction level, which use ingoing edges, outgoing edges and a interaction node as arguments. E.g:parity_conservation
.
The arguments can be any type of quantum number. However a rule argument
resembling edges only accepts EdgeQuantumNumbers
. Similarly
arguments that resemble a node only accept
NodeQuantumNumbers
. The argument types do not have to be
limited to a single quantum number, but can be a composite (see
CParityEdgeInput
).
Warning
Besides the rule logic itself, a rule also has the responsibility of
stating its run conditions. These run conditions must be stated by
the type annotations of its __call__
method. The type annotations
therefore are not just there for static type checking: they also
carry more information about the rule that is extracted dynamically
by the solving
module.
Generally, the conditions can be separated into two categories:
variable conditions
toplogical conditions
Currently, only variable conditions are being used. Topological conditions
could be created in the form of Tuple
instead of List
.
For additive quantum numbers, the decorator additive_quantum_number_rule
can be used to automatically generate the appropriate behavior.
The module is therefore strongly typed (both
for the reader of the code and for type checking with mypy). An example is HelicityParityEdgeInput
, which has been
defined to provide type checks on parity_conservation_helicity
.
-
class
BaryonNumberConservation
(*args, **kwargs)[source]¶ Bases:
qrules.conservation_rules.EdgeQNConservationRule
Decorated via
additive_quantum_number_rule
.Check for
baryon_number
conservation.-
__call__
(ingoing_edge_qns: List[qrules.quantum_numbers.EdgeQuantumNumbers.baryon_number], outgoing_edge_qns: List[qrules.quantum_numbers.EdgeQuantumNumbers.baryon_number]) → bool¶ Call self as a function.
-
-
class
BottomnessConservation
(*args, **kwargs)[source]¶ Bases:
qrules.conservation_rules.EdgeQNConservationRule
Decorated via
additive_quantum_number_rule
.Check for
bottomness
conservation.-
__call__
(ingoing_edge_qns: List[qrules.quantum_numbers.EdgeQuantumNumbers.bottomness], outgoing_edge_qns: List[qrules.quantum_numbers.EdgeQuantumNumbers.bottomness]) → bool¶ Call self as a function.
-
-
class
CParityEdgeInput
(spin_magnitude, pid, c_parity=None)[source]¶ Bases:
object
-
__eq__
(other)¶ Method generated by attrs for class CParityEdgeInput.
-
c_parity
: Optional[qrules.quantum_numbers.EdgeQuantumNumbers.c_parity]¶
-
spin_magnitude
: qrules.quantum_numbers.EdgeQuantumNumbers.spin_magnitude¶
-
-
class
CParityNodeInput
(l_magnitude, s_magnitude)[source]¶ Bases:
object
-
__eq__
(other)¶ Method generated by attrs for class CParityNodeInput.
-
-
class
ChargeConservation
(*args, **kwargs)[source]¶ Bases:
qrules.conservation_rules.EdgeQNConservationRule
Decorated via
additive_quantum_number_rule
.Check for
charge
conservation.-
__call__
(ingoing_edge_qns: List[qrules.quantum_numbers.EdgeQuantumNumbers.charge], outgoing_edge_qns: List[qrules.quantum_numbers.EdgeQuantumNumbers.charge]) → bool¶ Call self as a function.
-
-
class
CharmConservation
(*args, **kwargs)[source]¶ Bases:
qrules.conservation_rules.EdgeQNConservationRule
Decorated via
additive_quantum_number_rule
.Check for
charmness
conservation.-
__call__
(ingoing_edge_qns: List[qrules.quantum_numbers.EdgeQuantumNumbers.charmness], outgoing_edge_qns: List[qrules.quantum_numbers.EdgeQuantumNumbers.charmness]) → bool¶ Call self as a function.
-
-
class
ElectronLNConservation
(*args, **kwargs)[source]¶ Bases:
qrules.conservation_rules.EdgeQNConservationRule
Decorated via
additive_quantum_number_rule
.Check for
electron_lepton_number
conservation.-
__call__
(ingoing_edge_qns: List[qrules.quantum_numbers.EdgeQuantumNumbers.electron_lepton_number], outgoing_edge_qns: List[qrules.quantum_numbers.EdgeQuantumNumbers.electron_lepton_number]) → bool¶ Call self as a function.
-
-
class
GParityEdgeInput
(isospin_magnitude, spin_magnitude, pid, g_parity=None)[source]¶ Bases:
object
-
__eq__
(other)¶ Method generated by attrs for class GParityEdgeInput.
-
g_parity
: Optional[qrules.quantum_numbers.EdgeQuantumNumbers.g_parity]¶
-
isospin_magnitude
: qrules.quantum_numbers.EdgeQuantumNumbers.isospin_magnitude¶
-
spin_magnitude
: qrules.quantum_numbers.EdgeQuantumNumbers.spin_magnitude¶
-
-
class
GParityNodeInput
(l_magnitude, s_magnitude)[source]¶ Bases:
object
-
__eq__
(other)¶ Method generated by attrs for class GParityNodeInput.
-
-
class
GellMannNishijimaInput
(charge, isospin_projection=None, strangeness=None, charmness=None, bottomness=None, topness=None, baryon_number=None, electron_lepton_number=None, muon_lepton_number=None, tau_lepton_number=None)[source]¶ Bases:
object
-
__eq__
(other)¶ Method generated by attrs for class GellMannNishijimaInput.
-
baryon_number
: Optional[qrules.quantum_numbers.EdgeQuantumNumbers.baryon_number]¶
-
bottomness
: Optional[qrules.quantum_numbers.EdgeQuantumNumbers.bottomness]¶
-
charmness
: Optional[qrules.quantum_numbers.EdgeQuantumNumbers.charmness]¶
-
electron_lepton_number
: Optional[qrules.quantum_numbers.EdgeQuantumNumbers.electron_lepton_number]¶
-
isospin_projection
: Optional[qrules.quantum_numbers.EdgeQuantumNumbers.isospin_projection]¶
-
muon_lepton_number
: Optional[qrules.quantum_numbers.EdgeQuantumNumbers.muon_lepton_number]¶
-
strangeness
: Optional[qrules.quantum_numbers.EdgeQuantumNumbers.strangeness]¶
-
tau_lepton_number
: Optional[qrules.quantum_numbers.EdgeQuantumNumbers.tau_lepton_number]¶
-
topness
: Optional[qrules.quantum_numbers.EdgeQuantumNumbers.topness]¶
-
-
class
HelicityParityEdgeInput
(parity, spin_magnitude, spin_projection)[source]¶ Bases:
object
-
__eq__
(other)¶ Method generated by attrs for class HelicityParityEdgeInput.
-
spin_magnitude
: qrules.quantum_numbers.EdgeQuantumNumbers.spin_magnitude¶
-
spin_projection
: qrules.quantum_numbers.EdgeQuantumNumbers.spin_projection¶
-
-
class
IdenticalParticleSymmetryOutEdgeInput
(spin_magnitude, spin_projection, pid)[source]¶ Bases:
object
-
__eq__
(other)¶ Method generated by attrs for class IdenticalParticleSymmetryOutEdgeInput.
-
spin_magnitude
: qrules.quantum_numbers.EdgeQuantumNumbers.spin_magnitude¶
-
spin_projection
: qrules.quantum_numbers.EdgeQuantumNumbers.spin_projection¶
-
-
class
IsoSpinEdgeInput
(isospin_magnitude, isospin_projection)[source]¶ Bases:
object
-
__eq__
(other)¶ Method generated by attrs for class IsoSpinEdgeInput.
-
isospin_magnitude
: qrules.quantum_numbers.EdgeQuantumNumbers.isospin_magnitude¶
-
isospin_projection
: qrules.quantum_numbers.EdgeQuantumNumbers.isospin_projection¶
-
-
class
MassConservation
(width_factor: float)[source]¶ Bases:
object
Mass conservation rule.
-
__call__
(ingoing_edge_qns: List[qrules.conservation_rules.MassEdgeInput], outgoing_edge_qns: List[qrules.conservation_rules.MassEdgeInput]) → bool[source]¶ Implements mass conservation.
\(M_{out} - N \cdot W_{out} < M_{in} + N \cdot W_{in}\)
It makes sure that the net mass outgoing state \(M_{out}\) is smaller than the net mass of the ingoing state \(M_{in}\). Also the width \(W\) of the states is taken into account.
-
-
class
MassEdgeInput
(mass, width=None)[source]¶ Bases:
object
-
__eq__
(other)¶ Method generated by attrs for class MassEdgeInput.
-
width
: Optional[qrules.quantum_numbers.EdgeQuantumNumbers.width]¶
-
-
class
MuonLNConservation
(*args, **kwargs)[source]¶ Bases:
qrules.conservation_rules.EdgeQNConservationRule
Decorated via
additive_quantum_number_rule
.Check for
muon_lepton_number
conservation.-
__call__
(ingoing_edge_qns: List[qrules.quantum_numbers.EdgeQuantumNumbers.muon_lepton_number], outgoing_edge_qns: List[qrules.quantum_numbers.EdgeQuantumNumbers.muon_lepton_number]) → bool¶ Call self as a function.
-
-
class
SpinEdgeInput
(spin_magnitude, spin_projection)[source]¶ Bases:
object
-
__eq__
(other)¶ Method generated by attrs for class SpinEdgeInput.
-
spin_magnitude
: qrules.quantum_numbers.EdgeQuantumNumbers.spin_magnitude¶
-
spin_projection
: qrules.quantum_numbers.EdgeQuantumNumbers.spin_projection¶
-
-
class
SpinMagnitudeNodeInput
(l_magnitude, s_magnitude)[source]¶ Bases:
object
-
__eq__
(other)¶ Method generated by attrs for class SpinMagnitudeNodeInput.
-
-
class
SpinNodeInput
(l_magnitude, l_projection, s_magnitude, s_projection)[source]¶ Bases:
object
-
__eq__
(other)¶ Method generated by attrs for class SpinNodeInput.
-
l_projection
: qrules.quantum_numbers.NodeQuantumNumbers.l_projection¶
-
s_projection
: qrules.quantum_numbers.NodeQuantumNumbers.s_projection¶
-
-
class
StrangenessConservation
(*args, **kwargs)[source]¶ Bases:
qrules.conservation_rules.EdgeQNConservationRule
Decorated via
additive_quantum_number_rule
.Check for
strangeness
conservation.-
__call__
(ingoing_edge_qns: List[qrules.quantum_numbers.EdgeQuantumNumbers.strangeness], outgoing_edge_qns: List[qrules.quantum_numbers.EdgeQuantumNumbers.strangeness]) → bool¶ Call self as a function.
-
-
class
TauLNConservation
(*args, **kwargs)[source]¶ Bases:
qrules.conservation_rules.EdgeQNConservationRule
Decorated via
additive_quantum_number_rule
.Check for
tau_lepton_number
conservation.-
__call__
(ingoing_edge_qns: List[qrules.quantum_numbers.EdgeQuantumNumbers.tau_lepton_number], outgoing_edge_qns: List[qrules.quantum_numbers.EdgeQuantumNumbers.tau_lepton_number]) → bool¶ Call self as a function.
-
-
additive_quantum_number_rule
(quantum_number: type) → Callable[[Any], qrules.conservation_rules.EdgeQNConservationRule][source]¶ Class decorator for creating an additive conservation rule.
Use this decorator to create a
EdgeQNConservationRule
for a quantum number to which an additive conservation rule applies:\[\sum q_{in} = \sum q_{out}\]- Parameters
quantum_number – Quantum number to which you want to apply the additive conservation check. An example would be
EdgeQuantumNumbers.charge
.
-
c_parity_conservation
(ingoing_edge_qns: List[qrules.conservation_rules.CParityEdgeInput], outgoing_edge_qns: List[qrules.conservation_rules.CParityEdgeInput], interaction_node_qns: qrules.conservation_rules.CParityNodeInput) → bool[source]¶ Check for \(C\)-parity conservation.
Implements \(C_{in} = C_{out}\).
-
clebsch_gordan_helicity_to_canonical
(ingoing_spins: List[qrules.conservation_rules.SpinEdgeInput], outgoing_spins: List[qrules.conservation_rules.SpinEdgeInput], interaction_qns: qrules.conservation_rules.SpinNodeInput) → bool[source]¶ Implement Clebsch-Gordan checks.
For \(S_1, S_2\) to \(S\) and the \(L,S\) to \(J\) coupling based on the conversion of helicity to canonical amplitude sums.
Note
This rule does not check that the spin magnitudes couple correctly to L and S, as this is already performed by
spin_magnitude_conservation
.
-
g_parity_conservation
(ingoing_edge_qns: List[qrules.conservation_rules.GParityEdgeInput], outgoing_edge_qns: List[qrules.conservation_rules.GParityEdgeInput], interaction_qns: qrules.conservation_rules.GParityNodeInput) → bool[source]¶ Check for \(G\)-parity conservation.
Implements for \(G_{in} = G_{out}\).
-
gellmann_nishijima
(edge_qns: qrules.conservation_rules.GellMannNishijimaInput) → bool[source]¶ Check the Gell-Mann–Nishijima formula.
\[Q = I_3 + \frac{1}{2}(B+S+C+B'+T)\]where \(Q\) is charge (computed), \(I_3\) is
Spin.projection
ofisospin
, \(B\) isbaryon_number
, \(S\) isstrangeness
, \(C\) ischarmness
, \(B'\) isbottomness
, and \(T\) istopness
.
-
helicity_conservation
(ingoing_spin_mags: List[qrules.quantum_numbers.EdgeQuantumNumbers.spin_magnitude], outgoing_helicities: List[qrules.quantum_numbers.EdgeQuantumNumbers.spin_projection]) → bool[source]¶ Implementation of helicity conservation.
Check for \(|\lambda_2-\lambda_3| \leq S_1\).
-
identical_particle_symmetrization
(ingoing_parities: List[qrules.quantum_numbers.EdgeQuantumNumbers.parity], outgoing_edge_qns: List[qrules.conservation_rules.IdenticalParticleSymmetryOutEdgeInput]) → bool[source]¶ Verifies multi particle state symmetrization for identical particles.
In case of a multi particle state with identical particles, their exchange symmetry has to follow the spin statistic theorem.
For bosonic systems the total exchange symmetry (parity) has to be even (+1). For fermionic systems the total exchange symmetry (parity) has to be odd (-1).
In case of a particle decaying into N identical particles (N>1), the decaying particle has to have the same parity as required by the spin statistic theorem of the multi body state.
-
isospin_conservation
(ingoing_isospins: List[qrules.conservation_rules.IsoSpinEdgeInput], outgoing_isospins: List[qrules.conservation_rules.IsoSpinEdgeInput]) → bool[source]¶ Check for isospin conservation.
Implements
\[|I_1 - I_2| \leq I \leq |I_1 + I_2|\]Also checks \(I_{1,z} + I_{2,z} = I_z\) and if Clebsch-Gordan coefficients are all 0.
-
isospin_validity
(isospin: qrules.conservation_rules.IsoSpinEdgeInput) → bool[source]¶ Check for valid isospin magnitude and projection.
-
ls_spin_validity
(spin_input: qrules.conservation_rules.SpinNodeInput) → bool[source]¶ Check for valid isospin magnitude and projection.
-
parity_conservation
(ingoing_edge_qns: List[qrules.quantum_numbers.EdgeQuantumNumbers.parity], outgoing_edge_qns: List[qrules.quantum_numbers.EdgeQuantumNumbers.parity], l_magnitude: qrules.quantum_numbers.NodeQuantumNumbers.l_magnitude) → bool[source]¶ Implement \(P_{in} = P_{out} \cdot (-1)^L\).
-
parity_conservation_helicity
(ingoing_edge_qns: List[qrules.conservation_rules.HelicityParityEdgeInput], outgoing_edge_qns: List[qrules.conservation_rules.HelicityParityEdgeInput], parity_prefactor: qrules.quantum_numbers.NodeQuantumNumbers.parity_prefactor) → bool[source]¶ Implements parity conservation for helicity formalism.
Check the following:
\[A_{-\lambda_1-\lambda_2} = P_1 P_2 P_3 (-1)^{S_2+S_3-S_1} A_{\lambda_1\lambda_2}\]\[\mathrm{parity\,prefactor} = P_1 P_2 P_3 (-1)^{S_2+S_3-S_1}\]Note
Only the special case \(\lambda_1=\lambda_2=0\) may return False independent on the parity prefactor.
-
spin_conservation
(ingoing_spins: List[qrules.conservation_rules.SpinEdgeInput], outgoing_spins: List[qrules.conservation_rules.SpinEdgeInput], interaction_qns: qrules.conservation_rules.SpinNodeInput) → bool[source]¶ Check for spin conservation.
Implements
\[|S_1 - S_2| \leq S \leq |S_1 + S_2|\]and
\[|L - S| \leq J \leq |L + S|\]Also checks \(M_1 + M_2 = M\) and if Clebsch-Gordan coefficients are all 0.
-
spin_magnitude_conservation
(ingoing_spins: List[qrules.conservation_rules.SpinEdgeInput], outgoing_spins: List[qrules.conservation_rules.SpinEdgeInput], interaction_qns: qrules.conservation_rules.SpinMagnitudeNodeInput) → bool[source]¶ Check for spin conservation.
Implements
\[|S_1 - S_2| \leq S \leq |S_1 + S_2|\]and
\[|L - S| \leq J \leq |L + S|\]
-
spin_validity
(spin: qrules.conservation_rules.SpinEdgeInput) → bool[source]¶ Check for valid spin magnitude and projection.