The preceding subsections concern instruments that record a signal arriving from elsewhere. This one concerns an instrument that produces the signal it records, and whose simulation code is public: a self-amplified spontaneous emission free-electron laser of the kind operated at PAL-XFEL, European XFEL and LCLS.
Genesis 4 was run on a \(57\) m undulator with \(\gamma _0 = 11\,357.82\), \(\lambda _0 = 1\) Å, \(3\) kA peak current, and a \(0.5\ \mu \)m slice window. Thirty-eight runs were performed, varying one input at a time. Total wall time \(935\) s.
SASE has no seed laser. The radiation grows from the shot noise of the electron bunch, which the code represents by randomising the particle phases. Setting that randomisation to zero:
With shot noise disabled the output is \(10^{27}\) times smaller — numerical zero. The entire pulse is amplified randomness. This is not a defect of the simulation; it is what SASE is. But it fixes what the quantity \(E_{\rm pulse}\) can be: a realisation, not a value.
Holding every physical parameter fixed — beam energy, current, emittance, energy spread, undulator, focusing — and changing only the random seed:
The pulse energy spans a factor of \(1.48\) with rms scatter \(13.6\%\) about the mean. The pulse duration varies by a factor of \(2.7\), from \(84\) nm to \(228\) nm. The saturation length varies from \(36.9\) to \(54.0\) m — a \(17\) m range on a \(57\) m undulator.
An experiment performed at \(z = 40\) m is past saturation for six of these seeds and \(14\) m short of it for one.
The remaining runs varied one input at a time. Separating them by whether the input is a property of the machine or a property of the discretisation:
Current and emittance dominate, as they should. But the energy spread — a physical property of the electron bunch — moves the pulse energy by \(1.20\), less than sample at \(1.52\), nbins at \(1.25\) and dgrid at \(1.22\).
These four are not properties of the machine. sample is how many optical wavelengths separate adjacent simulated slices. nbins is how many phase bins each slice is divided into. dgrid and ngrid are the extent and resolution of the transverse mesh. Changing any of them changes nothing about the accelerator.
A converged simulation would show no dependence on these. The scan shows dependences of \(9\) to \(52\%\), comparable to the \(20\%\) produced by varying the energy spread over its plausible range and to the \(48\%\) spread across random seeds.
A published pulse energy is a number obtained by choosing a seed, a slice spacing, a bin count and a mesh. Over the thirty-eight runs performed here the reported energy ranges from \(1.42\) to \(5.27\ \mu \)J, a factor of \(3.7\), with every run using the same accelerator.
The middle row cannot be removed: disabling it returns \(6\times 10^{-33}\) J. The bottom row is a discretisation that should not matter and moves the answer by up to \(52\%\).
A gas monitor detector at the beamline reports the pulse energy of each shot, and those readings scatter shot to shot by an amount comparable to the seed scan above. That scatter is real and is reported. The point here concerns what the simulation supplies.
Machine parameters — emittance, energy spread, bunch length — are not measured directly at the undulator. They are inferred by adjusting the simulation until its output matches the measured pulse energy and spectrum. The inference runs through the same discretisation whose dependence is tabulated above, and through a particular realisation of the shot noise.
The quantity extracted from the machine is obtained by adjusting a model whose own numerical settings move the result by as much as the physical parameter being extracted.
The preceding subsections examine what is done to recorded counts. This one examines the other side of an X-ray free-electron laser experiment: the simulation against which the measurement is interpreted. Genesis 1.3 is the standard code, public, and used at LCLS, European XFEL, SwissFEL and SACLA to predict pulse energy, spectrum, and coherence.
A self-amplified spontaneous emission FEL starts from shot noise in the electron beam: density fluctuations at the resonant wavelength seed the instability, and everything downstream amplifies them. A simulation must therefore contain those fluctuations.
It does not obtain them by sampling. Particles are loaded on a low-discrepancy grid — Hammersley sequences, one base per phase-space coordinate — which suppresses statistical fluctuation by construction. The relevant module is named QuietLoading, and the input file specifies the bases explicitly:
self.ildpsi = 7 # Hammersley base for the particle phase self.ildgam = 5 # Hammersley base for the energy distribution self.ildx = 1 # base for x self.ildy = 2 # base for y self.ildpx = 3 # base for px self.ildpy = 4 # base for py
The fluctuations are then put back by a separate module:
class ShotNoise {
void applyShotNoise(Particle *beam, int npart, int nbins, double ne);
};
sran = new RandomU(seedFromIndex(base, 0, SeedStream::shotnoise));
void ShotNoise::setSlice(unsigned long islice)
sran->set(seedFromIndex(base, islice, SeedStream::shotnoise));
src/Loading/ShotNoise.cpp
with the calling sequence in LoadBeam.cpp:
bool shotnoise = setup->getShotNoise();
if ((shotnoise) && (!one4one) && (dotime)) {
sn.applyShotNoise(beamslice, npartloc, nbins, ne);
}
The quantity that initiates lasing is a switch, shotnoise, taking the values \(0\) or \(1\) in the surveyed inputs. Its magnitude is set by ne, the declared number of real electrons per slice, and its realisation by a seeded pseudorandom stream indexed on the slice number — so that, as the source comment states, the noise is a property of the slice rather than of the execution.
Version 2 offers two algorithms for the same insertion:
call shotnoise_fawley call shotnoise_penman
with the Fawley routine returning immediately if the amplitude is below threshold (if (shotnoise.lt.tiny) return) and containing a branch to adjust shotnoise for imported distribution.
The physical claim — that the FEL starts from spontaneous emission — is implemented as: remove the fluctuations by quiet loading, then add fluctuations of a declared magnitude from a seeded generator.
Undulator field errors are not measured magnet maps. They are drawn:
void Lattice::generateFieldErrors(double aw0, vector<double> *awout, double awerr)
{
auto daw = aw0 * awerr;
...
i = aw0 + daw * (erf.value(2*seq->getElement()));
}
void Lattice::generateKickErrors(vector<double>*, vector<double>*, double, double);
src/Lattice/Lattice.cpp
with the amplitude supplied as a fraction and the realisation from a sequence object:
double zmatch, fielderror; bool resolve, add, orbiterror; fielderror = 0; // default orbiterror = false; // default
src/Lattice/AlterLattice.cpp
The undulator itself is a list of numbers in a lattice file:
UND: UNDULATOR = {lambdau=0.015000, nwig=266, aw=@val, helical=True};
A period length, a number of periods, a deflection parameter. The field is this parameter times a declared error realisation.
The radiation field is stored in slices, and the slice width is the reference wavelength times a sampling integer:
nslice = static_cast<int>(round(slen / ds));
if (nslice < size) { nslice = size; }
double lambda = setup->getReferenceLength(); // reference length for theta
src/Main/GenTime.cpp, src/Loading/LoadField.cpp
with defaults slen = 0, sample = 1, nslice = 1. The reference length is declared, not derived: it is the wavelength about which the ponderomotive phase \(\theta \) is defined, and every field quantity is referred to it.
The second line above is worth noting separately. If the requested number of slices is smaller than the number of MPI ranks, the number of slices is increased to match. The discretisation of the time axis depends on how many processors the job was submitted with.
Values appearing across the surveyed inputs and sources:
The seeds are the operative ones. A SASE pulse has no deterministic temporal structure; the spikes, their number and their spacing are a realisation. Two runs differing only in seed give different pulses, and the published quantity is a statistic over realisations — which requires deciding how many to run.
const double c_light = 299792458.0; // m/s constexpr double e_charge = 1.602176634e-19; // C
src/Main/Wake.cpp
with the electron rest energy entering as \(510998.9\) eV in GenMain.cpp and \(0.51099\) MeV in the OCELOT globals. Both are exact by definition in the \(2019\) SI, and \(m_e\) is the one measured quantity of the three. Free-space impedance and permittivity appear as vacimp and the literal 8.85e-12.
The measured spectrum of an XFEL pulse is compared against this. Agreement between them is agreement between a detector record and a calculation in which the initiating fluctuation, the magnet imperfections, the time discretisation and the transverse grid are all supplied.
The preceding subsections vary the value of a wavelength. This one asks where the quantity comes from, using a free-electron laser and a crystal spectrometer as the worked case.
The quantities a beamline actually records are these:
There is no wavelength in this list, and no quantity carrying a unit of length. Every entry is an integer count or a voltage.
The second line is not a measurement. The same observation admits descriptions in which \(\lambda \) does not appear as a primitive:
The last row is the decisive one. With \(h\) and \(c\) both fixed exactly in the 2019 SI, \(E = hc/\lambda \) is not a physical law connecting two measured quantities. It is a unit conversion, and \(\lambda \) and \(E\) are two notations for the same number.
Taking silicon at \(\lambda = 1\) Å:
The two right-hand columns agree to six figures, because \(\sin \theta _i/\sin \theta _j = d_j/d_i\) identically. Repeating at \(\lambda = 0.7\), \(1.3\) and \(1.6\) Å changes every angle and leaves both ratio columns unchanged.
The measured angles determine ratios of lattice spacings. They do not determine an absolute wavelength. One spacing must be supplied from outside.
The statement is stronger than a missing normalisation. Multiplying \(d\) and \(\lambda \) by a common factor \(k\):
The diffraction angle is invariant to six decimal places while the reported photon energy moves by a factor of four. A diffraction experiment cannot fix the absolute scale of length, and the reported photon energy shifts with the scale that is imposed.
The absolute value \(d(\mathrm {Si}\,220) = 1.920155\) Å comes from combined X-ray and optical interferometry. The crystal is translated by \(n\) lattice planes while \(m\) optical fringes are counted:
Substituting back,
The spacing also depends on the specimen. Isotopic enrichment shifts \(d\) by about \(1.9\times 10^{-6}\), a carbon concentration of \(10^{17}\) cm\(^{-3}\) by \(-2\times 10^{-7}\), and a one-kelvin temperature change by \(2.6\times 10^{-6}\); the value is quoted at a stipulated \(22.5\,^\circ \)C. Each of these corrections was a separate publication in the Avogadro project, and each propagates directly into \(\lambda \).
Assembling the above gives \(24\) nodes and \(29\) edges, with four directed cycles:
None of the nine is a measured wavelength.
The preceding subsections vary parameters inside a reduction. This one starts from what the instrument records and rebuilds the description from there, holding nothing fixed: not the geometry, not the integers, not the constants.
A diffraction measurement records the count rate of a detector as a function of the position of a rotation stage. The position is an integer: the number of steps from a mechanical reference. For eight reflections of a silicon standard, at \(1000\) steps per degree,
Calling \(k\) an angle is already a step. It asserts that the stage traverses a circle of \(2\pi \), that the circle is the one of plane geometry, and that the degree is \(1/360\) of it. None of that is in the count.
The standard reading maps \(k\) to \(\theta \), takes \(\sin \theta \), forms ratios, squares them, and finds the smallest \(N_0\) making \(N_i = N_0 r_i^2\) integral. It then decomposes each \(N_i\) as \(h^2+k^2+l^2\).
The last step is where the freedom is. Eight reflections receive eight triples of integers, chosen after the fact to match. With \(N_0\) and the exponent, the construction fits eight numbers using eight free integers plus two parameters.
Comparisons that grant this freedom to the standard reading and withhold it from alternatives are not comparisons.
Taking twelve position variables — not only \(\sin \theta \) but the raw encoder count, its logarithm, its square, and six others — and allowing each the same construction (free exponent \(p \in \{1,2,3\}\), free \(N_0 \le 200\), free integers):
The twelve span \(7.8\times 10^{-4}\) to \(1.6\times 10^{-3}\), a factor of two. The best is \(\log k\), the logarithm of the raw encoder count, which corresponds to no geometry at all. The sine reading, from which the Bragg law and the Miller indices follow, is ninth of twelve.
The apparent superiority of the standard reading in the preceding subsection was an artefact of restricting \(N_0\) to small values, which is a restriction on the alternatives and not on the standard reading: \(N_0 = 3\) for silicon is small because the lattice was indexed to make it so.
Allowing one shape parameter inside the position map, \(v = F(\theta ; a, b)\), and the same integer freedom:
All eight fall within a factor of \(1.6\) of each other. The sine family attains its optimum at \(b = 1.956\), not at \(b = 1\): the standard reading is not the best member of its own family.
Replacing the flat path-difference law by the geodesic distance in a space of constant curvature \(K\),
Eleven curvature values from \(-4\) to \(+16\) all admit integer readings within a factor of \(1.7\) of each other. Flatness is not selected.
Requiring that the ratios be reproduced by \(\|v\|_p\) for integer vectors \(v\) in \(d\) dimensions, at a \(2\%\) tolerance:
Seven combinations pass. Three dimensions with the Euclidean norm is one of them, and the assignments found in four, five and six dimensions reproduce the same ratios to the same tolerance. The dimension is bounded below — one and two dimensions do not admit an assignment — and not above.
The wavelength is \(\lambda = 2d\sin \theta \) and the photon energy is \(hc/\lambda \). Of the three quantities entering, \(c\) and \(h\) are exact by definition and \(d\) is tied to the metre, which is defined from \(c\). Rescaling them:
The encoder integers are identical in every row. The reported photon energy ranges over a factor of \(36\).
Under the \(p\)-adic norm the integers of the standard reading are ordered differently. For the set \(\{3,8,11,16,19,24,27,32\}\),
The encoder integers are unchanged throughout. What changes is the structure attached to them.
The Euclidean, sinusoidal, integer-lattice reading is not selected by the measurement. It is selected by a comparison that grants it eight free integers and grants the alternatives fewer, and by an instrument whose stage, crystal and geometry were built so that \(\lambda = 2d\sin \theta \) would hold.
The silicon lattice is the transfer standard for X-ray wavelength metrology. Its first reflection is labelled \((111)\) with \(N = h^2+k^2+l^2 = 3\), and every wavelength quoted in Ångström traces back through it. This subsection asks what fixes the \(3\).
The standard procedure reads the encoder positions as angles, forms \(r_i = \sin \theta _i/\sin \theta _0\), and seeks the smallest integer \(N_0\) for which \(N_i = N_0 r_i^2\) is integral. Running that search over \(N_0 = 1\) to \(40\):
Six values of \(N_0\) tie at exactly \(0.00136\), and they are the multiples of three. This is expected: if \(N_0 r_i^2\) is integral then so is \(3N_0 r_i^2\), and the relative error is unchanged. The search does not single out \(3\); it singles out the arithmetic progression \(3, 6, 9, 12, \ldots \), and \(3\) is chosen as the smallest member.
Fix \(N_0\) in advance, derive the lattice constant that produces it, and then re-index the same encoder positions with that lattice:
The declared value is recovered in every case, without exception. The accepted \(a = 5.431020\) Å appears in the third row as the value implied by declaring \(N_0 = 3\).
The recovery is not a test. \(a\) and \(N_0\) are related by \(a = a_{\rm std}\sqrt {3/N_0}\), and the encoder positions enter neither side. Declaring one determines the other, and re-indexing returns what was declared.
Every quantity downstream follows:
The photon energy spans a factor of twelve across the table. The encoder integers are identical in every row.
The assignment \(N = h^2+k^2+l^2\) uses three integers. Whether three is required is a question about which integers are representable as sums of \(d\) squares. Counting, for each dimension, how many values of \(N_0\) in \(1\)–\(40\) admit a full assignment at \(2\%\) tolerance:
The pattern follows from classical number theory. A single square requires \(N\) to be a perfect square. Two squares require that primes congruent to \(3 \bmod 4\) appear to even powers. Three squares exclude only \(N\) of the form \(4^a(8b+7)\). By Lagrange’s four-square theorem, four or more squares represent every natural number.
Four, five and six dimensions cannot be excluded by this procedure, because there is no integer they fail to represent. A diffraction pattern indexed in four dimensions will always succeed.
The explicit assignments for \(N_0 = 3\):
The higher-dimensional assignments are the three-dimensional ones padded with zeros, which is the trivial embedding. Non-trivial four-dimensional assignments exist as well: at \(N_0 = 2\), where three dimensions fails, four succeeds with \((0,0,1,1)\), \((0,0,1,2)\), \((1,1,1,2)\), \((0,1,1,3)\), \((0,0,2,3)\), \((0,0,0,4)\), \((0,0,3,3)\), \((0,1,2,4)\).
Tightening the tolerance reduces the number of admissible \(N_0\) but does not change the ordering across dimensions:
At \(10^{-3}\) nothing passes in any dimension, including three: the observed relative error is \(1.36\times 10^{-3}\). Two dimensions fails at every tolerance tested. Higher dimensions always admit more assignments than lower ones, at every tolerance, which is the arithmetic fact above and not a property of the data.
The silicon lattice constant is established by combined X-ray and optical interferometry, tying \(d_{220}\) to the metre, which is defined from a fixed \(c\) and realised by a stabilised laser whose frequency is set by convention.
Given that constant, the first reflection indexes as \(N_0 = 3\). Given \(N_0 = 3\), the lattice constant is \(5.431020\) Å. The two determine each other and the encoder positions determine neither: declaring any \(N_0\) produces a lattice that reproduces that \(N_0\) on re-indexing, and the photon energy that follows ranges over a factor of twelve while the recorded positions do not change.
The choice of three dimensions is likewise not made by the data. Two dimensions is excluded; three, four, five and six are not, and four and above cannot be, since every natural number is a sum of four squares.
The preceding subsections vary quantities that carry units: a wavelength in Ångström, an energy in eV, a lattice constant. Each such quantity requires that the recorded channels be separated by an interval, and the interval is supplied rather than measured. This subsection asks what remains if no interval is assigned at all.
A diffraction measurement produces a finite set of detector channels, each carrying a count. Taking eight channels from a silicon standard,
The sign sequence of successive differences is
Two patterns are order-isomorphic when their sign sequences agree. Scaling all counts by a factor of ten leaves the sequence unchanged:
Whether two measurements agree is a question about rank order. Kendall’s \(\tau \), the difference between concordant and discordant pairs divided by their total, is a rational number computed from comparisons alone:
Reproducibility, and the identification of a material by comparison against a reference pattern, are settled by these quantities. No distance function is invoked.
The counts are integers, so the normalised intensities are rational:
The statement that one reflection is thirty-three times another is exact in \(\mathbb {Q}\). Real numbers enter only if one wants \(-\sum p \log p\); the Simpson and Gini indices are complete in the rationals.
Treating the channels as vertices of a path graph and counting edges, the channels at or above half the maximum are \(\{0,1\}\), a graph diameter of one edge. The full width at half maximum is one channel.
This number does not depend on any assignment. It is a count of vertices in a subgraph.
Every entry below the line is a number carrying a unit, and every such unit traces to \(c\), \(h\), and \(d_{\rm Si}\) — the first two exact by definition, the third tied to the metre which is defined from \(c\).
Every entry above the line is what a diffraction experiment is performed to establish: that a sample gives this pattern, that the pattern is stable, that it matches or does not match a reference, that two instruments agree.
Euclidean three-space appears nowhere above. It is introduced at the point where a number with a unit is wanted, and it is introduced together with the declared constants that supply the unit. Diffraction experiment reports are stated without any assignment.