GammaLoop · latest
On this page

GammaLoop DOT input

GammaLoop imports Feynman graphs from Graphviz digraph files. The generic DOT syntax and parser behavior are covered in Linnet’s DOT input and graph indices this page records GammaLoop’s physics contract.

Explore a DOT diagram

Edit an amplitude or cross-section diagram with FeynKit. The notebook parses compact model-aware DOT into a FeynmanDiagram and uses its interactive renderer for the preview.

The notebook loads automatically when it comes into view. The first visit downloads browser Python and its dependencies; rendering then runs locally in your browser.

This interactive notebook requires JavaScript and this documentation build’s notebook assets. The physics rendering notebook source is also available to run locally.

The editor accepts compact physics DOT and the annotated format emitted by FeynmanDiagram.to_dot(). FeynKit resolves particle or pdg against the bundled Standard Model and infers interaction slots. Supply int_id if the incident particles match several interactions. Invalid particles, interactions, cut pairs, or loop bases produce a parsing error in the notebook.

The amplitude retains the photon/top/gluon example and its explicit external half-edge order. The cross-section describes electron–positron annihilation into muons. Matching is_cut tags pair its initial-state legs, while graph [final_state="mu-,mu+"] requests physical cuts with those final-state particles. FeynKit sews the initial-state legs, finds matching separating cuts, and routes momenta through the resulting diagram. Each side of a physical cut is one connected blob unless graph [n_cut_blobs="1,2"] (a count or ordered min,max) admits more, as --n-cut-blobs does in generation; canonical DOT export keeps the resulting cuts rather than this filter. The preview opens initial-state connections into matching left/right legs by default. Turn off Split initial state to draw the sewn graph; the parsed diagram and physical final-state cut remain unchanged. Its compact importer supports num, overall_factor, projector, and lmb_id; it does not generate numerator tensors from Feynman rules or implement GammaLoop-specific evaluator overrides and local numerator shorthand.

The initial layout uses 100 steps per epoch, 30 epochs, and seed 42, with momentum arrows and labels disabled. Enable momentum labels to display the parsed diagram’s stored loop momentum basis. The preview and edge table both read the parsed FeynKit diagram. Hover to inspect physics information, and Shift-click to select vertices, edges, or half-edges near an internal edge’s ends. The SVG has a transparent background and follows the documentation theme.

Graph shape and half-edges

digraph box {
  ext [style=invis];
  ext -> v0:0 [particle="e-"];
  v0 -> v1 [id=1, particle="a"];
  v1 -> ext [particle="e+"];
}

Use digraph NAME { ... }. DOT arrows define the underlying edge orientation. An invisible node represents an external dangling half-edge: invisible-node to vertex is incoming, and vertex to invisible-node is outgoing. An edge between two invisible nodes is invalid.

Use one shared ext [style=invis] node for all external legs. Each connection still creates a separate dangling half-edge. Keep the shared node otherwise attribute-free: attributes on a dangling node are merged into every external edge, so put particle, num, and other per-leg data on the edge.

Numeric ports (vertex:0) fix half-edge indices; an edge id=1 fixes its edge index. These are separate index spaces. Assign only indices needed by momentum or numerator references; omitted indices are allocated automatically. Either endpoint of an internal edge can be indexed independently. Supplied indices must be unique and in range across the entire graph, including external legs. A numeric port is not a slot numbered locally within one vertex. Omitted indices follow parser order, which need not be DOT statement order; see DOT input and graph indices for the allocation rules.

InputDrawingGammaLoop calculation
Edge id=nNames the momentum label 𝑞𝑛.Identifies an edge in momentum expressions such as Q(n, ...).
Numeric port vertex:hSets initial row order in both drawing modes and identifies half-edge debug labels.Orders amplitude external momentum and helicity entries; also supplies tensor-index identities.
Edge is_cut=kGroups matching cross-section legs at a shared, movable vertical position.Marks an initial-state cut and orders its external momentum entries; equal tags sew split legs.
Edge lmb_id=kDoes not rename the edge’s 𝑞 label.Selects this edge as the carrier of loop momentum K(k, ...).

DOT arrow direction determines incoming versus outgoing, independently of these numbers and of dir, which controls the displayed or particle orientation. For an amplitude, the runtime external momentum and helicity lists follow increasing dangling half-edge index. Incoming momenta enter the conservation equation with a plus sign and outgoing momenta with a minus sign. Automatic placement in both modes uses this half-edge order, separately for the incoming left column and outgoing right column. Gaps in the indices do not create empty rows. These are initial vertical positions that layout may adjust; explicit positions still take precedence. Moving a port index to another leg changes its kinematic-list position and its initial drawing order. See Kinematics, normalization, and weights for the four-vector and sign conventions.

The graph-level threshold_counterterms attribute controls subtraction solve spaces and weighted variants. Its schema, scoped functions and copyable exports are described in Threshold subtraction metadata. These generation-time directives are separate from runtime sampling channels and maps.

For example, the edge and half-edge indices deliberately differ here:

digraph amplitude_order {
  ext [style=invis];
  ext -> v:3 [id=0, particle="H"];
  v:2 -> ext [id=1, particle="H"];
  v:1 -> ext [id=2, particle="H"];
  ext -> v:0 [id=3, particle="H"];
}

The incoming half-edges are 0, 3, so the left column starts with 𝑞3 above 𝑞0. The outgoing half-edges are 1, 2, so the right column starts with 𝑞2 above 𝑞1. The runtime external list follows half-edges 0, 1, 2, 3, belonging to edges 3, 2, 1, 0. This ordering does not renumber either collection: edge IDs continue to determine the 𝑞 labels.

Cross-section cuts and drawing order

A cross-section input may describe an initial-state cut as an internal edge carrying is_cut, or as two dangling legs with the same is_cut value. In the split form, one leg must be incoming and the other outgoing. They still have distinct edge IDs and distinct half-edge IDs. For example, these two statements in a larger graph identify one pair:

ext -> left:0 [id=0, is_cut=0, particle="e-"];
right:7 -> ext [id=5, is_cut=0, particle="e-"];

Here ext must be declared invisible, and the enclosing graph must have enough edges and half-edges for the explicit indices. Sharing id=0 between the two statements would be an error; sharing is_cut=0 is what associates them. Use one tag per initial-state pair, with consistent particle data on its two legs. A cut-tagged dangling leg without its opposite-flow partner is invalid for a GammaLoop calculation.

On import, GammaLoop sews matching legs into one edge, then sorts the cut tags numerically and moves the resulting cut edges and their incoming half-edges to leading indices 0, 1, .... These cut entries determine the cross-section’s external momentum order. Sewing and this normalization can change other edge and half-edge indices too. Exports conventionally use the incoming cut half-edge index as the tag. On import, however, tags are non-negative integer matching and ordering values: they need not be contiguous or name an existing half-edge. The index bounds described above apply to id and numeric ports, not to these tags.

just draw renders compact DOT directly, without this physics import or sewing. The notebook instead imports compact DOT with FeynKit and selects physical cuts using final_state. Both renderers give incoming legs one shared, movable X coordinate on the left and outgoing legs another on the right. Initial Y positions follow half-edge order separately on each side. Cross sections additionally group Y coordinates by numeric is_cut identity: matching tags share a freely moving row, seeded from the mean of their starting positions. The tag’s numeric order does not determine drawing order. The existing dangling-centroid repulsion spreads external endpoints in both modes; its default strength is gamma-dangling-centroid=1.25. Neither mode automatically pins X or Y. All dangling depths are pinned to zero, and explicit horizontal and vertical placements retain precedence. A tag without a counterpart still gets its side’s X group and its own movable Y group; an untagged leg keeps an independent Y coordinate.

In just draw, generated momentum labels use the current drawing edge’s eid, including on split cut legs: the example’s labels are 𝑞0 and 𝑞5. With edge IDs fixed, changing is_cut, a half-edge port, or lmb_id does not rename these labels. After importing and saving a graph, the labels instead reflect the edge IDs in that newly exported DOT. Do not infer kinematic-list positions from the drawing’s 𝑞 subscripts.

Physics attributes

LocationFieldsMeaning
GraphnumGlobal numerator factor, default 1.
Graphoverall_factor, projector, params, group_id, is_group_masterAdvanced imported-state and grouping metadata.
Nodeint_idUFO interaction identifier when incident particles do not uniquely select a rule.
Nodenum, dodVertex numerator override and degree-of-divergence override.
Edgeparticle, pdgModel particle name or signed UFO PDG code.
EdgedirExplicit orientation; otherwise fermion orientation is derived from the signed particle.
Edgename, massOptional stable name and Symbolica mass override.
Edgelmb_idLoop-momentum slot carried by this edge.
Edgenum, is_cut, is_dummy, momtrop_edge_power, vakint_edge_powerNumerator and evaluator controls.

For fermions, signed particles and edge orientation must give a consistent fermion flow around closed loops and along open fermion lines. External momentum labels are not a current GammaLoop physics attribute; older examples using mom should use edge particle/pdg and half-edge ports. The active model supplies propagator tensors; the legacy propagator field is not a current GammaLoop input field. multiplicity_factor is likewise a legacy field; current grouping uses group_id, is_group_master, and overall_factor.

Numerators and loop bases

A graph, vertex, or edge num is parsed as a Symbolica expression. Quote expressions containing punctuation or spaces. Keep vertex and edge numerators attached to their owning statement when editing an exported graph. In an edge numerator, eid, source, and sink refer to that edge’s index and its existing endpoint indices; their function forms, such as source(0), construct corresponding tensor-index identities. This local shorthand is resolved for edge numerators, not for an arbitrary graph or vertex expression.

For example, num="GC_11*Q(0,cind(0))" multiplies a Standard Model coupling by the time component of edge 0. Graph, tensor, Dirac, and color function names such as Q, cind, g, mink, gamma, and t resolve to their registered definitions (cos(...) remains the cosine function; write spenso::cos for the color sextet). Bare scalar names resolve dim (gammalooprs::dim), Nc (spenso::Nc), and parameters or couplings of the loaded model unless shadowed by a graph-local params declaration or an edge-local eid, source, or sink. An explicit namespace such as example::GC_11 or UFO::MT always selects that exact symbol. CLI generation prefactors and projectors resolve the same model and tensor names in the command parser’s FeynKit frame (where dot denotes spenso::dot rather than runtime DOT’s gammalooprs::dot).

By contrast, generated hedge(h) or hedge(h, k) expressions contain explicit tensor-index identities: h is not a local port number within the statement. Preserve the exported topology, indices, and numerator expressions together. Sewing can move graph records without renaming those abstract tensor identities, so changing only the printed ports or only numbers in num is not a safe way to renumber an exported calculation.

Edge momenta Q(e, ...), loop momenta K(k, ...), and external momenta P(p, ...) use different indices. Setting lmb_id=k chooses the internal edge carrying K(k, ...); it does not set the edge ID or an external momentum slot. The remaining edge momenta are expressed through the chosen basis and external flows. Exports show these expressions in lmb_rep; they are generated routing information, not a replacement for the lmb_id input.

Load a DOT file after importing its model:

import model assets/models/json/sm/sm.json
import graphs ./my_graphs.dot

Save loaded graphs back to DOT with save dot ./my_graphs_exported. GammaLoop fills omitted names, indices, factors, and loop-momentum basis entries during import/export. The current spelling is lmb_id; older wiki examples may use lmb_index.

Keep external data on edges
A shared invisible node is deliberately compact. Put each external particle, numerator, and cut flag on its own connecting edge so those attributes do not get copied to every leg.

For PDF figures, run just draw from the directory written by save dot. See Clinnet DOT rendering for renderer configuration, or Rendering graphs from Python to build graphs with arbitrary Python data and custom drawing selectors.