408 The X-ray Free-Electron Laser (XFEL)

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.

408.0.1 The pulse starts from noise

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:

\[ \begin {array}{lrr} \texttt {shotnoise} & E_{\rm pulse}\ [\mathrm {J}] & \text {ratio} \\ \hline 1 \ \text {(default)} & 3.4900\times 10^{-6} & 1 \\ 0 & 6.4854\times 10^{-33} & 5.4\times 10^{-28} \\ \end {array} \]

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.

408.0.2 The same machine, eight seeds

Holding every physical parameter fixed — beam energy, current, emittance, energy spread, undulator, focusing — and changing only the random seed:

\[ \begin {array}{rrrrr} \text {seed} & E_{\rm pulse}\ [\mathrm {J}] & P_{\rm peak}\ [\mathrm {W}] & \mathrm {FWHM}\ [\mathrm {m}] & z_{\rm sat}\ [\mathrm {m}] \\ \hline 1 & 4.7590\times 10^{-6} & 1.188\times 10^{10} & 1.92\times 10^{-7} & 41.7 \\ 7 & 3.4078\times 10^{-6} & 8.485\times 10^{9} & 8.40\times 10^{-8} & 38.2 \\ 777 & 3.2099\times 10^{-6} & 7.132\times 10^{9} & 1.92\times 10^{-7} & 39.7 \\ 12345 & 3.4900\times 10^{-6} & 1.029\times 10^{10} & 2.28\times 10^{-7} & 38.8 \\ 31337 & 3.7009\times 10^{-6} & 9.707\times 10^{9} & 2.16\times 10^{-7} & 36.9 \\ 99991 & 4.0846\times 10^{-6} & 8.651\times 10^{9} & 2.22\times 10^{-7} & 54.0 \\ 424242 & 3.3672\times 10^{-6} & 1.005\times 10^{10} & 1.62\times 10^{-7} & 39.6 \\ 2718281 & 3.5294\times 10^{-6} & 7.411\times 10^{9} & 2.04\times 10^{-7} & 37.0 \\ \end {array} \]

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.

408.0.3 Numerical parameters move the answer as much as physical ones

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:

\[ \begin {array}{llrr} & \text {parameter} & E\ \text {range ratio} & n \\ \hline \text {numerical} & \texttt {sample} \ (\text {slice spacing}) & 1.52 & 3 \\ & \texttt {nbins} \ (\text {bins per slice}) & 1.25 & 4 \\ & \texttt {dgrid} \ (\text {transverse extent}) & 1.22 & 3 \\ & \texttt {ngrid} \ (\text {transverse resolution}) & 1.16 & 4 \\ & \texttt {delz} \ (\text {integration step}) & 1.09 & 4 \\ \hline \text {physical} & \text {peak current} & 3.70 & 3 \\ & \text {emittance } \epsilon _x & 3.37 & 3 \\ & \text {energy spread } \delta \gamma & 1.20 & 3 \\ \hline \text {stochastic} & \text {seed} & 1.48 & 8 \\ \end {array} \]

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.

408.0.4 What is being reported

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.

\[ \begin {array}{ll} \text {fixed by the machine} & \text {current, emittance, energy spread, undulator} \\ \text {fixed by the noise} & \text {which realisation of shot noise occurred} \\ \text {fixed by the code user} & \texttt {sample},\ \texttt {nbins},\ \texttt {ngrid}, \ \texttt {dgrid},\ \texttt {delz} \\ \end {array} \]

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\%\).

408.0.5 The measured quantity

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.

\[ \begin {array}{ll} \text {pulse energy} & \text {measured by gas monitor, calibrated against} \\ & \text {a photodiode, calibrated against a synchrotron standard} \\ \text {beam emittance} & \text {inferred by matching simulation to that energy} \\ \text {simulation} & \text {depends on seed, slice spacing, bin count, mesh} \\ \text {seed} & \text {a random number} \\ \end {array} \]

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.

pict

pict

408.1 Simulating the Source

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.

408.1.1 The noise is inserted

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.

408.1.2 The magnet errors are generated

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.

408.1.3 The time axis is cut

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.

408.1.4 The numerical grid

Values appearing across the surveyed inputs and sources:

\[ \begin {array}{ll} \texttt {ngrid} & 151,\ 255,\ 301 \\ \texttt {nbins} & 4,\ 8,\ 400,\ 500 \\ \texttt {npart} & 8192,\ 10^4,\ 2\times 10^4,\ 65536,\ 2\times 10^5 \\ \texttt {delz} & 0.015,\ 0.035,\ 0.038,\ 0.045,\ 0.1,\ 1.0 \\ \texttt {nharm} & 1,\ 3 \\ \texttt {seed} & -1,\ 0,\ 1,\ 7,\ 100,\ 123,\ 666,\ 1234567,\ 123456789 \\ \end {array} \]
\(172\) such assignments were recovered over \(54\) distinct names. The transverse grid, the number of macroparticles standing for \(10^9\) electrons, the integration step in undulator periods, and the number of harmonics retained are all selections.

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.

408.1.5 The constants
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.

408.1.6 What the simulation supplies
\[ \begin {array}{ll} \text {electron distribution} & \text {Hammersley quasi-random grid} \\ \text {shot noise} & \text {inserted from a seeded stream, amplitude } \propto \sqrt {n_e} \\ \text {slice width} & \text {sample} \times \lambda _{\rm ref},\ \lambda _{\rm ref} \text { declared} \\ \text {number of slices} & \text {raised to the MPI rank count if smaller} \\ \text {transverse grid} & \texttt {ngrid} \in \{151, 255, 301\} \\ \text {integration step} & \texttt {delz} \in [0.015, 1.0] \text { undulator periods} \\ \text {harmonics} & \texttt {nharm} \in \{1,3\} \\ \text {undulator field} & a_w \times (1 + \text {drawn error}) \\ \text {seed} & \text {fixes the pulse structure entirely} \\ c,\ e & \text {exact by definition} \\ \end {array} \]

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.

408.2 Where the Wavelength Comes From

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.

408.2.1 What the instrument produces

The quantities a beamline actually records are these:

\[ \begin {array}{lll} \text {quantity} & \text {form} & \text {origin} \\ \hline \text {detector pixel index} & \text {integer} & \text {CCD readout} \\ \text {pixel ADU} & \text {integer} & \text {digitised after amplification} \\ \text {goniometer step} & \text {integer} & \text {stepper motor count} \\ \text {BPM charge} & \text {voltage} & \text {integrator output} \\ \text {magnet current} & \text {voltage} & \text {shunt resistor} \\ \text {timing} & \text {clock count} & \text {RF reference} \\ \end {array} \]

There is no wavelength in this list, and no quantity carrying a unit of length. Every entry is an integer count or a voltage.

408.2.2 Where the wavelength enters
\[ \begin {array}{ll} \text {observation} & \text {counts concentrate at particular goniometer steps} \\ \text {description} & \text {a wave of wavelength } \lambda \text { interferes} \text { constructively off a lattice of spacing } d \\ & n\lambda = 2d\sin \theta \\ \end {array} \]

The second line is not a measurement. The same observation admits descriptions in which \(\lambda \) does not appear as a primitive:

\[ \begin {array}{lll} \text {description} & \text {relation} & \text {status of } \lambda \\ \hline \text {Bragg} & n\lambda = 2d\sin \theta & \lambda = 2d\sin \theta /n \\ \text {Laue} & \Delta \mathbf {k} = \mathbf {G} & \lambda = 2\pi /|\mathbf {k}| \\ \text {momentum transfer} & q = 2k\sin \theta & \text {only } q \text { observed} \\ \text {scattering angles only} & \theta _n & \text {expressible in } d \text { ratios} \\ \text {energy} & E = hc/\lambda & \text {a change of notation} \\ \end {array} \]

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.

408.2.3 Angles alone give only ratios

Taking silicon at \(\lambda = 1\) Å:

\[ \begin {array}{lrrrr} (hkl) & d\ [\text {\AA }] & \theta \ [^\circ ] & \sin \theta \ \text {ratio} & d\ \text {ratio} \\ \hline 111 & 3.13556 & 9.1756 & 1.000000 & 1.000000 \\ 220 & 1.92016 & 15.0935 & 1.632968 & 1.632968 \\ 311 & 1.63749 & 17.7789 & 1.914857 & 1.914857 \\ 400 & 1.35773 & 21.6085 & 2.309414 & 2.309414 \\ 331 & 1.24592 & 23.6601 & 2.516662 & 2.516662 \\ 422 & 1.10858 & 26.8096 & 2.828447 & 2.828447 \\ 511 & 1.04519 & 28.5798 & 2.999990 & 2.999990 \\ 440 & 0.96008 & 31.3853 & 3.265936 & 3.265936 \\ \end {array} \]

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.

408.2.4 Scale invariance

The statement is stronger than a missing normalisation. Multiplying \(d\) and \(\lambda \) by a common factor \(k\):

\[ \begin {array}{rrrrrl} k & d(220)\ [\text {\AA }] & \lambda \ [\text {\AA }] & \theta \ [^\circ ] & E\ [\mathrm {eV}] & \text {angle change} \\ \hline 0.50 & 0.96008 & 0.50000 & 15.093540 & 24796.84 & \text {none} \\ 0.90 & 1.72814 & 0.90000 & 15.093540 & 13776.02 & \text {none} \\ 1.00 & 1.92016 & 1.00000 & 15.093540 & 12398.42 & \text {none} \\ 1.10 & 2.11217 & 1.10000 & 15.093540 & 11271.29 & \text {none} \\ 2.00 & 3.84031 & 2.00000 & 15.093540 & 6199.21 & \text {none} \\ \end {array} \]

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.

408.2.5 The spacing is supplied by the metre

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:

\[ n\,d = m\,\frac {\lambda _{\rm opt}}{2}, \qquad \lambda _{\rm opt} = \frac {c}{f} , \]
so that
\[ d = \frac {m}{2n}\cdot \frac {c}{f} . \]
The left-hand side counts X-ray lattice planes; the right-hand side counts optical fringes. The laser frequency \(f\) is measured against a caesium clock, which is the definition of the second, and \(c\) is fixed exactly. The length dimension of \(d\) comes entirely from those two definitions.

Substituting back,

\[ \lambda _x = \frac {2\sin \theta }{n}\cdot \frac {m}{2n'}\cdot \frac {c}{f} . \]
The only X-ray information on the right is \(\sin \theta \) and the integers \(n\), \(m\), \(n'\). Everything carrying a unit of length is \(c/f\), and both are stipulations.

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 \).

408.2.6 The graph

Assembling the above gives \(24\) nodes and \(29\) edges, with four directed cycles:

\[ \begin {array}{ll} 1. & \mathrm {metre} \leftrightarrow c_{\rm def} \\ 2. & \mathrm {second} \leftrightarrow \mathrm {Cs\ transition} \\ 3. & \lambda _x \leftrightarrow E_\gamma \\ 4. & \lambda _x \to d_{\rm Si} \to \text {Bragg} \to \lambda _x \\ \end {array} \]
Of the \(23\) ancestors of the photon energy, seven lie on a cycle. Nine vertices have in-degree zero:
\[ \begin {array}{ll} c,\ h,\ \mathrm {Cs\ transition} & \text {defined exactly} \\ \text {wave description} & \text {the description adopted} \\ \text {fringe count } m,\ \text {plane count } n & \text {integers} \\ \text {isotope model, temperature convention} & \text {models and stipulations} \\ \text {detector ADU, encoder calibration} & \text {instrument} \\ \end {array} \]

None of the nine is a measured wavelength.

408.2.7 What “a 1 Å X-ray” asserts
\[ \begin {array}{ll} \text {content} & \text {counts concentrate at particular angles} \\ & \text {the } \sin \theta \text { of those angles stand in integer-like ratios} \\ & \text {the same ratio structure recurs in other planes and crystals} \\[4pt] \text {convention} & \text {that the phenomenon is described as a wave} \\ & \text {that the scale is fixed at } d(\mathrm {Si}\,220)=1.920155\ \text {\AA } \\ & \text {that this } d \text { takes its length dimension from } c/f \\ & \text {that } c \text { and the second are defined} \\ \end {array} \]

408.3 Rebuilding from the Encoder

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.

408.3.1 What is recorded

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,

\[ k = \{9176,\ 15094,\ 17779,\ 21608,\ 23660,\ 26810,\ 28580,\ 31385\}. \]
This, with the count at each position and the fact that the sequence repeats on re-measurement, is the observation.

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.

408.3.2 Counting the freedom in the standard reading

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.

408.3.3 The same freedom, granted to everything

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):

\[ \begin {array}{lrrr} \text {position variable} & p & N_0 & \text {relative error} \\ \hline \log k & 3 & 197 & 7.85\times 10^{-4} \\ \theta \ \text {(or raw } k) & 3 & 153 & 9.02\times 10^{-4} \\ \tan \theta & 1 & 188 & 1.04\times 10^{-3} \\ \sqrt {k} & 3 & 191 & 1.05\times 10^{-3} \\ \theta /(1+\theta ^2) & 1 & 192 & 1.09\times 10^{-3} \\ 1-\cos \theta & 2 & 197 & 1.09\times 10^{-3} \\ \sinh \theta & 3 & 135 & 1.20\times 10^{-3} \\ k^2 & 2 & 128 & 1.25\times 10^{-3} \\ \sin \theta & 2 & 111 & 1.36\times 10^{-3} \\ 2\sin (\theta /2) & 3 & 162 & 1.40\times 10^{-3} \\ \tanh \theta & 1 & 190 & 1.56\times 10^{-3} \\ \end {array} \]

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.

408.3.4 Function families

Allowing one shape parameter inside the position map, \(v = F(\theta ; a, b)\), and the same integer freedom:

\[ \begin {array}{lrrr} \text {family} & b & N_0 & \text {relative error} \\ \hline a\,\theta ^{\,b} & 1.054 & 117 & 1.24\times 10^{-3} \\ a\tan (b\theta ) & 0.912 & 110 & 1.35\times 10^{-3} \\ a\log (1+b\theta ) & 1.197 & 86 & 1.42\times 10^{-3} \\ a\sin (b\theta ) & 1.956 & 68 & 1.58\times 10^{-3} \\ a\,\theta /(1+b\theta ^2) & 1.149 & 111 & 1.62\times 10^{-3} \\ a\sinh (b\theta ) & 0.769 & 119 & 1.83\times 10^{-3} \\ a(e^{b\theta }-1) & 1.814 & 116 & 1.87\times 10^{-3} \\ a(1-\cos (b\theta )) & 1.434 & 114 & 2.01\times 10^{-3} \\ \end {array} \]

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.

408.3.5 Curvature

Replacing the flat path-difference law by the geodesic distance in a space of constant curvature \(K\),

\[ s(x) = \begin {cases} K^{-1/2}\sin (K^{1/2}x) & K > 0 \\ x & K = 0 \\ |K|^{-1/2}\sinh (|K|^{1/2}x) & K < 0 \end {cases} \]
and applying the same construction:
\[ \begin {array}{rrr} K & N_0 & \text {relative error} \\ \hline 0.00 & 153 & 9.02\times 10^{-4} \\ -0.50 & 194 & 1.19\times 10^{-3} \\ 0.50 & 175 & 1.15\times 10^{-3} \\ -1.00 & 135 & 1.20\times 10^{-3} \\ -2.00 & 181 & 1.31\times 10^{-3} \\ 1.00 & 111 & 1.36\times 10^{-3} \\ -4.00 & 200 & 1.30\times 10^{-3} \\ 2.00 & 193 & 1.29\times 10^{-3} \\ 4.00 & 173 & 1.52\times 10^{-3} \\ 16.00 & 200 & 1.52\times 10^{-3} \\ \end {array} \]

Eleven curvature values from \(-4\) to \(+16\) all admit integer readings within a factor of \(1.7\) of each other. Flatness is not selected.

408.3.6 Dimension and norm

Requiring that the ratios be reproduced by \(\|v\|_p\) for integer vectors \(v\) in \(d\) dimensions, at a \(2\%\) tolerance:

\[ \begin {array}{lll} d & p & \text {admits an assignment} \\ \hline 1,2 & 1,2,3 & \text {no} \\ 3 & 2 & \text {yes} \\ 3 & 1,3 & \text {no} \\ 4,5,6 & 2 & \text {yes} \\ 4,5,6 & 3 & \text {yes} \\ \end {array} \]

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.

408.3.7 The constants

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:

\[ \begin {array}{rrrrr} c\ \text {factor} & h\ \text {factor} & d\ \text {factor} & \lambda \ [\text {\AA }] & E\ [\mathrm {eV}] \\ \hline 1 & 1 & 1 & 1.00003 & 12398.1 \\ 1 & 1 & 2 & 2.00006 & 6199.0 \\ 1 & 1 & 0.5 & 0.50001 & 24796.1 \\ 2 & 1 & 1 & 1.00003 & 24796.1 \\ 1 & 2 & 1 & 1.00003 & 24796.1 \\ 1 & 0.5 & 2 & 2.00006 & 3099.5 \\ 3 & 1 & 1/3 & 0.33334 & 111582.5 \\ \end {array} \]

The encoder integers are identical in every row. The reported photon energy ranges over a factor of \(36\).

408.3.8 Non-Archimedean reading

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\}\),

\[ \begin {array}{rl} |\cdot |_2: & 1,\ 0.125,\ 1,\ 0.0625,\ 1,\ 0.125,\ 1,\ 0.03125 \\ |\cdot |_3: & 0.333,\ 1,\ 1,\ 1,\ 1,\ 0.333,\ 0.037,\ 1 \\ |\cdot |_5,\ |\cdot |_7: & 1\ \text {throughout} \\ \end {array} \]
The reflection indexed \(440\), with \(N = 32\), is the smallest of the eight under \(|\cdot |_2\); the one indexed \(111\), with \(N = 3\), is among the largest. The notion of a reflection lying far out in reciprocal space does not survive the change of norm.
408.3.9 Summary
\[ \begin {array}{lll} \text {varied} & \text {outcome} \\ \hline \text {position variable (12)} & \text {all admit integers; } \log k \text { best, } \sin \theta \text { ninth} \\ \text {function family (8)} & \text {all within a factor of } 1.6 \\ \text {curvature } K \in [-4,16] & \text {all admit integers; } K=0 \text { not selected} \\ \text {dimension and norm} & \text {seven combinations pass; } d \geq 3 \\ c,\ h,\ d & E \text { spans a factor of } 36 \\ \text {norm (Archimedean or not)} & \text {ordering of the integers reverses} \\ \end {array} \]

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.

408.4 Re-indexing the Lattice

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\).

408.4.1 The search that returns three

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\):

\[ \begin {array}{rrl} N_0 & \text {relative error} & N_i \\ \hline 1 & 0.33469 & 1,3,4,5,6,8,9,11 \\ 2 & 0.16726 & 2,5,7,11,13,16,18,21 \\ 3 & \mathbf {0.00136} & 3,8,11,16,19,24,27,32 \\ 4 & 0.08469 & 4,11,15,21,25,32,36,43 \\ 5 & 0.06726 & 5,13,18,27,32,40,45,53 \\ 6 & \mathbf {0.00136} & 6,16,22,32,38,48,54,64 \\ 9 & \mathbf {0.00136} & 9,24,33,48,57,72,81,96 \\ 12 & \mathbf {0.00136} & 12,32,44,64,76,96,108,128 \\ 15 & \mathbf {0.00136} & 15,40,55,80,95,120,135,160 \\ 18 & \mathbf {0.00136} & 18,48,66,96,114,144,162,192 \\ \end {array} \]

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.

408.4.2 Declaring \(N_0\) and recovering it

Fix \(N_0\) in advance, derive the lattice constant that produces it, and then re-index the same encoder positions with that lattice:

\[ \begin {array}{rrcr} \text {declared } N_0 & \text {implied } a\ [\text {\AA }] & \text {re-measured } N_0 & \text {agreement} \\ \hline 1 & 9.406803 & 1 & \text {yes} \\ 2 & 6.651614 & 2 & \text {yes} \\ 3 & 5.431020 & 3 & \text {yes} \\ 4 & 4.703401 & 4 & \text {yes} \\ 6 & 3.840311 & 6 & \text {yes} \\ 8 & 3.325807 & 8 & \text {yes} \\ 16 & 2.351701 & 16 & \text {yes} \\ \end {array} \]

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.

408.4.3 The propagation

Every quantity downstream follows:

\[ \begin {array}{rrrrr} N_0 & a\ [\text {\AA }] & d_{\rm first}\ [\text {\AA }] & \lambda \ [\text {\AA }] & E\ [\mathrm {eV}] \\ \hline 1 & 9.406803 & 9.406803 & 3.000162 & 4132.6 \\ 2 & 6.651614 & 4.703401 & 1.500081 & 8265.2 \\ 3 & 5.431020 & 3.135601 & 1.000054 & 12397.8 \\ 4 & 4.703401 & 2.351701 & 0.750041 & 16530.3 \\ 6 & 3.840311 & 1.567800 & 0.500027 & 24795.5 \\ 12 & 2.715510 & 0.783900 & 0.250014 & 49591.0 \\ \end {array} \]

The photon energy spans a factor of twelve across the table. The encoder integers are identical in every row.

408.4.4 Which dimensions are excluded

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:

\[ \begin {array}{rrl} d & \text {count} & \text {admissible } N_0 \\ \hline 1 & 0 & - \\ 2 & 0 & - \\ 3 & 5 & 3, 6, 9, 12, 18 \\ 4 & 13 & 3, 6, 9, 12, 15, 18, 19, 20, 22, 23, 24, 26, \ldots \\ 5 & 25 & \text {all of the above and more} \\ 6 & 28 & \\ 7 & 28 & \\ \end {array} \]

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\):

\[ \begin {array}{rllll} N & d=3 & d=4 & d=5 & d=6 \\ \hline 3 & (1,1,1) & (0,1,1,1) & (0,0,1,1,1) & (0,0,0,1,1,1) \\ 8 & (0,2,2) & (0,0,2,2) & (0,0,0,2,2) & (0,0,0,0,2,2) \\ 11 & (1,1,3) & (0,1,1,3) & (0,0,1,1,3) & (0,0,0,1,1,3) \\ 16 & (0,0,4) & (0,0,0,4) & (0,0,0,0,4) & (0,0,0,0,0,4) \\ 19 & (1,3,3) & (0,1,3,3) & (0,0,1,3,3) & (0,0,0,1,3,3) \\ 24 & (2,2,4) & (0,2,2,4) & (0,0,2,2,4) & (0,0,0,2,2,4) \\ 27 & (1,1,5) & (0,1,1,5) & (0,0,1,1,5) & (0,0,0,1,1,5) \\ 32 & (0,4,4) & (0,0,4,4) & (0,0,0,4,4) & (0,0,0,0,4,4) \\ \end {array} \]

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)\).

408.4.5 Tolerance

Tightening the tolerance reduces the number of admissible \(N_0\) but does not change the ordering across dimensions:

\[ \begin {array}{rrrrrr} \text {tol} & d=2 & d=3 & d=4 & d=5 & d=6 \\ \hline 10^{-3} & 0 & 0 & 0 & 0 & 0 \\ 3\times 10^{-3} & 0 & 5 & 7 & 12 & 13 \\ 10^{-2} & 0 & 5 & 7 & 13 & 15 \\ 3\times 10^{-2} & 0 & 8 & 17 & 29 & 32 \\ 10^{-1} & 0 & 11 & 23 & 35 & 38 \\ \end {array} \]

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.

408.4.6 Summary

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.

408.5 Without an Interval

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.

408.5.1 The record

A diffraction measurement produces a finite set of detector channels, each carrying a count. Taking eight channels from a silicon standard,

\[ I = \{100,\ 55,\ 30,\ 6,\ 11,\ 12,\ 6,\ 3\}, \qquad \textstyle \sum I = 223 . \]
The channels are ordered — channel \(3\) lies between \(2\) and \(4\) — but no distance between them is asserted. The structures available are a finite set, a total order on it, the natural numbers, and the adjacency relation of the ordering.
408.5.2 What the order alone supports

The sign sequence of successive differences is

\[ (-,-,-,+,+,-,-), \]
from which the local maxima are channels \(\{0,5\}\) and the local minima \(\{3,7\}\). The number of peaks, their positions, and the number of monotone runs are properties of the order.

Two patterns are order-isomorphic when their sign sequences agree. Scaling all counts by a factor of ten leaves the sequence unchanged:

\[ \begin {array}{lll} A = \{100, 55, 30, 6, 11, 12, 6, 3\} & \to & (-,-,-,+,+,-,-) \\ B = \{1000, 600, 299, 7, 60, 61, 7, 2\} & \to & (-,-,-,+,+,-,-) \\ C = \{100, 55, 30, 6, 11, 10, 6, 3\} & \to & (-,-,-,+,-,-,-) \\ \end {array} \]
\(A\) and \(B\) are the same pattern; \(C\) is not, having lost one maximum. That \(A\) and \(C\) differ is decidable without any interval.
408.5.3 Comparison without distance

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:

\[ \tau (X, Y) = \frac {n_c - n_d}{n_c + n_d} . \]
For a repeat measurement \(Y = \{100, 54, 31, 7, 10, 13, 5, 4\}\) of the same material, \(\tau = 1\) exactly and the sign sequence is identical. For a pattern with the same values in a different arrangement, \(Z = \{100, 12, 11, 6, 30, 55, 6, 3\}\), \(\tau = 19/27 = 0.704\).

Reproducibility, and the identification of a material by comparison against a reference pattern, are settled by these quantities. No distance function is invoked.

408.5.4 Intensities

The counts are integers, so the normalised intensities are rational:

\[ p = \left \{\tfrac {100}{223}, \tfrac {55}{223}, \tfrac {30}{223}, \tfrac {6}{223}, \tfrac {11}{223}, \tfrac {12}{223}, \tfrac {6}{223}, \tfrac {3}{223}\right \}, \]
with \(\max /\min = 100/3\) exactly, the two strongest channels carrying \(155/223 = 0.695\) of the total, and the Gini concentration \(1 - \sum p_i^2 = 35458/49729\).

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.

408.5.5 Width without a metric

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.

408.5.6 Where the interval enters
\[ \begin {array}{lll} \text {statement} & \text {interval} & \text {requires} \\ \hline \text {number of peaks} & \text {no} & \text {order} \\ \text {same pattern?} & \text {no} & \text {order isomorphism} \\ \text {reproducible?} & \text {no} & \text {rank correlation} \\ \text {relative intensity} & \text {no} & \mathbb {Q} \\ \text {width in channels} & \text {no} & \text {graph distance} \\ \text {material identification} & \text {no} & \text {pattern matching} \\ \text {cross-instrument comparison} & \text {no} & \text {rank correlation} \\ \hline \lambda = 1.54\ \text {\AA } & \text {yes} & \text {interval} + \text {Bragg} + d_{\rm Si} \\ E = 12.4\ \text {keV} & \text {yes} & \text {above} + h, c \\ a = 5.43\ \text {\AA } & \text {yes} & \text {above} + \text {Euclidean norm} \\ \text {cubic, three-dimensional} & \text {yes} & \text {above} + \text {integer lattice} \\ \end {array} \]

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.

408.5.7 What was used
\[ \begin {array}{ll} \text {used} & \text {finite set; natural numbers; total order;} \\ & \text {addition; division in } \mathbb {Q}; \text { adjacency} \\[3pt] \text {not used} & \text {real numbers; a distance function; angle; sine;} \\ & \text {a norm; a dimension; the continuum} \\ \end {array} \]

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.