qrules#
import qrules
A rule based system that facilitates particle reaction analysis.
QRules generates allowed particle transitions from a set of conservation rules and boundary conditions as specified by the user. The user boundary conditions for a particle reaction problem are for example the initial state, final state, and allowed interactions.
The core of qrules computes which transitions (represented by a MutableTransition)
are allowed between a certain initial and final state. Internally, the system propagates
the quantum numbers defined by the particle module through the MutableTransition,
while satisfying the rules define by the conservation_rules module. See
Generate transitions and Particle database.
Finally, the io module provides tools that can read and write the objects of this
framework.
- check_reaction_violations(initial_state: StateDefinition | Sequence[StateDefinition], final_state: Sequence[StateDefinition], mass_conservation_factor: float | None = 3.0, particle_db: ParticleCollection | None = None, max_angular_momentum: int = 1, max_spin_magnitude: float = 2) set[frozenset[str]][source]#
Determine violated interaction rules for a given particle reaction.
Warning
This function only guarantees to find P, C and G parity violations, if itβs a two body decay. If all initial and final states have the C/G parity defined, then these violations are also determined correctly.
- Parameters:
initial_state β Shortform description of the initial state w/o spin projections.
final_state β Shortform description of the final state w/o spin projections.
mass_conservation_factor β Factor with which the width is multiplied when checking for
MassConservation. Set toNonein order to deactivate mass conservation.particle_db (Optional) β Custom
ParticleCollectionobject. Defaults to theParticleCollectionreturned byload_pdg.max_angular_momentum β Maximum angular momentum over which to generate \(LS\)-couplings.
max_spin_magnitude β Maximum spin magnitude over which to generate \(LS\)-couplings.
- Returns:
Set of least violating rules. The set can have multiple entries, as several quantum numbers can be violated. Each entry in the frozenset represents a group of rules that together violate all possible quantum number configurations.
Example
>>> import qrules >>> qrules.check_reaction_violations( ... initial_state="pi0", ... final_state=["gamma", "gamma", "gamma"], ... ) {frozenset({'c_parity_conservation'})}
See also
- generate_transitions(initial_state: StateDefinitionInput | Sequence[StateDefinitionInput], final_state: Sequence[StateDefinitionInput], allowed_intermediate_particles: list[str] | None = None, allowed_interaction_types: str | Iterable[str] | None = None, formalism: SpinFormalism = 'canonical-helicity', particle_db: ParticleCollection | None = None, mass_conservation_factor: float | None = 3.0, max_angular_momentum: int = 2, max_spin_magnitude: float = 2, topology_building: str = 'isobar', number_of_threads: int | None = None) ReactionInfo[source]#
Generate allowed transitions between an initial and final state.
Serves as a facade to the
StateTransitionManager(see Generate transitions).- Parameters:
initial_state (list) β A list of particle names in the initial state. You can specify spin projections for these particles with a
tuple, e.g.("J/psi(1S)", [-1, 0, +1]). If spin projections are not specified, all projections are taken, so the example here would be equivalent to"J/psi(1S)".final_state (list) β Same as
initial_state, but for final state particles.allowed_intermediate_particles (
list, optional) β A list of particle states that you want to allow as intermediate states. This helps (1) filter out resonances and (2) speed up computation time.allowed_interaction_types β Interaction types you want to consider. For instance,
["s", "em"]results inEMandSTRONGand["strong"]results inSTRONG.formalism (
str, optional) β Formalism that you intend to use in the eventual amplitude model.particle_db (
ParticleCollection, optional) β The particles that you want to be involved in the reaction. Usesload_pdgby default. Itβs better to use a subset for larger reactions, because of the computation times. This argument is especially useful when you want to use your own particle definitions (see Particle database).mass_conservation_factor β Width factor that is taken into account for for the
MassConservationrule.max_angular_momentum β Maximum angular momentum over which to generate angular momenta.
max_spin_magnitude β Maximum spin magnitude over which to generate spins.
topology_building (str) β
Technique with which to build the
Topologyinstances. Allowed values are:"isobar": Isobar model (each state decays into two states)"nbody": Use one central node and connect initial and final states to it
number_of_threads β Number of cores with which to compute the allowed transitions. Defaults to the current value returned by
settings.NumberOfThreads.get().
An example (where, for illustrative purposes only, we specify all arguments) would be:
>>> import qrules >>> reaction = qrules.generate_transitions( ... initial_state="D0", ... final_state=["K~0", "K+", "K-"], ... allowed_intermediate_particles=["a(0)(980)", "a(2)(1320)-"], ... allowed_interaction_types=["e", "w"], ... formalism="helicity", ... particle_db=qrules.load_pdg(), ... topology_building="isobar", ... ) >>> len(reaction.transitions) 4 >>> len(reaction.group_by_topology()) 3
- load_default_particles() ParticleCollection[source]#
Load the default particle list that comes with
qrules.Runs
load_pdgand supplements its output definitions from the fileadditional_definitions.yml.
Submodules and Subpackages
- argument_handling
- combinatorics
- conservation_rules
GraphElementRuleEdgeQNConservationRuleConservationRuleadditive_quantum_number_rule()ChargeConservationBaryonNumberConservationElectronLNConservationMuonLNConservationTauLNConservationStrangenessConservationCharmConservationBottomnessConservationparity_conservation()HelicityParityEdgeInputparity_conservation_helicity()CParityEdgeInputCParityNodeInputc_parity_conservation()GParityEdgeInputGParityNodeInputg_parity_conservation()IdenticalParticleSymmetryOutEdgeInputidentical_particle_symmetrization()SpinNodeInputSpinMagnitudeNodeInputls_spin_validity()IsoSpinEdgeInputisospin_validity()isospin_conservation()SpinEdgeInputspin_validity()spin_conservation()spin_magnitude_conservation()clebsch_gordan_helicity_to_canonical()helicity_conservation()GellMannNishijimaInputGellMannNishijimaInput.chargeGellMannNishijimaInput.isospin_projectionGellMannNishijimaInput.strangenessGellMannNishijimaInput.charmnessGellMannNishijimaInput.bottomnessGellMannNishijimaInput.topnessGellMannNishijimaInput.baryon_numberGellMannNishijimaInput.electron_lepton_numberGellMannNishijimaInput.muon_lepton_numberGellMannNishijimaInput.tau_lepton_number
gellmann_nishijima()MassEdgeInputMassConservation
- particle
SpinParticleParticle.nameParticle.pidParticle.latexParticle.spinParticle.massParticle.widthParticle.chargeParticle.isospinParticle.strangenessParticle.charmnessParticle.bottomnessParticle.topnessParticle.baryon_numberParticle.electron_lepton_numberParticle.muon_lepton_numberParticle.tau_lepton_numberParticle.parityParticle.c_parityParticle.g_parityParticle.is_lepton()
ParticleWithSpinParticleCollectioncreate_particle()create_antiparticle()load_pdg()
- quantum_numbers
ParityEdgeQuantumNumbersEdgeQuantumNumbers.pidEdgeQuantumNumbers.massEdgeQuantumNumbers.widthEdgeQuantumNumbers.spin_magnitudeEdgeQuantumNumbers.spin_projectionEdgeQuantumNumbers.chargeEdgeQuantumNumbers.isospin_magnitudeEdgeQuantumNumbers.isospin_projectionEdgeQuantumNumbers.strangenessEdgeQuantumNumbers.charmnessEdgeQuantumNumbers.bottomnessEdgeQuantumNumbers.topnessEdgeQuantumNumbers.baryon_numberEdgeQuantumNumbers.electron_lepton_numberEdgeQuantumNumbers.muon_lepton_numberEdgeQuantumNumbers.tau_lepton_numberEdgeQuantumNumbers.parityEdgeQuantumNumbers.c_parityEdgeQuantumNumbers.g_parity
EdgeQuantumNumberEdgeQuantumNumberTypesNodeQuantumNumbersNodeQuantumNumberNodeQuantumNumberTypesInteractionPropertiesarange()
- settings
- solving
- system_control
- topology
FrozenDictEdgeTopologyTopology.nodesTopology.edgesTopology.incoming_edge_idsTopology.outgoing_edge_idsTopology.intermediate_edge_idsTopology.is_isomorphic()Topology.get_edge_ids_ingoing_to_node()Topology.get_edge_ids_outgoing_from_node()Topology.get_originating_final_state_edge_ids()Topology.get_originating_initial_state_edge_ids()Topology.relabel_edges()Topology.swap_edges()
get_originating_node_list()MutableTopologyInteractionNodeSimpleStateTransitionTopologyBuildercreate_isobar_topologies()create_n_body_topology()TransitionFrozenTransitionMutableTransition
- transition
SpinFormalismSolvingModeExecutionInfoProblemSetStateTransitionManagerStateTransitionManager.interaction_determinatorsStateTransitionManager.final_state_groupingsStateTransitionManager.filter_remove_qnsStateTransitionManager.filter_ignore_qnsStateTransitionManager.topologiesStateTransitionManager.set_allowed_intermediate_particles()StateTransitionManager.formalismStateTransitionManager.add_final_state_grouping()StateTransitionManager.get_allowed_interaction_types()StateTransitionManager.set_allowed_interaction_types()StateTransitionManager.create_problem_sets()StateTransitionManager.find_solutions()StateTransitionManager.find_quantum_number_transitions()
StateStateTransitionReactionInfo