feynlag 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- feynlag-0.1.0/CHANGELOG.md +54 -0
- feynlag-0.1.0/LICENSE +21 -0
- feynlag-0.1.0/MANIFEST.in +3 -0
- feynlag-0.1.0/PKG-INFO +183 -0
- feynlag-0.1.0/README.md +140 -0
- feynlag-0.1.0/pyproject.toml +48 -0
- feynlag-0.1.0/setup.cfg +4 -0
- feynlag-0.1.0/src/feynlag/__init__.py +138 -0
- feynlag-0.1.0/src/feynlag/anomalies.py +247 -0
- feynlag-0.1.0/src/feynlag/charges.py +528 -0
- feynlag-0.1.0/src/feynlag/conventions.py +35 -0
- feynlag-0.1.0/src/feynlag/dirac.py +640 -0
- feynlag-0.1.0/src/feynlag/export/__init__.py +3 -0
- feynlag-0.1.0/src/feynlag/export/latex.py +88 -0
- feynlag-0.1.0/src/feynlag/export/ufo/__init__.py +9 -0
- feynlag-0.1.0/src/feynlag/export/ufo/legs.py +146 -0
- feynlag-0.1.0/src/feynlag/export/ufo/lorentz_map.py +62 -0
- feynlag-0.1.0/src/feynlag/export/ufo/pycode.py +73 -0
- feynlag-0.1.0/src/feynlag/export/ufo/static.py +325 -0
- feynlag-0.1.0/src/feynlag/export/ufo/vvvv.py +238 -0
- feynlag-0.1.0/src/feynlag/export/ufo/writer.py +643 -0
- feynlag-0.1.0/src/feynlag/fields.py +358 -0
- feynlag-0.1.0/src/feynlag/flavor.py +100 -0
- feynlag-0.1.0/src/feynlag/gauge_basis.py +196 -0
- feynlag-0.1.0/src/feynlag/groups/__init__.py +6 -0
- feynlag-0.1.0/src/feynlag/groups/base.py +67 -0
- feynlag-0.1.0/src/feynlag/groups/discrete.py +239 -0
- feynlag-0.1.0/src/feynlag/groups/gauge.py +103 -0
- feynlag-0.1.0/src/feynlag/groups/sun.py +394 -0
- feynlag-0.1.0/src/feynlag/invariance.py +345 -0
- feynlag-0.1.0/src/feynlag/lagrangian.py +560 -0
- feynlag-0.1.0/src/feynlag/models.py +307 -0
- feynlag-0.1.0/src/feynlag/operators.py +154 -0
- feynlag-0.1.0/src/feynlag/parameters.py +241 -0
- feynlag-0.1.0/src/feynlag/pheno/__init__.py +77 -0
- feynlag-0.1.0/src/feynlag/pheno/amplitudes.py +181 -0
- feynlag-0.1.0/src/feynlag/pheno/calculator.py +410 -0
- feynlag-0.1.0/src/feynlag/pheno/diagrams.py +446 -0
- feynlag-0.1.0/src/feynlag/pheno/epsilon.py +230 -0
- feynlag-0.1.0/src/feynlag/pheno/integrate.py +78 -0
- feynlag-0.1.0/src/feynlag/pheno/kinematics.py +361 -0
- feynlag-0.1.0/src/feynlag/pheno/loop.py +175 -0
- feynlag-0.1.0/src/feynlag/pheno/lorentz.py +214 -0
- feynlag-0.1.0/src/feynlag/pheno/offshell.py +165 -0
- feynlag-0.1.0/src/feynlag/pheno/particles.py +184 -0
- feynlag-0.1.0/src/feynlag/pheno/propagator.py +90 -0
- feynlag-0.1.0/src/feynlag/pheno/scattering.py +173 -0
- feynlag-0.1.0/src/feynlag/pheno/trace.py +105 -0
- feynlag-0.1.0/src/feynlag/pheno/vertices.py +220 -0
- feynlag-0.1.0/src/feynlag/suggest.py +714 -0
- feynlag-0.1.0/src/feynlag/vacuum/__init__.py +20 -0
- feynlag-0.1.0/src/feynlag/vacuum/diagonalize.py +356 -0
- feynlag-0.1.0/src/feynlag/vacuum/ewsb.py +79 -0
- feynlag-0.1.0/src/feynlag/vacuum/masses.py +145 -0
- feynlag-0.1.0/src/feynlag/vacuum/tadpoles.py +64 -0
- feynlag-0.1.0/src/feynlag/verify/__init__.py +18 -0
- feynlag-0.1.0/src/feynlag/verify/checks.py +134 -0
- feynlag-0.1.0/src/feynlag/verify/ufo_roundtrip.py +146 -0
- feynlag-0.1.0/src/feynlag/vertices/__init__.py +11 -0
- feynlag-0.1.0/src/feynlag/vertices/bilinear.py +584 -0
- feynlag-0.1.0/src/feynlag/vertices/extract.py +136 -0
- feynlag-0.1.0/src/feynlag/vertices/vertex.py +168 -0
- feynlag-0.1.0/src/feynlag/vertices/yangmills.py +144 -0
- feynlag-0.1.0/src/feynlag.egg-info/PKG-INFO +183 -0
- feynlag-0.1.0/src/feynlag.egg-info/SOURCES.txt +66 -0
- feynlag-0.1.0/src/feynlag.egg-info/dependency_links.txt +1 -0
- feynlag-0.1.0/src/feynlag.egg-info/requires.txt +20 -0
- feynlag-0.1.0/src/feynlag.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to feynlag are documented here. The format follows
|
|
4
|
+
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the project uses
|
|
5
|
+
[Semantic Versioning](https://semver.org/).
|
|
6
|
+
|
|
7
|
+
## [0.1.0] — 2026-09-16
|
|
8
|
+
|
|
9
|
+
First public release (beta).
|
|
10
|
+
|
|
11
|
+
### Model building and checks
|
|
12
|
+
- Parameters split into external and internal, with dependencies resolved in
|
|
13
|
+
order; scalar, Weyl-fermion, Majorana-fermion and gauge-boson fields.
|
|
14
|
+
- Gauge groups `U1` and `SUN` (any SU(N) irrep, generators built in the
|
|
15
|
+
Gelfand–Tsetlin basis); discrete groups `ZN` and `S3` with Clebsch–Gordan
|
|
16
|
+
products.
|
|
17
|
+
- Lagrangian building blocks: `Dmu`, `dag`, `Bilinear`, `MajoranaBilinear`,
|
|
18
|
+
`fermion_gauge_current`.
|
|
19
|
+
- Invariance checks (gauge, discrete, hermiticity, mass dimension with an
|
|
20
|
+
EFT `max_dim` flag) and a `Model.validate()` umbrella adding anomaly
|
|
21
|
+
cancellation, electric-charge conservation and a UFO round-trip.
|
|
22
|
+
- Operator suggestion (`suggest_potential`, `suggest_yukawa`,
|
|
23
|
+
`suggest_kinetic`, `build_lagrangian`), including the dim-5 Weinberg
|
|
24
|
+
operator.
|
|
25
|
+
- Reusable Standard Model builders (`feynlag.models`) and CKM mixing
|
|
26
|
+
(`standard_ckm`).
|
|
27
|
+
|
|
28
|
+
### Symmetry breaking, masses and vertices
|
|
29
|
+
- VEV expansion, tadpole extraction and solving, and scalar, charged,
|
|
30
|
+
gauge-boson, Dirac and Majorana mass matrices, including the type-I seesaw.
|
|
31
|
+
- Diagonalization: orthogonal and analytic 2×2, SVD (biunitary), Takagi,
|
|
32
|
+
and `MajoranaRotation` for Majorana mass eigenstates.
|
|
33
|
+
- Momentum-space Feynman rules for SSS, SSSS, VSS, VVS, VVSS, VVV, VVVV, FFS,
|
|
34
|
+
FFV, four-fermion (FFFF) and Majorana vertices.
|
|
35
|
+
|
|
36
|
+
### Export
|
|
37
|
+
- LaTeX vertex tables.
|
|
38
|
+
- UFO model directories for MadGraph, with SU(3) colour tensors and
|
|
39
|
+
four-fermion Lorentz structures; the exported SM reproduces MadGraph's
|
|
40
|
+
stock `sm` cross sections (`docs/benchmark.md`).
|
|
41
|
+
|
|
42
|
+
### Phenomenology (`feynlag.pheno`)
|
|
43
|
+
- Tree-level 1→2 partial widths, total widths and branching ratios, with a
|
|
44
|
+
`DiracParticle` abstraction for fermions.
|
|
45
|
+
- Off-shell `h→WW*/ZZ*` widths (1→3 with a Breit–Wigner propagator).
|
|
46
|
+
- Loop-induced `h→gg`, `h→γγ` and `h→Zγ` from standard effective vertices.
|
|
47
|
+
- Tree-level single-diagram 2→2 cross sections, including the γ₅ (ε·ε) term
|
|
48
|
+
and the forward–backward asymmetry.
|
|
49
|
+
|
|
50
|
+
### Known limitations
|
|
51
|
+
- No R_ξ gauge fixing or ghosts.
|
|
52
|
+
- Majorana vertices are not exported to UFO.
|
|
53
|
+
- 2→2 scattering does not yet sum interfering diagrams; `VVV` decays are not
|
|
54
|
+
implemented.
|
feynlag-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Moises Zeleny
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
feynlag-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: feynlag
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Tree-level Feynman rules from BSM Lagrangians in pure SymPy
|
|
5
|
+
Author-email: Moises Zeleny <moiseszeleny@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/moiseszeleny/feynlag
|
|
8
|
+
Project-URL: Repository, https://github.com/moiseszeleny/feynlag
|
|
9
|
+
Project-URL: Documentation, https://moiseszeleny.github.io/feynlag/
|
|
10
|
+
Project-URL: Issues, https://github.com/moiseszeleny/feynlag/issues
|
|
11
|
+
Keywords: physics,particle-physics,high-energy-physics,feynman-rules,lagrangian,bsm,beyond-standard-model,sympy,ufo,madgraph,quantum-field-theory,phenomenology
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
22
|
+
Requires-Python: >=3.10
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
Requires-Dist: sympy>=1.14
|
|
26
|
+
Requires-Dist: numpy
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: pytest>=7; extra == "dev"
|
|
29
|
+
Requires-Dist: numpy; extra == "dev"
|
|
30
|
+
Requires-Dist: nbstripout; extra == "dev"
|
|
31
|
+
Requires-Dist: matplotlib; extra == "dev"
|
|
32
|
+
Requires-Dist: scipy; extra == "dev"
|
|
33
|
+
Provides-Extra: docs
|
|
34
|
+
Requires-Dist: sphinx>=7; extra == "docs"
|
|
35
|
+
Requires-Dist: myst-nb; extra == "docs"
|
|
36
|
+
Requires-Dist: furo; extra == "docs"
|
|
37
|
+
Requires-Dist: sphinx-copybutton; extra == "docs"
|
|
38
|
+
Requires-Dist: sphinx-design; extra == "docs"
|
|
39
|
+
Requires-Dist: sphinxcontrib-mermaid; extra == "docs"
|
|
40
|
+
Provides-Extra: numeric
|
|
41
|
+
Requires-Dist: scipy; extra == "numeric"
|
|
42
|
+
Dynamic: license-file
|
|
43
|
+
|
|
44
|
+
# feynlag
|
|
45
|
+
|
|
46
|
+
Tree-level Feynman rules from Beyond-Standard-Model Lagrangians, in pure
|
|
47
|
+
[SymPy](https://sympy.org).
|
|
48
|
+
|
|
49
|
+
You declare particle fields with their gauge and discrete-symmetry
|
|
50
|
+
representations, write the Lagrangian explicitly with library building blocks
|
|
51
|
+
(`Dmu`, `dag`, `Bilinear`), and `feynlag` takes it from there:
|
|
52
|
+
|
|
53
|
+
- gauge / discrete invariance and hermiticity checks,
|
|
54
|
+
- electroweak symmetry breaking: VEV expansion, tadpole conditions,
|
|
55
|
+
- mass-matrix extraction and diagonalization (orthogonal, unitary, SVD for
|
|
56
|
+
Dirac fermions, Takagi for Majorana),
|
|
57
|
+
- rotation from the weak basis to the physical (mass) basis,
|
|
58
|
+
- vertex extraction (SSS, SSSS, VSS, VVS, VVSS, VVV, VVVV, FFS, FFV, plus
|
|
59
|
+
four-fermion and Majorana/Weinberg operators) with derivative couplings
|
|
60
|
+
taken to momentum space,
|
|
61
|
+
- model consistency in one call (`Model.validate()`): invariance,
|
|
62
|
+
hermiticity, anomaly cancellation, charge conservation,
|
|
63
|
+
- export: LaTeX vertex tables and UFO (MadGraph et al.),
|
|
64
|
+
- phenomenology (`feynlag.pheno`): decay widths and branching ratios
|
|
65
|
+
(tree-level 1→2, off-shell `h→WW*/ZZ*`, loop-induced `h→gg/γγ/Zγ`) and
|
|
66
|
+
tree-level 2→2 cross sections with forward–backward asymmetries.
|
|
67
|
+
|
|
68
|
+
Parameters are split into **external** (fixed by experiment, e.g. `v`, `m_h`,
|
|
69
|
+
`g`) and **internal** (derived: tadpole solutions, mixing angles, inverted
|
|
70
|
+
quartics), forming a dependency chain that closes the UFO parameter card.
|
|
71
|
+
|
|
72
|
+
## Documentation
|
|
73
|
+
|
|
74
|
+
Full docs, including an **Algorithms Manual** deriving the physics and
|
|
75
|
+
design of every pipeline stage (invariance checking, EWSB/tadpoles, mass
|
|
76
|
+
matrices, diagonalization, vertex extraction, export), tutorial notebooks,
|
|
77
|
+
an examples gallery, and the API reference:
|
|
78
|
+
**https://moiseszeleny.github.io/feynlag/**
|
|
79
|
+
|
|
80
|
+
## Install
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
pip install feynlag # add [numeric] for SciPy-backed integration
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
For development:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
pip install -e .[dev]
|
|
90
|
+
pytest
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Quick tour
|
|
94
|
+
|
|
95
|
+
```python
|
|
96
|
+
import sympy as sp
|
|
97
|
+
from feynlag import (ExternalParameter, InternalParameter, SU2, U1, Scalar,
|
|
98
|
+
Lagrangian, Model, Dmu, dag)
|
|
99
|
+
|
|
100
|
+
gw = ExternalParameter("gw", 0.6535, positive=True)
|
|
101
|
+
g1 = ExternalParameter("g1", 0.3580, positive=True)
|
|
102
|
+
SU2L, U1Y = SU2("SU2L", coupling=gw), U1("U1Y", coupling=g1)
|
|
103
|
+
|
|
104
|
+
v = ExternalParameter("v", 246.0, positive=True, unit_dim=1)
|
|
105
|
+
lam = ExternalParameter("lam", 0.129)
|
|
106
|
+
mu2 = InternalParameter("mu2", unit_dim=2) # defined by the tadpole
|
|
107
|
+
|
|
108
|
+
H = Scalar("H", reps={SU2L: 2, U1Y: sp.Rational(1, 2)},
|
|
109
|
+
component_names=["Gp", "H0"])
|
|
110
|
+
H.expand_vev({H.components[1]: v}) # H0 -> (v + h + i G0)/√2
|
|
111
|
+
|
|
112
|
+
HdH = (dag(H) * H.mat)[0]
|
|
113
|
+
DH = Dmu(H)
|
|
114
|
+
L = Lagrangian()
|
|
115
|
+
L.add((dag(DH) * DH)[0], sector="kinetic")
|
|
116
|
+
L.add(mu2.s * HdH - lam.s * HdH**2, sector="potential")
|
|
117
|
+
|
|
118
|
+
m = Model("SM", gauge_groups=[SU2L, U1Y],
|
|
119
|
+
fields=[H, SU2L.bosons("W"), U1Y.bosons("B")],
|
|
120
|
+
parameters=[gw, g1, v, lam, mu2], lagrangian=L)
|
|
121
|
+
|
|
122
|
+
m.check_invariance() # gauge invariance, hermiticity, dim ≤ 4
|
|
123
|
+
m.solve_tadpoles([mu2]) # {mu2: lam v²}, registered as internal
|
|
124
|
+
|
|
125
|
+
h = sp.Symbol("H0_r", real=True)
|
|
126
|
+
m.mass_matrix([h]) # Matrix([[2 lam v²]])
|
|
127
|
+
m.feynman_rules([h]) # {(h,h,h): -6i lam v, (h,h,h,h): -6i lam}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
See `examples/` for full runs: `sm_scalar_gauge.py` (complete SM: Higgs +
|
|
131
|
+
electroweak gauge + leptons + quark/QCD sector), `sm_vll.py` (SM + a
|
|
132
|
+
vector-like lepton doublet, biunitary mass-matrix diagonalization),
|
|
133
|
+
`sm_u1x.py` (SM × U(1)_X with a Z′, symbolic charges, chained rotations),
|
|
134
|
+
`thdm.py` (2HDM with the α rotation), `thdm_s3.py` (3HDM+S₃, where the
|
|
135
|
+
tadpole conditions force the √3 vacuum alignment), `sm_ckm.py` (CKM quark
|
|
136
|
+
mixing), `fermi_theory.py` (four-fermion muon decay), `sm_weinberg.py` and
|
|
137
|
+
`sm_seesaw.py` (Majorana neutrino masses), `sm_decays.py` and
|
|
138
|
+
`sm_higgs_decays.py` (widths and the full Higgs branching-ratio table), and
|
|
139
|
+
`ee_to_ff.py` (2→2 scattering). The
|
|
140
|
+
[docs site](https://moiseszeleny.github.io/feynlag/) walks these models
|
|
141
|
+
stage by stage in ten executed tutorial notebooks.
|
|
142
|
+
|
|
143
|
+
## Validation
|
|
144
|
+
|
|
145
|
+
The test suite pins the physics, not just the code (dual verification:
|
|
146
|
+
symbolic difference **and** random-point numeric checks):
|
|
147
|
+
|
|
148
|
+
- SM Higgs: `μ² = λv²`, `m_h² = 2λv²`, `h³ = −3i m_h²/v`, `h⁴ = −3i m_h²/v²`
|
|
149
|
+
- SM gauge: `m_W = gv/2`, Weinberg rotation, `hWW = i g m_W g^{μν}`,
|
|
150
|
+
`γW⁺W⁻ = e`, `ZW⁺W⁻ = g cosθ_W`, scalar-QED Goldstone vertices
|
|
151
|
+
- SM leptons: `hℓℓ = −i m_ℓ/v`, `Wℓν = i g/√2 γ^μ P_L`,
|
|
152
|
+
Z couplings ∝ `T³ − Q sin²θ_W`
|
|
153
|
+
- 2HDM: tadpoles, all three mass matrices and rotation angles vs the
|
|
154
|
+
Gunion–Haber/Branco expressions
|
|
155
|
+
- 3HDM+S₃: invariant potential from the library's CG products; the tadpole
|
|
156
|
+
system forces the `√3` alignment
|
|
157
|
+
- UFO: generated model imports cleanly; parameters resolve in dependency
|
|
158
|
+
order; `hWW` coupling pinned numerically
|
|
159
|
+
|
|
160
|
+
## Status / roadmap
|
|
161
|
+
|
|
162
|
+
feynlag 0.1 is a **beta**: the tree-level pipeline above is complete and
|
|
163
|
+
tested (400+ tests pinning physical results), and the exported SM UFO is
|
|
164
|
+
**cross-checked against MadGraph** (`e+e-→μ+μ-` and the gauge-cancelling
|
|
165
|
+
`e+e-→W+W-` reproduce the stock `sm` cross sections to MC precision, and a
|
|
166
|
+
four-fermion UFO reproduces the muon width — see
|
|
167
|
+
[`docs/benchmark.md`](https://github.com/moiseszeleny/feynlag/blob/main/docs/benchmark.md)).
|
|
168
|
+
|
|
169
|
+
Known limitations (planned, see [`docs/roadmap.md`](https://github.com/moiseszeleny/feynlag/blob/main/docs/roadmap.md)):
|
|
170
|
+
|
|
171
|
+
- no R_ξ gauge fixing or ghosts (Goldstone bosons are kept, but no
|
|
172
|
+
gauge-fixing terms, ghost vertices or ξ dependence);
|
|
173
|
+
- Majorana vertices are symbolic-only, not yet exported to UFO;
|
|
174
|
+
- 2→2 scattering handles single-diagram processes only (no interference yet),
|
|
175
|
+
and `VVV` decays are not implemented;
|
|
176
|
+
- no NLO / UFO 2.0 extensions.
|
|
177
|
+
|
|
178
|
+
Unsupported cases raise `NotImplementedError` rather than returning a
|
|
179
|
+
plausible-looking wrong answer.
|
|
180
|
+
|
|
181
|
+
## License
|
|
182
|
+
|
|
183
|
+
MIT — see [`LICENSE`](https://github.com/moiseszeleny/feynlag/blob/main/LICENSE).
|
feynlag-0.1.0/README.md
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# feynlag
|
|
2
|
+
|
|
3
|
+
Tree-level Feynman rules from Beyond-Standard-Model Lagrangians, in pure
|
|
4
|
+
[SymPy](https://sympy.org).
|
|
5
|
+
|
|
6
|
+
You declare particle fields with their gauge and discrete-symmetry
|
|
7
|
+
representations, write the Lagrangian explicitly with library building blocks
|
|
8
|
+
(`Dmu`, `dag`, `Bilinear`), and `feynlag` takes it from there:
|
|
9
|
+
|
|
10
|
+
- gauge / discrete invariance and hermiticity checks,
|
|
11
|
+
- electroweak symmetry breaking: VEV expansion, tadpole conditions,
|
|
12
|
+
- mass-matrix extraction and diagonalization (orthogonal, unitary, SVD for
|
|
13
|
+
Dirac fermions, Takagi for Majorana),
|
|
14
|
+
- rotation from the weak basis to the physical (mass) basis,
|
|
15
|
+
- vertex extraction (SSS, SSSS, VSS, VVS, VVSS, VVV, VVVV, FFS, FFV, plus
|
|
16
|
+
four-fermion and Majorana/Weinberg operators) with derivative couplings
|
|
17
|
+
taken to momentum space,
|
|
18
|
+
- model consistency in one call (`Model.validate()`): invariance,
|
|
19
|
+
hermiticity, anomaly cancellation, charge conservation,
|
|
20
|
+
- export: LaTeX vertex tables and UFO (MadGraph et al.),
|
|
21
|
+
- phenomenology (`feynlag.pheno`): decay widths and branching ratios
|
|
22
|
+
(tree-level 1→2, off-shell `h→WW*/ZZ*`, loop-induced `h→gg/γγ/Zγ`) and
|
|
23
|
+
tree-level 2→2 cross sections with forward–backward asymmetries.
|
|
24
|
+
|
|
25
|
+
Parameters are split into **external** (fixed by experiment, e.g. `v`, `m_h`,
|
|
26
|
+
`g`) and **internal** (derived: tadpole solutions, mixing angles, inverted
|
|
27
|
+
quartics), forming a dependency chain that closes the UFO parameter card.
|
|
28
|
+
|
|
29
|
+
## Documentation
|
|
30
|
+
|
|
31
|
+
Full docs, including an **Algorithms Manual** deriving the physics and
|
|
32
|
+
design of every pipeline stage (invariance checking, EWSB/tadpoles, mass
|
|
33
|
+
matrices, diagonalization, vertex extraction, export), tutorial notebooks,
|
|
34
|
+
an examples gallery, and the API reference:
|
|
35
|
+
**https://moiseszeleny.github.io/feynlag/**
|
|
36
|
+
|
|
37
|
+
## Install
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
pip install feynlag # add [numeric] for SciPy-backed integration
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
For development:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
pip install -e .[dev]
|
|
47
|
+
pytest
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Quick tour
|
|
51
|
+
|
|
52
|
+
```python
|
|
53
|
+
import sympy as sp
|
|
54
|
+
from feynlag import (ExternalParameter, InternalParameter, SU2, U1, Scalar,
|
|
55
|
+
Lagrangian, Model, Dmu, dag)
|
|
56
|
+
|
|
57
|
+
gw = ExternalParameter("gw", 0.6535, positive=True)
|
|
58
|
+
g1 = ExternalParameter("g1", 0.3580, positive=True)
|
|
59
|
+
SU2L, U1Y = SU2("SU2L", coupling=gw), U1("U1Y", coupling=g1)
|
|
60
|
+
|
|
61
|
+
v = ExternalParameter("v", 246.0, positive=True, unit_dim=1)
|
|
62
|
+
lam = ExternalParameter("lam", 0.129)
|
|
63
|
+
mu2 = InternalParameter("mu2", unit_dim=2) # defined by the tadpole
|
|
64
|
+
|
|
65
|
+
H = Scalar("H", reps={SU2L: 2, U1Y: sp.Rational(1, 2)},
|
|
66
|
+
component_names=["Gp", "H0"])
|
|
67
|
+
H.expand_vev({H.components[1]: v}) # H0 -> (v + h + i G0)/√2
|
|
68
|
+
|
|
69
|
+
HdH = (dag(H) * H.mat)[0]
|
|
70
|
+
DH = Dmu(H)
|
|
71
|
+
L = Lagrangian()
|
|
72
|
+
L.add((dag(DH) * DH)[0], sector="kinetic")
|
|
73
|
+
L.add(mu2.s * HdH - lam.s * HdH**2, sector="potential")
|
|
74
|
+
|
|
75
|
+
m = Model("SM", gauge_groups=[SU2L, U1Y],
|
|
76
|
+
fields=[H, SU2L.bosons("W"), U1Y.bosons("B")],
|
|
77
|
+
parameters=[gw, g1, v, lam, mu2], lagrangian=L)
|
|
78
|
+
|
|
79
|
+
m.check_invariance() # gauge invariance, hermiticity, dim ≤ 4
|
|
80
|
+
m.solve_tadpoles([mu2]) # {mu2: lam v²}, registered as internal
|
|
81
|
+
|
|
82
|
+
h = sp.Symbol("H0_r", real=True)
|
|
83
|
+
m.mass_matrix([h]) # Matrix([[2 lam v²]])
|
|
84
|
+
m.feynman_rules([h]) # {(h,h,h): -6i lam v, (h,h,h,h): -6i lam}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
See `examples/` for full runs: `sm_scalar_gauge.py` (complete SM: Higgs +
|
|
88
|
+
electroweak gauge + leptons + quark/QCD sector), `sm_vll.py` (SM + a
|
|
89
|
+
vector-like lepton doublet, biunitary mass-matrix diagonalization),
|
|
90
|
+
`sm_u1x.py` (SM × U(1)_X with a Z′, symbolic charges, chained rotations),
|
|
91
|
+
`thdm.py` (2HDM with the α rotation), `thdm_s3.py` (3HDM+S₃, where the
|
|
92
|
+
tadpole conditions force the √3 vacuum alignment), `sm_ckm.py` (CKM quark
|
|
93
|
+
mixing), `fermi_theory.py` (four-fermion muon decay), `sm_weinberg.py` and
|
|
94
|
+
`sm_seesaw.py` (Majorana neutrino masses), `sm_decays.py` and
|
|
95
|
+
`sm_higgs_decays.py` (widths and the full Higgs branching-ratio table), and
|
|
96
|
+
`ee_to_ff.py` (2→2 scattering). The
|
|
97
|
+
[docs site](https://moiseszeleny.github.io/feynlag/) walks these models
|
|
98
|
+
stage by stage in ten executed tutorial notebooks.
|
|
99
|
+
|
|
100
|
+
## Validation
|
|
101
|
+
|
|
102
|
+
The test suite pins the physics, not just the code (dual verification:
|
|
103
|
+
symbolic difference **and** random-point numeric checks):
|
|
104
|
+
|
|
105
|
+
- SM Higgs: `μ² = λv²`, `m_h² = 2λv²`, `h³ = −3i m_h²/v`, `h⁴ = −3i m_h²/v²`
|
|
106
|
+
- SM gauge: `m_W = gv/2`, Weinberg rotation, `hWW = i g m_W g^{μν}`,
|
|
107
|
+
`γW⁺W⁻ = e`, `ZW⁺W⁻ = g cosθ_W`, scalar-QED Goldstone vertices
|
|
108
|
+
- SM leptons: `hℓℓ = −i m_ℓ/v`, `Wℓν = i g/√2 γ^μ P_L`,
|
|
109
|
+
Z couplings ∝ `T³ − Q sin²θ_W`
|
|
110
|
+
- 2HDM: tadpoles, all three mass matrices and rotation angles vs the
|
|
111
|
+
Gunion–Haber/Branco expressions
|
|
112
|
+
- 3HDM+S₃: invariant potential from the library's CG products; the tadpole
|
|
113
|
+
system forces the `√3` alignment
|
|
114
|
+
- UFO: generated model imports cleanly; parameters resolve in dependency
|
|
115
|
+
order; `hWW` coupling pinned numerically
|
|
116
|
+
|
|
117
|
+
## Status / roadmap
|
|
118
|
+
|
|
119
|
+
feynlag 0.1 is a **beta**: the tree-level pipeline above is complete and
|
|
120
|
+
tested (400+ tests pinning physical results), and the exported SM UFO is
|
|
121
|
+
**cross-checked against MadGraph** (`e+e-→μ+μ-` and the gauge-cancelling
|
|
122
|
+
`e+e-→W+W-` reproduce the stock `sm` cross sections to MC precision, and a
|
|
123
|
+
four-fermion UFO reproduces the muon width — see
|
|
124
|
+
[`docs/benchmark.md`](https://github.com/moiseszeleny/feynlag/blob/main/docs/benchmark.md)).
|
|
125
|
+
|
|
126
|
+
Known limitations (planned, see [`docs/roadmap.md`](https://github.com/moiseszeleny/feynlag/blob/main/docs/roadmap.md)):
|
|
127
|
+
|
|
128
|
+
- no R_ξ gauge fixing or ghosts (Goldstone bosons are kept, but no
|
|
129
|
+
gauge-fixing terms, ghost vertices or ξ dependence);
|
|
130
|
+
- Majorana vertices are symbolic-only, not yet exported to UFO;
|
|
131
|
+
- 2→2 scattering handles single-diagram processes only (no interference yet),
|
|
132
|
+
and `VVV` decays are not implemented;
|
|
133
|
+
- no NLO / UFO 2.0 extensions.
|
|
134
|
+
|
|
135
|
+
Unsupported cases raise `NotImplementedError` rather than returning a
|
|
136
|
+
plausible-looking wrong answer.
|
|
137
|
+
|
|
138
|
+
## License
|
|
139
|
+
|
|
140
|
+
MIT — see [`LICENSE`](https://github.com/moiseszeleny/feynlag/blob/main/LICENSE).
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "feynlag"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Tree-level Feynman rules from BSM Lagrangians in pure SymPy"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = { text = "MIT" }
|
|
12
|
+
authors = [{ name = "Moises Zeleny", email = "moiseszeleny@gmail.com" }]
|
|
13
|
+
keywords = [
|
|
14
|
+
"physics", "particle-physics", "high-energy-physics", "feynman-rules",
|
|
15
|
+
"lagrangian", "bsm", "beyond-standard-model", "sympy", "ufo", "madgraph",
|
|
16
|
+
"quantum-field-theory", "phenomenology",
|
|
17
|
+
]
|
|
18
|
+
classifiers = [
|
|
19
|
+
"Development Status :: 4 - Beta",
|
|
20
|
+
"Intended Audience :: Science/Research",
|
|
21
|
+
"License :: OSI Approved :: MIT License",
|
|
22
|
+
"Operating System :: OS Independent",
|
|
23
|
+
"Programming Language :: Python :: 3",
|
|
24
|
+
"Programming Language :: Python :: 3.10",
|
|
25
|
+
"Programming Language :: Python :: 3.11",
|
|
26
|
+
"Programming Language :: Python :: 3.12",
|
|
27
|
+
"Programming Language :: Python :: 3.13",
|
|
28
|
+
"Topic :: Scientific/Engineering :: Physics",
|
|
29
|
+
]
|
|
30
|
+
dependencies = ["sympy>=1.14", "numpy"]
|
|
31
|
+
|
|
32
|
+
[project.urls]
|
|
33
|
+
Homepage = "https://github.com/moiseszeleny/feynlag"
|
|
34
|
+
Repository = "https://github.com/moiseszeleny/feynlag"
|
|
35
|
+
Documentation = "https://moiseszeleny.github.io/feynlag/"
|
|
36
|
+
Issues = "https://github.com/moiseszeleny/feynlag/issues"
|
|
37
|
+
|
|
38
|
+
[project.optional-dependencies]
|
|
39
|
+
dev = ["pytest>=7", "numpy", "nbstripout", "matplotlib", "scipy"]
|
|
40
|
+
docs = ["sphinx>=7", "myst-nb", "furo", "sphinx-copybutton", "sphinx-design",
|
|
41
|
+
"sphinxcontrib-mermaid"]
|
|
42
|
+
numeric = ["scipy"]
|
|
43
|
+
|
|
44
|
+
[tool.setuptools.packages.find]
|
|
45
|
+
where = ["src"]
|
|
46
|
+
|
|
47
|
+
[tool.pytest.ini_options]
|
|
48
|
+
testpaths = ["tests"]
|
feynlag-0.1.0/setup.cfg
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"""feynlag — tree-level Feynman rules from BSM Lagrangians in pure SymPy."""
|
|
2
|
+
|
|
3
|
+
__version__ = "0.1.0"
|
|
4
|
+
|
|
5
|
+
from .conventions import METRIC_SIGNATURE, SQRT2, tidy
|
|
6
|
+
from .dirac import (
|
|
7
|
+
DiracC, DiracGamma, DiracGammaLower, MetricTensor, dirac0, diracC, diracI,
|
|
8
|
+
diracPL, diracPR, dirac_conjugate, gamma_simplify, majorana_symmetry_sign,
|
|
9
|
+
minkowski_metric,
|
|
10
|
+
)
|
|
11
|
+
from .operators import (
|
|
12
|
+
D_linear, Dmu, PartialMu, expand_derivatives, momentum, to_momentum_space,
|
|
13
|
+
)
|
|
14
|
+
from .vertices import (
|
|
15
|
+
extract_interaction_coefficients, feynman_rule, vertex_multiplicity,
|
|
16
|
+
)
|
|
17
|
+
from .vertices.vertex import LORENTZ_CATALOG, Vertex, classify_spins
|
|
18
|
+
from .vertices.yangmills import (
|
|
19
|
+
cubic_couplings, quartic_couplings, structure_constants,
|
|
20
|
+
)
|
|
21
|
+
from .vacuum.masses import gauge_mass_matrix
|
|
22
|
+
from .verify import (
|
|
23
|
+
UFORoundTripReport, check_dimension, is_hermitian, is_symmetric,
|
|
24
|
+
numeric_equal, round_trip_reconstruct, seesaw_light_mass,
|
|
25
|
+
verify_ufo_numeric,
|
|
26
|
+
)
|
|
27
|
+
from .export import latex_feynman_table
|
|
28
|
+
from .parameters import (
|
|
29
|
+
ExternalParameter, InternalParameter, Parameter, ParameterSet,
|
|
30
|
+
)
|
|
31
|
+
from .groups import SU2, SU3, SUN, U1, S3, ZN, DiscreteSymmetry, GaugeGroup
|
|
32
|
+
from .fields import (
|
|
33
|
+
DiracFermion, Field, Fermion, GaugeBoson, MajoranaFermion, Scalar,
|
|
34
|
+
WeylFermion, bar_partner, conjugate_pair, dag, hc,
|
|
35
|
+
)
|
|
36
|
+
from .vacuum import (
|
|
37
|
+
MajoranaRotation, Rotation, Vacuum, build_mass_matrix, charged_mass_matrix,
|
|
38
|
+
diagonalize_orthogonal_2x2, diagonalize_svd, diagonalize_svd_2x2,
|
|
39
|
+
diagonalize_takagi,
|
|
40
|
+
rotation_2x2, scalar_mass_matrix, seesaw_mass_matrix, seesaw_light_mass,
|
|
41
|
+
solve_mixing_angle_2x2,
|
|
42
|
+
)
|
|
43
|
+
from .vertices.bilinear import (
|
|
44
|
+
Bilinear, MajoranaBilinear, expand_bilinear, extract_fermion_vertices,
|
|
45
|
+
extract_majorana_vertices, fermion_feynman_rule, fermion_gauge_current,
|
|
46
|
+
fermion_mass_matrix, four_fermion_feynman_rule, majorana_feynman_rule,
|
|
47
|
+
majorana_mass_matrix,
|
|
48
|
+
)
|
|
49
|
+
from .invariance import (
|
|
50
|
+
check_discrete_invariance, check_gauge_invariance, check_hermiticity,
|
|
51
|
+
check_mass_dimension, gauge_variation,
|
|
52
|
+
)
|
|
53
|
+
from .lagrangian import (
|
|
54
|
+
InvarianceReport, Lagrangian, LagrangianTerm, Model, ValidationReport,
|
|
55
|
+
)
|
|
56
|
+
from .anomalies import (
|
|
57
|
+
AnomalyReport, anomaly_coefficients, check_anomaly_free,
|
|
58
|
+
)
|
|
59
|
+
from .charges import (
|
|
60
|
+
ChargeConservationReport, ChargeConsistencyReport, ChargeRegistry,
|
|
61
|
+
HermiticityPairingReport, check_charge_conservation,
|
|
62
|
+
check_charge_consistency, check_hermiticity_pairing,
|
|
63
|
+
derive_charge_operator, physical_charges,
|
|
64
|
+
)
|
|
65
|
+
from .flavor import CKM_ELEMENT_NAMES, cabibbo_2x2, standard_ckm
|
|
66
|
+
from .gauge_basis import (
|
|
67
|
+
adjoint_rotation, gauge_self_couplings, physical_vector_basis,
|
|
68
|
+
)
|
|
69
|
+
from .export.ufo.legs import ufo_leg_sign
|
|
70
|
+
from .models import (
|
|
71
|
+
ElectroweakScaffold, PhysicalBasis, StandardModel,
|
|
72
|
+
charged_current_rotation, electroweak_gauge, electroweak_scaffold,
|
|
73
|
+
higgs_doublet, standard_model, to_physical_basis, weinberg_rotation,
|
|
74
|
+
)
|
|
75
|
+
from .suggest import (
|
|
76
|
+
SuggestedTerm, build_lagrangian, suggest_kinetic, suggest_potential,
|
|
77
|
+
suggest_yukawa,
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
__all__ = [
|
|
81
|
+
"Parameter", "ExternalParameter", "InternalParameter", "ParameterSet",
|
|
82
|
+
"GaugeGroup", "U1", "SUN", "SU2", "SU3", "DiscreteSymmetry", "ZN", "S3",
|
|
83
|
+
"Field", "Scalar", "Fermion", "WeylFermion", "DiracFermion",
|
|
84
|
+
"MajoranaFermion", "GaugeBoson", "dag", "hc", "conjugate_pair",
|
|
85
|
+
"bar_partner",
|
|
86
|
+
"Vacuum", "Rotation", "MajoranaRotation", "rotation_2x2",
|
|
87
|
+
"solve_mixing_angle_2x2",
|
|
88
|
+
"diagonalize_orthogonal_2x2", "diagonalize_svd", "diagonalize_svd_2x2",
|
|
89
|
+
"diagonalize_takagi",
|
|
90
|
+
"build_mass_matrix", "scalar_mass_matrix", "charged_mass_matrix",
|
|
91
|
+
"seesaw_mass_matrix", "seesaw_light_mass",
|
|
92
|
+
"Bilinear", "MajoranaBilinear", "expand_bilinear",
|
|
93
|
+
"extract_fermion_vertices", "extract_majorana_vertices",
|
|
94
|
+
"fermion_feynman_rule", "fermion_gauge_current", "fermion_mass_matrix",
|
|
95
|
+
"four_fermion_feynman_rule", "majorana_mass_matrix",
|
|
96
|
+
"majorana_feynman_rule",
|
|
97
|
+
"gauge_variation", "check_gauge_invariance", "check_discrete_invariance",
|
|
98
|
+
"check_hermiticity", "check_mass_dimension",
|
|
99
|
+
"Lagrangian", "LagrangianTerm", "Model", "InvarianceReport",
|
|
100
|
+
"ValidationReport",
|
|
101
|
+
"METRIC_SIGNATURE", "SQRT2", "tidy",
|
|
102
|
+
"DiracGamma", "DiracGammaLower", "DiracC", "MetricTensor", "dirac0",
|
|
103
|
+
"diracI", "diracPL", "diracPR", "diracC", "dirac_conjugate",
|
|
104
|
+
"gamma_simplify", "majorana_symmetry_sign", "minkowski_metric",
|
|
105
|
+
"D_linear", "Dmu", "PartialMu", "expand_derivatives", "momentum",
|
|
106
|
+
"to_momentum_space",
|
|
107
|
+
"Vertex", "classify_spins", "LORENTZ_CATALOG",
|
|
108
|
+
"structure_constants", "cubic_couplings", "quartic_couplings",
|
|
109
|
+
"gauge_mass_matrix",
|
|
110
|
+
"extract_interaction_coefficients", "feynman_rule", "vertex_multiplicity",
|
|
111
|
+
"check_dimension", "is_hermitian", "is_symmetric", "numeric_equal",
|
|
112
|
+
"round_trip_reconstruct", "seesaw_light_mass",
|
|
113
|
+
"UFORoundTripReport", "verify_ufo_numeric",
|
|
114
|
+
"latex_feynman_table",
|
|
115
|
+
"SuggestedTerm", "suggest_potential", "suggest_yukawa", "suggest_kinetic",
|
|
116
|
+
"build_lagrangian",
|
|
117
|
+
"AnomalyReport", "anomaly_coefficients", "check_anomaly_free",
|
|
118
|
+
"ChargeRegistry", "ChargeConservationReport", "ChargeConsistencyReport",
|
|
119
|
+
"HermiticityPairingReport", "check_charge_conservation",
|
|
120
|
+
"check_charge_consistency", "check_hermiticity_pairing",
|
|
121
|
+
"derive_charge_operator", "physical_charges",
|
|
122
|
+
"standard_ckm", "cabibbo_2x2", "CKM_ELEMENT_NAMES",
|
|
123
|
+
"adjoint_rotation", "gauge_self_couplings", "physical_vector_basis",
|
|
124
|
+
"ufo_leg_sign",
|
|
125
|
+
"ElectroweakScaffold", "PhysicalBasis", "StandardModel",
|
|
126
|
+
"electroweak_gauge", "higgs_doublet", "weinberg_rotation",
|
|
127
|
+
"charged_current_rotation", "electroweak_scaffold", "to_physical_basis",
|
|
128
|
+
"standard_model",
|
|
129
|
+
]
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
def __getattr__(name):
|
|
133
|
+
# ``feynlag.pheno`` is imported on first access, so ``import feynlag``
|
|
134
|
+
# stays free of the numeric/phenomenology stack.
|
|
135
|
+
if name == "pheno":
|
|
136
|
+
import importlib
|
|
137
|
+
return importlib.import_module(".pheno", __name__)
|
|
138
|
+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|