Color
The color accuracy decides which part of the color sum an artifact computes. You choose it at generation, with color.accuracy in the run card or --color-accuracy on the command line; an artifact cannot change it later. Tree-level requests default to leading color (LC), one-loop requests to full color. This page helps you choose, shows what each accuracy returns, and covers the two other color settings: the FFT contraction, which makes full color faster, and the flow layout of an LC artifact.
The exact definitions of every accuracy are on Correlation and color conventions.
Choose an accuracy
color.accuracy | What is kept | Use it for |
|---|---|---|
lc (default for trees) | the highest power \(N_c^P\) of the color matrix; amplitudes at \(N_c = 3\) | event generation with color flows, the fastest evaluation |
nlc | the powers down to \(N_c^{P-2}\), with \(N_c^P\) the highest | a cheaper approximation to full color |
full (default for one loop) | the exact color sum | physics results and comparisons with other programs |
strict-lc | the leading term of the formal expansion in \(1/N_c\) | studies of the color expansion, at tree level |
strict-nlc | the three leading terms of that expansion | the same, one order further |
lc and nlc keep color in the familiar way of LC event generators: they truncate the color matrix and leave the amplitudes as they are. strict-lc and strict-nlc expand the whole squared amplitude in \(1/N_c\) instead; see Strict expansion.
The difference shows on u d > u d, whose color factor is \(\tfrac{1}{4}(N_c^2 - 1)\) at full color, \(\tfrac{1}{4}(N_c^2 + 1)\) at LC and \(\tfrac{1}{4}N_c^2\) at strict LC, that is 2, 2.5 and 2.25:
from pyamplicol import ColorConfig, ModelSource, RunConfig, Runtime, generate
point = [[500, 0, 0, 500], [500, 0, 0, -500],
[500, 300, 0, 400], [500, -300, 0, -400]]
for accuracy in ("full", "lc", "strict-lc"):
config = RunConfig(action="generate", color=ColorConfig(accuracy=accuracy))
generate("u d > u d", f"artifacts/ud_{accuracy}",
model=ModelSource.built_in_sm(), config=config, mode="replace")
value = Runtime.load(f"artifacts/ud_{accuracy}").evaluate([point])[0].real
print(accuracy, value)
# full 176.88043572777997
# lc 221.10054465972496
# strict-lc 198.9904901937524
The ratios to full color are \(\tfrac{5}{4}\) and \(\tfrac{9}{8}\), the ratios of the color factors. On the command line the accuracy is one option:
pyamplicol generate "u d > u d" artifacts/ud_full_cli --model built-in-sm \
--color-accuracy full
A tree-level request is generated at LC unless you ask otherwise. Compare with MadGraph standalone output or an analytic formula at full: at LC, g g > h in the HEFT model is \(\tfrac{9}{8}\) of its full-color value.
What each accuracy returns
Runtime.evaluate returns the color-summed value at every accuracy. evaluate_resolved also returns the color components, and their number depends on the accuracy:
| Accuracy | Color components per helicity |
|---|---|
lc | one per leading-color flow; you can select flows at evaluation |
nlc, full | one contracted component |
full with color.graded = true | one per power of \(N_c\) |
strict-lc | one: the leading power |
strict-nlc | one per power of \(N_c\) (three) |
Only LC flows can be selected; at the other accuracies you select helicities only. Selection is explained on Evaluating matrix elements.
Leading and next-to-leading color
At lc and nlc the color matrix is built with a symbolic \(N_c\) and truncated, while the amplitudes keep their values at \(N_c = 3\), including the \(-1/N_c\) of every \(\mathrm{U}(1)\) piece of the Fierz identity that joins quark lines. With \(N_c^P\) the highest power of the whole color matrix, LC keeps the terms of order \(N_c^P\) and NLC those down to \(N_c^{P-2}\); for a process with quark lines NLC keeps the exact coefficient of every entry whose highest power is at least \(N_c^{P-2}\).
This is an approximation of the color matrix, not an expansion of the result: the LC value of u d > u d is above the full one, and color conservation and the Casimir relations hold only up to the powers left out. For processes with few colored partons NLC is often exact: it equals full color for u d > u d and g g > g g.
At LC the value splits into one term per color flow, and the flows sum to the total. A flow is named by its color word, for example flow:2,3,4,5,1; runtime.physics.color_flow_ids lists them.
Strict expansion
strict-lc and strict-nlc expand the color-summed squared amplitude in \(1/N_c\) before \(N_c = 3\) is inserted. Each \(\mathrm{U}(1)\) piece of an amplitude counts as one power of \(1/N_c\), so a term of the color sum has a definite degree \(d\) in \(N_c\). With \(P\) the highest degree the color sum can reach,
strict-lckeeps \(d = P\);strict-nlckeeps \(d = P\), \(P - 1\) and \(P - 2\).
Color conservation and the Casimir relations hold degree by degree, so they hold exactly in each strict result. Strict artifacts are tree-level only and are generated in the compiled execution mode, which auto selects for them. For u u~ > g g, full color is
up to a common factor: strict LC keeps \(N_c^3 X\), strict NLC \((N_c^3 - N_c) X - N_c\). The conventions page gives the definition and more examples.
Graded output
A strict artifact reports its value split by degree in \(N_c\), and a full-color artifact does so too when generated with color.graded = true (--color-graded). evaluate_graded returns, per point, the term of each degree evaluated at \(N_c = 3\); the terms sum to the total. One evaluation then gives, for example, full color minus LC:
from pyamplicol import ColorConfig, ModelSource, RunConfig, Runtime, generate
point = [[500, 0, 0, 500], [500, 0, 0, -500],
[500, 300, 0, 400], [500, -300, 0, -400]]
graded = RunConfig(action="generate",
color=ColorConfig(accuracy="full", graded=True))
generate("u u~ > g g", "artifacts/uu_gg_graded", model=ModelSource.built_in_sm(),
config=graded, mode="replace")
split = Runtime.load("artifacts/uu_gg_graded").evaluate_graded([point])
print(split.degrees)
# (3, 2, 1, 0, -1)
print([round(term.real, 6) for term in split.values[0]])
# [12.320553, 0.0, -3.038402, 0.0, 0.185495]
print(split.total[0].real)
# 9.467645667622811
The three nonzero terms are those of the formula above. for_degree(d) returns one degree for every point; the strict LC value is split.for_degree(3). Per helicity, the same split is the color axis of evaluate_resolved, with the components color:nc-degree:<d>. An artifact without degrees (lc, nlc, or full without graded) raises CompatibilityError.
Strict and graded artifacts expand the complete color basis with the direct contraction: they refuse process.max_color_sectors, process.reference_color_order, process.selected_color_sector_ids and the FFT contraction, and every execution mode other than compiled.
Color at one loop
A one-loop request is generated at full color unless you ask otherwise. lc and nlc are served for QCD corrections on a model that declares its formal \(N_c\), such as the shipped loop_sm. There they already expand in \(1/N_c\) as strict-lc and strict-nlc do at tree level, each squared coupling order at its own leading power, which is why the strict accuracies and graded output are refused for one-loop requests (Correlation and color conventions). QED and mixed corrections at LC or NLC are refused with the key lc-electroweak-corrections. The accuracy is asked for the same way at one loop as at tree level: --color-accuracy, color.accuracy in a run card, or a ColorConfig in Python. One-loop matrix elements explains color at one loop.
FFT contraction
At NLC and full color, the color sum can be computed with a Fourier transform over the permutations of the color-ordered amplitudes instead of the direct product with the color matrix. The result is the same exact sum; only the cost differs. Three settings control it:
| Setting | Values | Default |
|---|---|---|
color.contraction (--color-contraction) | auto, direct, symmetric-group-fft | auto |
color.fft_basis | adjoint, trace | adjoint |
--fft adjoint, --fft trace | shorthand: force the FFT with that basis | – |
With the defaults, an NLC or full-color artifact in the recurrence or on-the-fly execution mode uses the FFT where the process supports it and the direct contraction elsewhere. LC, the compiled and eager modes, strict and graded colors and correlations always use the direct contraction. You need to do nothing to get the FFT; to compare, generate the same process with --color-contraction direct and time both with profile.
The adjoint basis picks the smallest exact representation the process admits:
| Process | Representation |
|---|---|
| gluons only (Yang–Mills trees) | Del Duca–Dixon–Maltoni (DDM) basis: \((n-2)!\) orderings of \(n\) gluons instead of \((n-1)!\) |
gluons and one Higgs boson in HEFT, with HIG = 1 | DDM basis of the gluons |
| one quark line, with color singlets | the fundamental chain of the quark line |
| several quark lines | exact products of fundamental chains |
| other adjoint interactions | the trace basis |
To force the FFT, and get an error where a process does not support it, pass --fft with an explicit NLC or full accuracy and a supported mode:
pyamplicol generate "g g > g g g" artifacts/ggg_fft --model built-in-sm \
--color-accuracy full --fft adjoint --execution-mode recurrence
The artifact records what generation chose as fft_basis_selection in its artifact.json: the requested and the actual basis, the name of the representation (here ddm) and the reason.
The speed-up depends on the process. For pure-gluon processes the adjoint basis is faster than the trace basis from six external gluons on, and the two are comparable below. A process with a small symmetry group, or one whose color sum is mostly outside the transformed part, can gain little over the direct contraction. Measure before you rely on it.
Two tuning settings change speed and memory, never results: color.adjoint_dense_max_gluons (default 12), above which the automatic basis prefers the trace basis, and color.fused_selector_max_sectors (default 128), the number of color sectors up to which an auxiliary path for helicity selection is built. Both are listed in the Run card.
Leading-color flow layouts
An LC artifact in the recurrence, compiled or eager mode stores its recursion arranged for one of two repeated workloads. Both layouts keep every flow and every helicity, and both answer every selection; the layout decides which one is fast.
color.lc_flow_layout | Fast for |
|---|---|
topology-replay (default) | one selected color flow, summed over helicities |
all-flow-union | one selected helicity, summed over color flows |
Choose topology-replay when a color sampler asks for one flow at a time; choose all-flow-union when a helicity sampler asks for one helicity at a time. For the fully summed value, time both on your process and batch size.
pyamplicol generate "u u~ > g g g" artifacts/uu_ggg_union --model built-in-sm \
--lc-flow-layout all-flow-union
pyamplicol inspect artifacts/uu_ggg_union
...
| u_ubar_to_g_g_g | mode / backend | recurrence (jit) |
| u_ubar_to_g_g_g | LC flow layout | all-flow-union |
...
The layout is fixed at generation: selections at evaluation do not change it. The on-the-fly mode has no stored layout: it builds what the first selection asks for (Execution modes and backends). Evaluating matrix elements shows the selections that match each layout.
Limits
- The accuracy is fixed at generation; regenerate to change it.
- Color-flow selection exists at LC only.
strict-lc,strict-nlcandcolor.gradedare tree-level only, compiled mode only, with the complete color basis and the direct contraction.color.gradedcombines withfull, not withlcornlc.- Forcing the FFT (
--fft,contraction = "symmetric-group-fft") is refused at LC, in the compiled and eager modes, with strict or graded colors and with correlations. all-flow-unionis LC only and refusesprocess.max_color_sectors; in the compiled and eager modes it also refuses a selection of flows or helicities at generation.- At one loop, LC and NLC serve QCD corrections only (
lc-electroweak-corrections).
See also
- Correlation and color conventions: the definitions.
- Evaluating matrix elements: helicity and color-flow selection.
- Execution modes and backends: which modes serve which accuracy.
- Spin and color correlations: color accuracy of correlations.
- Run card: every
[color]field.