Contents Menu Expand Light mode Dark mode Auto light/dark, in light mode Auto light/dark, in dark mode Skip to content
feynlag
feynlag
  • Getting Started
  • 1. The Pipeline
  • 2. Declaration: Parameters, Fields, Groups
  • 3. Writing the Lagrangian
  • 4. Checking Invariance
  • 5. Spontaneous Symmetry Breaking
  • 6. Mass Matrices
  • 7. Diagonalization and the Physical Basis
  • 8. Extracting Vertices
  • 9. Export
  • 10. Verification Philosophy
  • 11. Suggesting Invariant Terms
  • 12. Gauge-Anomaly Cancellation
  • 13. Electric Charge and the Vertex Checks
  • 14. Quark Flavour Mixing (CKM)
  • 15. Decay Widths
  • 16. Extending the Decay Calculator
  • 17. Extending to 2→2 Scattering
  • Tutorials
    • How to compute a particle decay
    • 2→2 scattering in feynlag: from Mandelstam invariants to a forward–backward asymmetry
    • From Pauli matrices to any SU(N): gauge representations with feynlag
    • Discrete symmetries: representations, characters, and the construction of invariants
    • Feynman rules of the Standard Model with feynlag
    • Vector-like fermions in feynlag: SM + a vector-like lepton doublet
    • Extending the SM by a gauged U(1)\(_X\): a Z′ tutorial in feynlag
    • Model building with feynlag: suggest + anomaly cancellation
    • The type-I seesaw in feynlag: Majorana neutrino masses, step by step
    • 3HDM with S₃ flavor symmetry: forcing the vacuum, not tuning it
  • Examples Gallery
  • Validated against MadGraph
  • Roadmap: Status and Remaining Work
  • Conventions
  • API Reference
    • feynlag.parameters
      • feynlag.parameters.ExternalParameter
      • feynlag.parameters.InternalParameter
      • feynlag.parameters.Parameter
      • feynlag.parameters.ParameterSet
    • feynlag.fields
      • feynlag.fields.bar_partner
      • feynlag.fields.conjugate_pair
      • feynlag.fields.dag
      • feynlag.fields.hc
      • feynlag.fields.DiracFermion
      • feynlag.fields.Fermion
      • feynlag.fields.Field
      • feynlag.fields.GaugeBoson
      • feynlag.fields.MajoranaFermion
      • feynlag.fields.Scalar
      • feynlag.fields.WeylFermion
    • feynlag.groups.base
      • feynlag.groups.base.GaugeGroup
      • feynlag.groups.base.SymmetryGroup
    • feynlag.groups.gauge
      • feynlag.groups.gauge.SU2
      • feynlag.groups.gauge.SU3
      • feynlag.groups.gauge.SUN
      • feynlag.groups.gauge.U1
    • feynlag.groups.discrete
      • feynlag.groups.discrete.DiscreteSymmetry
      • feynlag.groups.discrete.S3
      • feynlag.groups.discrete.ZN
    • feynlag.lagrangian
      • feynlag.lagrangian.InvarianceReport
      • feynlag.lagrangian.Lagrangian
      • feynlag.lagrangian.LagrangianTerm
      • feynlag.lagrangian.Model
      • feynlag.lagrangian.ValidationReport
    • feynlag.operators
      • feynlag.operators.D_linear
      • feynlag.operators.Dmu
      • feynlag.operators.expand_derivatives
      • feynlag.operators.to_momentum_space
      • feynlag.operators.PartialMu
    • feynlag.invariance
      • feynlag.invariance.check_discrete_invariance
      • feynlag.invariance.check_gauge_invariance
      • feynlag.invariance.check_hermiticity
      • feynlag.invariance.check_mass_dimension
      • feynlag.invariance.gauge_variation
    • feynlag.models
      • feynlag.models.charged_current_rotation
      • feynlag.models.electroweak_gauge
      • feynlag.models.electroweak_scaffold
      • feynlag.models.higgs_doublet
      • feynlag.models.higgs_lagrangian
      • feynlag.models.standard_model
      • feynlag.models.to_physical_basis
      • feynlag.models.weinberg_rotation
      • feynlag.models.ElectroweakScaffold
      • feynlag.models.PhysicalBasis
      • feynlag.models.StandardModel
    • feynlag.suggest
      • feynlag.suggest.build_lagrangian
      • feynlag.suggest.reynolds_project
      • feynlag.suggest.suggest_kinetic
      • feynlag.suggest.suggest_potential
      • feynlag.suggest.suggest_yukawa
      • feynlag.suggest.SuggestedTerm
    • feynlag.dirac
      • feynlag.dirac.dirac_conjugate
      • feynlag.dirac.gamma_simplify
      • feynlag.dirac.majorana_symmetry_sign
      • feynlag.dirac.minkowski_metric
      • feynlag.dirac.DiracC
      • feynlag.dirac.DiracGamma
      • feynlag.dirac.DiracGammaLower
      • feynlag.dirac.DiracIdentity
      • feynlag.dirac.DiracLatexPrinter
      • feynlag.dirac.DiracZero
      • feynlag.dirac.PL
      • feynlag.dirac.PR
    • feynlag.vacuum.ewsb
      • feynlag.vacuum.ewsb.Vacuum
    • feynlag.vacuum.tadpoles
      • feynlag.vacuum.tadpoles.extract_tadpoles
      • feynlag.vacuum.tadpoles.solve_tadpoles
    • feynlag.vacuum.masses
      • feynlag.vacuum.masses.build_mass_matrix
      • feynlag.vacuum.masses.charged_mass_matrix
      • feynlag.vacuum.masses.gauge_mass_matrix
      • feynlag.vacuum.masses.scalar_mass_matrix
      • feynlag.vacuum.masses.seesaw_light_mass
      • feynlag.vacuum.masses.seesaw_mass_matrix
    • feynlag.vacuum.diagonalize
      • feynlag.vacuum.diagonalize.diagonalize_orthogonal_2x2
      • feynlag.vacuum.diagonalize.diagonalize_svd
      • feynlag.vacuum.diagonalize.diagonalize_svd_2x2
      • feynlag.vacuum.diagonalize.diagonalize_takagi
      • feynlag.vacuum.diagonalize.rotation_2x2
      • feynlag.vacuum.diagonalize.solve_mixing_angle_2x2
      • feynlag.vacuum.diagonalize.MajoranaRotation
      • feynlag.vacuum.diagonalize.Rotation
    • feynlag.vertices.extract
      • feynlag.vertices.extract.extract_interaction_coefficients
      • feynlag.vertices.extract.feynman_rule
      • feynlag.vertices.extract.vertex_multiplicity
    • feynlag.vertices.bilinear
      • feynlag.vertices.bilinear.expand_bilinear
      • feynlag.vertices.bilinear.extract_fermion_vertices
      • feynlag.vertices.bilinear.extract_majorana_vertices
      • feynlag.vertices.bilinear.fermion_feynman_rule
      • feynlag.vertices.bilinear.fermion_gauge_current
      • feynlag.vertices.bilinear.fermion_mass_matrix
      • feynlag.vertices.bilinear.four_fermion_feynman_rule
      • feynlag.vertices.bilinear.majorana_feynman_rule
      • feynlag.vertices.bilinear.majorana_mass_matrix
      • feynlag.vertices.bilinear.Bilinear
      • feynlag.vertices.bilinear.MajoranaBilinear
    • feynlag.vertices.vertex
      • feynlag.vertices.vertex.classify_spins
      • feynlag.vertices.vertex.Vertex
    • feynlag.vertices.yangmills
      • feynlag.vertices.yangmills.cubic_couplings
      • feynlag.vertices.yangmills.quartic_couplings
      • feynlag.vertices.yangmills.structure_constants
    • feynlag.export.latex
      • feynlag.export.latex.latex_feynman_table
    • feynlag.export.ufo.writer
      • feynlag.export.ufo.writer.write_ufo
      • feynlag.export.ufo.writer.UFOParticle
    • feynlag.export.ufo.vvvv
      • feynlag.export.ufo.vvvv.adjoint_vvv
      • feynlag.export.ufo.vvvv.adjoint_vvvv
      • feynlag.export.ufo.vvvv.assemble_vvvv
      • feynlag.export.ufo.vvvv.metric_pair_coefficients
      • feynlag.export.ufo.vvvv.permute_vvvv
      • feynlag.export.ufo.vvvv.structures_from_metric_pairs
    • feynlag.export.ufo.lorentz_map
      • feynlag.export.ufo.lorentz_map.structures_for
    • feynlag.pheno.lorentz
      • feynlag.pheno.lorentz.contract_to_dots
      • feynlag.pheno.lorentz.dirac_trace
      • feynlag.pheno.lorentz.index
      • feynlag.pheno.lorentz.momentum
      • feynlag.pheno.lorentz.reduce_projectors
      • feynlag.pheno.lorentz.slashed
    • feynlag.pheno.kinematics
      • feynlag.pheno.kinematics.is_allowed
      • feynlag.pheno.kinematics.kallen
      • feynlag.pheno.kinematics.two_body_momentum
      • feynlag.pheno.kinematics.two_body_phase_space
      • feynlag.pheno.kinematics.ThreeBodyKinematics
      • feynlag.pheno.kinematics.TwoBodyKinematics
      • feynlag.pheno.kinematics.TwoToTwoKinematics
    • feynlag.pheno.amplitudes
      • feynlag.pheno.amplitudes.amplitude_squared
      • feynlag.pheno.amplitudes.ffs_squared
      • feynlag.pheno.amplitudes.ffv_squared
      • feynlag.pheno.amplitudes.polarization_sum
      • feynlag.pheno.amplitudes.spin_sum
      • feynlag.pheno.amplitudes.sss_squared
      • feynlag.pheno.amplitudes.vvs_squared
    • feynlag.pheno.vertices
      • feynlag.pheno.vertices.classify_gamma
      • feynlag.pheno.vertices.collect_decay_vertices
      • feynlag.pheno.vertices.fermion_decay_vertices
      • feynlag.pheno.vertices.resolve_leg
      • feynlag.pheno.vertices.DecayVertex
    • feynlag.pheno.particles
      • feynlag.pheno.particles.expand_particles
      • feynlag.pheno.particles.DiracParticle
      • feynlag.pheno.particles.ExternalState
    • feynlag.pheno.propagator
      • feynlag.pheno.propagator.breit_wigner
      • feynlag.pheno.propagator.propagator_denominator
      • feynlag.pheno.propagator.scalar_propagator
      • feynlag.pheno.propagator.vector_propagator
      • feynlag.pheno.propagator.vector_propagator_numerator
    • feynlag.pheno.integrate
      • feynlag.pheno.integrate.dalitz_integral
      • feynlag.pheno.integrate.have_scipy
    • feynlag.pheno.offshell
      • feynlag.pheno.offshell.offshell_scalar_vv_width
      • feynlag.pheno.offshell.scalar_offshell_vv_width
      • feynlag.pheno.offshell.scalar_vv_s12_integral
      • feynlag.pheno.offshell.scalar_vv_squared
    • feynlag.pheno.loop
      • feynlag.pheno.loop.A_half
      • feynlag.pheno.loop.A_half_zgamma
      • feynlag.pheno.loop.A_one
      • feynlag.pheno.loop.A_one_zgamma
      • feynlag.pheno.loop.f_function
      • feynlag.pheno.loop.g_function
      • feynlag.pheno.loop.higgs_gammagamma_width
      • feynlag.pheno.loop.higgs_gg_width
      • feynlag.pheno.loop.higgs_zgamma_width
    • feynlag.pheno.calculator
      • feynlag.pheno.calculator.partial_width
      • feynlag.pheno.calculator.DecayCalculator
      • feynlag.pheno.calculator.DecayChannel
    • feynlag.verify.checks
      • feynlag.verify.checks.check_dimension
      • feynlag.verify.checks.decoupling_limit
      • feynlag.verify.checks.diagonalize_hermitian
      • feynlag.verify.checks.is_hermitian
      • feynlag.verify.checks.is_symmetric
      • feynlag.verify.checks.numeric_equal
      • feynlag.verify.checks.round_trip_reconstruct
      • feynlag.verify.checks.seesaw_light_mass
Back to top
View this page

Examples Gallery¶

examples/ contains full worked models, used as both documentation and manual smoke tests. Each file is runnable end to end (python examples/<name>.py) and doubles as the “how do I actually write this in feynlag” reference for the corresponding physics.

sm_scalar_gauge.py — the complete Standard Model¶

Higgs sector + electroweak gauge (SU(2)_L × U(1)_Y) + one lepton generation

  • a full 3-generation quark/QCD sector (SU(2) doublet QL, SU(3)_c-triplet singlets uR/dR, flavor-generic Yukawas — no CKM diagonalization, since CKM mixing is orthogonal to SU(3) vertex dynamics). Exercises every stage of the pipeline: gauge invariance, EWSB, tadpoles, the Higgs/Goldstone/gauge mass matrices, the Weinberg rotation, fermion gauge currents and Yukawa mass matrices via the bilinear track, and both LaTeX and UFO export (including real SU(3) color-tensor strings for qqg/ggg/gggg).

sm_vll.py — vector-like lepton doublet¶

Adds a vector-like SU(2) doublet Ψ = (N, E) with a bare Dirac mass to the lepton sector. Demonstrates biunitary 2×2 diagonalization (diagonalize_svd_2x2) of the resulting charged-lepton mass matrix, fermion mass-basis rotations through Indexed fields, and the physics signature of doublet VLL mixing: a right-handed-only Z FCNC, an h-coupling sum rule, and the correct SM-decoupling limit as M → ∞. See Tutorials for the step-by-step notebook.

sm_u1x.py — SM × U(1)_X with a Z′¶

Extends the SM by a second abelian factor with symbolic charge assignment X = a·Y + b·(B−L). An X-charged Higgs singlet VEV drives tree-level Z–Z′ mixing through two chained 2×2 rotations (Weinberg, then Z–Z′). Also adds 3 right-handed neutrinos with a Dirac Yukawa via H̃. Demonstrates keeping physics symbolic in an extra charge parameter, Goldstone counting across two broken U(1)s, and multi-stage rotation chaining (Model.physical_lagrangian applies registered rotations in registration order). No UFO export — UFO’s particle table calls float() on charges, incompatible with the symbolic a/b.

thdm.py — softly-broken Z₂ 2HDM¶

The scalar sector of a two-Higgs-doublet model with a softly-broken Z₂ symmetry. Demonstrates the analytic 2×2 orthogonal diagonalization (diagonalize_orthogonal_2x2) and the α mixing angle, cross-checked against the standard Gunion–Haber/Branco expressions.

thdm_s3.py — 3HDM with an S₃ flavor symmetry¶

Three Higgs doublets, (H1, H2) forming an S₃ doublet and HS a singlet. The potential is built entirely from the library’s own S₃ Clebsch–Gordan products (S3.doublet_product) rather than hand-written invariants — a stress test of the discrete-symmetry machinery. The tadpole system is deliberately over-constrained and forces a specific vacuum alignment (v₁ = √3 v₂ in the literature basis).

Each model is described algorithmically, stage by stage, in the 1. The Pipeline; the manual cites which pinned test in tests/ fixes each physical result these examples produce.

Next
Validated against MadGraph
Previous
3HDM with S₃ flavor symmetry: forcing the vacuum, not tuning it
Copyright © 2026, Moises Zeleny
Made with Sphinx and @pradyunsg's Furo
On this page
  • Examples Gallery
    • sm_scalar_gauge.py — the complete Standard Model
    • sm_vll.py — vector-like lepton doublet
    • sm_u1x.py — SM × U(1)_X with a Z′
    • thdm.py — softly-broken Z₂ 2HDM
    • thdm_s3.py — 3HDM with an S₃ flavor symmetry