Qlua Tutorials

Qlua taught by example, from a first program to the Level III solvers and the gradient flow.

Qlua is Lua 5.1 with lattice QCD built in: the QDP/C field types and their algebra, the QIO and legacy file formats, and a set of Level III inverters. These tutorials are the way in. Each is short, each is a program you can run, and they are meant to be read in the order they stand: the lattice tutorials build the vocabulary, the file-format ones show how a measurement gets its input and leaves its output, and the physics ones put the two together.

The reference manual is the other half. It lists every name the interpreter answers to, what it takes and what it gives back; these pages say which names you reach for and why.

The examples were written against a recent Qlua and are checked against qlua/2026.10d. Against an older build some of them will not run: names mentioned here were added over the years, and calling a name a Qlua object does not know aborts the job rather than returning nil. Where a tutorial needs a particular version, it says so.

Hello World
A first program, how Qlua is started, and what it does with its arguments.
Loading modules
Where Qlua looks for modules, and how to add a directory of your own.
Arithmetics
Complex numbers, gamma matrices and the other serial types Qlua adds to Lua.
Lattices and Fields
The lattice object, the parallel field types it makes, and the operations on them.
Dot Products
Contracting two fields with qcd.dot() and summing the result.
Lattice Subsets
Restricting a computation to part of the lattice, with subsets and multisets.
Parallel Indices
Turning a sequential vector into a lattice field through a parallel index.
Multiple Lattices
Several lattices in one program, and the rule that keeps them apart.
Gather Collectives
Collecting values from many sites of one lattice into one site of another.
Scatter Collectives
Filling a field from another, with the source address given for every site.
Random Numbers
Seeding a generator so that every site differs and the run can still be repeated.
Handling XML
Parsing, reading and writing the XML that QIO files carry as metadata.
Working with AFF
Reading and writing AFF files, whose interface works like a file system.
Working with HDF5 files
Strings, vectors, matrices and lattice fields in HDF5, with its own options.
Reading and Writing QIO files
NERSC gauge files, QIO records, ddpairs and the other formats Qlua reads.
Plaquette
A whole program: build gauge fields of varying randomness and measure them.
Two-point meson functions
Two-point functions for all sixteen light-light mesons.
Momentum projection
Projecting those two-point functions onto a fixed momentum and saving them.
Two-point nucleon functions
The diquark primitive, and the nucleon two-point function built from it.
Gauge Field Smearing
The four smearing operations qlib provides, and what each one takes.
Clover Wilson Solver
The clover object, the solvers it makes, and the parameters they take.
Möbius Domain Wall Fermion Solver
The Möbius domain wall object, its variants, and solving with it.
Eigenspace Deflation Solver
Deflating the Dirac equation with EigCG, with Lanczos, or from disk.
Multigrid Solvers
The QOPQDP and the QUDA multigrid inverters, line by line.
GRID Solvers
The Grid bindings, as far as they go.
Gradient Flow
Gauge loops, the flow equation, and the code that integrates it.