Particle
symbolica.community.hepkit Class
Particle()A particle species in a loaded interaction model.
Particle records expose the signed PDG code, spin and color representations, electric charge, and the parameters used for mass and width.
Examples
from symbolica import S, E
from symbolica.community import hepkit as hep
model = hep.Model.standard_model()
electron = model.particle_by_pdg(11)
assert electron.name == "e-"Member details
typstname
Property · read-only#typstname: Optional[str] Native Typst math label without dollar delimiters, or None if not supplied.
Examples
from symbolica.community import hepkit as hep
hep.Model.phi4().particle("phi").typstnameantitypstname
Property · read-only#antitypstname: Optional[str] Native Typst math label of the antiparticle without dollar delimiters, or None if not supplied.
Examples
from symbolica.community import hepkit as hep
hep.Model.phi4().particle("phi").antitypstnamename
Property · read-only#name: strReturn the particle name used by the model.
Examples
Using the setup in the Particle class example:
assert electron.name == "e-"antiname
Property · read-only#antiname: strReturn the name of the corresponding antiparticle.
Examples
Using the setup in the Particle class example:
assert electron.antiname == "e+"antiparticle
Property · read-only#antiparticle: ParticleReturn the corresponding antiparticle from the same model.
Self-conjugate particles map to themselves.
Examples
Using the setup in the Particle class example:
electron = model.particle_by_pdg(11)
electron.antiparticle.name
model.particle_by_pdg(22).antiparticle.name # the photon is self-conjugatepdg_code
Property · read-only#pdg_code: intReturn the signed Particle Data Group code.
Examples
Using the setup in the Particle class example:
model.particle("e-").pdg_codespin
Property · read-only#spin: intReturn the UFO spin code 2S + 1 (negative for ghost fields).
Examples
Using the setup in the Particle class example:
model.particle_by_pdg(11).spin # spin-1/2 electroncolor
Property · read-only#color: intReturn the signed UFO SU(3) color representation code.
Examples
Using the setup in the Particle class example:
model.particle_by_pdg(11).color # color-singlet electronmass_parameter
Property · read-only#mass_parameter: strReturn the name of the particle's mass parameter.
Examples
Using the setup in the Particle class example:
particle = model.particle_by_pdg(13)
mass = model.parameter(particle.mass_parameter)width_parameter
Property · read-only#width_parameter: strReturn the name of the particle's width parameter.
Examples
Using the setup in the Particle class example:
particle = model.particle_by_pdg(23)
width = model.parameter(particle.width_parameter)mass
Property · read-only#mass: ExpressionExact symbolic mass, with the UFO ZERO parameter represented as zero. Other parameters remain symbolic, even when their current value is zero.
Examples
Using the setup in the Particle class example:
model.particle("c").masselectric_charge
Property · read-only#electric_charge: ExpressionSigned symbolic electric charge Q e, including the model's coupling. An electron has charge -e and a positron +e. Neutral particles return exact zero. Use charge for the dimensionless charge Q. The unit charge is inferred from minimal photon (PDG 22) interactions with fermions or scalars, including their Lorentz normalization; no parameter name is assumed. Use -electron.electric_charge for positive e.
Examples
from symbolica.community import hepkit as hep
qed_model = hep.Model.qed()
electron = qed_model.particle("e-")
mass, charge = electron.mass, electron.electric_charge
assert electron.antiparticle.electric_charge == -charge
assert qed_model.particle("a").electric_charge == 0Raises
ModelErrorIf a charged particle's model has no supported minimal photon vertex, or its photon vertices imply inconsistent unit charges.
charge
Property · read-only#charge: ExpressionElectric charge in units of e, as an exact Symbolica expression.
Examples
Using the setup in the Particle class example:
model.particle("c").chargey_charge
Property · read-only#y_charge: Optional[Expression] Hypercharge in Q = T3 + Y/2; left-handed for fermions. None means absent, undefined, or unspecified, rather than zero.
Examples
Using the setup in the Particle class example:
model.particle("c").y_chargey_charge_right
Property · read-only#y_charge_right: Optional[Expression] Right-handed fermion hypercharge in Q = T3 + Y/2, if specified.
Examples
Using the setup in the Particle class example:
model.particle("c").y_charge_rightweak_isospin
Property · read-only#weak_isospin: Optional[Expression] Third weak-isospin component Q - Y/2; left-handed for fermions. Antiparticle chiralities are exchanged by charge conjugation.
Examples
Using the setup in the Particle class example:
model.particle("c").weak_isospinweak_isospin_right
Property · read-only#weak_isospin_right: Optional[Expression] Right-handed fermion third weak-isospin component, if specified.
Examples
Using the setup in the Particle class example:
model.particle("c").weak_isospin_rightis_antiparticle
Property · read-only#is_antiparticle: boolReport whether this object represents an antiparticle.
Examples
Using the setup in the Particle class example:
model.particle_by_pdg(11).is_antiparticleis_self_antiparticle
Property · read-only#is_self_antiparticle: boolReport whether the particle is its own antiparticle.
Examples
Using the setup in the Particle class example:
model.particle_by_pdg(22).is_self_antiparticleis_fermion
Property · read-only#is_fermion: boolReport whether the particle has fermionic spin.
Examples
Using the setup in the Particle class example:
model.particle_by_pdg(11).is_fermionis_massless
Property · read-only#is_massless: boolReport whether the particle's mass parameter is zero.
Examples
Using the setup in the Particle class example:
model.particle_by_pdg(22).is_masslesscolor_sum
Method#color_sum(left: Expression, right: Expression, *, average: bool = False) -> Expression Construct the identity on this particle's color space.
The bare left index carries the particle representation; right carries its dual. Antiquarks and antisextets reverse the dual orientation. Supports UFO singlet, fundamental, sextet and adjoint representations. average=True divides by the number of color states (1, 3, 6 or 8). This sums color only; spin sums and color-algebra simplification remain separate operations. To close an existing tensor, use indices whose slots are dual to the open color slots of that tensor.
Examples
Using the setup in the Particle class example:
from symbolica import S
i, j = S("i", "j")
color_projector = model.particle_by_pdg(5).color_sum(i, j, average=True)
model.particle_by_pdg(11).color_sum(i, j) == 1Returns
Expression
Spenso color identity, or one for a color singlet.
Raises
ValueErrorIf the particle's UFO color representation is unsupported.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
left | Expression | — | Bare index in the particle's color representation. |
right | Expression | — | Bare index in its dual representation. |
average | bool | False | Divide by the number of color states. Defaults to |
spin_sum
Method#spin_sum(momentum: Expression, left: Expression, right: Expression, *, average: bool = False, reference: Optional[Expression] = None, covariant: bool = False, spin_vector: Optional[Expression] = None, dimension: Optional[Expression | int | Float | int | float | str | decimal.Decimal | ComplexFloat | Float | int | float | str | decimal.Decimal | complex | tuple[Float | int | float | str | decimal.Decimal, Float | int | float | str | decimal.Decimal]] = None) -> Expression Construct this particle's external-state spin or polarization sum.
Return an ordinary Symbolica expression using Spenso gamma matrices and metrics. Indices are bare symbols; momentum and reference are unindexed symbols or labeled calls such as Q(1). The calculation defaults to four-dimensional external states. dimension changes the Lorentz dimension while Dirac spinor slots retain dimension four. Massive vectors use the Proca projector. For massless vectors, supply a reference for a physical axial sum, or omit it for the covariant sum of a gauge-invariant amplitude. Subsequent kinematic substitutions must enforce on-shell conditions and a nonzero momentum-reference scalar product.
For a massive Dirac particle, spin_vector selects one physical spin state instead of summing states. Supply a dimensionless unindexed vector satisfying p.s = 0 and s.s = -1: the rest-frame spin direction, boosted with the particle. The same projector sign applies to fermions and antifermions; do not reverse this vector for an antiparticle. This option requires average=False and four Lorentz dimensions.
Examples
Using the setup in the Particle class example:
from symbolica import S
p, i, j = S("p", "i", "j")
projector = model.particle("e-").spin_sum(p, i, j, average=True)
polarized = model.particle("ta-").spin_sum(p, i, j, spin_vector=S("s"))
dimensional = model.particle("g").spin_sum(p, i, j, dimension=S("D"))
six_dimensional = model.particle("g").spin_sum(p, i, j, dimension=6)Raises
ValueErrorIf
spin_vectoris used with averaging, a massless particle, or a particle other than a Dirac fermion, non-four-dimensional Lorentz slots, or is not an unindexed name. Also raised for an invalid dimension or a concrete dimension with no physical vector states.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
momentum | Expression | — | Unindexed external momentum. |
left | Expression | — | Open index on the amplitude. |
right | Expression | — | Open index on the conjugate amplitude. |
average | bool | False | Divide by two for Dirac fermions, D-2 for massless vectors, or D-1 for massive vectors. Scalars have one state. |
reference | Optional[ | None | Axial reference momentum for a massless vector; need not be null. |
covariant | bool | False | Use the Feynman-gauge vector numerator even for a massive vector. |
spin_vector | Optional[ | None | Physical spin vector of a massive Dirac state, with |
dimension | Optional[ | None | Integer or symbolic Lorentz dimension; defaults to four. Dirac spinor slots and their trace dimension stay four. To use a fixed two-state vector average at symbolic D, leave average=False and divide the result by two. |
sum_spins
Method#sum_spins(expression: Expression, momentum: Expression, *, edge: int, average: bool = False, reference: Optional[Expression] = None, covariant: bool = False, spin_vector: Optional[Expression] = None, dimension: Optional[Expression | int | Float | int | float | str | decimal.Decimal | ComplexFloat | Float | int | float | str | decimal.Decimal | complex | tuple[Float | int | float | str | decimal.Decimal, Float | int | float | str | decimal.Decimal]] = None) -> Expression Sum paired generated external wavefunctions for one edge.
Replace this particle's wavefunction and its adjoint using the same completeness relation as spin_sum. The expression may be a sewn diagram's projector_expression() or a squared amplitude. Only pairs with the supplied edge label are replaced; unpaired wavefunctions stay unchanged. Scalar particles have no external wavefunction factors. Vector wavefunction slots must use the requested Lorentz dimension. External states default to four dimensions; reference and gauge conventions are those of spin_sum. For a massive Dirac particle, spin_vector selects the same physical spin state as in spin_sum, including for antiparticles. This does not sum color, conjugate amplitudes, or apply graph symmetry factors.
Examples
Using the setup in the Particle class example:
from symbolica import S, E
from symbolica.community import hepkit as hep
model = hep.Model.standard_model()
diagram = model.process(["e-", "e+"], ["mu-", "mu+"]).generate_diagrams().diagrams[0]
electron = model.particle("e-")
projector = diagram.projector_expression()
spin_summed = electron.sum_spins(projector, S("gammalooprs::P")(1), edge=1)Raises
ValueErrorIf
spin_vectoris used with averaging, a massless particle, or a particle other than a Dirac fermion, non-four-dimensional Lorentz slots, or is not an unindexed name. Also raised for an invalid dimension or a concrete dimension with no physical vector states.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
expression | Expression | — | Projector or squared expression containing paired wavefunctions. |
momentum | Expression | — | Unindexed external momentum in the physical particle direction. |
edge | int | — | Generated edge label of the pair to replace. |
average | bool | False | Divide by two for Dirac fermions, D-2 for massless vectors, or D-1 for massive vectors. Scalars have one state. |
reference | Optional[ | None | Axial reference for a massless vector; need not be null. |
covariant | bool | False | Use the Feynman-gauge vector numerator even for a massive vector. |
spin_vector | Optional[ | None | Physical spin vector of a massive Dirac state, with |
dimension | Optional[ | None | Integer or symbolic Lorentz dimension; defaults to four. Dirac spinor slots and their trace dimension stay four. To use a fixed two-state vector average at symbolic D, leave average=False and divide the result by two. |
__repr__
Method#__repr__() -> strSummarize the defining data as well as the name and PDG code.
Examples
Using the setup in the Particle class example:
print(model.particle_by_pdg(11))_repr_html_
Method#_repr_html_() -> strDisplay the model member's physical data and defining expressions.
Examples
Using the setup in the Particle class example:
from IPython.display import display
display(electron)_repr_pretty_
Method#_repr_pretty_(pretty: Any, cycle: bool) -> None Write the complete text summary to an IPython pretty printer.
Examples
Using the setup in the Particle class example:
from IPython.lib.pretty import pretty
text = pretty(electron)Parameters
| Name | Type | Default | Description |
|---|---|---|---|
pretty | Any | — | IPython pretty printer receiving the text. |
cycle | bool | — | Whether the object occurs recursively in the current display. |
View generated signature source: docs/api/python/feynkit-community.pyi:8878