AKV tutorial
This walks through one real job: the two-loop q q̄ → W⁺W⁻ integrand of Amplitudes2to2/qqWW, from FORM-style integrand chunks to scalar integrals and Kira jobs. Everything here runs on the files shipped in examples/ and tests/data/.
1. Build and self-test
./build.sh
./test/run_tests.sh # ALL TESTS PASSED
2. The process file
examples/qqWW/qqWW.spec describes q(p1) q̄(p2) → W⁺(q1) W⁻(q2) with off-shell W's (q1² = 1 sets the scale, q2² = mq2), s = (p1+p2)², t = (p1−q1)², and decay currents ε1, ε2 with ε_i·q_i = 0. Read it top to bottom:
ring— the variables of every coefficient. Order does not matter for the results.outside I gs Cf Caprints those outsiderat(…);imaginary Iapplies I² = −1.alias eps (4-D)/2,alias mq1 1— input symbols that are not ring variables.gram— the six dot products of {p1, p2, q1}. AKV decomposes every loop momentum against this span (the AKV span);ginv iGkeeps the Gram inverse as adj(G)·iG with iG = 1/det G a symbol, which keeps all arithmetic polynomial (as twoloop.frm does).pol— the transversality rules;extdots— print names of p1·ε1, p1·ε2, p2·ε1, p2·ε2, ε1·ε1, ε1·ε2, ε2·ε2.openline— the open quark line v̄(p2) … u(p1): p̸2 is absorbed on the left with factor 0 (massless), p̸1 on the right, words are ordered p2 < ε1 < ε2 < q1 < p1. A massive spinor would beright q1 m(q̸1 u = m u);projector leftputs P_L next to u(p1) and absorbs γ5 (NDR).traceline— a string turned into a trace: the Higgs-scheme scalar string Tr[G p̸1 p̸2]/(2s).- the registry —
kirafamilyimports PL1, PL2, NPL from Kira'sintegralfamilies.yaml(with p3 = q1),basefamily BoxWW, the crossings x12, x34, x34x12, and thefamilylines that tie input tags and output templates to them.
3. Reduce a chunk
bin/akvred chunk --spec examples/qqWW/qqWW.spec \
--in tests/data/ww/in_E12c1.h --out E12c1.h --threads 4 --verbose
in_E12c1.h is a UV counterterm piece: a massive tadpole loop k1 (DM = k1² − M) times a massless one-loop box in k2, tagged TAG1(2). AKV averages k1 isotropically (its denominators are massive and external-free), decomposes k2 against {p1,p2,q1}, contracts the transverse metric inside the Dirac string, normal orders it, and writes
E12c1 :=
+ Ubar(Vbar2,q1,Uspin1)*BOX(-2,1,1,1)*TD(2)*e1e2*I*gs^4*Cf*Ca*rat(...)
...
Compare with FORM's result, exactly:
gzip -dc tests/data/ww/form_E12c1.h.gz > form_E12c1.h
bin/wwcompare form_E12c1.h E12c1.h # ... 0 nonzero differences -> EQUAL
wwcompare parses both files independently of AKV (a separate parser and factored rational arithmetic), forms A − B key by key and requires zero. Keys that occur on one side only are allowed if their coefficient sums to zero (FORM's iG representation is not canonical).
4. Where do the families enter?
The tensor and spin layers never look at families. You choose when the family map happens:
bin/akvred scramble --spec examples/qqWW/qqWW.spec --in tests/data/ww/in_E21c1.h --out s.h --seed 3
bin/akvred chunk --spec examples/qqWW/qqWW.spec --in s.h --out before.h --families before
bin/akvred chunk --spec examples/qqWW/qqWW.spec --in s.h --out after.h --families after
bin/wwcompare before.h after.h # EQUAL
scramble rewrites the chunk with plain propagators sprop(q, m) in a random loop-momentum frame. before maps each term's propagator set onto the registry (mapfam.py's search, ported), transforms the numerator and reduces; after reduces first and maps the scalar integrals, transforming their scalar-product monomials. The results are identical.
5. One IBP run per family
bin/akvred targets --spec examples/qqWW/qqWW.spec --out-dir kira out/*.h
reads all front-end outputs of the amplitude (AKV's or FORM's), collects the integrals of every family once, and writes kira/<FAM>/targets, kira/<FAM>/jobs.yaml (top sectors, r, s from the targets), a combined kira/jobs.yaml, kira/integralfamilies.yaml and FAIR topologies kira/<FAM>.topo.
6. Your own process
Copy examples/qqWW/qqWW.spec, change the ring, the Gram matrix, the polarisation rules and the registry. The input dialect is FORM's: one L NAME = + (...) + ... ; expression whose terms are products of numbers, ring symbols, sprop(q, 0|M) or tagged propagator symbols, DOT(a,b), and Ubar(Vbar2, …, Uspin1) strings with vectors and Lorentz indices. Today the vectors are k1, k2, p1, p2, q1, ep1, ep2 (2 → 2 with two external currents); see docs/OFFSHELL.md for what is next.