- Home
- Library
- Computational Quantum Field Theory
- From a Lagrangian to Executable Amplitudes
- From a Lagrangian to Feynman Diagrams
From a Lagrangian to Feynman Diagrams
A diagram generator must answer more than “which lines can be connected?” It must know which fields can propagate into one another, which permutations describe the same internal graph, and which exchanges of external fermions change the amplitude's sign. A plausible picture can conceal an incorrect multiplicity or a missing minus sign.
This article builds a small generator whose complete output can be checked independently by Wick contractions. The examples are four-scalar scattering with cubic and quartic interactions, and identical-fermion scattering through scalar exchange. They connect the derivation of Feynman rules to Dirac and color algebra. The program generates a specified class of four-point trees; it is not a general loop-diagram package.
What information belongs in the model?
In four dimensions, take a real scalar of mass and a Dirac field of mass , with
Here and in mass units. We calculate perturbatively about . The scalar condition makes this a local classical minimum. For a sufficient condition that it is the unique classical minimum, one may also impose
Indeed, , and (2) makes the quadratic bracket strictly positive. This condition fixes the minimum of the classical potential. At higher orders, a tadpole or vacuum-renormalization condition is needed to keep the expansion point fixed.
Each interaction is stored as a coefficient and a list of field slots. For example, a Yukawa vertex contains one , one , and one . The order of the two fermionic slots is retained. A scalar propagator joins two slots; an oriented fermion propagator joins a slot to a slot. It never joins two slots in this Dirac model.
With the inverse Fourier phase and vertices obtained from , the nonderivative rules are
The factorials in (1) have already been canceled by permutations of identical scalar slots when deriving these rules. They must not be divided out a second time during amplitude assembly.
A useful software separation is to generate topologies, insert allowed fields, and then attach vertex and propagator expressions. FeynArts makes this separation explicit; its topology generation also removes equivalent internal-vertex labelings. Hahn, §§2 and 3.1, preprint pp. 3–6 (PDF). Our implementation combines the first two steps for a very small tree class, while leaving the algebraic factors separate.
A bounded generator whose graph list is derived
For a connected tree with external legs, internal vertices of valence , and internal lines,
At , with only valence three and four, the possibilities are therefore one four-valent vertex or two three-valent vertices joined by one internal line. There are no other tree topologies in this model. Two-point counterterm insertions would invalidate this simple bound and require an additional perturbative-order restriction.
The generator uses (4) as follows:
- For a four-valent vertex, test whether its four slots can attach to the four labeled external fields.
- For a pair of three-valent vertices, choose every two-element subset of the external labels for the first vertex. Give the complement to the second.
- Remove the slots used by those external fields. Keep a candidate only if one slot remains at each vertex and those two fields admit a propagator.
- Store a canonical key that identifies equivalent internal-vertex relabelings, while keeping every external label fixed.
An external Green-function field attaches to an internal slot, and conversely. These types encode orientation before any spinor chain is evaluated. For example, four external fields produce no allowed tree from two number-conserving Yukawa vertices.
The scalar exchange output consists of the unordered partitions
These partitions are generated by the subset and field-compatibility operations; they are not supplied as an expected channel list. Their interpretation as channels comes later, from the assigned physical momenta. Exchanging the two internal vertices changes no partition. Exchanging external labels generally changes which momentum flows through the internal line.
The four generated scalar trees. Labels specify the external particles; horizontal placement does not impose an incoming or outgoing convention. Each exchange partition is one graph even though its labeled vertex slots admit 72 contractions. The graph list and multiplicities come from two different enumeration procedures.
Wick counting checks the multiplicities
The independent check starts with all individual field slots in the perturbative expansion of the time-ordered Green function. It recursively pairs the first remaining slot with every compatible partner, then pairs the rest. A completed matching is rejected if it contracts two external fields directly, makes a self-contraction, disconnects the graph, or produces a cycle. For the tree class considered here, the surviving edges obey the connected-graph test and .
At first order in the quartic interaction, there are ways to attach four distinct external labels to the four slots. The expansion contributes , so the amputated contact coefficient is one.
At second order in the cubic interaction, the expansion contains
Choose which two of the four external fields attach to : there are choices. At each vertex, the two external labels can occupy its slots in ways. The two remaining slots must contract with each other. Thus there are connected contractions. Each of the three partitions in (5) receives , exactly canceling .
| Contribution | Raw contractions per graph | Expansion denominator | Graph coefficient |
|---|---|---|---|
| Quartic contact | 24 | 24 | |
| Each cubic exchange | 72 | 72 | |
| Yukawa direct exchange | 2 | 2 | |
| Yukawa exchanged pairing | 2 | 2 |
The final two rows include the fermionic permutation signs derived below. Omitting only the Dyson in (6) gives coefficient two for every exchange graph, although the set of pictures remains correct. Conversely, applying a further factor after using the already normalized vertices and their correct graph coefficient undercounts the amplitude.
The graph symmetry factor is also distinct from the that may appear when integrating over the full labeled phase space of two identical outgoing particles. The latter prevents counting the same final physical state twice. It does not halve either the or amplitude before interference.
Momentum routing turns partitions into an amplitude
Let be incoming and outgoing physical momenta for scalar scattering. Assign the all-incoming map
For a two-vertex tree, summing the attached to either vertex gives the internal momentum, up to reversal. The scalar propagator depends only on its square. The partitions in (5) give , , and .
Using , each exchange contributes
The complete tree amplitude is consequently
The generator's evaluator obtains each denominator by summing attached momenta, rather than selecting a stored Mandelstam expression. For , , , center-of-mass momentum , and scattering cosine , it finds , , , and . These parameters obey (2), and this evaluation is away from exchange poles. The independent expression (9) agrees at the precision shown. Relabeling external scalar fields permutes the generated channels; it leaves their sum invariant when the momentum labels are permuted consistently.
Fermion flow carries an ordering sign
For identical-fermion scattering, use the ordered states
The symbols include momentum and spin labels, with relativistic normalization factors understood. The bilinear can take fermion 1 into either outgoing state. Field compatibility allows the partitions and , but forbids attaching both incoming fermions to the same Yukawa vertex.
The relative sign follows before any gamma algebra. Keeping only the external creation and annihilation operators associated with a given attachment gives
These signs are obtained by moving annihilators through the ordered creation operators with . Each pairing has two choices of which spacetime vertex is named first; those cancel the expansion's . The exchanged pairing retains its minus sign. Tong works through this external-state ordering and the cancellation of the Dyson factorial explicitly. Tong, §5.6.1 and the example in §5.7.1.
For reproducibility, the Green-function enumeration uses the fermionic order , followed by the ordered slots at each interaction. Relative to the external ordering in (10), both external pairs are reversed, so the two extra signs cancel. A recursive pairing contributes when the first remaining fermion is paired with the field at zero-based position . A contraction written as supplies the additional sign relative to . Applying these rules gives the signed counts and in the table.
Write . The result is
Exchanging the complete outgoing labels, including their momenta and spins, changes the sign of (12). The companion tests this by reevaluating the generated trees on the exchanged state and momentum maps for all sixteen spin assignments. It also compares with (12), and independently evaluates (11) using creation and annihilation matrices on the sixteen-dimensional occupation space of four modes. Replacing the generated signed coefficients by their absolute values fails the amplitude comparison; it is not a harmless change in drawing convention.
This external exchange sign is separate from the minus sign associated with a closed fermion loop. No loop occurs here. Majorana lines and fermion-number-violating interactions require further conventions that this program does not implement; for example, FeynArts uses a dedicated reversed-flow treatment. Hahn, §3.6, preprint pp. 9–10 (PDF).
Derivative vertices need slots as well as field names
As a separate vertex example, introduce another real scalar and
Let the all-incoming momenta on the two fields be , and that on be , with . Each differentiated slot supplies . The two permutations of the identical attachments give
A vertex record must therefore retain which slot carries which derivative. In more complicated operators, exchanging identical fields can move a momentum into a different Lorentz structure; multiplying one arbitrarily chosen assignment by a factorial need not be correct.
Integration by parts can be used to choose an operator basis before generating rules. It is not a license to silently drop an equation-of-motion operator during an off-shell calculation. The first exercise checks (14) in an integration-by-parts representation without imposing . Further derivative and contact examples are developed in derivative vertices.
What the executable example establishes
The companion wick_diagrams.py contains the typed, valence-bounded graph generator, the separate slot-pairing recursion, and amplitude evaluators for the two processes above. Run wick_diagram_checks.py --write from examples/computational-qft/symbolic-computation/ to regenerate wick-diagram-results.json. The selected output includes all graph keys, raw counts, denominators, signs, the scalar numerical point, actual outgoing-state exchange tests, CAR checks, and an off-shell derivative-vertex comparison. plot_wick_diagrams.py draws the scalar graphs from that retained output.
The graph-generation completeness argument is (4), restricted to four external legs and the stated valences. The companion has no loop-momentum routing, ghost sector, Majorana prescription, renormalization machinery, or automatic integration by parts. In a gauge theory, even a correctly enumerated collection of graphs still needs Ward-identity and gauge-parameter checks on the appropriate sum; amplitude simplification supplies a concrete example.
The two-vertex quartic combinatorics can also be checked with a loop. Keep two labeled external legs at each vertex and pair the other four fields between them. The physical four-scalar amplitude counts the resulting three partitions, retains the symmetry factor of each, and compares their sum with an on-shell cut.
Summary
A reproducible diagram calculation separates field-compatible topology, internal relabeling, Wick multiplicity, fermion ordering, and momentum-dependent rules. The scalar example produces three exchange partitions and a contact, with unit graph coefficients. The Yukawa example produces two allowed pairings whose relative minus sign survives every relabeling convention. Counts and drawings become a physical amplitude only after those factors and the external-state normalization are attached consistently.
Exercises
1. An integration-by-parts comparison off shell
Starting from (13), use integration by parts to write the interaction, modulo a total derivative, as
Derive the three-point vertex from this expression and compare it with (14), without using the field equations. What would go wrong if only the term were replaced by its free on-shell value in an off-shell Green function?
Solution
Use . Then integrate twice, neglecting the boundary integral for fields of suitable decay or for the corresponding momentum-conserving vertex. This gives the stated expression.
The first term has two identical undifferentiated slots, so its vertex is . In the second, either external can occupy the differentiated slot. Its contribution is . Their sum is
where only was used. This is an off-shell equality between the complete vertices from the two integration-by-parts representations.
If is replaced by while an attached line is off shell, the vertex changes by terms proportional to . On an internal line these can cancel a propagator denominator and create a contact contribution. An equation-of-motion field redefinition must carry its other induced operators and source changes; simply deleting this term does not preserve general off-shell Green functions.
2. Six labeled scalars at second order in the quartic coupling
Extend the counting argument, but not the four-point program, to six labeled external scalars and exactly two quartic vertices. How many connected tree graphs occur? Find the raw Wick count for each graph and its coefficient after expansion factorials. Explain why permuting external particles is not an internal graph automorphism in this calculation.
Solution
Each vertex has three external attachments and one internal slot. The graph is an unordered partition of six external labels into two triples. Hence there are
graphs. Before quotienting the two spacetime vertices, there are choices for the labels attached to the first. The three distinct external fields occupy its four slots in ways, and similarly at the second vertex. The remaining slots have one internal contraction. The total raw count is therefore
Each unordered partition receives contractions. The perturbative expansion denominator is , so every graph has coefficient one. Their sum has ten exchange denominators, one for each triple momentum, with the common vertex and propagator factors.
The external labels identify specified sources or external momenta; permuting them changes the labeled contraction problem. Crossing or Bose symmetry relates the resulting amplitudes, but does not justify merging their different denominators into one graph at a fixed assignment of external data.
References
- T. Hahn, “Generating Feynman Diagrams and Amplitudes with FeynArts 3,” Computer Physics Communications 140 (2001), 418–431, doi:10.1016/S0010-4655(01)00290-9, arXiv:hep-ph/0012260v2 (PDF). Consulted passages: §2 for the workflow, §§3.1–3.3 for topology and field insertion, and §3.6 for fermion-flow limitations.
- D. Tong, Quantum Field Theory, University of Cambridge lecture notes (2006), §§5.6.1 and 5.7.1: ordered external fermion states, the Dyson factorial, and the direct-minus-exchange Yukawa amplitude. The notation here replaces the source's Yukawa coupling .
Scrollable formula. Use Left and Right arrow keys to reveal hidden content.
Scrollable table. Use Left and Right arrow keys to reveal hidden columns.
Scrollable figure. Use Left and Right arrow keys to reveal hidden content.