Fast tree-level and one-loop matrix elements
pyAmpliCol is a matrix-element generator with a Rust runtime. It turns a scattering process of a built-in, UFO or JSON model into an artifact that evaluates its tree-level, one-loop or loop-induced matrix elements. It is used from the command line and Python, and from C11, C++17, Fortran 2008 and Rust 2021 through the native SDK.
- Trees at full, next-to-leading or leading color, with run-time helicity selection (and color-flow selection at leading color).
- One-loop corrections (
[QCD],[QCD QED]): Born-virtual interference and its poles, split by squared coupling order, in the real on-shell or the complex-mass scheme. - Loop-induced processes (
[noborn=QCD]) such asg g > h h. - Shipped loop models:
loop_smfor QCD;loop_qcd_qed_smandloop_qcd_qed_sm_Gmufor QCD and electroweak corrections. - Two reductions, NinjaRS and TIRust, with stability estimates and a higher-precision rescue of refused reductions; Python adds a policy that repeats whole points.
- Spin and color correlations,
a multi-threaded one-loop runtime, and pole and Ward checks (
pyamplicol check).
Install
python -m venv .venv && . .venv/bin/activate
python -m pip install pyamplicol
Wheels for Python 3.11 and newer cover macOS 11 or newer (arm64, x86_64) and Linux
x86_64 (manylinux 2.28); they need no compiler. One-loop matrix elements need
version 1.0.3 or newer. From source, with Rust 1.96 or newer (rustup takes the
pinned 1.97.1), a C/C++ toolchain, make, m4, git and network access
(guide):
git clone --branch v1.0.3 --depth 1 https://github.com/MadGraphTeam/pyamplicol.git
cd pyamplicol
python -m pip install . # macOS
python -m pip install . --config-settings pyamplicol.host-wheel=true # Linux
Symbolica is a required dependency. While the package key that pyAmpliCol registers at import is valid, the calls made by pyAmpliCol need no personal Symbolica license (details). Artifacts of earlier builds are refused by 1.0.3: generate them again; see the release notes.
From the command line
A process is generated once, then evaluated. Without a momenta file, evaluate draws
two flat phase-space points (at 1 TeV for the processes below). Output is shortened.
Tree level, in full color, then one color flow in leading color:
pyamplicol generate "g g > t t~" artifacts/tree --model built-in-sm --color-accuracy full
pyamplicol evaluate artifacts/tree
pyamplicol generate "u u~ > g g g" artifacts/tree_lc --model built-in-sm --color-accuracy lc
pyamplicol evaluate artifacts/tree_lc --color-flow 1
# artifacts/tree (full color)
| point | matrix element |
| 0 | +1.256317208040510e+00 |
...
# artifacts/tree_lc (leading color, color flow 1)
| point | matrix element |
| 0 | +1.319850948400757e-05 |
One loop. The default real on-shell scheme refuses a top width in the tree
currents; no_widths is the loop_sm way to zero it (not for the QCD+QED models,
whose no_widths also changes masses):
pyamplicol generate "g g > t t~ [QCD]" artifacts/loop --model loop_sm --restriction no_widths
pyamplicol evaluate artifacts/loop
| point | virtual squared order | finite [0] | single pole [-1] | double pole [-2] |
| 0 | QCD^6 | +0.5328865751873291 | -0.25843080806497853 | -0.1415641898922143 |
Loop-induced, with the recommended stability checks:
pyamplicol generate "g g > h h [noborn=QCD]" artifacts/loop_induced --model loop_sm
pyamplicol evaluate artifacts/loop_induced \
--stability-rotations 1 --stability-reduction-direction --stability-rescaled
| point | virtual squared order | finite [0] | ...
| 0 | QCD^4, QED^4 | +3.237119151958233e-05 | ...
...
# Stability estimates (relative, target 1e-05)
| point | relative | finite | ...
| 0 | 3.525e-10 | 3.525e-10 | ...
From Python
Momenta are lists of [E, px, py, pz] per external particle, incoming first.
from math import sqrt
from pyamplicol import (
ColorConfig, ModelSource, RunConfig, Runtime, VirtualRescuePolicy, generate,
)
def point(m, E=500.0): # 2 -> 2 at 1 TeV; m is the model's mass of both final particles
p = sqrt(E * E - m * m)
return [[E, 0, 0, E], [E, 0, 0, -E],
[E, 0.6 * p, 0, 0.8 * p], [E, -0.6 * p, 0, -0.8 * p]]
# Tree level, full color
sm = ModelSource.built_in_sm()
full = RunConfig(action="generate", color=ColorConfig(accuracy="full"))
generate("u u~ > g g", "artifacts/py_tree", model=sm, config=full)
print(Runtime.load("artifacts/py_tree").evaluate([point(0.0)])[0].real)
# 9.46764566762281
# Tree level, leading color (the tree default), per color flow
generate("u u~ > g g", "artifacts/py_tree_lc", model=sm)
runtime = Runtime.load("artifacts/py_tree_lc")
for flow in runtime.physics.color_flow_ids:
print(flow, runtime.evaluate([point(0.0)], color_flows=[flow])[0].real)
# flow:2,3,4,1 0.15025064637097335
# flow:2,4,3,1 12.170302356048834
# One loop, with two threads and the rescue policy
loop_sm = ModelSource.from_path("loop_sm", restriction="no_widths")
generate("g g > t t~ [QCD]", "artifacts/py_loop", model=loop_sm)
runtime = Runtime.load("artifacts/py_loop", threads=2)
# mu_r2: the squared renormalization scale; results are indexed [point][order]
result = runtime.evaluate([point(173.0)], mu_r2=1000**2, stability=VirtualRescuePolicy())
print(result.born_values[0][0])
# 2.1999075333190716
print(result.values[0][0])
# LaurentCoefficients(finite=0.7171999700928999, single_pole=-0.5676332035131346, double_pole=-0.24788932005716266)
print(f"{result.stability[0].relative:.0e}") # relative accuracy estimate
# 4e-14
# Loop-induced
loop_sm = ModelSource.from_path("loop_sm")
generate("g g > h h [noborn=QCD]", "artifacts/py_loop_induced", model=loop_sm)
runtime = Runtime.load("artifacts/py_loop_induced")
result = runtime.evaluate([point(125.0)], mu_r2=1000**2)
print(result.contribution, result.values[0][0].finite)
# loop-induced 3.2293614476584975e-05
Run the shipped examples
pyamplicol examples list names the run cards, among them:
| generate_pp_zjj_from_ufo_sm | generate | Generate p p > Z j j from the serialized form of the UFO ...
| loop_uux_ttxgg_generate | generate | Loop example: generate u u~ > t t~ g g, NLO QCD virtual ...
| loop_gg_zgg_generate | generate | Loop example: generate g g > z g g, loop-induced ...
Run a generation card first, then the card that evaluates its artifact:
pyamplicol examples run generate_pp_zjj_from_ufo_sm
pyamplicol examples run evaluate_total
pyamplicol examples run loop_uux_ttxgg_generate
pyamplicol examples run loop_uux_ttxgg_evaluate
# evaluate_total
| point | matrix element |
| 0 | +1.866133610490048e-02 |
...
# loop_uux_ttxgg_evaluate
| point | virtual squared order | finite [0] | ...
| 0 | QCD^10 | +3.5913911917268418e-09 | ...
examples run writes its artifacts in a workspace of your user cache. A second run
of a generation card is refused unless you add --set generation.mode=replace.
Editable copies of the cards, scripts and data:
pyamplicol examples copy ./pyamplicol-examples
cd pyamplicol-examples
pyamplicol builtin_sm_lc.toml
pyamplicol loop_generate.toml generate --process="g g > h [noborn=QCD]" --output=./gg_h
python python/typed_generation.py artifacts/pp_zjj --plan-only
The copy also holds C, C++, Fortran and Rust drivers in native; the
examples guide
describes every card and how to build them.
Where to go next
- The documentation covers models, configuration and the Python API. One-loop users coming from MadLoop can start with QCD or QCD+QED.
- Native APIs and UMAMI and MadSpace describe the C11, C++17, Fortran 2008 and Rust 2021 interfaces and the shared library.
- Papers: the tree-level version is described in pyAmpliCol: fast tree-level matrix elements, arXiv:2610.10729; a paper on the one-loop extension is forthcoming.
License
pyAmpliCol is distributed under the 0BSD license. It builds on Symbolica, SymJIT, NinjaRS, TIRust and oneloopmaster; see the third-party notices and the licensing page.
Metadata
Release files for pyamplicol 1.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyamplicol-1.0.3.tar.gz | 21.7 MB | With provenance | Details for pyamplicol-1.0.3.tar.gz |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyamplicol-1.0.3-cp311-abi3-manylinux_2_28_x86_64.whl | CPython 3.11 | abi3 | Linux glibc 2.28+ x86-64 | Details for pyamplicol-1.0.3-cp311-abi3-manylinux_2_28_x86_64.whl |
| pyamplicol-1.0.3-cp311-abi3-macosx_11_0_x86_64.whl | CPython 3.11 | abi3 | macOS 11.0+ x86-64 | Details for pyamplicol-1.0.3-cp311-abi3-macosx_11_0_x86_64.whl |
| pyamplicol-1.0.3-cp311-abi3-macosx_11_0_arm64.whl | CPython 3.11 | abi3 | macOS 11.0+ ARM64 | Details for pyamplicol-1.0.3-cp311-abi3-macosx_11_0_arm64.whl |
Total release size: 309.7 MB
Release files / pyamplicol-1.0.3.tar.gz
| Download URL | pyamplicol-1.0.3.tar.gz |
|---|---|
| Size | 21.7 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8f7dee94280cdad0e2c63be1e579980bf74a3acbbcc63dbf9c923c5c839c0447
|
|
BLAKE2b-256 checksum How to use checksums |
c4ce0461b9d63ea6a71ea2b7f5296a9381c35af74bb8f2d0d43cf8564e5315ca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.
Transparency logRelease files / pyamplicol-1.0.3-cp311-abi3-manylinux_2_28_x86_64.whl
| Download URL | pyamplicol-1.0.3-cp311-abi3-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 98.7 MB |
| Tags | CPython 3.11 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
1009d3c6108a175751276990d11e7d7686ed4c42dfe3e2593e0169cd2fcbd100
|
|
BLAKE2b-256 checksum How to use checksums |
94cc1e93d90c053689bcc26e8ab00b6b6685ff5ab60a2d8bfd1c51312de95db8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.
Transparency logRelease files / pyamplicol-1.0.3-cp311-abi3-macosx_11_0_x86_64.whl
| Download URL | pyamplicol-1.0.3-cp311-abi3-macosx_11_0_x86_64.whl |
|---|---|
| Size | 102.3 MB |
| Tags | CPython 3.11 abi3 macOS 11.0+ x86-64 |
|
SHA-256 checksum How to use checksums |
6729e3b0b2186578453a3f3650d8f0400ac559ad978ddd8540115ded107cbf80
|
|
BLAKE2b-256 checksum How to use checksums |
58e469b3fdad4a4e4e4a90e04cb6c3df1e140c71de1361e1120bbda06ddfd43d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.
Transparency logRelease files / pyamplicol-1.0.3-cp311-abi3-macosx_11_0_arm64.whl
| Download URL | pyamplicol-1.0.3-cp311-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 87.0 MB |
| Tags | CPython 3.11 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
ff2110efcee120b9dd4b81f38549d24a80f7935bc89bdc110cd312abd164a05e
|
|
BLAKE2b-256 checksum How to use checksums |
67714034f499b2cb473baa7d729f0599f71974e74e7031c5b4906d08abbf198f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.
Transparency logSecurity for pyamplicol 1.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 4 files in this release have been uploaded with provenance metadata.
Attestation for pyamplicol-1.0.3.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.