ClayQuant

Calculation of X-ray powder diffraction patterns of interstratified clay minerals, and quantification of clay mineral assemblages from oriented mounts
User and reference manual · Program version 0.1.0 · September 2026

Scope. ClayQuant computes one-dimensional (00l) and three-dimensional (hkl) X-ray powder diffraction patterns for mica-type (illite), chlorite and kaolinite layer structures, for the ethylene glycol–smectite complex, and for randomly or non-randomly interstratified two-component stacks of these layers, with arbitrary preferred orientation and crystallite thickness distribution. It then uses those calculated patterns to quantify the clay mineral assemblage of a clay separate measured as three oriented mounts (air-dried, ethylene glycol-solvated and heated), by non-negative least squares over the whole pattern.

The program is written in Python, is operated through a local browser interface or from the command line, and is distributed as source. This manual documents the physical model, the implementation, the operating procedure, every control of the interface, the output files, and the tests by which the program was verified.

Contents
  1. Introduction
    1. Purpose
    2. What the program does and does not do
    3. Notation and conventions
    4. Related programs
  2. Theory
    1. The oriented mount
    2. Scattering factors and the structure factor
    3. The one-dimensional layer model
    4. Basal reflections of a periodic stack
    5. Interstratification: the matrix method
    6. Crystallite thickness
    7. Ordering and Reichweite
    8. The Lorentz–polarization factor
    9. Preferred orientation
    10. Beam overflow
    11. Emission profile and peak shape
    12. Assembling a pattern
    13. Quantification
  3. Implementation
    1. Module map
    2. Data flow
    3. The reference library
    4. Numerical notes
  4. Installation and structure data
    1. Installation
    2. Structure data and licensing
    3. Importing a TOPAS structure library
    4. Building the reference library
    5. A library from measured peak lists
  5. Operating procedure
    1. Specimen preparation assumed
    2. Step 1 — Load
    3. Step 2 — Zero error
    4. Step 3 — Background
    5. Step 4 — Main minerals
    6. Step 5 — Kaolinite
    7. Step 6 — Expandable clay
    8. Step 7 — Fit and results
    9. The simulator
  6. Reference: interface controls
  7. Reference: command line
  8. Output files
  9. Limitations
  10. References
  11. Appendix A — Record of verification tests
  12. Appendix D — Provenance of the accompanying-mineral structures
  13. Appendix B — File formats read
  14. Appendix C — Symbols

1 Introduction

1.1 Purpose

Quantitative analysis of clay mineral assemblages by X-ray diffraction is made difficult by three properties of the minerals themselves. Clay minerals are platy, so a specimen prepared for analysis is strongly textured rather than randomly oriented. They are frequently interstratified, so that a crystallite is a stack of two or more different layer types and produces neither the pattern of one end member nor a superposition of both. And they are finely divided, so that crystallites are only a few tens of layers thick and their reflections are correspondingly broad. None of these is a defect of the measurement; all three are properties of the material that a calculation must reproduce before a quantification can mean anything.

ClayQuant addresses these by calculating the pattern that each candidate phase would produce under the conditions of the measurement — its texture, its crystallite thickness, its layer spacing, the instrument's emission profile and slit geometry — and then fitting the measured pattern as a non-negative combination of those calculated patterns.

1.2 What the program does and does not do

It does:

It does not:

1.3 Notation and conventions

Throughout, λ is the wavelength in ångström, θ the Bragg angle, and

s = 2 sinθ / λ = 1/d (1.1)

the length of the scattering vector, in å−1. Note that s is defined here without the factor 2π and without the factor ½ used in some crystallographic literature; the quantity q = sinθ/λ = s/2 is used only as the argument of scattering factors and displacement factors, matching International Tables convention. The stacking axis of a layer structure is c*, and heights along it are given in ångström and denoted z. Layer repeat distances are denoted dA, dB. Intensities are per unit incident flux and are reported in arbitrary units, since only relative intensities enter the analysis.

1.4 Related programs

The one-dimensional part of the calculation follows the same physics as NEWMOD (Reynolds), PyXRD (Dumon & Van Ranst) and Sybilla, all of which implement the matrix formalism of §2.5. ClayQuant differs from these chiefly in coupling the calculation directly to a whole-pattern non-negative least-squares quantification, in computing the three-dimensional hkl contribution of the host phases from crystal structures rather than treating only basal reflections, and in being open source and scriptable.

2 Theory

2.1 The oriented mount

A clay separate is deposited on a glass slide so that the platelets lie with (001) close to the slide surface. In Bragg–Brentano reflection geometry the diffraction vector is always parallel to the specimen normal, so such a specimen presents predominantly its basal (00l) reflections. The degree to which this is true is a property of the preparation, not a constant, and is treated here as an adjustable texture parameter (§2.9).

Three mounts of the same separate are measured:

MountTreatmentDiagnostic role
Air-driedas deposited, equilibrated with laboratory airreference state
Glycol-solvatedexposed to ethylene glycol vapourexpandable layers swell to a two-layer complex near 16.9 å
Heatedtypically 500 °Ckaolinite dehydroxylates and its 7.15 å reflection is lost; chlorite survives

The quantitative fit is performed on the glycol-solvated mount, because glycolation separates the expandable from the non-expandable component and resolves the illite/smectite series, which in the air-dried state overlap near 10–14 å.

2.2 Scattering factors and the structure factor

Atomic scattering factors f0(q) are evaluated from the eleven-parameter analytical expansion of Waasmaier & Kirfel (1995),

f0(q) = c + Σi=15 ai exp(−bi q2) (2.1)

valid to q = 6 å−1, with q = sinθ/λ. Ionic species are used where the tabulation provides them and the CIF specifies a charge; otherwise the neutral atom is used, and a species that is not tabulated falls back to its neutral atom with a warning. Isotropic displacement is applied as

T(q) = exp(−B q2) (2.2)

with B in å2. Where a CIF reports Uiso, the conversion B = 8π2U is applied. The structure factor of a reflection hkl is then

F(hkl) = Σj nj fj(q) exp(−Bjq2) exp[2πi(hxj + kyj + lzj)] (2.3)

summed over the symmetry-expanded content of the unit cell, with nj the site occupancy. Symmetry operations are taken from the CIF as written, parsed into a rotation and a translation, applied to each asymmetric-unit site, and duplicate positions removed within a tolerance of 10−4 in fractional coordinates.

2.3 The one-dimensional layer model

For a basal reflection h = k = 0, equation (2.3) reduces to

F(00l) = Σj nj fj Tj exp(2πi l zj) (2.4)

which depends only on the fractional coordinate along c, whatever the cell angles: the scalar product of the reciprocal vector (00l) with a position xa+yb+zc is lz exactly. No projection correction is required. The basal spacing follows from the triclinic metric as

d(001) = 1/|c*| = V / (ab sinγ) (2.5)

A layer model is therefore a list of scatterers at absolute heights z (in ångström) within one layer of repeat distance d, each with an occupancy and a displacement parameter, together with the continuous layer structure factor

F(s) = Σj nj fj(s/2) exp(−Bj s2/4) exp(2πi s zj) (2.6)

Here s is continuous, not restricted to l/d: an interstratified stack is not periodic and scatters at every s, which is precisely what §2.5 integrates.

Deriving a layer model from a polytype cell

The structures available for illite, chlorite and kaolinite are multi-layer polytypes: illite ICSD 90144 is a two-layer C2/c cell, kaolinite 2M ICSD 30285 a two-layer C1c1 cell. Successive layers in these polytypes are related by operations of the form (x, −y, z+½) — a rotation or reflection in the ab plane combined with a translation of exactly half the cell along c. Such an operation leaves the projection of the electron density on c* unchanged. The projected density therefore repeats every d(001)/n, and a single-layer model is obtained exactly by folding all atomic heights modulo that distance. This is done automatically; the fold is exact for the 2M1 and IIb polytypes used here and was verified numerically (§A.1).

Consequence. Because only the projection on c* enters, kaolinite 1M and kaolinite 2M have nearly identical basal series and are not distinguishable from 00l intensities alone. They are separable only through their hkl reflections, which in a strongly oriented mount are weak. Both are provided, and a fit that divides intensity between them should not be read as a polytype determination.

2.4 Basal reflections of a periodic stack

For a crystallite of N identical layers of thickness d, the amplitudes add with a phase 2πs d per layer and

I(s) = |F(s)|2 · sin2(πN s d) / sin2(πs d) (2.7)

the familiar Laue interference function, which has maxima of height N2 at s = l/d and a width in s of about 1/(Nd). Equation (2.7) is the A = B limit of the general result below, and is used as a closed-form check on it (§A.1).

2.5 Interstratification: the matrix method

Consider a crystallite of N layers stacked along c*, each of type A or B, with layer structure factors FA(s), FB(s) and thicknesses dA, dB. Let the sequence be a stationary first-order Markov chain with transition matrix P, where Pmn is the probability that a layer of type m is followed by one of type n, and with stationary proportions W satisfying WP = W.

The scattered amplitude is

A(s) = Σj=1N Ftj(s) exp(2πi s zj),    zj = Σk<j dtk (2.8)

and the expected intensity ⟨|A|2⟩ separates into a self term and a pair term,

I(s) = Σj ⟨|Ftj|2⟩ + 2 Re Σj<k ⟨Ftk F*tj exp(2πi s(zk−zj))⟩ (2.9)

Define the matrix

Tmn(s) = Pmn exp(2πi s dm) (2.10)

Then the sum over all sequences of n steps from type m to type p, weighted by probability and carrying the accumulated phase, is exactly [Tn]mp. Writing fm = WmF*m, the pair at separation n contributes fTTnF, and counting the (N−n) pairs at that separation gives

I(s) = N Σm Wm|Fm|2 + 2 Re Σn=1N−1 (N−n) fTTnF (2.11)

which is the result implemented. Dividing by N and letting N→∞ gives the Kakinoki–Komura form

I∞(s)/N = Re{ fT[2(I−T)−1−I]F } (2.12)

since Σn≥1Tn = (I−T)−1−I and fTF = ΣWm|Fm|2. ClayQuant uses the finite form (2.11), because crystallite thickness controls basal peak width and the infinite limit would give delta functions.

On the phase convention. The distance from the origin of layer j to that of layer j+1 is the thickness of layer j, not of layer j+1. This is why the exponential in (2.10) carries dm, the thickness of the layer being left. Using the other convention transposes the roles of the two components and is a common source of error; the implementation is checked against the pure end members and against the closed form (2.7) for this reason (§A.1).

2.6 Crystallite thickness

Real specimens contain crystallites of many thicknesses. Averaging (2.11) over a distribution p(N) and normalising per layer gives

I(s)/⟨N⟩ = ΣmWm|Fm|2 + 2 Re Σn≥1 G(n) fTTnF (2.13)

with the pair weights

G(n) = ⟨max(N−n, 0)⟩ / ⟨N⟩ (2.14)

so the thickness distribution enters through one vector of weights, computed once and reused at every s. The distribution used is lognormal in N, parameterised by its mean ⟨N⟩ and by the width β of the underlying normal distribution in ln N, following the crystallite size distribution (CSDS) treatment standard in this field (Drits, Eberl & Środoń). G(n) is normalised so that G(0) = 1.

Crystallite thickness is the dominant control on basal peak width. For a 10 å layer, a mean of 10 layers gives a 001 width of order 0.8° 2θ, while a well-crystallised illite may show 0.12°, which requires of order 70 layers (§A.7). It cannot be assumed; it must either be spanned by the library or determined from the data.

2.7 Ordering and Reichweite

The transition matrix carries the ordering. For a two-component system with proportions WA, WB:

CaseTransition probabilitiesDescription
Random, R = 0PAB = WB, PBA = WA a layer's identity is independent of its neighbour
Ordered, R = 1PAB > WB unlike layers tend to alternate; the limit PAB = 1 at WA = ½ is a regular alternation (rectorite-like)
SegregatedPAB < WB like layers cluster; the limit PAB = 0 is a physical mixture

Ordering is expressed through a single parameter PAB, from which the remaining probabilities follow by the stationarity and normalisation conditions WAPAB = WBPBA and PmA+PmB = 1. Values of PAB for which any probability would fall outside [0,1] are rejected. The supplied reference library is computed for the random case, which is the appropriate default for illite/smectite and chlorite/smectite in most sedimentary settings; ordered stacks can be computed in the simulator or by calling the library builder directly.

2.8 The Lorentz–polarization factor

Which Lorentz factor applies to an oriented clay aggregate measured on a diffractometer is a genuine and long-standing question, and the choice matters: the two candidate conventions differ by a factor l across a basal series after normalisation at 001, so an incorrect choice distorts every relative basal intensity and therefore every quantification derived from them.

The two candidates are the random-powder (Debye–Scherrer) form

LPpowder = (1 + cos22θ) / (2 sin2θ cosθ) (2.15)

and the single-crystal form appropriate to a one-dimensionally periodic, perfectly oriented specimen,

LPcrystal = (1 + cos22θ) / (2 sin 2θ) (2.16)

Bradley (1954) and Schoen (1962) found the random-powder factor to work for oriented aggregates; MacEwan, Amil & Brown (1961) argued for something intermediate. The matter was settled empirically by Reynolds (1965), who showed for an ethylene glycol–montmorillonite complex (his Table 2) and independently for a dry Na-montmorillonite (his Table 4) that the random-powder factor is required to reproduce observed basal intensities, the single-crystal factor giving large deviations — for the dry montmorillonite, a calculated 003 intensity of 141 against an observed 55.

ClayQuant therefore uses (2.15) by default. This is not merely a convention: the published one-dimensional clay layer models, including the glycol–smectite model used here, were refined under it, and their structure factors are only consistent when it is applied. Equation (2.16) is selectable for comparison. A monochromator-modified polarization factor,

p = (1 + cos22θ cos22θM) / (1 + cos22θM) (2.17)

is available for a crystal-monochromated beam.

2.9 Preferred orientation

Texture is described by the March–Dollase model (March 1932; Dollase 1986). For a reflection whose scattering vector makes an angle α with the texture axis,

P(α; r) = (r2cos2α + sin2α/r)−3/2 (2.18)

The texture axis is c*, the platelet normal, which in Bragg–Brentano reflection geometry coincides with the specimen normal. r = 1 is a random powder; r < 1 describes platelets lying in the specimen plane, enhancing 00l and suppressing hk0. The function conserves total scattered intensity, its average over the sphere being unity, so r redistributes intensity rather than creating it.

Preferred orientation does not change a purely basal pattern. For every 00l reflection α = 0, so P = r−3 for all of them alike: a common scale factor. The March–Dollase parameter therefore has no effect on the shape of a basal series, and acts only on the ratio of basal to non-basal intensity. This is why the ten orientation parameters of the reference library change an interstratified pattern only through its hkl contribution (§2.12), and why r cannot be determined from basal reflections alone.

2.10 Beam overflow

The Lorentz factor diverges as 1/sin2θ, but a real measurement does not, because at low angle the irradiated length of a flat specimen,

Lirr(θ) = R γ / sinθ (2.19)

with R the goniometer radius and γ the equatorial divergence in radians, exceeds the specimen and part of the beam misses it. Only the intercepted fraction diffracts:

φ(θ) = min[1, Lspec sinθ / (R γ)] (2.20)

This matters precisely where clay basal reflections lie. Reynolds (1965) avoided the correction by changing beam slits with angle so that the beam never exceeded his specimen, following Klug & Alexander (1954); with the fixed slits of a modern instrument it must be applied, or every calculated pattern carries an unphysical low-angle ramp. The specimen length, goniometer radius and divergence are settable; for a variable-divergence (automatic) slit, which keeps the irradiated length constant, the correction should be disabled.

The goniometer radius and the divergence come from the data file. The specimen length does not — nothing in a data file knows how long the smear was — and it decides where the correction stops acting: full illumination is reached at sin θ = Lspec/(R γ), which for a 0.5 ° slit on a 240 mm goniometer is 6.9 ° at 35 mm of specimen and 12.0 ° at 20 mm. The chlorite 001 lies between the two, so the assumption is not free there: on a real mount the calculated chlorite 001/002 is 0.26 at 20 mm and 0.47 at 35 mm, against 0.43 measured and 0.47 from an independent TOPAS refinement of the same specimen. Above 12 ° neither value acts at all, which is why the pure-mineral ratios of §A.17 are flat from 20 to 25 mm. The default is therefore 35 mm, a full smear on a standard slide; set it to the length you actually prepare.

2.11 Emission profile and peak shape

The source is described as a sum of Lorentzian-weighted lines, each with its own wavelength, relative intensity and intrinsic width. The default Cu Kα profile is the five-line description

Lineλ (å)Relative weightWidth
11.5347530.01593.6854
21.5405960.56910.4370
31.5410580.07620.6000
41.5444100.25170.5200
51.5447210.08710.6200

Every reflection is generated once per emission line, at the 2θ corresponding to that line's wavelength and scaled by its weight, so the Kα1/Kα2 separation emerges naturally and correctly with angle rather than being imposed. Other profiles, including a single Kα1 line, are available.

The instrumental profile is a pseudo-Voigt whose Gaussian width follows the Caglioti relation

FWHM2 = U tan2θ + V tanθ + W (2.21)

with a mixing parameter η between Gaussian and Lorentzian, optionally combined with a Scherrer broadening from a finite in-plane crystallite dimension. Note that broadening along c* is not imposed through (2.21): for interstratified phases it arises physically from the crystallite thickness distribution of §2.6.

2.12 Assembling a pattern

A pattern of a discrete crystalline phase is computed by enumerating every reciprocal lattice point within the measurable range, evaluating (2.3), and applying preferred orientation, Lorentz–polarization and beam overflow before convolution with the emission profile and peak shape. Reflections are enumerated individually rather than by symmetry-equivalent family, so multiplicity is accounted for by the enumeration itself and each reflection receives its own March–Dollase factor according to its own angle to c* — which is what the texture correction requires.

An interstratified pattern is assembled from two contributions:

  1. the continuous basal intensity of §2.5, evaluated at every point of the 2θ grid and carrying LP, beam overflow and the emission profile;
  2. the non-basal (hkl, k≠0 or h≠0) reflections of the host phase, computed from its crystal structure and scaled by their March–Dollase factors.
Approximation. Contribution (2) treats the non-basal scattering of an interstratified crystal as that of its host layer type, scaled by the host's proportion. This is an approximation. In reality, turbostratic stacking produces two-dimensional hk bands with a characteristic sawtooth profile rather than sharp three-dimensional reflections, and the interstratified component contributes its own non-basal scattering. The approximation is acceptable for a strongly oriented mount, where non-basal intensity is heavily suppressed by the texture, and it degrades as r approaches 1. The relative scaling of the two contributions is fixed by computing, for a pure host stack, the ratio of its basal intensity in the two formulations, so that a pure end member reproduces its own three-dimensional calculation (§A.1).

2.13 Quantification

The measured pattern y(2θ), after zero-error correction and background subtraction, is fitted as

y(2θ) ≈ Σp cp yp(2θ),    cp ≥ 0 (2.22)

over the library patterns yp, by non-negative least squares. The non-negativity constraint is physical — a phase cannot be present in negative amount — and has the useful side effect of producing a sparse solution, so that of several hundred candidate patterns only a handful take non-zero coefficients.

The solve is weighted. The variance of a counting measurement at a point is the number of counts recorded there, so the weight is

wi = 1 / max(yraw,i, 1) (2.23)

taken from the raw counts, before background subtraction: subtracting a background does not reduce the Poisson variance of the measurement. Weighting instead by the background-subtracted intensity — an easy error — places the greatest weight on the flat regions between peaks, where the subtracted value is near zero and only noise remains, and almost none on the peaks that carry the information (§A.9). Agreement is reported as

Rwp = [ Σwi (yi−ycalc,i)2 / Σwiyi2 ]1/2,    Rp = Σ|yi−ycalc,i| / Σ|yi| (2.24)

From coefficients to proportions

Two measures are reported for each phase, and they answer different questions:

Scattering share
the phase's fraction of the total calculated integrated intensity, cp∫yp / Σcq∫yq. This is the quantity the diffractogram actually measures.
Amplitude share
the phase's fraction of the summed scale factors, cp/Σcq. Broad interstratified patterns carry far more integrated area per unit peak height than a sharp discrete phase, so the two can differ by a factor of several.

A parameter the library stopped rather than determined

The fit chooses among pre-computed patterns (§3.3), so it cannot return a value the library does not hold. When a phase's coefficients collect on the lowest or highest value of a spanned parameter, the honest reading is not that the parameter equals that value but that the data wanted to go further and ran out of library: the answer is a bound, not a measurement. In a table of numbers that all look alike that difference is invisible, and it is the same signal that marks a refined parameter sitting on its limit — worth distrusting wherever it appears.

So every fit reports it. parameters_at_an_edge lists each phase and parameter whose fitted weight piles up on an end of its range, and the fit records the list in its metadata without being asked. Merely including an end value among others is not flagged; the default threshold is 80 % of a phase's coefficient.

Two cases look identical in a table of numbers and are not the same thing, so they are worded differently. A crystallite thickness sitting on the largest value calculated means the data wanted a larger one and the library should be extended. A composition sitting on 1.00 means the data wants the pure phase, and there is nothing beyond it to extend to — the fit has answered rather than run out of room, and the same goes for an orientation parameter at r = 1, which is a random powder. Advice to span those further is advice that cannot be taken, and a warning a user learns to ignore is worse than none.

What prompted it: a measured pure illite standard put 94 % of its illite on the 0.99 entry of the illite/smectite series, the highest the series went. That reported 1 % of smectite the specimen did not have, and reported the end of a range as though it were a composition. The series now reaches 1.00 (§3.3), and the chlorite/smectite series with it.

How much of an interstratified phase is the host

The library spans illite/smectite from 0.20 to 0.99 illite layers and groups every one of those entries under the phase name I/S. The name alone is therefore misleading at the ends of the series: a fit that settles on the 0.99/0.01 entry has found a stack of essentially pure illite, and a table reporting that as “I/S, 63 % of the pattern” reads as though 63 % of the specimen were an expandable clay. On a measurement of a pure illite standard that is the difference between accepting the material and rejecting it.

So each phase also reports the host-layer fraction the fit chose, averaged over its entries and weighted by their coefficients, with the expandable fraction as its complement. A discrete mineral reports 1. Read the two together: I/S at 0.99 is an illite, at 0.60 it is genuinely interstratified.

Weight percent

A third quantity is reported, and it is a weight percent. It needs no reference intensity ratios, because the calculated patterns carry the mass of what they were calculated from. A stored pattern is the calculated one divided by a normalisation se; the calculated one is for a single unit of the phase — one unit cell for a discrete mineral, one layer for an interstratified stack — of mass Me. So a fitted coefficient ce counts units, and

Wp ∝ kp Σe∈p ce Me / se (2.25)

with the constant of proportionality the same for every phase — it is the instrument, the irradiated volume and the counting time, which the phases of one measurement share — so the ratios are ratios of mass. This is the relation Rietveld analysis writes as W ∝ S(ZMV), in the form ClayQuant's normalisation calls for. Tested by building a specimen from known masses of library patterns and asking for the masses back, it returns them exactly (§A.14).

kp is 1, and that is the whole difficulty. Equation (2.25) assumes the calculated pattern accounts for everything the phase contributes. In an oriented mount it does not, because texture differs between minerals and between preparations, and the fit cannot tell a well-oriented phase from an abundant one. The effect is not a correction of a few percent. A basal series is multiplied by r−3 (§2.9), so a clay fitted at r = 0.13 is calculated to scatter 455 times more per gram than the same clay at r = 1, and the mass inferred for it falls by the same factor, while quartz — which does not plate onto the slide and is fitted at r = 1 — takes the mass the clays lose. Until kp has been measured for a preparation, read the weight percent as indicative and the clay-to-non-clay split as the least reliable part of it. The fitted r is reported beside every phase so this is visible rather than hidden.

Measuring kp. It is one factor per phase, covering texture, microabsorption and any error in the structural model together. To determine it, analyse specimens whose composition is known independently, through the same preparation routine, and solve for the factors that reproduce that composition — Calibration.from_known_composition does the arithmetic, and the factors are stored in a JSON file that the analysis loads. One way to obtain the known composition is to measure the same separate twice: once as a random mount spiked with an internal standard, which gives absolute weight fractions by the usual internal-standard method and is unaffected by texture because there is none; and once as the oriented mounts. The random mount fixes the composition, the oriented fit then yields kp. An oriented mount cannot be spiked usefully, since the standard does not orient as the clays do and its share in the mount is not its share in the suspension.

The other route needs no mixture at all: mount one pure mineral, and measure a standard of known weight separately through the same optics. Then the mass the specimen holds is known independently of any fit, and kp is what stands between it and the mass (2.25) infers. That is the external-standard method below, and §A.18 reports it.

The older route is still available for a laboratory that has measured reference intensity ratios of its own: Quantification.weight_percent divides each phase's share of diffracted intensity by its ratio.

An internal standard, and what the fit does not account for

Every weight percent above is a share of what was fitted, and sums to 100 however much of the specimen was left out. A mount holding amorphous material, or a mineral the library does not have, therefore reports every phase in it overstated by one common factor, and nothing inside the fit reveals the factor: the residual of a whole-pattern fit is not a measure of missing crystalline matter, because a missing phase's intensity is taken up by whatever else lies under it.

A weighed addition of a standard reveals it. If a mass fraction Wstd of a standard is mixed into the specimen before mounting, and the fit returns W′std for it on the relative basis, then every phase's weight percent of the specimen is

Wp = W′p · Wstd / W′std (2.26)

and what is left over, 100 − ΣpWp, is the amorphous content together with any crystalline phase absent from the fit. The measurement separates that sum from the phases that were fitted, but not into its two parts.

Pass the standard and its weight to the analysis (quantify(..., internal_standard=("Corundum", 20.0))) and the table gains an absolute column beside the relative one, with the unaccounted fraction reported alongside. A standard that was weighed in but does not appear in the fit leaves the analysis relative and says so, rather than scaling by a number it does not have. The absolute column is given on the whole-specimen basis only: a clay-mineral table is renormalised to 100 % by definition, so scaling it would mean nothing.

An internal standard belongs in a random mount, not an oriented one. The standard must share the specimen's texture for (2.26) to hold, and a spike added to a clay suspension does not: it does not plate onto the slide as the clays do, so its share of the mount is not its share of the suspension. Equation (2.26) is for a pressed random powder. This is also why the internal-standard route cannot by itself measure kp for an oriented mount (§A.15); an external standard can, and is treated next.

An external standard, and the absolute scale

The restriction just stated — that a standard mixed into an oriented mount cannot work — does not apply to a standard that is never mixed in. Measure a standard of known weight fraction on its own, under the same optics, and it is never asked to share the specimen's texture. That is the external-standard method of O'Connor and Raven (1988), and it is what turns the proportionality of (2.25) into an equality.

The standard's own measurement fixes one instrument constant,

K = Sstd(ZMV)std · (μ/ρ)std / Wstd (2.27)

and any later measurement on the same instrument then gives an absolute weight fraction without a spike,

Wp = Sp(ZMV)p · (μ/ρ)spec / K (2.28)

where S(ZMV) is, in ClayQuant's normalisation, exactly the sum ΣceMe/se of (2.25), and μ/ρ is the mass attenuation coefficient of the whole specimen at the wavelength used. Absorption enters because the two measurements sample different depths: a weakly absorbing specimen returns intensity from further down, and the ratio of the two coefficients corrects for it. absorption.py computes μ/ρ for a structure from its mass fractions and tabulated elemental coefficients at Cu Kα, and refuses — rather than guessing — for an element it does not hold.

Two conditions have to hold, and both are checkable rather than assumed. The specimen must be thicker than the beam penetrates, since (2.28) is derived for infinite thickness; penetration_depth and thick_enough give the depth sinθ/2μ and test a film against it, which for a clay mount matters most at low angle where the depth is smallest. And the two measurements must be made through the same optics: a difference in divergence slit, mask, counting time or tube setting changes K and is not recoverable afterwards. So ExternalStandard records the conditions of the standard's measurement and comparable_with names every difference it finds against a later one, rather than scaling by a constant that no longer applies.

For a mount of a known phase this reads backwards and measures kp directly: Wp is known, so calibration_factor returns the ratio of the mass (2.25) infers to the mass the specimen holds. That is the one route to kp for an oriented mount that does not need an independent analysis of a mixture, and §A.18 carries it out on four pure clay mounts against a corundum measured through the same optics.

Results are given on two bases: over all fitted phases, and over the clay minerals alone, renormalised to 100 % with the accompanying minerals removed. The latter is the customary basis for reporting a clay mineral assemblage.

3 Implementation

3.1 Module map

ModuleContents
crystal.pyCIF reading, symmetry expansion, the Crystal and LayerModel classes, structure factors, derivation of a layer model from a polytype cell
scattering.pyWaasmaier–Kirfel scattering factors, species normalisation, displacement factors
absorption.pymass attenuation coefficients at Cu Kα, penetration depth, the infinite-thickness test
emission.pyemission profiles, including the five-line Cu Kα description
optics.pyLorentz–polarization, March–Dollase, beam overflow
profile.pypseudo-Voigt peak shapes, Caglioti widths, Scherrer broadening
mixed_layer.pythe matrix method, transition matrices, the CSDS and its pair weights
pattern.pyInstrument, reflection enumeration, powder, basal and mixed-layer pattern assembly, peak lists
library.pythe PatternLibrary, its builder, storage, and the spanning of orientation, thickness and spacing
models.pythe expected CIF sources, the structure search path, the Reynolds (1965) glycol–smectite layer
bern.pyimport of a TOPAS/jEdit structure library into a phase database; clay/non-clay classification
io.pyreaders for XRDML, .xy, Bruker .raw and two-column text
pairing.pyrecognising the three mounts of one sample from their file names
calibration.py2θ zero error on the quartz 100 reflection, merit profile for the slider
background.pybackground components, peak stripping, the Sonneveld–Visser estimator and its noise level, the non-parametric background
diagnostics.pykaolinite collapse and expandable-clay swelling
detection.pyfinding accompanying minerals, by competitive fit or by peak matching
nnls.pythe weighted non-negative least-squares fit and its metrics
quantification.pygrouping by phase, the two normalisation bases, CSV export
plots.pythe four result figures and the report writer
gui/the browser interface, its session state, and the native file and folder choosers it opens on the computer running it
peaklist.pypatterns and a separate library from measured peak lists (§4.5)
tools.pythe two double-clickable setup windows and the jobs behind them
desktop.pythe three desktop and menu shortcuts, on all platforms
install.sh, install.ps1 installers for Linux/macOS/WSL and for Windows: interpreter selection, environment creation, installation and verification
install.cmd, clayquant.cmd the Windows entry points, which start the PowerShell scripts beside them with the execution policy bypassed for one invocation — the default policy refuses a .ps1 outright and a .cmd is exempt from it

3.2 Data flow

CIF files ─────┐
               ├─► Crystal ──► LayerModel ──┐
TOPAS library ─┘                            ├─► MixedLayerStack ──┐
                                            │                     ├─► PatternLibrary ──┐
Reynolds (1965) glycol-smectite ────────────┘                     │                    │
                                                  Instrument ─────┘                    │
                                                  (emission, peak shape, LP, slits)    │
                                                                                       ▼
measurement ──► read ──► zero error ──► background ──► [diagnostics]      weighted NNLS fit
   (3 mounts)                                │                                         │
                                             └──► phase screening ──► confirmed ───────┤
                                                  (accompanying minerals)              │
                                                                                       ▼
                                                        quantification ──► tables, CSV, four plots

3.3 The reference library

Because the fit selects among pre-computed patterns rather than refining parameters, the library must span the parameters that actually vary between specimens. Three are spanned:

DimensionValuesWhy it must be spanned
Preferred orientation r0.1 to 1.0 in steps of 0.1 texture is a property of the preparation, not of the mineral; it sets the ratio of basal to non-basal intensity
Mean crystallite thickness ⟨N⟩5, 15, 50 layers sets basal peak width; 10 layers give a 001 width near 0.8° where a well-crystallised illite shows 0.12°
Layer spacing dillite 9.95, 10.02, 10.10 å; chlorite 14.20, 14.35 å illite d(001) varies with interlayer potassium and hydration; an error of 0.07 å displaces the 001 by half a peak width

Together with the compositional series this gives, with default settings, 1751 patterns:

PhasePatternsComposition range
Illite/smectite (I/S)1440 16 compositions, 0.20/0.80 to 1.00/0.00
Chlorite/smectite (C/S)240 1.00/0.00, 0.95/0.05, 0.90/0.10, 0.85/0.15
Illite30discrete
Chlorite20discrete
Kaolinite 1M, 2M10 + 10discrete
Glycol–smectite1pure end member
Both series reach their pure end member, and that matters more than it looks. Without it the closest a pure illite could be described as was 0.99/0.01, and a fit of one piles its whole coefficient onto that entry: it reports 1 % of smectite the specimen does not have, and it reports the end of a range as though it were a composition (§2.13). A measured pure illite standard is what showed this, putting 94 % of its illite on the 0.99 entry. The end member is also not redundant with the discrete illite entries: those are three-dimensional powder patterns whose basal widths come from the instrumental profile, while the interstratified entries carry the crystallite thickness distribution of §2.6, which is what actually sets a basal width. Only through this series can a pure illite be fitted with its thickness spanned.

Each pattern is stored normalised to unit maximum above 4° 2θ, not to its global maximum. Intensity rises steeply towards zero angle — the Lorentz factor still diverges after the beam-overflow correction — and no clay basal reflection of interest lies below about 4°; normalising on that rise would shrink the diffraction peaks themselves and leave the fit poorly conditioned.

Each pattern also has its own smooth continuum stripped before storage. An interstratified stack of finite thickness scatters a genuine diffuse continuum rising towards zero angle, but in a measurement that continuum is inseparable from air scatter and the direct beam and is always treated as background. Leaving it in the basis patterns would let a phase absorb the measured background and inflate its apparent share.

For that reason every pattern is calculated over a wider range than it is stored on: one stripping window beyond each end, trimmed away afterwards. Peak stripping needs data on both sides of a point, so its estimate is unreliable within one window of either end (§A.11), and for a calculated clay pattern that is exactly where the diffuse continuum is largest. Moving the ends outside the stored range takes the continuum left standing at 3.5° on an I/S 0.80/0.20 pattern from 21 % of its strongest peak down to 5 %, with the peaks themselves unchanged. The lower limit of the calculation is 1° 2θ, below which the Lorentz factor is of no use.

3.4 Numerical notes

4 Installation and structure data

4.1 Installation

Requirements

ComponentRequirementNotes
Python3.10 or laterdeveloped and tested on 3.11
NumPy≥ 1.24required
SciPy≥ 1.10required, for the NNLS solver
Dash≥ 2.14extra gui; needed only for the interface
Plotly≥ 5.18extra gui; also used by the figure export
gemmi≥ 0.6extra import; needed only to import a TOPAS structure library
pytest≥ 7.4extra dev; needed only to run the test suite
Operating systemanypure Python; no compiler required. Linux, macOS and Windows
Disk~200 MBdependencies, plus 30–60 MB per stored reference library
Memory~1 GBa default library holds 1601 patterns on the measurement grid
Browserany currentthe interface runs locally at 127.0.0.1; nothing is sent over the network

Procedure

The supplied installer does the whole of this and checks the result. From the project directory:

# Linux, macOS, WSL
./install.sh

# Windows, in PowerShell
.\install.cmd
On Windows, start with install.cmd and not install.ps1. Every client installation of Windows ships with PowerShell script execution disabled, so running the PowerShell installer directly fails before it executes a line:
.\install.ps1 : File ...\install.ps1 cannot be loaded because running
scripts is disabled on this system.

That is the machine's default and says nothing about the script. A .cmd file is not subject to the policy, so install.cmd starts PowerShell with the policy bypassed for that one invocation, passes its arguments through unchanged, and changes no setting on the computer. It can be double-clicked, and waits for a keypress before it closes, so an error can be read — set CLAYQUANT_NO_PAUSE to skip that. The equivalent typed by hand is

powershell -ExecutionPolicy Bypass -File .\install.ps1

Keep the .\: PowerShell does not run a program from the current directory unless told to, so a plain install.cmd is answered with “the term ‘install.cmd’ is not recognized”, which is about the path and not the file. cmd.exe does not mind either way. The same applies to running the program: use .\clayquant.cmd gui rather than .\clayquant.ps1 gui. The desktop and Start-menu shortcuts are unaffected, because they point at the environment's own clayquant-gui.exe rather than at a script.

The alternative, if a permanent change is preferred, is to allow local scripts for your own account once — no administrator rights needed:

Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned

A checkout made with git clone then runs as it stands. Files extracted from a downloaded ZIP carry Windows' mark-of-the-web and count as remote, so RemoteSigned still refuses them until the mark is removed with Unblock-File .\install.ps1. Cloning avoids the question altogether.

It selects an interpreter, builds the virtual environment, installs ClayQuant with its dependencies, verifies that the package imports, checks that every command it declares has been created and answers, and reports which clay structures it can find. Re-running it is safe: an environment of the right version is reused, one of the wrong version is rebuilt. Useful options are -y to answer prompts automatically, --python /path/to/python3.12 to force an interpreter, and --no-dev to omit the test and import extras.

Starting it from an icon

At the end of the installation you are asked whether to create a desktop icon and a menu entry. Answering yes writes what the desktop in question expects — a .desktop file on Linux, an application bundle in ~/Applications on macOS, a shortcut on the desktop and in the Start menu on Windows — pointing at the interpreter of the environment ClayQuant was installed in, so nothing has to be activated or on PATH. Double-clicking it starts the program and opens it in the default browser.

It can be done or undone at any time, and does not need the installer:

./clayquant shortcut            # create them
./clayquant shortcut --where    # say where they would go
./clayquant shortcut --remove   # take them away

For the icon, put an image called clayquant into assets/ and run the command again. Any common raster format will do and the spelling of the name does not matter — ClayQuant.PNG is found as readily as clayquant.png, which on a case-sensitive filesystem it otherwise would not be — and it is converted to the format each platform needs (.ico on Windows, .icns on macOS). The placeholder that ships with ClayQuant is called clayquant-placeholder.png so that a supplied icon always takes precedence over it and is never overwritten by an update. The command prints which file it used.

Run it again after every update. The commands (clayquant-gui and the rest) are written into the environment when the package is installed and at no other time, so an environment built from one version keeps that version's set of commands. Updating the source with git pull does not add a command the new version introduced, and it is then reported as not found although its code is in the checkout. Re-running the installer writes them all; §7 gives the module form to use meanwhile.
Why an installer rather than three commands. python -m venv runs whichever interpreter the name python resolves to, and each Python version carries its own venv module and ensurepip, with its own bundled wheels. On Ubuntu and WSL, python and python3 are frequently an older version than the one that was installed later, so the command fails with
The virtual environment was not created successfully because ensurepip is
not available. ... apt install python3.10-venv

even on a machine where python3.12-venv is installed. Nothing is failing to "see" the newer Python: version 3.10 was invoked, and 3.10's package is the one missing. The immediate fix is to name the interpreter — python3.12 -m venv .venv — and the installer does this automatically, trying every interpreter it can find, newest first, testing each by actually building a throwaway environment, and naming the exact distribution package if none succeeds.

Doing it by hand

1. Obtain the source and create an isolated environment. Name the interpreter explicitly rather than relying on python.

git clone https://github.com/lomalaspina/ClayQuant.git
cd ClayQuant
python3.12 -m venv .venv          # or whichever version 3.10+ you have

2. Activate the environment.

# Linux and macOS
source .venv/bin/activate

# Windows, PowerShell
.venv\Scripts\Activate.ps1

# Windows, cmd.exe
.venv\Scripts\activate.bat

The PowerShell form is refused on a machine that has not had its execution policy changed, for the reason given under the procedure above; activate.bat from cmd.exe is never affected, and neither is clayquant.cmd, which needs no activation at all.

3. Install. The extras select optional components; installing all of them is normal for interactive use.

pip install -e ".[gui,import,dev]"

The editable install (-e) means edits to the source take effect without reinstalling. To install only what is needed to compute patterns from a script, omit the extras: pip install -e .

4. Verify the installation. The test suite takes about a minute.

pytest -q

Tests that need structure data are skipped automatically when it is absent, and report as s rather than as failures; see §4.2. With no structure data installed, expect 29 passed and 10 skipped; with the four CIFs in place, 45 passed. Any failure indicates a problem and should be reported.

5. Provide structure data (§4.2), build a reference library (§4.4), and start the interface:

clayquant-gui

which prints a local address, by default http://127.0.0.1:8050, to open in a browser. Use --port to choose another port and --host to bind an interface other than the loopback.

Upgrading. After pulling a new revision, re-run pip install -e ".[gui,import,dev]" to pick up any dependency change, and rebuild the reference library if the pattern calculation has changed. Stored libraries carry the metadata of the settings they were built with, and a library built by an older revision is read but may not correspond to the current calculation.

4.2 Structure data and licensing

No structure data is distributed with ClayQuant. The crystal structures it uses are ICSD entries, which are licensed by FIZ Karlsruhe and may not be redistributed. They must be exported from your own subscription. The repository's ignore rules are written so that a local copy cannot be committed by accident.

Export each of the following as CIF and put it in the structure directory. The name given is the one ClayQuant looks for first, but it is not required: a file is also accepted if its name carries the ICSD code, or the phase name with its polytype. Kaolinite_1M_63192.cif and Illite_ICSD_90144.cif are both found, in any letter case.

PhaseICSDFile nameStructure reference
Illite90144illite_ICSD_90144.cif Gualtieri (2000)
Chlorite (clinochlore IIb-4)164234chlorite_ICSD_164234.cif Zanazzi, Comodi, Nazzareni & Andreozzi (2009)
Kaolinite 1M63192kaolinite_1M_ICSD_63192.cif Bish & Von Dreele (1989)
Kaolinite 2M30285kaolinite_2M_ICSD_30285.cif Gruner (1932)

These directories are searched, in this order, and all of them are searched rather than only the first that exists — the program is as likely to be started from the home directory as from the project, and a file that is plainly there should not be reported missing over where the shell happened to be:

  1. the path in the environment variable CLAYQUANT_STRUCTURE_DIR, if set;
  2. a structures folder in the current working directory;
  3. the current working directory itself;
  4. the structures folder of a source checkout;
  5. the package data directory.

To see what was looked for, where, and what was found:

python -c "from clayquant.models import describe_structure_search as d; print(d())"

The same report is printed when a structure cannot be loaded, so an error names the directories that were searched rather than one expected file name.

The glycol–smectite layer requires no file. It is the published one-dimensional model of Reynolds (1965), transcribed into the source with its provenance, and is reproduced under §A.2.

4.3 Importing a TOPAS structure library

This step and the next have a window each, which can be double-clicked. Both were command lines with paths in them, and typing a Windows path into a terminal is where this program lost people. clayquant shortcut now puts three icons on the desktop and in the menu — the interface, Import structures and Build library — and each of the latter two opens a small window with file pickers, a Run button and the log of what happened. The same windows open from a checkout with .\clayquant.cmd setup import-structures and .\clayquant.cmd setup build-library (./clayquant on Linux and macOS). The command lines described below are unchanged and remain the scriptable route.

The work runs in a worker thread and the window polls it, because building a library takes minutes and a window that stops repainting for minutes is a window people force-quit. Anything the job prints — including the import's report of phases that do not match the mass TOPAS states for them — appears in the window rather than on a console a double-clicked program does not have. The icons run python -m clayquant.tools rather than a console script, because the scripts are written into the environment at install time and at no other, so an icon naming one would break for anybody who pulled a version that added it without reinstalling (§4.1).

The accompanying non-clay minerals — quartz, feldspars, carbonates, sulphates, oxides — come from a structure library of your own. ClayQuant reads the jEdit macro-menu form in which TOPAS structure collections are commonly distributed: an XML file whose items each insert a TOPAS str block with a phase name, cell parameters, space group and site lines.

clayquant-import-structures my_structures.xml -o structures/phases.json

Space group symbols are expanded to explicit symmetry operations with gemmi, including the origin-choice settings that TOPAS writes as a trailing letter (Fd-3mS for origin choice 1, Fd-3mZ for choice 2; see §A.3). The operations are stored in the generated database, so gemmi is not needed afterwards.

The generated database is derived from licensed structure data and is likewise kept out of version control.

Structures from one of your own refinements

TOPAS writes a refinement's result back in the syntax it read, so a refinement's .out — or its .inp — is itself a structure library, of the few phases that refinement contained. The same command reads it, and decides which kind of file it has by looking:

clayquant-import-structures M_26_1041_air.out -o structures/refined.json

Several sources may be given, in increasing order of authority: where two name the same phase the later one is kept, so a refinement laid over a library keeps the library's breadth and takes the refinement's structure for the phases it covers.

clayquant-import-structures my_structures.xml M_26_1041_air.out -o structures/phases.json

For the clay minerals the refined structure goes further than the phase database: it can replace the published CIF the pattern library is calculated from.

clayquant-build-library --refined-structures M_26_1041_air.out

Which phases to take is chosen per mineral, with --refined-only or --refined-except, because the judgement differs between them. Keeping a published structure that can be cited, while taking the refined ones that describe the specimen better, is a reasonable decision rather than a missed opportunity:

clayquant-build-library --refined-structures M_26_1041_air.out --refined-except chlorite

This is worth doing, and worth doing for the clays in particular, because the octahedral Fe-for-Mg and Fe-for-Al substitutions are refinable against the basal intensities, differ from one deposit to the next, and change those intensities substantially — iron scatters about twice as strongly as the magnesium it replaces. On the specimen of §A.16 it improves Rwp from 35.9 % to 31.2 %, and the occupancies rather than the refined cells account for nearly all of that.

Do not extend it to the accompanying minerals without checking. Measured on the same specimen, taking their refined cells as well costs 3 points of Rwp (§A.16). Part of the reason is identifiable — quartz is also the zero-error standard (§5.3), so replacing its structure puts the calibration and the fitted cell out of step — and part is not. Where a library structure is wrong rather than merely someone else's, overriding it is still right: a refinement is how the incomplete cordierite of §A.14 was found to be incomplete, and supplies the sites it is missing.

A refinement that models its clays as hkl_Is peak sets, which is the usual way to refine an oriented mount, contains no clay structure at all; the import says so rather than reporting success with nothing in it. A refinement also covers only the phases it contained: one that fits kaolinite as the 2M polytype supplies no 1M, and the CIF for that is still wanted. The refined structures replace the CIFs one phase at a time; they do not remove the need for the folder.

Or as a CIF in the structure folder

The refined structures do not pass through the structure folder at all — the CIF files there are untouched, and the substitution happens when the pattern library is calculated. There is a second route, though, and it is the one most people will reach for first: put a CIF carrying the refined values into the folder like any other. It works, and TOPAS will have written the file already if the refinement carried Out_CIF_STR(...) for the phase.

Two details of such a file are handled, because both would otherwise cost the user the change they were trying to make. TOPAS writes a mineral name as ?Clinochlore?, using ? where CIF wants a quote, and the marks are stripped rather than kept as part of the name. And the file arrives named after the phase as the refinement called it, so a chlorite refined as Clinochlore arrives as Clinochlore.cif, which carries neither the ICSD code nor the key chlorite; the mineral's other names are now consulted, where before such a file matched nothing, the published structure was used instead, and nothing said so.

Which route to use is not a matter of taste. The structure folder is global: one file serves every specimen analysed afterwards. A refined occupancy belongs to one specimen — the iron content of a chlorite is a property of the deposit, and two specimens from different formations refine to octahedral compositions that are not close to each other. Put one specimen's refined chlorite in the folder and every later sample is calculated with that specimen's iron content, which is a harder mistake to notice than a missing file. --refined-structures keeps the coupling visible and per-analysis: the library is built from the refinement of the specimen it is going to be used on. Reach for the folder only for a structure meant as a better generic default than the published one — a composition typical of the material a laboratory usually sees — and name it so it says which.

What it reads, and what it reports

A structure library kept in a laboratory is written partly by hand and partly by TOPAS, and the two differ. The import reads both: a value carrying the backtick TOPAS puts on a refined parameter (16.875164`, or with a limit welded on as 9.663417`_LIMIT_MIN_9.5); an occupancy given as an expression with the value TOPAS last evaluated after a colon (occ Fe+2 =FeMgOCC;:0.99996`), which keeps a split site split instead of putting a full atom on each half; a space group written with spaces ("C c c m"); a comment after str; and a second structure block that takes its cell from the first by name (a =a_Calcite;), which is how a two-component phase for a crystallinity distribution is written.

Anything not imported is named. A phase that cannot be read is listed with the reason — no cell, no space group, no sites — and a phase that lists reflections rather than atoms (hkl_Is, a Pawley or amorphous entry) is named as such, since ClayQuant calculates from structures and has nothing to calculate from. Items that are headings or helper macros are passed over silently, as a menu is full of them. Before this, an item that could not be read was dropped before it became a record, so it was absent from every count afterwards: adding a phase to the library and re-importing gave the same number of phases as before, with nothing to say why.

4.4 Building the reference library

A library is built once for a given instrument configuration and measurement grid, and reused. Build it on the same 2θ grid as the measurements.

clayquant-build-library -o library/clays.npz

Building the default library takes about three minutes. Within the interface the same operation is available as Build library now, using the current instrument settings.

Chlorite compositions

The library holds one chlorite by default, the published structure, and that is the recommended setting. The two octahedral sheets of a chlorite take iron for magnesium in proportions that vary from one deposit to the next, iron scatters about twice as strongly as the magnesium it replaces, and each sheet sits at a definite height in the layer, so the composition does act directly on the basal intensities a quantification is read from. Whether that matters enough to fit is a separate question, and on the two pure chlorites of §A.17 it did not: the fit improved the residual only 1.5 to 1.7 times, drove one specimen to implausibly little iron, and ran against the bound of the crystallite-thickness grid.

So the facility is there for a specimen where the evidence calls for it, and is off by default. Unlike the illite/smectite ratio there is no generic set of compositions worth spanning; fit the composition to a measured pattern of a pure chlorite, check that the residual improves by enough to be worth having and that nothing lands on a bound, and only then calculate the library for the values that came out:

clayquant-build-library --chlorite-iron 0.35/0.20,0.55/0.30

Each pair is the iron occupancy of the 2:1 layer's octahedral sheet and of the interlayer hydroxide sheet. Every pair gets its own set of chlorite patterns, all grouped under the phase chlorite, so the fit chooses among compositions as it already chooses among layer spacings and orientations, and the quantification reports one chlorite. The cell mass follows the substitution, so the weight percent is consistent with whichever composition the fit chooses.

To measure the pairs, from a pattern of the pure mineral:

from clayquant.composition import fit_chlorite_iron
from clayquant.io import read_pattern

fit = fit_chlorite_iron(read_pattern("Chlorite_pure.xrdml"), instrument)
print(fit.describe())

The fit uses ratios of basal intensities within the one pattern, not the intensities themselves, so it needs neither a standard nor a known amount of material nor a known texture: preferred orientation multiplies a basal series by a single factor and divides straight out. It reports the residual beside the residual of the published structure, so a composition that is no improvement says so — and reports the crystallite thickness it settled on, because one at the edge of the grid means the composition absorbed something that was not composition.

Check the integration window before believing the result. A clay basal reflection has a diffuse tail from stacking disorder that carries much of its area, so a window that looks ample beside the peak width can hold a different fraction of each order — which is exactly what a ratio of orders responds to. §A.17 records a conclusion drawn from a window too narrow by a factor of three, and its retraction.

4.5 A library from measured peak lists

Everything above calculates a pattern from atomic positions. This is the other case: a reference pattern built from a table of d-spacings and relative intensities, which is the form a powder diffraction file entry takes. It is an addition — the clay library is still built from structures by §4.4, and a peak-list library is a separate file built separately.

What it cannot do, and why the clays are not in it. ICDD's PDF-2 — the set a local HighScore installation usually searches, whose entry numbers look like 00-012-0219 — holds per entry a table of interplanar spacings, relative intensities and often the diffraction indices. It holds no atomic coordinates; those are in PDF-4+. So an entry from it can give a pattern and cannot give a structure, and two things follow that no amount of work will change.

An illite/smectite pattern is not a sum of reflections at all. It comes from the matrix method (§2.5), which needs the layer structure factor as a continuous function of the scattering vector, and that needs scatterers at heights within the layer. A table of spacings cannot supply it, so an interstratified phase cannot be built from a file entry — only a discrete one, which is the opposite of the point. And a weight percent needs the mass of what the pattern was calculated from (§2.13); a peak list was not calculated from anything with a mass, so a peak-list phase has no weight percent of its own. That is why it is a separate file: mixing the two kinds behind one interface would make the weight percent quietly wrong for some of them.

Where it earns its place is the accompanying minerals. Quartz, the feldspars and calcite enter the fit as discrete phases, and a file entry's intensities are measured, on a real specimen with its real substitutions — which a calculated pattern from one published structure need not match any better. So a peak-list library is a reasonable thing to fit those against, and to compare against the calculated ones.

One correction is applied and it is not cosmetic. An entry's intensities are observed, so they already carry the Lorentz–polarization factor at the angle each line was measured at, while the pattern assembler applies that factor itself. Passing them through unchanged would apply it twice — a factor of thirty across a 4–40° scan, tilting the pattern end to end. The observed intensity is therefore divided by the factor on the way in and the assembler puts it back, so the pattern reproduces the entry at the entry's own geometry and still responds correctly to a change of instrument description. Tested by integrating each peak of the result and comparing with the entry, which agrees to 0.5 %.

Preferred orientation needs the indices and the cell, because the March–Dollase factor is a function of the angle between a reflection and c*. An entry carrying both can be spanned over r as the clay library is; an entry without them raises rather than guessing, since treating unindexed reflections as basal would enhance every line in the entry alike, which is not what an oriented mount does to anything. Such an entry contributes one pattern at r = 1, and the library records which entries those were.

The input

One block per phase, in a plain text file, which is what a powder diffraction file entry can be copied into:

PHASE   Montmorillonite-18A
SOURCE  ICDD PDF 00-012-0219
CELL    5.17 8.94 15.0 90 90 90
#   d(A)     I    h  k  l
  15.000   100    0  0  1
   4.490    80    1  1  0
   2.570    60

PHASE starts a block and is the only required line. SOURCE is free text, carried into the pattern's metadata so a fit can be traced back to the entry it came from. CELL takes the six cell parameters and is needed only for orientation. Then two or more columns: the spacing in ångström, the relative intensity, and optionally the indices, either as three columns or as one token such as 001. A line that looks like data and cannot be read raises with its number — a peak list silently one row short is a pattern wrong in a way nothing downstream can notice.

Scoring an entry against the structure in use

compare_with_calculated puts a file entry beside the calculated peak list of a structure and reports, line by line, the nearest calculated line, the difference in position and the difference in intensity, with three summary numbers: how many lines matched, the worst and mean position deviation, and an intensity agreement between 0 and 1. Positions are compared in degrees rather than ångström, because an ångström at 5° and an ångström at 35° are not remotely the same disagreement.

The comparison also reports what the entry has no line for — calculated reflections above a tenth of the strongest that the file does not list. That is the half of such a comparison an agreement number hides, and it is where the interesting answer usually is: an entry can match every line it has and still be missing the reflection that distinguishes the mineral from its neighbour. Checked against a stand-in built from a structure's own lines, where the right answer is known: eight of eight matched, worst deviation 0.007°, agreement 1.00.

A powder diffraction file is licensed data. A library built from one is a derived work of it and belongs with your own files — not in a repository and not in anything shared, which is the same position the ICSD structures are in (§4.2). Nothing of the kind ships with ClayQuant: the input is supplied by whoever holds the licence. Entries can be quoted in a report by their file number, which is what the number is for.

5 Operating procedure

5.1 Specimen preparation assumed

ClayQuant assumes the preparation customary for clay mineral analysis: the bulk sample is ground, the clay fraction separated by sedimentation or centrifugation, and the separate deposited on glass slides to give oriented mounts, of which one is left air-dried, one solvated with ethylene glycol and one heated, typically to 500 °C. A bulk (randomly oriented) measurement of the whole sample is useful context but is not required by the program.

5.2 Step 1 — Load

Press Browse and pick the folder holding the measurements, or type or paste the path and press Enter; either way the folder is scanned at once and the readable files are listed in the three drop-down menus. Scan folder re-reads a folder whose contents have changed since. Choose one of the three mounts: the other two are then filled in automatically, because the three scans of a sample normally differ in a single token of the file name, so DBB_17_PW_air.xrdml identifies DBB_17_PW_eg.xrdml and DBB_17_PW_heat.xrdml. It works from whichever mount is chosen first and in whichever format the files are held; a line beneath the menus reports what was matched, and says so when a mount is missing from the folder. Press Load.

The tokens recognised are air, airdried, airdry, ad and lutro for the air-dried mount; eg, egl, gly, glyc, glycol and ethylenglykol for the glycol-solvated one; and heat, heated, ht, 350, 500 and 550 for the heated one. A token counts only where it stands as a word of its own, delimited by an underscore, hyphen, dot or space or ending the name — otherwise the ad of Bad_Segeberg would name an air-dried mount — and the rest of the name must agree exactly, so DBB_17_air finds DBB_17_eg and never DBB_17_PW_eg. Files of the format chosen are preferred, so a folder holding both XRDML and .xy exports of everything does not yield one of each. Any assignment can be overridden by hand, and a box already holding a mount of the same sample is left untouched.

The accompanying minerals are identified here, before anything has been set. As soon as the scans are in — and the structure database of §4.3 is loaded, in whichever order — a panel beneath the plot lists the phases the specimen supports. No zero error, no background and no reference library: this is where Clayfit does it, and two things make it possible.

Each mount is aligned on its own quartz lines. The 20.86 and 26.64° pair is looked for within half a degree of where it belongs; a pair counts only when the two shifts it implies agree to 0.10°, and the strongest agreeing pair wins. So a displacement of a few hundredths of a degree — which is what an oriented mount gives — is gone before any phase is matched, and the three scans are aligned independently, which they must be, because a displacement belongs to the preparation and the three mounts are three preparations. A peak must carry 3 % of the strongest peak's prominence to be taken for quartz: without that floor, noise peaks aligned one real specimen's three mounts by +0.37°, which is not a displacement any oriented mount has.

And the test is which peaks the three treatments share, not how well one of them can be explained. The clays move between air, glycol and heat and nothing else does, so a line at the same angle in all three is evidence that no amount of fitting one scan can give: rutile's strongest line sits on an albite reflection, so a fit of a single scan ranks thirty-five phases above it, and its lines are nevertheless at the same angles in all three mounts.

Each phase is reported with three numbers. Coverage is the share of its own calculated intensity standing on a stable peak, over the lines above 6 % of its strongest; stable lines is how many of its lines those are; and cell is the coherent scaling it needed, up to the 2 % allowance of §A.6. A phase at 0 % fits the database entry as written and one near 2 % needed most of the allowance to line up, which is weaker evidence — the allowance is there for a solid solution a per cent off its entry, not to rescue a phase that does not fit. The ranking is coverage × √lines, so a phase resting on five lines outranks one resting on one at the same coverage. The panel also says when one mount's alignment disagrees with the others by more than a displacement should, naming the outlier rather than correcting it.

This is an identification and not a quantification: it says what the specimen supports, and step 4 is where the phases are chosen and fitted. Nothing here is applied to the data — the zero error is still set in step 2, against a reference, where it can be seen.

Why Browse opens a dialog and not a web page's file picker. A browser cannot tell a page where a folder is. Its file input element reports the names and contents of what is chosen and never the location, which is a deliberate part of the sandbox rather than an oversight, and no amount of scripting gets a path out of it. What makes a chooser possible here is that ClayQuant's server is the analyst's own computer: the process answering the page opens the operating system's own dialog and reads the answer directly. Two consequences follow. The dialog is the one belonging to the machine running ClayQuant, so where the page has been opened from another computer the button says so and declines rather than opening a dialog on an empty desk. And it needs tkinter, which the Windows and macOS installers from python.org include but many Linux distributions package separately as python3-tk; without it the button reports that and the path is typed instead. Nothing else in ClayQuant depends on it.
Paths under WSL. If ClayQuant runs inside WSL while the measurements sit on the Windows side, a path copied from Explorer such as C:\Users\you\samples\TM refers to a drive Linux does not have: Windows drives appear under /mnt, so that folder is /mnt/c/Users/you/samples/TM. Either form may be typed — a drive letter is translated automatically, surrounding quotes are stripped, and a \\wsl$\Distro\home\you share is mapped back to /home/you. The folder that was actually opened is named in the confirmation, so it is visible which one was used.

The point count, angular range and step are reported for each mount. Check that all three cover the same range: the diagnostics compare mounts point by point after interpolation, and a mount measured over a different range will still work but will restrict the comparison.

5.3 Step 2 — Zero error

The 2θ zero error is determined on the quartz 100 reflection, d = 4.2551 å, 2θ = 20.859° for Cu Kα1. This reflection is chosen because no clay basal reflection falls on it.

Find peak automatically locates it and sets the slider; the slider itself steps in 0.01°, half the usual measurement step, and the merit curve beneath shows the figure of merit against candidate offsets so the chosen value can be seen to be the optimum. Each mount carries its own zero error, because each is a separately prepared slide with its own displacement; set all three.

Quartz 100 is only 0.4° from the kaolinite 020 band at 4.36 å. In a clay separate quartz is often weak while kaolinite is strong, and a wide search window will find kaolinite and return a zero error of about −0.4°, displacing the whole pattern. The search window is therefore deliberately narrow (±0.30° by default) and a signal-to-noise test is applied. Where quartz is genuinely absent the program reports that it found no calibration peak and leaves the shift at zero rather than returning a meaningless number; set the value by hand or calibrate on another reflection. See §A.5.

5.4 Step 3 — Background

Six models are offered. Five of them are Clayfit's, and the same choice made here and there gives the same curve; the sixth, Sonneveld–Visser, is the addition (§A.19). They are six methods, not six components to be added together and not several bases for one fit, and they do not agree with one another — on a real air-dried mount they sit as much as 1400 counts apart at 3°. The plot therefore draws all six at once, the chosen one as a thick orange line and the other five faintly, because choosing between them is a judgement about the specimen and cannot be made without seeing what each does.

ModelWhat it is fitted toWhat it does on an oriented mount
ExponentialThe anchor points a e−b 2θ + c. Follows the direct-beam tail, which falls faster over the first few degrees than any low-order polynomial through the same points can. Clayfit's default and this program's.
PolynomialThe anchor points A least-squares polynomial of the chosen order, in raw 2θ. Passes closest of the six through the anchor points — 20 to 50 counts RMS at order 6.
ChebyshevThe whole pattern, then one amplitude on the anchors A Chebyshev series fitted to I/2θ over every point of the pattern, peaks included, then rescaled by a single amplitude fitted to the anchor points. TOPAS's way of writing a background with a 1/x term built in. Because only an amplitude is free it is not obliged to pass through the anchors, and on a pattern with strong basal reflections it dives several hundred counts below them in the middle of the range while overshooting the measurement at the start.
ALSThe whole pattern Asymmetric least squares: the smoothest curve that stays under the data. Follows a structured background closely, and cuts well under the low-angle tail — 2105 of 3505 counts at 3° on the mount measured here, leaving 40 % of the direct beam to be explained as diffraction.
QPA percentile + Savitzky–GolayThe whole pattern A running fifteenth percentile over 1.5°, smoothed. The one model that also smooths the corrected pattern, which is what Clayfit's “QPA” means: the pattern is being prepared for a quantitative fit rather than displayed.
Sonneveld–VisserNothing The erosion of §A.19, driven by HighScore's granularity and bending factor. Returns a convex background exactly as it found it, so it keeps the whole direct-beam tail.

The anchor points. Three of the six are fitted to a set of anchor points rather than to the measurement, and those points are found by rolling a ball underneath the pattern: the pattern is scaled into a unit square, a ball of the given radius is rolled along its underside, and the points it touches are the anchors. On a clay mount there are twenty to thirty of them, and they are drawn in the plot as red circles. They are what to look at when a polynomial misses the measurement, because it usually misses it where the ball found no point to hold it down. A smaller ball enters the gaps between reflections and follows the measurement more closely; a larger one spans them and cuts under. Radius 0.5 rolling on every fifth point is Clayfit's setting and the default.

The order drives the polynomial and the Chebyshev model and runs from 4 to 12, 6 being the default, as in Clayfit. It moves both curves: the polynomial because its coefficients are refitted, the Chebyshev because its shape is. It does not make them agree.

The A/2θ term can be added to any model but the erosion. It is set, not fitted, and that is the point of it: the term is there to be turned up until the low-angle rise from air scatter and the direct beam is accounted for, whereas a fitted amplitude would be free to eat the 001 reflections that stand on that rise instead. At the default A = 500 it adds 167 counts at 3° and 17 at 30°. It is not offered with Sonneveld–Visser, and not for want of arithmetic: the erosion leaves a convex background untouched and the low-angle rise is convex, so it is already in the curve and adding the term would count it twice.

What replaced what. Earlier versions fitted one parametric model — polynomial, Chebyshev or exponential, optionally with a 1/x term — to a peak-stripped estimate of the background, and offered Polynomial and Chebyshev as two bases for that one fit. Under an unconstrained least-squares fit to the same target with the same number of free terms those two bases span the same space and give the same curve, so the two menu entries did nothing, and the note here said as much. That was a true statement about that implementation and a misleading one about the methods, which is why it is gone: in Clayfit the two entries are different algorithms, the order visibly moves both, and the two curves sit in different places. The peak stripping itself is not gone — it is still what measures the widths that set Sonneveld–Visser's starting values, and what strips the calculated continuum when the library is built (§A.11) — but it is no longer interposed between a model and the measurement.

Sonneveld–Visser's two parameters are still proposed when the patterns are loaded, read off the glycol mount: the granularity from the width of the broadest reflection that stands above the noise, the bending factor from which value eight mounts' worth of real fits preferred. The line beneath the sliders says what was measured and whether the measurement or a safety limit decided the answer, and a slider moved by hand afterwards is left alone (§A.19).

Apply to all mounts uses the same model and the same settings for the three mounts, which is appropriate when they were measured under identical conditions.

5.5 Step 4 — Main minerals

Point the box at the phase database of §4.3 — typed, or with Browse, which opens the file chooser of the computer running ClayQuant for the same reason the folder button does (§5.2) — and press Search for main minerals. If a reference library has been loaded, every candidate is calculated and fitted in competition with the clay patterns and with each other in a single non-negative least-squares solve, and each is ranked by the share of the pattern it takes. Without a library, the program falls back to matching predicted peak positions, which is a much weaker test (§A.6).

A dialog lists what was found:

Evidence for the following main minerals has been found in the data:

with, for each, its share of the pattern, how many of its expected lines were found, and the best signal-to-noise among them. Phases with a clear share are ticked; the tail at one or two per cent is listed but left unticked, being largely least-squares slack rather than mineralogy.

This is a shortlist for judgement, not an identification. Phases with similar cells — the feldspars, the spinels, dolomite against ankerite — cannot be separated on diffraction evidence alone at these levels, and a database assembled for general laboratory use contains many phases that cannot occur in a sediment. Tick what the sample can plausibly contain. Selected phases are fitted with the clays and reported separately, then removed when the clay percentages are normalised.

5.6 Step 5 — Kaolinite

Kaolinite is identified by the loss of its 7.15 å reflection on heating. Because the two mounts are separate slides with different amounts of material, the comparison is meaningless until they are put on a common scale; the program does this on a reflection that survives heating, by default the illite 10 å reflection, and reports the scale factor used.

The result is the percentage of the 7.15 å area lost. What survives is chlorite 002, which occupies the same position and does not collapse. A sample with both minerals therefore shows partial collapse, and the surviving fraction is an estimate of the chlorite contribution to that peak.

5.7 Step 6 — Expandable clay

Expandable layers are identified by the shift of the low-angle reflection on glycol solvation: a smectite interlayer takes up a two-layer glycol complex and expands to about 16.9 å. The program locates the reflection in a window of the air-dried and glycolated mounts, reports both positions in ångström and the shift between them, and the ratio of the areas.

A shift towards larger d is the diagnostic. A shift of 13.8 → 16.1 å, for example, is unambiguous evidence of expandable layers. No shift means either that there are none, or that the expandable component is a minor interstratified fraction whose effect is spread through the illite/smectite series rather than concentrated in a discrete peak — which the quantitative fit will still detect.

5.8 Step 7 — Fit and results

Load a reference library, choose the mount to fit — normally the glycol-solvated one — set the angular range, and press Run NNLS fit.

Choose the fitting range deliberately. The lower limit should exclude the direct-beam tail, and 4° is a reasonable default; setting it lower rarely adds information and can let the fit chase background. The upper limit should include the region where the main minerals have their strong lines, so that they are properly determined, but there is little clay information above about 35°.

Restrict orientation parameters limits the fit to library patterns of particular March–Dollase values. Since a well-prepared oriented mount is strongly textured, restricting to the low values (0.1–0.3) both speeds the fit and prevents it from using near-random patterns to model what is really a texture effect.

The results appear as four plots and two tables, described in §8. Export tables and plots writes them to disk.

Read the plots, not only the table. The fit will always return numbers. Whether they mean anything is visible in the difference curve of the Fit plot and in whether the per-phase curves of the All phases plot sit under real features of the measurement. A large systematic residual at one strong peak usually means a layer spacing or crystallite thickness outside the range the library spans (§9).

5.9 The simulator

The simulator drives the calculation directly, independently of any measurement, for teaching, for exploring what a given composition looks like, and for checking the effect of a parameter. It computes a single interstratified or discrete pattern from the controls of §6 and displays it immediately.

6 Reference: interface controls

Every control is listed below by the tab on which it appears, with the identifier used internally, its default, and its meaning. Sliders show their current value; range sliders have two handles.

6.1 Tab 1 — Load

ControlIdentifierDefaultMeaning
Data folderdirectory— Folder searched for measurement files. Sub-folders are not searched. Setting it — by browsing, or by typing a path and pressing Enter — scans it, so the button below is for re-reading a folder that has changed rather than for the first look.
Browse…browse— Opens the folder chooser of the computer running ClayQuant, fills the box with what is picked and scans it. Dismissing the dialog leaves everything as it was. Where the interface has been opened from a different computer, or where tkinter is missing, the button explains that instead (§5.2).
Scan folderscan— Re-lists the readable files and offers them in the three drop-downs. Sub-folders are not searched.
Air-dried / Ethylene glycol / Heatedfile-air, file-glycol, file-heated— Assignment of a file to each mount. Choosing one fills the other two from the file names (§5.2); either can then be changed by hand. The glycol mount is the one normally fitted; the other two drive the diagnostics.
Matched filesfile-pairing— Reports which files were assigned automatically, and names any mount for which no matching file is present in the folder.
Loadload— Reads the selected files and reports points, range and step for each.

6.2 Tab 2 — Zero error

ControlIdentifierDefaultMeaning
Mountzero-mountAir-dried Which mount the slider and the automatic search act on. Each mount has its own zero error.
Calibration reflectionzero-referenceQuartz 100, 4.2551 å The reflection whose known position defines the zero. Quartz 100 clears all clay basal reflections. Quartz 101 (3.3435 å) is stronger but overlaps illite 003.
Zero error (°2θ, steps of 0.01)zero-slider0.00 The offset subtracted from the measured angles. The step is 0.01°, half the usual 0.02° measurement step.
Find peak automaticallyzero-auto— Locates the calibration peak within a narrow window and sets the slider. Reports the signal-to-noise, or states that no calibration peak was found.

6.3 Tab 3 — Background

ControlIdentifierDefaultMeaning
Mountbg-mountAir-driedMount displayed and fitted.
Background modelbg-kindExponential One of the six of §5.4: Exponential, Polynomial, Chebyshev, ALS, QPA percentile + Savitzky–Golay, Sonneveld–Visser. The first five are Clayfit's and give the same curve there.
Orderbg-order6 Polynomial and Chebyshev only, 4 to 12 as in Clayfit. Drives both, and separately: the polynomial's coefficients and the Chebyshev shape are each refitted at each order. Raise it only as far as the background demands — in raw 2θ the monomials of an argument running from 3 to 40 span eighteen orders of magnitude at order 12, so the curve is free to move a long way between anchor points.
Add A/2θ termbg-inverseoff Adds A/2θ on top of the chosen model. Offered with every model but Sonneveld–Visser, which already carries the low-angle rise.
Amplitude Abg-amplitude500 The amplitude, in counts × °2θ. Set, not fitted (§5.4).
Rolling-ball radiusbg-radius0.5 Radius of the ball that finds the anchor points, as a fraction of the pattern's own extent: the pattern is scaled into a unit square first, so the number means the same thing on any scan. 0.5 is Clayfit's value and a ball half the width of the pattern.
Points between ball samplesbg-stride5 The ball rolls on every nth point — Clayfit's array[::5]. It bounds the work, which grows as the cube of the number of samples, and the finest feature the ball can enter, which on a 0.017° scan is 0.08°.
Percentile window (°2θ)bg-qpa-window1.50 Percentile model only. Width of the running window. A fifteenth percentile cannot be raised by a reflection occupying less than that fraction of the window, so set it wider than the broadest reflection that has to survive: it follows a smectite band as readily as it follows the background.
Background smoothing and order bg-qpa-baseline-smooth, bg-qpa-baseline-order 0.30°, 2 Percentile model only. Savitzky–Golay window and polynomial order applied to the percentile envelope, the window given in degrees and converted to an odd number of points for the scan's step.
Corrected-pattern smoothing and order bg-qpa-final-smooth, bg-qpa-final-order 0.08°, 2 Percentile model only, and the one place where a background model alters the corrected pattern rather than only the curve subtracted from it. Set the window to zero to switch it off.
Granularity (points per interval)bg-granularity 0–50, read from the glycol scan Sonneveld–Visser only. Its starting value is proposed from the glycol mount when the patterns are loaded, from the width of the broadest reflection standing above the noise (§A.19); the line beneath the sliders says what was measured and what decided the answer. Moving either slider afterwards is not undone. Points between the samples the erosion runs on — the paper's every twentieth point, and HighScore's parameter of the same name, recommended there between 15 and 30. It is the parameter that decides the baseline, because it sets how wide a feature is removed: 2.2 × granularity × step × √passes, which the panel reports in degrees beneath the slider. Counted in points rather than degrees, as both the paper and HighScore count it, so the same number reaches further on a coarser scan — 20 points is 2.4° on a 0.01° film scan and 4.0° on this laboratory's 0.0167° step.
Bending factorbg-bending0–100, proposed at 0 Sonneveld–Visser only. How much downward curvature the background may keep; HighScore's slider of the same name, where 0 to 2 is the usual advice. 0 allows only a straight or convex background, which is the paper's first form; 1 is the value the paper itself used. On clay patterns 0 to 4 moves the baseline by well under 1 % of the intensity range and 0 to 100 by 2.3–12.4 %, against granularity's 30 % (§A.19). Set granularity first, and note that every mount tested fitted best at 0.
Apply to this mount / Apply to all mountsbg-apply, bg-apply-all— Stores the background. All uses the same model and settings for the three mounts, appropriate when they were measured under identical conditions.

Reading the plot. The measured pattern is grey; the chosen model is a thick orange line; the five models not chosen are faint dotted lines, so that what the choice costs is visible without making it; the anchor points are red circles, present for the three models fitted to them; and the subtracted result is green. Judge the orange line against the grey one at the start of the scan, where an oriented mount carries the direct-beam tail and the strongest basal reflections together, and against the red circles in the middle, where the gaps between reflections are the only evidence of where the background lies.

Reading the status line. Three numbers, in the order in which they decide whether the curve is in the right place. How closely it passes the anchor points, in counts RMS, for the three models that are fitted to them — with R2, which is reported but is close to 1 for almost any of them and therefore reads as success even where the curve is a thousand counts below the measurement at 3°. What is left as signal at the first measured point, as counts and as a percentage: on a scan that opens on the direct-beam tail that share should be a few per cent, and a large one means the background is not following the tail. And what the subtracted pattern still holds between the peaks, taken as the median of its lowest two fifths, where it should hold nothing — that is the number to compare two models by. Rwp is not, because a lower baseline raises the observed intensity in its denominator as much as in its numerator, so it prefers whichever model subtracts least whatever the specimen; on one real scan it ranked the worst of four estimators first (§A.19). The line closes with how far the curve runs above the measurement, judged against the counting noise rather than by counting points: a background fitted to a lower envelope crosses above the noise somewhere on any real scan, and what matters is whether it sits above systematically, because that intensity is signal being removed. Measured on three real mounts, the exponential runs 2.0 to 3.4 times the noise above, the Chebyshev 1.1 to 2.6, the polynomial 0.5 to 0.8, the percentile and ALS models 0.3 to 0.4, and the erosion never.

6.4 Tab 4 — Main minerals

ControlIdentifierDefaultMeaning
Phase database (.json)db-pathstructures/phases.json The database produced by clayquant-import-structures.
Load databasedb-load— Reads it and reports how many phases it holds. Phyllosilicates in the database are left to the clay library and are not offered here.
Mount to searchdetect-mountAir-dried Which mount is searched. The air-dried mount is usually the best choice: glycol dilutes the accompanying minerals and heating alters some of them.
Unit cell allowance (%)detect-allowance2 Relative cell deviation allowed when matching positions, applied as one coherent scaling of all of a phase's d-spacings. Most accompanying minerals are solid solutions whose cells differ from the database entry. Applied per peak instead of coherently, a 2 % allowance is a window up to 1.6° wide and matches almost anything (§A.6).
Minimum share (‰) or score (%)detect-score10 Reporting threshold. With a library loaded it is read as parts per thousand of the pattern (10 = 1 %); without one, as a percentage score of the peak-matching test.
Browse… (database)db-browse— Opens the file chooser of the computer running ClayQuant, filtered to .json, and fills the box with what is picked.
Tick phases above (%)detect-tick3.0 Which phases arrive already ticked in the dialog; every phase found is listed either way. A share is not a property of one phase — it is what is left after every other candidate in the database has taken the intensity it can explain — so a mineral can fall below this line because a different candidate was added to the database, with no change in the evidence for it. A phase you expect that is listed but unticked is a reason to lower this, not to conclude it was not found.
Minimum peak S/Ndetect-snr5 Height above the local noise a predicted line must reach to count as found. Used by the peak-matching fallback and by the per-line evidence shown in the dialog.
Search range (°2θ)detect-range4 to 40 Angular range considered. It should cover the strong lines of the expected accompanying minerals.
Search for main mineralsdetect-run— Runs the search and opens the confirmation dialog.
Include selected in the fit / Dismissdetect-accept, detect-dismiss— Confirms the tick list, or discards it. Nothing is added to the fit until confirmed.

6.5 Tab 5 — Kaolinite

ControlIdentifierDefaultMeaning
7.15 å window (°2θ)kao-window11.6 to 13.2 Integration window for the kaolinite 001 / chlorite 002 reflection.
Scaling referencekao-referenceIllite 10 å The reflection used to put the air-dried and heated mounts on a common scale. It must survive heating. Manual uses the factor below instead.
Manual scale factorkao-scale1.00 Used when the scaling reference is set to manual.
Compare air and heatedkao-run— Reports the percentage of the 7.15 å area lost, the surviving fraction attributable to chlorite 002, both areas, and the scale factor used.

6.6 Tab 6 — Expandable

ControlIdentifierDefaultMeaning
Search window (°2θ)sme-window4.0 to 10.0 Window searched for the low-angle reflection in both mounts. It must be wide enough to hold the air-dried position and the glycolated position, which may differ by several degrees.
Scaling referencesme-referenceIllite 10 å As for kaolinite: puts the two mounts on a common scale so that the area ratio is meaningful.
Manual scale factorsme-scale1.00Used when scaling is manual.
Compare air and glycolsme-run— Reports both positions in ångström, the shift, and the area ratio.

6.7 Tab 7 — Fit and results

ControlIdentifierDefaultMeaning
Browse… (library)lib-browse— As the database's, filtered to .npz.
Library file (.npz)lib-pathlibrary/clays.npzThe stored reference library.
Load library / Build library nowlib-load, lib-build— Loads a stored library, or builds one with the current instrument settings. Building takes a few minutes.
Mount to fitfit-mountEthylene glycol Which mount is quantified. The glycolated mount is the standard choice because glycolation resolves the illite/smectite series.
Fit range (°2θ)fit-range4 to 34 Range fitted. Exclude the direct-beam tail at the low end; there is little clay information above about 35°.
Restrict orientation parametersfit-orientationsall Limits the fit to library patterns of the chosen March–Dollase values. Restricting to low values is appropriate for a well-oriented mount and prevents the fit using near-random patterns to model a texture effect.
Subtract the fitted backgroundfit-subtracton Subtracts the background stored in step 3. Turn it off only if the measurement is already background-corrected.
Run NNLS fitfit-run— Performs the weighted non-negative least-squares fit and produces the plots and tables.
Export folder / Export tables and plotsexport-path, export-runresults Writes the outputs of §8.

6.8 Simulator

ControlIdentifierDefaultMeaning
Modelsim-modelInterstratified Interstratified computes a two-component stack; Discrete phase computes the pure phase from its structure.
Phase / hostsim-phaseillite The discrete phase, or the host layer type A of the interstratification (the other component being glycol–smectite).
Host layer fractionsim-fraction0.80 WA, the proportion of host layers. 1.0 is the pure host; 0.0 the pure smectite.
Junction probability P(host→smectite)sim-pab0 (random) PAB of §2.7. Zero selects random stacking (R = 0); values above WB give ordering, below it segregation.
Mean crystallite thickness (layers)sim-csds10 ⟨N⟩ of the lognormal CSDS. This is the principal control on basal peak width.
CSDS width β (in ln N)sim-beta0.35 Width of the distribution in ln N. Larger values give a broader spread of thicknesses and smoother peak profiles.
March–Dollase orientation rsim-po0.3 Texture parameter. Recall that it does not change the shape of a purely basal series, only the basal-to-non-basal ratio.
Glycolated smectite d(001) (å)sim-dsmectite16.86 Repeat distance of the glycol–smectite layer. 16.86 å is the value measured by Reynolds (1965); 16.9–17.1 å is also used.
2θ range (degrees)sim-range2 to 40Calculated range.
Optionssim-options— Toggles for including the non-basal contribution and for showing the component curves separately.

7 Reference: command line

There are three commands, and three ways to reach each of them. The ./clayquant script in the project directory (clayquant.ps1 on Windows) is the one that needs nothing set up: it locates the virtual environment itself and runs the module, so it works whether or not the environment is activated and whether or not the installed command was ever written.

From the project directoryWith the environment activatedAs a module
./clayquant build-libraryclayquant-build-library python -m clayquant.library
./clayquant import-structuresclayquant-import-structures python -m clayquant.bern
./clayquant guiclayquant-gui python -m clayquant.gui.app

Options are identical in all three forms; the tables below list them once.

“No module named clayquant”, or a command not found. Both mean the shell is not using the virtual environment. A bare python is then the system interpreter, which has never heard of ClayQuant, and the installed commands are not on PATH. Either activate the environment (source .venv/bin/activate) or use ./clayquant, which does not need it. The error names the interpreter it used — /usr/bin/python rather than something under .venv is the symptom.
A second reason a command can be missing. The installed commands are written into the environment when the package is installed, and at no other time. Updating the source — git pull — therefore does not create a command that the new version has added: the environment keeps the set it was built with, and the new command is reported as not found although its code is present in the checkout. Running ./install.sh (or install.ps1) again writes them all; it lists every command it has checked and names any that is missing rather than reporting success. ./clayquant is unaffected either way, since it runs the module rather than the command.

7.1 clayquant-build-library

OptionDefaultMeaning
-o, --outlibrary/clays.npzOutput file.
--two-theta-min, --two-theta-max2, 40Angular range of the calculated grid, in degrees.
--step0.02Step of the calculated grid. Match the measurement.
--csds-means5 15 50Mean crystallite thicknesses, in layers; one set of patterns per value.
--csds-beta0.35Width of each lognormal distribution in ln N.
--orientations0.1 … 1.0March–Dollase parameters to span.
--quietoffSuppress progress reporting.

7.2 clayquant-import-structures

OptionDefaultMeaning
xml—The jEdit macro-menu XML file to import (positional).
-o, --outstructures/phases.jsonOutput phase database.
--quietoffSuppress the per-phase notes and the failure list.

7.3 clayquant-gui

OptionDefaultMeaning
--port8050 Port to serve on. If it is already in use - a second copy started from the icon, most likely - the next free port is taken instead and reported, rather than the program failing where no one can see the message.
--host127.0.0.1Interface to bind. The default is the loopback, so the interface is not reachable from the network.
--debugoffEnable the development server's reloader and error pages.
--browseron Open the interface in the default browser once the server is answering. This is what makes the desktop icon work: it is started from a double-click, with no terminal to read an address from.
--no-browser— Serve without opening anything, for a script or a machine being used remotely.

8 Output files

Export tables and plots writes seven files into the chosen folder.

FileContents
clayquant_mounts.htmlThe three mounts overlaid: air-dried, glycol-solvated, heated. The plot in which the kaolinite collapse and the glycol expansion are seen directly.
clayquant_fit.htmlThe measurement, the fitted curve and the difference, with Rwp in the title.
clayquant_phases.htmlThe measurement with every fitted phase drawn separately, and their sum.
clayquant_clay_phases.htmlThe same for the clay minerals alone, annotated with the clay share of the whole pattern.
clayquant_all_phases.csvQuantification over all fitted phases.
clayquant_clays_only.csvQuantification over the clay minerals alone, renormalised to 100 %.
clayquant_curves.csvThe numerical curves: 2θ, measured, fit, and one column per phase, so the figures can be redrawn in any other program.

The figures are self-contained HTML: they need no plotting software to open and keep the zoom and hover of the interactive versions.

8.1 Columns of the quantification tables

ColumnMeaning
phasePhase name. Interstratified series appear as I/S and C/S, summed over the individual library patterns that contributed.
groupclay or main. Determines which phases the clay-basis normalisation keeps.
coefficientSum of the fitted scale factors cp of that phase's patterns. Depends on the arbitrary normalisation of the library and is meaningful only in comparison within one fit.
scattering_percentThe phase's share of the calculated integrated intensity. The primary number.
amplitude_percentThe phase's share of the summed scale factors.
entriesThe individual library patterns that took non-zero coefficients, naming the composition, orientation parameter, crystallite thickness and layer spacing selected. This is where the fit reports what it found: an I/S share carried by 0.90/0.10 patterns at d = 9.95 å and N = 50 is a specific mineralogical statement.

Each file carries a header recording the measurement, Rwp and Rp, the basis of normalisation, the clay share of the whole pattern where applicable, and a statement that the percentages are shares of diffracted intensity and not weight percent, so that a file cannot later be mistaken for a mass analysis.

9 Limitations

These are properties of the method, not defects to be worked around. Each is stated with its practical consequence.

  1. A fixed library cannot refine. Peak positions, widths and orientation are sampled at the values the library was built with. A specimen whose layer spacing or crystallite thickness falls outside the spanned range will fit badly, and the misfit appears as a systematic residual at a strong peak rather than as an obviously wrong answer. Widen the spanned ranges and rebuild if this is seen.
  2. Percentages are shares of intensity, not of mass (§2.13).
  3. Kaolinite polytypes are not distinguishable from basal reflections (§2.3). A division of intensity between 1M and 2M is not a polytype determination.
  4. The non-basal contribution of an interstratified phase is approximated by that of its host (§2.12). Turbostratic hk bands are not modelled with their true sawtooth profile. The approximation is good for a strongly oriented mount and degrades as r → 1.
  5. Only two-component interstratifications are treated. Three-component systems, and mixed-layer chlorite/smectite/illite, are outside the model.
  6. Accompanying minerals of similar cell cannot be separated. The screen ranks candidates by explained intensity, which is far sharper than position matching, but the feldspars, the spinels and the rhombohedral carbonates remain close enough that the ranking should be read as a shortlist for judgement (§5.5).
  7. The zero error requires quartz. Where quartz is absent the program declines to report a value; it must then be set by hand, and an error there displaces the whole pattern and corrupts the fit.
  8. The low-angle background is the weakest part of the reduction. There are no peak-free points below about 8°, so the background there is an extrapolation. It should always be inspected by eye, particularly when a smectite 001 near 5.2° is at issue.
  9. The ordered case is implemented but not spanned by the default library (§2.7). Regularly interstratified minerals such as rectorite and corrensite will not be fitted correctly by a library built with the default settings.
  10. No absorption or microabsorption correction is applied. For an infinitely thick specimen in Bragg–Brentano geometry the absorption factor is independent of angle and cancels in relative intensities; a thin mount violates this, as does a specimen of strongly contrasting absorption between phases.

10 References

The list below covers the physical model, the numerical methods, the software libraries, and the four crystal structures on which ClayQuant's clay mineral calculations rest. The accompanying mineral structures come from a user-supplied library and are not covered here, because their citations belong to the database they were drawn from; every one of them is identified by database and entry number in Appendix D, from which the citation can be retrieved.

  1. Bish, D. L. & Von Dreele, R. B. (1989) Rietveld refinement of non-hydrogen atomic positions in kaolinite. Clays and Clay Minerals 37, 289–296.
  2. Bradley, W. F. (1945) Molecular associations between montmorillonite and some polyfunctional organic liquids. Journal of the American Chemical Society 67, 975–981.
  3. Bradley, W. F. (1954) X-ray diffraction criteria of chloritic material. Proceedings of the Second National Conference on Clays and Clay Minerals, NAS–NRC Publication 327, 324–334.
  4. Caglioti, G., Paoletti, A. & Ricci, F. P. (1958) Choice of collimators for a crystal spectrometer for neutron diffraction. Nuclear Instruments 3, 223–228.
  5. Dollase, W. A. (1986) Correction of intensities for preferred orientation in powder diffractometry: application of the March model. Journal of Applied Crystallography 19, 267–272.
  6. Drits, V. A. & Tchoubar, C. (1990) X-ray Diffraction by Disordered Lamellar Structures. Springer, Berlin.
  7. Drits, V. A., Eberl, D. D. & Środoń, J. (1998) XRD measurement of mean thickness, thickness distribution and strain for illite and illite–smectite crystallites by the Bertaut–Warren–Averbach technique. Clays and Clay Minerals 46, 38–50.
  8. Gruner, J. W. (1932) The crystal structure of kaolinite. Zeitschrift für Kristallographie 83, 75–88.
  9. Gualtieri, A. F. (2000) Accuracy of XRPD QPA using the combined Rietveld–RIR method. Journal of Applied Crystallography 33, 267–278.
  10. Harris, C. R., Millman, K. J., van der Walt, S. J. et al. (2020) Array programming with NumPy. Nature 585, 357–362.
  11. Hendricks, S. & Teller, E. (1942) X-ray interference in partially ordered layer lattices. Journal of Chemical Physics 10, 147–167.
  12. Hubbell, J. H. & Seltzer, S. M. (1995) Tables of X-ray mass attenuation coefficients and mass energy-absorption coefficients. NIST Standard Reference Database 126, National Institute of Standards and Technology, Gaithersburg. (Source of the elemental mass attenuation coefficients at Cu Kα tabulated in absorption.py.)
  13. Ibers, J. A. (1962) Atomic scattering factors. In K. Lonsdale (ed.) International Tables for X-Ray Crystallography, Vol. III, Kynoch Press, Birmingham. (The scattering factors used in the original refinement of the glycol–smectite model; ClayQuant uses Waasmaier & Kirfel (1995) in their place.)
  14. Kakinoki, J. & Komura, Y. (1952) Intensity of X-ray diffraction by a one-dimensionally disordered crystal. Journal of the Physical Society of Japan 7, 30–35.
  15. Kerr, P. F., Hamilton, P. K., Pill, R. J. et al. (1950) Analytical data on reference clay materials. American Petroleum Institute Project 49, Preliminary Report 7. (Source of the octahedral composition of the Clay Spur bentonite used in the glycol–smectite layer model.)
  16. Klug, H. P. & Alexander, L. E. (1954) X-ray Diffraction Procedures. Wiley, New York.
  17. Lawson, C. L. & Hanson, R. J. (1974) Solving Least Squares Problems. Prentice-Hall, Englewood Cliffs.
  18. MacEwan, D. M. C. (1948) Complexes of clays with organic compounds I. Transactions of the Faraday Society 44, 349–367.
  19. MacEwan, D. M. C., Amil, A. R. & Brown, G. (1961) Interstratified clay minerals. In G. Brown (ed.) The X-ray Identification and Crystal Structures of Clay Minerals, Mineralogical Society, London, 393–445.
  20. Krekel, H., Oliveira, B., Pfannschmidt, R., Bruynooghe, F., Laugher, B. & Bruhin, F. (2004–) pytest. https://pytest.org
  21. March, A. (1932) Mathematische Theorie der Regelung nach der Korngestalt bei affiner Deformation. Zeitschrift für Kristallographie 81, 285–297.
  22. Moore, D. M. & Reynolds, R. C. Jr. (1997) X-Ray Diffraction and the Identification and Analysis of Clay Minerals, 2nd edn. Oxford University Press, Oxford.
  23. O'Connor, B. H. & Raven, M. D. (1988) Application of the Rietveld refinement procedure in assaying powdered mixtures. Powder Diffraction 3, 2–6. (The external-standard method of §2.13.)
  24. Pézerat, H. & Méring, J. (1954) Influence des substitutions isomorphes sur les paramètres de structure des phyllites. Clay Minerals Bulletin 2, 156–162. (Source of the 2:1 layer coordinates on which the glycol–smectite model is based.)
  25. Plotly Technologies Inc. (2015) Collaborative data science. Plotly Technologies Inc., Montréal. https://plot.ly (Plotly and Dash, used for the interface and the result figures.)
  26. Reynolds, R. C. Jr. (1965) An X-ray study of an ethylene glycol–montmorillonite complex. The American Mineralogist 50, 990–1001.
  27. Reynolds, R. C. Jr. (1980) Interstratified clay minerals. In G. W. Brindley & G. Brown (eds) Crystal Structures of Clay Minerals and their X-ray Identification, Mineralogical Society, London, 249–303.
  28. Ryan, C. G., Clayton, E., Griffin, W. L., Sie, S. H. & Cousens, D. R. (1988) SNIP, a statistics-sensitive background treatment for the quantitative analysis of PIXE spectra in geoscience applications. Nuclear Instruments and Methods in Physics Research B 34, 396–402. (The peak stripping of §A.11.)
  29. Schoen, R. (1962) Semi-quantitative analysis of chlorites by X-ray diffraction. The American Mineralogist 47, 1384–1392.
  30. Sonneveld, E. J. & Visser, J. W. (1975) Automatic collection of powder data from photographs. Journal of Applied Crystallography 8, 1–7. (The background estimator and noise level of §A.19.)
  31. Virtanen, P., Gommers, R., Oliphant, T. E. et al. (2020) SciPy 1.0: fundamental algorithms for scientific computing in Python. Nature Methods 17, 261–272.
  32. Waasmaier, D. & Kirfel, A. (1995) New analytical scattering-factor functions for free atoms and ions. Acta Crystallographica A51, 416–431.
  33. Wojdyr, M. (2022) GEMMI: a library for structural biology. Journal of Open Source Software 7, 4200. (Used to expand space group symbols when importing a structure library.)
  34. Zanazzi, P. F., Comodi, P., Nazzareni, S. & Andreozzi, G. B. (2009) Thermal behaviour of chlorite: an in-situ single-crystal and powder diffraction study. European Journal of Mineralogy 21, 581–589.

Appendix A — Record of verification tests

This appendix records the tests by which ClayQuant was verified during development: what each test was for, how it was done, what it returned, and what was concluded. Several tests are recorded that failed and led to a change in the program; these are the more informative ones and are reported in full.

On the measurements used. Development was verified against 33 measurements of eleven clay separates from a working laboratory. Those measurements are proprietary and are not reproduced here, nor distributed with the program. They are referred to below as Specimen 1, Specimen 2 and so on, and only derived quantities — agreement factors, peak widths, fitted positions — are quoted, never the measured data themselves.

A.1 The interstratification model against closed-form results

Reasoning. The matrix method of §2.5 is the core of the program and is easy to implement subtly wrongly: the phase convention of equation (2.10) can be transposed, the pair counting of equation (2.11) can be off by one, and the stationary distribution can be inconsistent with the transition matrix. None of these produce obviously absurd output — they produce a plausible pattern that is wrong. The model must therefore be tested against cases whose answer is known independently.

Method and results. Twenty-five tests (test_mixed_layer.py):

TestReasoningResult
Single component reproduces the Laue interference function, for N = 1, 2, 5, 17 With one layer type the general result must collapse to the closed form (2.7). This checks the phase convention, the pair counting and the N-dependence simultaneously, against an exact expression. Agreement to numerical precision at all four thicknesses. Pass.
Two identical layer types behave as one Setting A and B to the same layer must give the one-component answer whatever the proportions, which tests that the two components are combined without double counting. Identical to the single-component calculation. Pass.
A pure end member ignores the absent layer At WA = 1 the pattern must not depend on what B is. A failure here would show the absent component leaking through the transition matrix. Independent of the B layer model. Pass.
Single-layer crystallites show no interference At N = 1 the intensity must be the layer structure factor squared, with no interference term at all. This isolates the pair sum. Reduces to ΣWm|Fm|2. Pass.
Intensity is non-negative — 15 cases: random, ordered and segregated stacking at WA = 0.05, 0.2, 0.5, 0.8, 0.95 Intensity is a squared modulus and cannot be negative anywhere. A sign error in the real part of the matrix sum, or an inconsistent stationary distribution, shows up as small negative excursions between peaks. This is the most sensitive cheap test of the whole formalism. Non-negative throughout in all 15 cases. Pass.
CSDS pair weights G(n) of equation (2.14) must equal 1 at n = 0 and decrease monotonically to zero, or the thickness distribution is misapplied. As specified. Pass.
The random transition matrix is the Markov special case Building a matrix with PAB = WB through the general Markov constructor must give exactly the random one. This checks the constructor against its own special case. Identical matrices. Pass.
Impossible ordering is rejected A PAB implying a probability outside [0,1] is unphysical and must raise rather than silently produce nonsense. Raises. Pass.

Conclusion. The interstratification model reproduces every case for which an independent answer exists, and satisfies the positivity constraint across the full range of composition and ordering.

Consistency of the basal and three-dimensional calculations

Reasoning. The same phase can be computed two ways — as a three-dimensional structure through equation (2.3), or as a one-dimensional layer stack through §2.5. These are independent code paths that must agree on the basal series of a pure phase, otherwise the mixed-layer patterns and the discrete patterns are on different scales and the fit apportions intensity wrongly between them.

Results (test_basal_consistency.py): for illite, chlorite, kaolinite 1M and kaolinite 2M, the basal series computed from the one-dimensional layer model matches the 00l intensities of the full three-dimensional calculation; the derived layer thickness equals d(001) of the cell divided by the number of layers per cell; and the absolute spacings agree with the accepted values (10.02, 14.28, 7.15, 7.15 å). Pass.

Conclusion. The polytype folding of §2.3 is exact for the structures used, and the two code paths are on a common scale.

A.2 Validation against Reynolds (1965)

Reasoning. Everything above is internal consistency: the program agreeing with itself. An external check against a published experiment is needed, and the glycol–smectite complex is the ideal one, because Reynolds (1965) published both his structural model (his Table 1) and his observed and calculated structure factors and intensities for fourteen basal orders (his Table 2). Reproducing his calculated quantities from his stated model tests the layer structure factor of equation (2.6), the scattering factors, the displacement factors and the Lorentz–polarization treatment together, against data that did not come from this program.

Method. The model of his Table 1 was transcribed, the basal structure factors computed from equation (2.6), converted to intensities with the random-powder Lorentz–polarization factor he states he used, normalised at 001, and compared with his Table 2. Agreement is measured by his own reliability factor, R = Σ||Fo|−|Fc|| / Σ|Fo|.

An ambiguity, and how it was resolved. His Table 1 gives occupancies per atomic plane, but the octahedral plane lies on the mirror at z = 0 and is quoted as half its content; and his glycol rows are labelled as half-molecules ("H2C–HO"), which may or may not include their hydrogens. Four readings are possible. Rather than guess, all four were computed and compared with his published values:

ReadingElectrons per cellR(|Fo|)Mean |Δlog10I|
A — octahedral plane as quoted, glycol without H4520.2990.350
B — octahedral plane as quoted, glycol with H4760.3120.327
C — octahedral plane doubled, glycol without H4800.0770.158
D — octahedral plane doubled, glycol with H5040.0390.028

Result. Reading D is correct by a wide margin. It also reproduces independently the electron count Reynolds states for his cell ("about 500 electrons"): 504 against his ~500, where the other readings give 452 to 480. Its reliability factor, R = 0.039, is slightly better than the R = 0.042 he reports for his own best model — as expected, since modern scattering factors are used. Four tests now assert this permanently (test_reynolds_1965.py): the electron count, the reliability factor, the fourteen calculated intensities, and the ordering of the strong orders.

Conclusion. The one-dimensional structure factor calculation reproduces a published experimental analysis to better than its original agreement. This is the strongest external validation in the program, and it simultaneously confirms the choice of Lorentz–polarization factor of §2.8, since no other choice reproduces these intensities.

A.3 Import of a TOPAS structure library

Reasoning. The accompanying minerals enter the fit as calculated patterns, so an error in reading their structures — a misparsed cell parameter, a wrong space group setting, a mis-assigned occupancy — produces a wrong pattern that the fit will nevertheless use. The import must be verified against known diffraction data, phase by phase.

Method and results. A library of 205 phases was imported and the strongest calculated line of each of sixteen well-known phases compared with its accepted position.

PhaseCalculated (°2θ)Accepted (°2θ)Δ
Quartz26.6426.64+0.00
Calcite29.4029.40+0.00
Rutile27.4427.44+0.00
Magnetite35.4335.44−0.01
Halite31.6931.70−0.01
Hematite33.1633.15+0.01
Microcline27.5127.50+0.01
Dolomite30.9430.96−0.02
Albite27.9227.94−0.02
Anhydrite25.4225.44−0.02
Anatase25.3125.28+0.03
Siderite32.0232.05−0.03

Four phases appeared at first to disagree and were examined individually:

Determining the TOPAS origin-choice convention

Reasoning. Thirteen phases failed to import because TOPAS writes the two origin choices of centrosymmetric cubic and tetragonal groups with a trailing letter — Fd-3mS against Fd-3mZ — rather than the :1/:2 of the International Tables. Guessing the mapping was unacceptable: the two origins differ by a translation of (⅛,⅛,⅛), so the wrong choice silently produces wrong intensities for spinels, magnetite, zircon and anatase.

Method and result. The convention was determined from the structures themselves rather than assumed. Diamond, silicon and franklinite, written S, place their 8a site at (0,0,0), which is origin choice 1. Magnetite, spinel, chromite, hercynite and magnesioferrite, written Z, place it at (⅛,⅛,⅛), which is origin choice 2. Zircon (I41/amdZ) has Zr at (0,¾,⅛), the standard choice-2 setting; anatase (I41/amdS) has Ti at the origin, choice 1. Eight independent structures agree: S = origin choice 1, Z = origin choice 2. With this mapping all 205 phases import.

Conclusion. Structure import is verified: positions reproduce accepted values to 0.03° across twelve chemically diverse phases, the four apparent discrepancies are explained and none is an error in the program, and the origin-choice convention is established from evidence rather than assumption.

A.4 Workflow tests on synthetic data

Reasoning. The reduction steps — zero error, background, diagnostics, fit — can only be tested for correctness against data whose answer is known in advance, which no real measurement provides. Synthetic patterns were therefore constructed from the program's own library with a known composition, a known zero error and a known background, and the workflow required to recover them.

TestReasoningResult
Zero error is recoveredA known offset is imposed on a synthetic pattern; the calibration must return it. Tests the peak location and the sign convention — a sign error here would shift every pattern the wrong way.Recovered within the 0.01° step. Pass.
Background with an accumulated 1/x termThe 1/x term must be combinable with any main component, as specified. Tests the design matrix assembly.Recovers an imposed background of that form. Pass.
All background components can be combinedPolynomial, Chebyshev, exponential and 1/x simultaneously — the worst case for conditioning of the linear solve.Fits without degeneracy. Pass.
Those two rows test the additive-component model of clayquant.background.BackgroundModel, which the Background tab no longer uses; it is retained for scripts and for the synthetic-workflow test above. The Clayfit models the tab does use are verified separately in the row below.
The Clayfit background models give the same curve as Clayfit The five models taken from Clayfit have to agree with it, or a result obtained here cannot be compared with one obtained there. Where the algorithm is short enough to transcribe it is transcribed literally from Clayfit's own source — the nested loops of the rolling ball, its nearest-point validity test and its tolerances; the asymmetric least squares with its step-scaled second-difference operator — and the two implementations are compared point for point. The percentile model is checked against the values Clayfit's own test suite asserts. The rolling ball agrees at radius 0.2, 0.5 and 0.9; the asymmetric least squares to 10−6; the percentile model exactly, window counts included. 58 automated tests. Pass.
Polynomial and Chebyshev are not the same curve The claim this program previously got wrong, and the reason the background step was rewritten. The two differ at every order from 4 to 12, and the order moves both. They differ by more than 50 counts at every order and by 404 on a real mount at order 6; each curve moves at four or more of the eight order steps. Pass.
NNLS recovers a known compositionThe central claim of the method: a synthetic mixture of known proportions must be recovered. Tests the design matrix, the solver and the share computation.Recovers the composition. Pass.
Kaolinite collapse is detectedA synthetic pair with kaolinite removed from the heated mount must be diagnosed as collapse.Detected. Pass.
Chlorite survives heatingThe complement: chlorite must not be reported as collapsed, or every chloritic sample would be called kaolinitic.Survives. Pass.
Smectite swelling is detectedA synthetic pair with the expandable component shifted must be diagnosed as swelling.Detected. Pass.

A.5 File readers and zero-error behaviour on real mounts

Readers

Reasoning. A reader that silently misreads — an offset by one point, a wrong step, an intensity scaling — corrupts everything downstream while appearing to work. The strongest available check is that two independent encodings of the same measurement, the instrument's native XRDML and its own exported two-column text, must agree exactly.

Result. All 33 XRDML files read, and for every specimen where both forms exist the two agree bit for bit: maximum difference 0.000 counts, identical 2θ grids. The instrument configuration carried in the XRDML — wavelengths, goniometer radius, divergence slit, counting time — is also recovered, so a calculation can be set up to match the measurement. An initial version failed on all 33 files because intensities are held in a <counts> element rather than <intensities>; both are now accepted, as are measurements holding several appended scans.

Zero error

Reasoning. The zero error was first determined with a wide search window (±0.6°). Run across all eleven specimens, this produced shifts ranging to −0.40°, with the three mounts of one specimen disagreeing by 0.33°. Mounts of the same specimen are separate slides, so they may differ by a few hundredths of a degree — but not by a third of a degree. The disagreement itself was the evidence that something was wrong.

Diagnosis. Inspecting the region directly showed that in the kaolinite-rich specimens there is no quartz 100 peak at all, and the routine was locking onto the kaolinite 020 band at 4.36 å, 0.4° away. Quartz 100 clears every clay basal reflection, which is why it is the standard choice, but it does not clear the kaolinite hk bands.

Result after correction (narrow window, signal-to-noise test):

SpecimenAirGlycolHeatedSpread
1−0.06−0.06−0.040.02
2−0.06−0.06−0.060.00
3−0.04−0.05−0.050.01
4−0.04−0.06−0.060.02
5−0.04−0.04−0.040.00
6−0.05−0.03not found0.02
7−0.02+0.04not found0.06
8−0.06+0.00−0.060.06
9−0.05+0.06not found0.11
10, 11no calibration peak in any mount—

Conclusion. Detected shifts now lie between −0.06° and +0.06°, are consistent between the mounts of a specimen to 0.02° in the majority of cases, and are of the magnitude expected for instrument zero and specimen displacement. The eight mounts in which quartz is genuinely absent now report that fact instead of a fabricated number. This test is the reason the search window is narrow and the signal-to-noise test exists; with the original settings the program would have silently displaced whole patterns by 0.4°.

A.6 Development of the accompanying-mineral search

Reasoning. Searching a 205-phase database for the few minerals actually present is a discrimination problem, and a method that reports everything is worthless. Each candidate method was tested on a synthetic pattern of known content — quartz, calcite and albite in known proportions — so that false positives could be counted, and then on a real specimen.

MethodReasoningResultVerdict
1. Per-peak window, 2 % cell allowance The obvious first approach: allow each expected line to be found anywhere within the tolerance implied by a 2 % cell deviation. 190 of 205 phases scored 100 % on a three-phase pattern. A 2 % allowance is a window up to 1.6° wide at high angle; on a peak-rich pattern nearly every phase finds something near every expected line.Rejected.
2. One coherent cell scaling + cosine similarity A real cell deviation stretches the whole lattice together, so all of a phase's lines must move by the same relative amount — a far stronger constraint than independent windows. Intensity agreement was added as a cosine similarity. Better: the three true phases ranked 2nd, 4th and 7th. But 157 phases still passed, and graphite, aluminium, copper and lead ranked at the top. A cosine similarity is dominated by whichever single line falls on the largest peak, so any phase with one reflection near a strong peak scores ≈1.Insufficient.
3. Coherent scaling + proportionality + minimum line count Replace the cosine by a test that the implied scale is consistent across lines, and require a phase to have enough lines in range to be judged at all. Improved, but on a real specimen still ranked quartz 56th of 205, behind ilmenite, pyrite, cementite and faujasite — while quartz was demonstrably present, being the zero-error standard.Insufficient.
4. Competitive non-negative least-squares screen Ask the question that actually matters: does this phase explain intensity that nothing else can? Every candidate is fitted simultaneously with the clay library and with every other candidate, and ranked by the share of the pattern it takes. On a real specimen, two phases take four to five times the share of the pattern that the next candidate down takes, and the gap between them and the rest is clean rather than graded; on a second specimen, three phases separate from the rest the same way. Adding the identified phases to the fit lowered Rwp. Adopted.

Conclusion. Position matching cannot discriminate phases in a peak-rich pattern at these levels; explained intensity can. Method 4 is the default whenever a reference library is loaded, and method 3 is retained only as a fallback for when one is not. The residual tail at 1–2 % is least-squares slack rather than mineralogy, which is why the confirmation dialog leaves it unticked.

A.7 Crystallite thickness against measured peak width

Reasoning. The first fits to real specimens gave Rwp near 68 % while reproducing every peak position correctly, with the difference curve showing sharp excursions at the peaks — the signature of a width or position mismatch rather than a wrong phase. Crystallite thickness is the principal control on basal width (§2.6), so it was measured.

Method and results. Full widths at half maximum were measured on a real glycol-solvated mount and compared with the Scherrer prediction:

Position (°2θ)FWHM (°)Assignment
8.820.117illite 001
12.450.134kaolinite 001 / chlorite 002
17.750.134illite 002
26.570.134quartz 101 / illite 003

A width of 0.117° at 8.82° implies a crystallite thickness of about 680 å, or 68 layers. The library in use had been built with a mean of 10 layers, which predicts a 001 width of 0.79° — nearly seven times too broad.

Consequence. Crystallite thickness became a spanned library dimension (§3.3). Rebuilt with means of 5, 15 and 50 layers, the fit selected the N = 50 patterns for the sharp illite, confirming the mechanism.

An instructive negative result. Spanning thickness alone did not improve the agreement: Rwp went from 70.8 % to 70.8 %. The fit now had patterns of the right width available and chose them, but something else was still wrong — which led directly to the next two tests. Had the thickness test been taken as sufficient, the real causes would have been missed.

A.8 Layer spacing

Reasoning. With widths now correct, the residual remained concentrated at one place: the illite 001. At that point the measurement showed 7764 counts where the fit gave 1279 — the strongest clay reflection in the pattern almost entirely unexplained. A peak that is present in both but not fitted is a position problem.

Method and results. The basal spacing was determined from the measurement itself, using two orders so that the result is self-checking:

OrderObserved position (°2θ)d (å)Implied d(001) (å)
0018.8849.94599.946
00217.8084.97689.954
003 (apparent)26.6313.344510.034 — discard

The 001 and 002 agree on d(001) ≈ 9.95 å. The third order appears to disagree, but that reflection is quartz 101 at 3.3435 å overlapping illite 003, not illite alone — a reminder that the 3.34 å peak of a clay pattern is rarely a clay peak only.

The library value, taken from the ICSD illite structure, is 10.022 å, placing the 001 at 8.816° against the observed 8.884°. The discrepancy of 0.066° is half a peak width. Scanning the spacing:

d(001) assumed (å)001 calculated (°)Observed − calculated (°)
9.9008.920−0.038
9.9508.886−0.004
9.9808.853+0.029
10.0008.836+0.046
10.022 (library)8.820+0.062

Conclusion. The specimen's illite has d(001) = 9.95 å, not the 10.022 å of the reference structure. This is not an error in either: illite basal spacing varies from about 9.95 to 10.10 å with interlayer potassium content and hydration, and a single refined structure is one point in that range. Layer spacing therefore became a second spanned library dimension. On rebuilding, the fit selected d = 9.95 å of its own accord, and the illite 001 residual resolved.

A.9 The weighting of the fit

Reasoning. With widths and spacings now spanned, agreement was still poor. The remaining suspect was the fit's own weighting, which had been taken from the background-subtracted intensity. That is wrong on statistical grounds: the variance of a counting measurement is set by the number of photons recorded, and subtracting a smooth background does not reduce it. Weighting by the subtracted value gives near-zero-intensity points — the flat regions between peaks, which are pure noise — the largest weights, and the peaks the smallest.

Result. Changing the weights to 1/max(raw counts, 1), and weighting the solve as well as the metric:

WeightingRwpRp
By background-subtracted intensity (incorrect)70.8 %48.2 %
By raw counts (counting statistics)56.0 %46.4 %

Conclusion. A 15-point improvement in Rwp from a change that alters no physics at all, only the statistical weighting. The lesson is general: when a background-subtracted pattern is fitted, the weights must still come from the counts that were actually measured.

A.10 Cumulative effect and the final state

Reasoning. The preceding tests each addressed one cause. Their cumulative effect on a single real specimen records what each was worth, and whether the final state is fit for use.

StageRwpChange made
Initial68.4 %—
+ thickness spanned70.8 %no improvement alone (§A.7)
+ correct weighting56.0 %§A.9
+ quartz in the fit53.4 %accompanying minerals matter
+ quartz, albite, calcite49.1 %—
+ layer spacing spanned35.7 %§A.8
+ minerals from the competitive screen33.2 % §A.6
These figures predate the background correction of §A.11. They are kept because each row records what one change was worth, and the ordering of the rows is unaffected; the absolute values are not comparable with the measurements below, which were made after it. A background that cut under the data inflated the observed intensity, and Rwp is measured against that intensity, so the earlier figures were flattered by it.

Across all eleven specimens, after the correction. Fitting each glycol mount with the clay library, the accompanying minerals from the competitive screen and the zero error applied, Rwp runs from 37.4 % to 67.5 % with a median of 44.8 %. Eight of the eleven fall between 37 % and 50 %. Two kaolinite-dominated separates fit at 65 % and 68 %; their 7.17 and 7.37 å pair is not matched by the kaolinite library and the cause is not established. Both are specimens in which quartz is absent, so their zero error had to be left unset.

Conclusion. Typical agreement is Rwp ≈ 40–48 %, which is modest for a whole-pattern fit and is what a fixed library that cannot refine positions or widths continuously can be expected to give; it is poor by the standards of a Rietveld refinement, which can refine them. Two specimens of eleven are fitted badly. The plots exist so that this is visible to the user in every case, and §9 states the limitation plainly.

A.11 The peak stripping, and what it must not remove

Reasoning. The background components are fitted to a peak-stripped estimate rather than to the counts, and on real mounts they follow it to a few counts. The estimate therefore is the background, and the question is what the stripping should leave alone. The answer is not a matter of taste. Where a background is convex, the mean of two symmetric neighbours is never below the point itself, so the SNIP operation - replace each point by the smaller of itself and that mean - leaves a convex background exactly unchanged. The low-angle tail of an oriented mount, air scatter and the shoulder of the direct beam, is such a background. A correct implementation returns it untouched; an implementation that removes it leaves thousands of counts of direct beam behind as signal, to be explained as diffraction by whatever pattern in the library rises at low angle.

Method. A background of the measured shape (1820 counts at 3° falling to 339 at 30°) was constructed and stripped with no peaks present at all, at five widths. There is nothing to strip, so the estimate must return the input. Ten peaks of 400 to 7000 counts were then added and the test repeated.

ImplementationEstimate at 3°, background alone Worst error, background aloneWorst error, with peaks
As released (invented neighbours at the ends)546 1274 counts1270 counts
Corrected (comparison narrowed at the ends)1820 0 counts30 counts

Result. The released implementation removed 70 % of a background that contained no peaks whatever. The cause was at the ends of the scan, where the comparison has no neighbour on one side: the missing neighbour was replaced by the point itself, which on a falling edge puts the mean below the point, so every one of the roughly 120 passes lowered it further and the damage propagated inwards over several degrees. Padding the ends with an extrapolated trend, tried next, was no better - the padding is itself stripped and carries the data down with it - and padding by reflection inverts any peak that lies near the end. Narrowing the comparison to what the data allows, so that the window shrinks towards the ends instead of being filled in, restores the property exactly: with no peaks the estimate is the input to within a count, at every width tested.

What it changes. On a real air-dried mount measured from 3.01°, with a Chebyshev background of degree 4 plus the 1/x term:

2θ3.01°4.0°5.0° 8.85°20.85°34.0°
Measured350526732369 3670983493
Background, as released998973933 831484319
Background, corrected329426502174 1151558381

The released background was a nearly flat line 200 counts above the high-angle floor across the whole pattern - which is how it was reported, as a background that appeared not to respond to any control. It could not respond: the estimate it was fitted to had been flattened before the model ever saw it. Averaged over the quantified range the corrected background is 210 counts higher.

The stripping width now means peak width. With the tail preserved by the convexity property rather than by the choice of width, the control no longer trades the tail against the peaks. Measured over the eleven glycol mounts against the clay library alone, without accompanying minerals or zero-error correction, so the values are higher than those of §A.10 and only the trend is meaningful:

Width (°2θ)Overall Rwp 3–4.5° surviving8–40° Rwp
165.3 %2.2 %64.0 %
260.9 %4.5 %61.1 %
359.6 %5.1 %60.1 %
459.0 %5.1 %59.5 %
658.7 %5.1 %59.2 %
858.6 %5.2 %59.1 %

The share of low-angle counts surviving subtraction is now 5 % at every width from 3° upwards: the tail is background whatever is asked for, which is the property above. What the width still changes is how much of a broad reflection is treated as background, and both metrics flatten by about 4°, which is the default. Below 2° the background is lifted into the peaks and the 8–40° figure, a region containing no tail at all, is 4.5 points worse.

The same defect in the library. Each calculated pattern has its own diffuse continuum stripped before storage (§3.3), by the same routine, and the same end effect left that continuum standing over the first degrees - 21 % of the strongest peak at 3.5° on an I/S 0.80/0.20 pattern. Since it is a calculated pattern, the end can be moved: each is now computed on a grid reaching one stripping window beyond both ends of the stored range and trimmed afterwards, which puts the unreliable zone outside the library entirely. The residual continuum at 3.5° falls to 5 %, with the peaks unchanged to three decimal places. This matters because the measured background and the calculated continuum have to be removed consistently: if one side keeps its low-angle rise and the other does not, the fit is asked to reconcile an intensity that only one of them has.

Conclusion. The property to test for a background estimator is not how smooth its output looks but what it does to a background that contains no peaks. That test is now in the suite (tests/test_background.py), at five widths, along with the requirement that peaks are still removed and that the estimate never exceeds the measurement.

A.12 End-to-end tests of the interface

Reasoning. Unit tests cannot show that the assembled program works: state may be lost between steps, a control may not be connected, a computation may be correct but never reach the screen. The complete workflow was therefore driven in a real browser, automatically, on real measurements, with the browser console monitored for errors.

Method. A script loaded three mounts, set the zero error on each, fitted and applied a background, loaded the phase database and reference library, ran the mineral search, confirmed the selection, ran both diagnostics, ran the fit, visited all four result plots, exported, and opened the simulator — capturing a screenshot at each step.

Results. The workflow completed with no JavaScript errors, all four plots rendering and all seven export files written. Two defects were found this way and would not have been found otherwise:

Conclusion. The assembled program works end to end on real data. The dialog defect in particular was invisible to unit testing, being a property of the interface framework rather than of any function, and was caught only by driving the interface and looking at what it displayed.

A.12.1 A name that was never imported

What happened. Pressing Load database on the main-minerals tab reported name 'resolve_user_path' is not defined. The function exists and is correct; the module that calls it never imported it. Python raises that only when the line runs, so the interface started, the first three tabs worked, and the fault waited on a button. The same import was missing for the two other calls in that file — loading the reference library and exporting the results — so three of the seven steps were broken in the same way and by the same omission.

Why the existing tests did not catch it. The unit tests exercise the library, not the interface, and the end-to-end browser run that would have caught it had last been made before those three calls were written. A test that only proves what it reaches cannot prove what it does not.

What was added. Two things, because they fail differently. A whole-source check for names that do not exist (tests/test_no_undefined_names.py, using pyflakes) runs over every file in a fraction of a second and finds this class of fault wherever it is, including on paths no test reaches; run against the unfixed source it named all three lines. And the browser run now covers every tab and every button through to the export, which is what establishes that the assembled program works rather than that its parts do.

Result of that run. Load, zero error (−0.06°), background, phase database (209 phases), mineral search, kaolinite (most of the 7.15 å area collapsed on heating, as it should), expandable, library (1601 patterns), fit (Rwp = 49.6 %), export (7 files) and the simulator, with no JavaScript errors.

A.12.2 A step that looked like it did nothing

What happened. Search for main minerals was reported as doing nothing. It was doing exactly what it should, and finishing: the search takes seven to ten seconds, and Dash displays nothing at all while a callback runs. A button that shows no change for ten seconds cannot be told apart from a button that is broken, and was not.

What was changed. Every pane a slow step writes into is now wrapped so that a spinner appears over it while the step is computing, with the previous contents dimmed underneath rather than blanked, and a short delay before it shows so the quick steps do not flicker. That covers the mineral search, the quantification, the library load and build, and the export — the four steps measured in seconds rather than milliseconds.

StepTime on a real measurement
Mineral search, peak matching (no library loaded)7.4 s
Mineral search, competitive fit (library loaded)9.6 s
Quantification over 1614 patternstens of seconds

And the sliders. Each slider carried a bubble showing its value under the handle, which sat on top of the label of the control beneath it and hid part of the text. The value is already shown in the box beside every slider, so the bubbles are removed — nineteen of them.

A.14 Weight percent from the calculated masses

Reasoning. The chain from a fitted scale factor to a mass has four links — the pattern is calculated for one unit of the phase, stored divided by a normalisation, fitted with a coefficient, converted back with the mass of that unit — and an error in any one of them scales a phase without looking wrong. Nothing in a real measurement can catch that, because the true answer is not known. A specimen built out of the library's own patterns, from masses chosen in advance, can.

Method. Known masses of four library patterns were combined into one pattern, multiplied by an arbitrary constant standing for the instrument, and fitted. The fit is exact by construction (Rwp < 10−6), so anything wrong in the result is the conversion rather than the fit.

PhaseMass put inWeight % returned
Illite40.0 %40.00 %
Kaolinite 1M25.0 %25.00 %
Chlorite20.0 %20.00 %
Illite/smectite 0.80/0.2015.0 %15.00 %

Result. Exact to the printed precision, and unchanged when the arbitrary constant is doubled — counting twice as long does not change a weight percent. Equal masses of chlorite and kaolinite come back equal although their shares of scattered intensity differ, which is the point: the conversion uses the mass of the calculated unit and not the intensity. A library that does not record those masses reports no weight percent at all rather than a number computed from something else.

And what it did not test. That the relation was the right one. The specimen was built by inverting ClayQuant's own conversion, so a factor missing from both sides cancelled and the test passed. One was missing: equation (2.25) needs the volume of the calculated unit as well as its mass, and it was implemented with the mass alone.

What caught it

A TOPAS refinement of the same oriented air-dried mount, made independently in the laboratory the measurements come from. The version of it available at the time quantifies four phases — quartz, albite, kaolinite 2M and sekaninaite — and fits illite and chlorite as structureless hkl_Is phases with no weight at all, which is itself worth noting: an expert refinement of an oriented mount does not attempt to weigh the clays either.

The specimens are laboratory material and their compositions are not reproduced in this manual. What is given below is the ratio of ClayQuant's answer to the reference's, which is what a verification record needs and which says nothing about what the specimen contains.
PhaseCell volume ClayQuant / reference, without V ClayQuant / reference, with V
Quartz113 å31.81 1.10
Albite664 å30.39 1.38
Kaolinite657 å30.20 0.35
Sekaninaite1551 å30.40 3.2

Quartz has the smallest cell of the four and was over-weighted against albite by 4.7 times, which is the ratio of their cell volumes, 5.9, to within the other differences between the two analyses. With the volume included, quartz and albite agree with the refinement to 10 % and 38 % where they were out by factors of two and five — and the same correction cuts the quartz of the glycol-solvated mount of that specimen by two thirds, leaving the clay minerals carrying most of the mass, which is what a clay separate should look like.

Two differences remained and were not explained by this: kaolinite at a third of the refined value and sekaninaite at three times it. A later version of the refinement accounts for both, and is described next.

The refinement that weighs every phase

The refinement above was superseded by one of the same measurement in which illite and chlorite are modelled as structures rather than as hkl_Is peak sets, every phase carries a refined March–Dollase parameter instead of a fixed one, and all seven phases are weighed to a sum of 100 %. It is the better reference in every respect, and it changes the earlier comparison as much as it confirms it. Kaolinite and albite both fall by more than half once their texture is refined rather than assumed absent, which is where two of the disagreements above went; and rutile — which ClayQuant had been finding, and which was suspected of being a false positive — is in it as a phase of a few per cent.

PhaseClayQuant / reference Reference r, relative to ClayQuant's
Quartz0.61both fixed at 1
Chlorite (clinochlore)0.88 within a factor of 1.8
Kaolinite0.50slightly more textured
Albite3.20textured about 0 2 0, which ClayQuant cannot express
Rutile0.89 textured about 1 1 0, which ClayQuant cannot express
Illite7.8far more textured than the fit chooses
Sekaninaite11 textured about 2 0 0, which ClayQuant cannot express

ClayQuant's figures are renormalised over these seven phases; the competitive screen also admitted six minerals the refinement does not use — microcline, anorthite, tridymite, thaumasite, a calcium phosphate and pseudoboleite — carrying a further quarter of its mass, and the first three of those sit on feldspar and silica lines. ClayQuant's Rwp for this mount is 36 %, against the refinement's 6.7 %: a fixed library fitted linearly is not a Rietveld refinement and does not pretend to be one.

What this settles. Chlorite at 0.88 and rutile at 0.89 are the first phases to agree with an independent analysis to better than the uncertainty of the preparation, and chlorite could not be compared at all before, since the earlier refinement gave it no weight. Chlorite is counted here as the chlorite and chlorite/smectite entries together, which is what a single clinochlore phase in the refinement corresponds to. Rutile is real.

What it does not. Illite is nearly eight times the refined value and albite three times. Both have an identifiable cause and they are different causes.

Illite is the texture parameter, and the refinement measures it where ClayQuant cannot: it settles on a far stronger texture than the fit here chooses for its illite and illite/smectite entries. Because a basal series has the same shape at every r (§2.9), that difference is invisible in the residual and enters the mass as r3. Holding ClayQuant's illite at the refined value and leaving everything else alone takes the ratio from 7.8 to 3.4 — most of the discrepancy, and exactly the quantity the following section says the measurement cannot determine.

Albite is a limitation of the model rather than of the fit. Its refined texture is about 0 2 0, and sekaninaite's about 2 0 0 — axes that are not c*. ClayQuant applies March–Dollase about c* only, which is right for a platy clay and wrong for a feldspar lying on a cleavage that is not basal, so it has no way to express either texture and assumes both minerals are randomly oriented. Offering the accompanying minerals at several values of r about c* rather than at 1 alone brings albite from 3.20 down to 2.14 and leaves the rest where they were, which is about as much as an axis-restricted correction can do. A general orientation axis per phase is the fix, and it is not implemented.

Expressed as a mass ratio to quartz, which does not move when another phase does, the seven come out at 1.00 for quartz, 0.82 for kaolinite, 1.45 for chlorite, 1.46 for rutile, 5.2 for albite, 12.8 for illite and 18 for sekaninaite. Kaolinite, which looked like a factor-of-two problem in the renormalised table, is the second-best phase on this measure; what moves it is quartz, which ClayQuant under-weights by a third.

What no refinement of this mount can supply. It is the air-dried mount, and it contains no expandable phase: no smectite, no montmorillonite, no illite/smectite. That is not an omission but a consequence of the preparation — in an air-dried specimen an expandable clay sits near 14–15 å, on top of chlorite 001 and vermiculite, and cannot be separated from them. That is what the glycol-solvated mount is for (§2.1). The reference therefore constrains six crystalline phases and the illite, and says nothing about the expandable clay, which is the quantity the three-mount method exists to measure.

How well the fit determines the texture parameter

The illite discrepancy above is mostly the texture parameter, so it is worth measuring what the parameter is worth. For the kaolinite entries of the library, from r = 0.1 to r = 1:

rSimilarity of the stored pattern to r = 1 Mass per unit coefficient
0.10.8423.8 × 10−5
0.50.8614.8 × 10−3
1.01.0003.8 × 10−2

A tenfold change in r changes the shape of the pattern by 16 % and the mass it implies by a factor of a thousand. The shape it changes is the ratio of hkl to 00l intensity, which in a strongly oriented mount is the weakest thing in the pattern. The weight percent of a basal-dominated phase is therefore not merely uncalibrated: it rests on a quantity the measurement barely determines.

That has a consequence for the calibration of §2.13. A factor kp fitted while r is also free would be absorbing a parameter the data cannot fix. The calibration should instead fix r per phase, determined from the specimens of known composition, so that afterwards the fit chooses only how much of each phase is present.

The refinement bears this out from the other side. It determines r for each phase because it fits the hkl reflections as well as the basal ones, in a pattern where those reflections are weak but present; ClayQuant's clay library is basal-only by construction, so nothing in it constrains r at all. Where the two nearly agree on r — chlorite — they agree on the weight to 12 %; where they do not, they disagree by the cube of the ratio.

The importer now checks itself against TOPAS

A structure block written by TOPAS states two numbers ClayQuant does not need, because it works both out from the sites and the cell: cell_mass and cell_volume. That is what makes them worth reading. They are the same two quantities stated independently, by the program the library was written for, so a block that has lost atoms disagrees with itself — and nothing else in the import notices, since a phase with some of its sites is still a phase that reads.

The importer now compares them and reports every phase that disagrees by more than 0.5 %. Over the 209-phase laboratory library exactly one does, and it is the phase that had been added by hand:

phases that were imported but do not match what TOPAS says they weigh:
  Sekaninaite: cell mass works out to 1696.146 from the sites and cell given,
  but the block states 2592.043 (65 % of it); sites are probably missing

Five oxygen sites — O2 to O6 — are absent from that item; they are present in the refinement's own output for the same phase. The cell volume agrees exactly, which localises the fault to the site list rather than the cell. Restoring the five sites brings the computed mass to 2592.090 against the stated 2592.043. The phase is still written to the database, because whether an incomplete structure is usable is the user's judgement and not the importer's; it is only no longer silent. Sekaninaite is a trace phase here, so little followed from it, but the same fault in a major phase would have gone the same way.

Conclusion. A test built by inverting the code it tests will agree with the code and not with nature. Both faults in this section were found by comparison with something that did not come from ClayQuant: the missing cell volume by a refinement of the same measurement, the missing oxygen sites by the refinement's own statement of what the structure weighs. The synthetic test remains, rebuilt from the powder relation rather than from ClayQuant's conversion, alongside a check that the two calculation routes for one phase — as a discrete cell and as the host layer of a stack — weigh a specimen alike.

A.15 A weighed standard, and a random mount ClayQuant cannot fit

Reasoning. The oriented mounts confound two things: whether the conversion from a scale factor to a mass is right, and whether each phase's texture is modelled. A random powder mount removes the second — there is no texture and every phase is fitted at r = 1 — so what remains is the conversion alone. And a random mount can carry a weighed standard, which makes the reference absolute rather than relative. The laboratory's bulk analyses are exactly this: pressed random powders with 20 % of corundum by weight added before mounting, refined in TOPAS.

What the spike says about the reference analyses. The refinements record no trace of the spike — the weight of corundum added is knowledge held outside the files — so their weight percent is relative, normalised to 100 over the phases that were weighed. Applying (2.26) makes them absolute, and the difference from 100 is what each refinement does not account for: its illite and chlorite, which it fits as hkl_Is peak sets carrying no weight, together with any amorphous content. Sixteen refinements, eight specimens each prepared twice:

Quantity, over eight specimensLowestHighest Largest difference between the two preparations of one specimen
Corundum, refined against 20 % added21.0 %44.5 % 2.3 %
Scale factor implied, Wstd/W′std 0.450.950.03
Unaccounted, of the spiked powder4.9 %55.0 % 2.8 %
Unaccounted, of the specimen as sampled6.2 %68.8 % 3.5 %

The per-specimen compositions are laboratory data and are not reproduced here; what the verification argument needs is the spread and the reproducibility. The two preparations of a specimen agree to within 0.6 to 2.8 percentage points on the unaccounted fraction, which is the reproducibility of the whole chain — splitting, spiking, pressing, measuring and refining — and is the figure against which any disagreement should be read. The unaccounted fraction ranges from 5 % to 55 % of the spiked powder, so it is not a correction but the largest single number in several of the analyses.

Note the two bases. A weight percent from (2.26) is a fraction of the powder the diffractometer saw, which is one part standard to four parts specimen; the specimen as it was sampled is the remaining 80 %, so every phase in it, and the unaccounted fraction with them, is larger by 1.25. That is the basis an amorphous content is normally quoted on, and Quantification.original_basis returns it, with the standard removed since it is not part of the specimen.

The test that could not be run

ClayQuant was fitted to the same random mount, over the phases the refinement uses so that phase selection was not part of what was being tested, every phase at r = 1, with the corundum declared as the internal standard. The result is not a usable check, and the reason is worth recording rather than the numbers:

Window8–16°16–24° 24–32°32–40°40–48° 48–56°56–64°64–72°
Rwp94 %60 % 45 %42 %50 %47 % 40 %54 %

Overall Rwp is 43 % against the refinement's 7.6 %, at the best setting found, and the misfit is spread across the whole range rather than concentrated anywhere.

What makes the result unusable is not its size but its instability. Shifting the pattern by the zero error the refinement reports, 0.035°, and then by twice that in each direction, with everything else held fixed:

Shift applied−0.070°−0.035° 0+0.035°+0.070°
Rwp67 %51 % 43 %54 %61 %
Calcite, against the reference0.450.54 0.691.051.32
Quartz0.630.82 0.840.690.56

A tenth of a degree of alignment moves calcite by a factor of three. Nothing about the mass conversion can be read through a sensitivity that large, and the sensitivity has a cause: the reference refinement models a specimen displacement of 0.061 mm, which displaces each reflection by an amount varying as cosθ, and ClayQuant has no such model. No single constant zero error can align peaks across 8–70° in its place, so the fit trades one end of the range against the other and the phase weights follow. Over the 3–40° of an oriented clay mount the same displacement is nearly a constant offset and the zero-error correction absorbs it; over a bulk scan it is not. The other absences compound it — one fixed pseudo-Voigt where the reference convolves an axial-divergence model and a slit width, no sample-transparency correction, and no per-phase cell, size or strain — and 70 % of the weighted misfit lies between the peaks rather than on them, which is the background left over when peaks sit in the wrong places.

The background model is not the cause: Chebyshev degree 4, 6 and 8, with and without an inverse term, change Rwp by 0.2 percentage points and calcite by 0.01. That was worth checking, because it was the first explanation that suggested itself and it was wrong.

Conclusion, and what it does not license. The internal-standard arithmetic is implemented and tested, and the reference analyses above are absolute because of it. But the corundum-spiked mounts do not supply the calibration of §2.13, for two independent reasons, either of which alone would be enough:

What would supply it is the pairing described in §2.13: the same separate mounted twice, once as a spiked random powder and once oriented. The random mount fixes the composition without texture; the oriented fit of that known composition then yields kp directly. For ClayQuant to fit the random half of such a pair, the shortcomings listed above would have to be addressed first.

A.16 Structures as refined, rather than as published

Reasoning. Every structure the library calculates from is of somebody else's specimen. For quartz that hardly matters; for a clay it may matter a great deal, because the octahedral sheets accept iron for magnesium and for aluminium in proportions that differ from one deposit to the next, iron scatters about twice as strongly as the magnesium it replaces, and the substitution sits at a definite height in the layer — so it changes the basal structure factors, and therefore every basal intensity ratio the quantification rests on. Those occupancies are refinable against a measured pattern. Where a refinement of the same specimen exists, it has already measured them.

What the reference refinement of §A.14 actually refined. Its cells, and seven occupancy parameters across three phases: the two octahedral sites of the illite, four octahedral and two tetrahedral sites of the chlorite, and the Mg/Fe site of the cordierite. No atomic position and no displacement parameter was refined for any phase, so positions and B come from the published structures either way. The chlorite refines to substantially more iron than the published clinochlore carries, and unevenly between its four octahedral sites; the illite takes iron on one of its two sites and none on the other. The values are this specimen's and are not reproduced here.

Two of the seven parameters are worth distrusting rather than using blindly. Both tetrahedral Si/Al parameters of the chlorite refined to a bound, leaving an all-aluminium tetrahedral sheet, which is not a chlorite; silicon and aluminium differ by one electron, so the data cannot separate them and the parameter drifts. It costs little — about 0.7 % of the cell mass and nothing measurable in the pattern — but a parameter at its limit is a parameter the measurement did not determine, and the same is true of the specimen displacement in the same file.

Method. TOPAS writes a refined value back in the syntax it read, so the refinement's output is a structure library and the same importer serves. The clay structures were taken from it, the pattern library recalculated, and the fit of §A.14 repeated. To separate the refined occupancies from the refined cells, a third library was built with the refined sites placed on the published cells.

Structures usedRwp
Published throughout35.9 %
Clays: refined occupancies, published cells31.7 %
Clays: refined occupancies and cells31.2 %
… and the accompanying minerals refined too34.9 %

Result. Taking the clay structures from the refinement improves Rwp by 4.7 percentage points, the largest single improvement recorded in this appendix after the fit weighting of §A.9, and the occupancies account for 4.2 of the 4.7. The agreement ratios of §A.14 barely move: chlorite from 0.94 to 1.08, illite from 7.5 to 7.3, quartz unchanged at 0.6. That combination is coherent rather than disappointing. Rwp measures the shape of the calculated pattern, which the occupancies fix; the weights are governed by the r-degeneracy and by texture axes the model cannot express (§A.14), which a structure cannot touch.

The effect on the calculated basal series, as the cosine similarity of the normalised pattern to the one from the published structure, locates it:

PhaseRefined cell onlyRefined sites only Both
Chlorite0.8260.9610.810
Illite0.9530.9890.947
Kaolinite 2M0.9931.000 0.993

Chlorite moves most, and its 003 — the reflection an octahedral iron content is refined against — falls by a factor of about 2.6 relative to 002. Kaolinite barely moves, which is expected: its occupancies are all 1 and only its cell changed. Note that the cell changes the isolated pattern more than the sites do, while the sites improve the fit more. That is not a contradiction: a changed cell mostly moves the basal peaks, and the library spans layer spacing (§A.8), so the fit absorbs a spacing change by choosing a different spanned entry. A changed intensity ratio it cannot absorb at all.

Why not the accompanying minerals as well

Because it is measurably worse, by 3 points of Rwp, and the phase responsible is quartz: taking quartz's refined cell alone costs 3.0 points, albite's alone 1.3, and rutile's and cordierite's nothing. Quartz is a special case with an identifiable mechanism. It is also the zero-error standard (§5.3), and the standard is a fixed d(100) constant rather than the library's quartz: align the pattern to that constant and then fit a quartz whose refined cell puts its own 100 elsewhere, and the standard and the structure are out of step by 0.027°. Making the standard consistent with the refined cell recovers 1.2 of the 3.0 points. The remaining 1.8 is not explained; the refined quartz cell is simply a worse description of these data than the published one, in a program that cannot re-refine it.

A first hypothesis was that the refined cells carried the refinement's own alignment corrections — it fits a zero error and a specimen displacement, the displacement at its limit, where ClayQuant fits only a constant zero error. It was wrong: removing ClayQuant's zero-error correction makes every case worse, refined and published alike. Recorded because it was plausible and is the sort of explanation that is easier to assert than to test.

Conclusion. Refined clay structures are used where a refinement supplies them, and are the recommended input; the accompanying minerals stay on the library structures unless a library structure is demonstrably wrong, as the incomplete cordierite of §A.14 was. What a refinement cannot supply is the commonest case: an oriented mount refined with its clays as hkl_Is peak sets has no clay structure in it, and the import reports that rather than succeeding emptily. 21 automated tests cover the reading, the name mapping, the substitution inside the loader, and the restoration of the published structures afterwards.

A.17 Against measurements of the pure minerals

Reasoning. Every comparison up to here has been against an analysis of a mixture, where a disagreement can lie in the calculation, in the phase selection, in the texture of one phase among several, or in the reference itself. A measurement of a single pure mineral removes all of that at once. And one quantity in such a pattern is free of the two things a pure mount does not reveal — how much material is in the beam, and how well oriented it is: the ratio of one basal intensity to another. Preferred orientation multiplies a whole basal series by one factor (§2.9), so it divides out completely, and so does the amount of material. What is left in a basal ratio is the structure factors, the Lorentz–polarization factor, the beam-overflow correction and the crystallite thickness distribution.

Method. Oriented air-dried mounts of separate pure clay minerals, measured on one instrument under one setting within fourteen hours: 240 mm radius, graded incident mirror, 0.03 and 0.02 rad Soller slits, fixed 0.5° divergence and anti-scatter slits, 14 mm mask, 0.0167° steps, 19.7 s per step, no attenuator. Each 00l was integrated over ±1.0° of where the layer spacing puts it, after peak-stripped background subtraction, and divided by another order of the same pattern. The calculation used the published structures and the same instrument description, at the crystallite thickness that best matches the measured peak widths.

The integration window is not a detail, and getting it wrong produced a confident and wrong conclusion. A clay basal reflection has a full width at half maximum near 0.1–0.2°, so ±0.35° looks more than ample. It is not. Stacking disorder gives these reflections a long diffuse tail, and on one of the chlorites below a ±0.35° window held only 36–72 % of each order's area — and a different fraction of each order, which is precisely what a ratio of orders is sensitive to. At ±1.0° the same pattern gives 85–93 %. The 005 ratio of that chlorite reads 0.77 at ±0.35°, 1.22 at ±0.6° and 1.34 at ±1.0°. An earlier version of this section reported the ±0.35° figures and drew a conclusion from them that the corrected figures do not support; the retraction is below.
00lKaolinite Chlorite AChlorite B
0011.000.940.99
0021.051.001.00
0030.920.941.18
004—1.341.32
005—1.341.18

Observed divided by calculated, each column normalised on the order shown as 1.00 — 001 for kaolinite, 002 for the chlorites, 002 being the strongest chlorite basal. Integrated over ±1.0°. The 006 of both chlorites is omitted: the calculated 006 falls close to a node of the structure factor, so its ratio is set by noise rather than by the model.

Result. Kaolinite's 002/001 comes back at 1.05, and it is stable against the window: 1.02 at ±0.35°, 1.05 at ±1.0°, 1.08 at ±1.5°. That is the strongest single piece of evidence in this appendix that the chain of §2 is right — an absolute basal intensity ratio of a real mineral, reproduced to about 5 % with nothing fitted. Its 003 is 0.92, having read 0.65 at the narrow window.

Both chlorites come out about 1.3 on 004 and 1.2–1.3 on 005: the calculation under-produces the higher orders, by a similar amount in both specimens. Their 003 differs (0.94 against 1.18), which is the one place they are not alike.

A retraction

Read at ±0.35° and at a crystallite thickness fixed at 25 layers rather than matched to the observed widths, the same two chlorites appeared to depart from the published clinochlore in opposite directions — 0.62 against 0.83 on 003, 0.61 against 0.81 on 005. That looked like strong evidence that the two specimens differ in octahedral iron, that no single structure can serve both, and that a per-specimen composition was needed. Corrected, the two chlorites agree with each other to within 0.02 on 004 and differ from the published structure in the same direction on every order but 003. The pattern is a common shortfall in the calculated higher orders, not a composition difference between specimens, so this data does not call for a per-specimen chlorite composition; the published structure remains the better-supported default.

Fitting the iron content anyway bears that out rather than contradicting it. On these two patterns the two-parameter fit of §4.4 reduces the residual by only 1.5 to 1.7 times, drives one specimen to essentially zero octahedral iron — which for a mineral sold as an iron-rich chlorite is not credible — and settles against the lower bound of the crystallite thickness grid. A parameter at its bound is a parameter the measurement has not determined, and three signs of a model straining to fit are worth more than the improvement in the number being minimised. The mechanism is available and is verified against patterns calculated from known compositions, which it recovers; what these measurements do not show is a need for it.

What the chlorite shortfall is not

The chlorites need their 004 raised by about a third against their 002, and their 005 by a fifth to a third. The obvious suspect is a displacement parameter: exp(−B q2) falls with angle, so a B that is too large suppresses the high orders. The exponential is weak here — at 005 of a 14.28 å spacing q2 is 0.031 å−2, so B = 0.65 costs 2 % of an amplitude — but F(00l) is a sum of terms with opposing signs and the high orders are small differences of large numbers, so the sensitivity does not follow from the size of the exponential and has to be computed. Computed, with the 004/002 ratio the quantity to move from 0.62 to 0.83:

Change made to the calculation004/002 reachedVerdict
Octahedral B from 0 to 6 å2 0.63 → 0.57Ruled out; and the wrong way round
Every B in the structure scaled 0 to 6× 0.64 → 0.55Ruled out
Hydroxyl B from 0 to 8 å2 0.62 → 0.63Ruled out
Fe2+ in place of Fe3+0.62 Ruled out
Interlayer hydroxide sheet moved ±0.3 å along c* 0.48 → 0.57Ruled out, and it destroys 001
Crystallite thickness, 4 to 40 layers0.63 → 0.62 Ruled out (it is the 001 control, not the 004 one)
Single-crystal Lorentz factor instead of the powder one1.25 Overshoots, halves 001, and contradicts §A.2
Beam-overflow specimen length 25 → 15 mm0.62 → 0.80 Reaches it — see below

So the displacement parameters cannot do it. The whole range of 004/002 accessible to any B, at any value from zero to six times the published one, is 0.55 to 0.64, and the direction a shortfall needs is exhausted within 2 % of the published value. Neither can the iron valence, the hydroxide sheet's height, or the crystallite thickness.

The one change that reaches 0.83 is not structural at all: the specimen length in the beam-overflow correction (§2.10), which had been assumed at 20 mm rather than measured. At 15 mm the chlorites' 001, 004 and 005 all land within a few per cent. But the cross-check refutes it. The three mounts were prepared the same way, so one length must serve all three, and it does not:

Specimen length assumed12 mm15 mm 16 mm18 mm20 mm25 mm
Kaolinite0.380.220.18 0.090.0650.065
Chlorite A0.220.140.14 0.190.250.26
Chlorite B0.190.060.050 0.140.210.22

Root mean square of obs/calc − 1 over the orders other than the reference, at the crystallite thickness that best fits each row.

Kaolinite wants 20 mm or more and the chlorites want 15–16, and the disagreement is not marginal: at 16 mm kaolinite's residual triples. The reason the two disagree is worth noting, because it says what the parameter is doing. Kaolinite's reference order and the chlorites' both sit at 12.4°, and 20 mm puts full illumination at 12.0° — so at 20 mm and above the correction has stopped acting on any of these ratios at all, which is why kaolinite's residual is flat there. Shortening the specimen brings the reference order back into the overflow region and lifts the higher orders against it. That lifts the chlorites onto their measured values and lifts kaolinite off its own. A parameter that can absorb one discrepancy while creating another is not the cause of either.

So it remains open. What has not been tested: the individual oxygen and hydrogen heights within the chlorite layer, as against the rigid shift of the whole hydroxide sheet tried above; interstratified smectite or vermiculite layers in a natural chlorite, which would add intensity at low angle and redistribute the orders; and a different chlorite structure altogether. The integration window works against the observed excess rather than explaining it — the measured peaks are broader than the calculated ones, so a finite window discards more of the observation than of the calculation, and the true excess is if anything larger than reported.

What this does not cover. Only kaolinite and the two chlorites are single-phase enough to use. Of the other mounts measured, an illite's strongest reflection is quartz rather than illite, two smectites and a saponite carry several per cent of quartz, a bentonite carries opal-CT, and a synthetic hectorite is close to X-ray amorphous. None of those can serve as a reference for a basal ratio until the accompanying phase is either removed or modelled. All the mounts are also air-dried, while the quantitative fit is made on the glycol-solvated mount (§2.1), so nothing here bears on the expandable clays at all.

And the absolute scale. A basal ratio needs no standard, which is why these figures can be given at all. The absolute scale — the kp of §2.13 — needs one, measured through the same optics. A corundum mount measured alongside these was run with a 0.25° divergence slit where the clays had 0.5°, and with a fixed slit the ratio between two such settings is not a constant: where the beam overflows the specimen both slits illuminate the same area and the ratio is 1, where neither overflows it is 2, and the crossover falls between 2θ = 6° and 12° at a place that depends on the specimen length. That is exactly where the diagnostic basal reflections are — glycol-smectite 001 at 5.2°, chlorite 001 at 6.2°, illite 001 at 8.8°, kaolinite 001 at 12.3°. A standard measured through the clays' own optics avoids putting a modelled factor of up to two across the very peaks the calibration is for. That standard has since been measured, on these mounts' own settings, and §A.18 reports what it gives — including a check on the orientation correction that bears directly on the shortfall left open above.

A.18 A standard through the clays' own optics

Reasoning. Everything in §A.14 through §A.17 is either a ratio or a relative proportion. The one number none of them reaches is the absolute one: how much mass a fitted coefficient stands for in an oriented mount, the kp of §2.13. An internal standard cannot supply it, because a spike does not orient as the clays do (§A.15). An external standard can, because it is never asked to: it is measured on its own, and only the instrument is shared. And on a mount of a pure mineral the answer needs no independent analysis at all — the weight fraction is the purity, so (2.28) has a known answer and kp is the amount by which it misses.

Method. A pressed corundum mount was measured under the settings of the pure clay mounts of §A.17, and the agreement is exact rather than approximate — which matters, because the previous corundum available had a 0.25° divergence slit against the clays' 0.5°, and with a fixed slit that is a factor of up to two placed across the diagnostic low-angle peaks:

SettingCorundumThe four clay mounts
2θ range, step count3.008–39.990°, 2214 3.008–39.990°, 2214
Counting time per step19.685 s19.685 s
Divergence / anti-scatter slit0.5° / 0.5° 0.5° / 0.5°
Mask14 mm14 mm
Tube45 kV, 40 mA45 kV, 40 mA

All five measured within ten days on the same configuration. ExternalStandard.comparable_with compares these fields and reports nothing to flag; on the earlier corundum it named the slit difference.

The mass attenuation coefficients that (2.27) and (2.28) need were computed from each structure's mass fractions and checked against published values for the compounds:

Phaseμ/ρ, cm2/g Published
Corundum31.1431.1
Quartz34.4534.4
Calcite74.9474.8
Kaolinite29.77≈ 30
Illite42.12—
Chlorite39.36—

At Cu Kα, from Hubbell & Seltzer (1995). The elemental table stops where its authors' does: an element it does not hold raises rather than being given a plausible value, and the discontinuity across the Cu absorption edge is preserved — iron is 308 cm2/g and nickel, two places further on, is 49, which is not a typographical error but the reason an iron-rich clay and a corundum cannot be compared without this correction.

Result. Each clay mount was fitted with three-dimensional powder patterns of its own mineral spanning the orientation parameter, so that the mount's own hkl-to-basal ratio determines r rather than leaving it free (§A.14). The weight fraction each mount was credited with is its own purity, from the accompanying phases in the same fit.

MountFitted asW μ/ρRwp rr−3 kp
Kaolinitekaolinite0.8629.77 71 %0.162440.245
Chlorite Achlorite0.9739.36 94 %1.001.00.216
Chlorite Bchlorite1.0039.36 94 %0.683.20.281
Illiteillite0.8142.12 86 %0.594.90.247

Corundum standard: Rwp 41 % over the whole range, 33 % over 20–39°, fitted r = 0.99 as a pressed powder should be. K = 2.28 × 104 in the units of (2.27).

Two things in that table are worth separating. The first is the spread: 0.216 to 0.281, mean 0.247, a relative standard deviation of 11 % and a ratio of extremes of 1.30, across four mounts of three chemically different minerals. Texture, microabsorption and structural error are the three things kp lumps together, and all three differ between these minerals — so a factor they share to within 13 % is not mostly any of them. It is a property of the comparison between a settled clay film and a pressed powder, which is what these four mounts have in common and the corundum does not.

The second is a cross-check that falls out of it, and it is the stronger result. The orientation correction r−3 (§2.9) is the largest single factor in an oriented-mount mass, and across these four mounts it ranges over a factor of 244 — from a near-perfectly plated kaolinite at r = 0.16 to a chlorite that behaves as a random powder at r = 1.00. The mass inferred for each depends directly on it. If the r−3 scaling of mass were wrong, four specimens spanning that range could not land on one factor; they land within 1.30. This is the first evidence in the manual that the orientation correction is right in magnitude and not merely in shape, and it comes from data rather than from the model.

What the missing factor of four is not

The calculation over-produces by 1/0.247 ≈ 4 per unit mass in these mounts. The first suspect is specimen thickness, because (2.28) is derived for a specimen thicker than the beam penetrates and a settled clay film need not be. It is refuted twice over.

Refuted by arithmetic: at the packing density of a settled film the penetration depth sinθ/2μ is 3.5 µm at 6° and 20 µm at 35° for illite, so a deposit of 50 µm returns 100 % of the infinite-thickness intensity below 12° and 88 % at 35°, and 100 µm returns 99 % everywhere. The thinness needed to lose three quarters of the intensity is 1.3–2.2 µm depending on packing — below a single kaolinite booklet's worth of stacking, and far below any mount that survives handling.

Refuted by the data, which is the part that settles it: absorption in a thin film is angle-dependent, and in the direction opposite to what is observed. A film thin enough to give 0.25 at the illite 001 returns 0.071 at 35°, so the higher basal orders would come in a factor of 3.5 low against the first. §A.17 measures the higher orders of two chlorites coming in 20–30 % high. A thin film cannot be the explanation of the absolute deficit and be absent from the ratios at the same time, and the ratios are the better measurement of the two.

What remains, and what would distinguish them:

The irradiated length
The beam-overflow correction (§2.10) is applied with an assumed 20 mm of specimen, for both the clays and the corundum. With a fixed 0.5° slit the beam is 20 mm long at 6° and 30 mm at 4°, so a deposit shorter than the pressed standard loses intensity the correction does not restore. This can reach a factor of two, not four, but it is the one candidate that is a measurement rather than a hypothesis: the physical length of a clay mount's deposit along the beam, against the corundum's.
The deposit's mass per unit area
If the mounts are weighed before and after deposition, the mass in the beam is known outright and kp stops being inferred from a purity at all — (2.28) can be replaced by a direct comparison, and the thickness question above is answered by the same number.
A common factor in the basal calculation
Anything that multiplies a whole basal series by one constant per gram, independent of the mineral, is indistinguishable from the above on this data. It would have to leave the ratios of §A.17 untouched, which most candidates do not.

Why r is fixed rather than fitted, restated with numbers

The same four mounts were run a second way, with the library's own interstratified entries at the pure end member — which carry the crystallite-thickness broadening a powder calculation lacks, and fit far better — leaving r free:

MountRwp, powder Rwp, library kp, r fixed kp, r free
Kaolinite71 %71 %0.2450.245
Chlorite A94 %56 %0.2160.391
Chlorite B94 %40 %0.2810.292
Illite86 %54 %0.2470.100
Ratio of extremes 1.303.90

The better-fitting route gives the worse calibration, by a factor of three in spread. That is the r-degeneracy of §A.14 measured rather than argued: a basal-dominated pattern does not determine r, so a fit free to choose it will trade r against scale at no cost in Rwp and carry the trade straight into the mass. A lower residual is not a better calibration, and this is the clearest case of it in the manual. r belongs to the hkl reflections, and a calibration should be made where they are.

What this does not license

kp remains 1 in the code. Four mounts, one preparation, one operator, one instrument and one standard is a result, not a calibration table, and the factor is an instrument constant that no other laboratory could adopt. Beyond that:

What it does establish: the machinery is complete and checked — absorption coefficients against published compounds, the conditions of two measurements compared rather than assumed, the infinite-thickness assumption computed rather than hoped for — and applied to real data it returns one factor, not four unrelated ones. When the glycol and heated mounts are measured, the same three commands give kp for those, and the question of whether it is one factor per preparation or one per mineral will be answerable.

A.19 A second background estimator, and what it changes

Written against the earlier background step, and kept. The reasoning below starts from a design in which one parametric model was fitted to a peak-stripped estimate of the background, which is no longer what the Background tab does (§5.4): it now offers Clayfit's five models, each fitted to the measurement or to rolling-ball anchor points, with the erosion described here as a sixth. Three things in this section are unaffected and are why it is kept. The erosion itself, which is that sixth model, unchanged. Its two parameters and where their starting values are read from, which is still how the tab proposes them. And the argument about Rwp — that it prefers whichever estimate subtracts least and therefore cannot choose between two of them — which is why the status line reports what the subtracted pattern holds between the peaks instead. The measured comparison between the erosion and the stripped estimate is a record of the design it was made in; the comparison that matters now is between the six curves the tab draws together.

Reasoning. In the design this was written for, the background is fitted to a stripped estimate, and §A.11 establishes that the estimate is the background: the components follow it to a few counts, so whatever the estimator decides, the analysis inherits. That makes the estimator the single most consequential choice in the workflow and leaves it untested against anything but itself. A second, independent estimator is the only way to find out how much of the background is measurement and how much is method.

The obvious second choice is the oldest one. Sonneveld & Visser (1975) is the earliest of the iterative-erosion baseline estimators, thirteen years ahead of the SNIP paper and built on the same idea, and its background algorithm (their §3.1) is four lines: take a coarse subsample of the pattern, then repeatedly replace each sample by the mean of its two neighbours wherever it stands more than c above that mean,

mi = (pi+1 + pi−1)/2,    pi ← mi   if pi > mi + c (A.1)

and interpolate the eroded samples back onto the measured grid. A peak is a local maximum and is pulled down pass by pass; a background is not. Their own settings are every twentieth point of a 0.01° film scan, c ≈ 0.02 on the eight-bit scale of their microdensitometer, and about thirty passes.

It is a background component, not an estimator the other components are fitted to. The eroded curve is the background — nothing is fitted to it and there is no degree to choose — which is how HighScore presents it and how ClayQuant offers it, in the same list as the polynomials. Its two parameters carry HighScore's names and defaults so that a setting means the same thing in both:
ParameterPaperHighScoreHere
Granularityevery twentieth pointnumber of intervals, slider 0–50, 15–30 recommended, literature value 200–50, proposed from the scan
Bending factorc = 0.02 of 255slider, 0–100 0–100, proposed at 0
Passesabout 30not exposed30

Granularity is counted in points, as both the paper and HighScore count it, and bending 1 is anchored on the paper's own c, so that 0 is their strictly-linear first form. That anchoring is a choice rather than a conversion: HighScore's slider position is not documented as a multiple of anything, so the same number in both need not give exactly the same curve. Given what the bending factor is measured to do below — almost nothing — that matters less than it sounds. The passes are left at the paper's thirty and not exposed, for the same reason HighScore does not expose them: with the passes fixed, granularity is the single control of how wide a feature is removed.

Does it do what the paper says

Three properties are claimed or implied, and all three hold exactly rather than approximately:

PropertyTestResult
A straight background survives (their Fig. 1a) a line of slope −30 counts/°2 × 10−13 counts
A convex background survivesa/x1.5, the shape of the direct-beam tail0 counts
A curved background survives up to a stated limit a parabola at 1.1 and at 0.5 times the predicted bound kept / eroded

The convex case is the one that matters here, and it holds for the same reason it holds for SNIP (§A.11): where the background is convex, the mean of two neighbours is never below the point itself, so (A.1) cannot fire. The direct-beam tail of an oriented mount is returned untouched by both estimators, which is the property the whole low-angle analysis rests on.

The third row needs a statement the paper does not make. At the fixed point of (A.1) the second difference of the retained background is exactly −2c, so with a sample spacing h

d2p/dx2 ≥ −2c/h2 (A.2)

— c is neither a tolerance nor a smoothing parameter but precisely the largest downward curvature a background is allowed to keep. Two things follow: c scales with the intensity, so it is taken here as a fraction of the range of the sampled data rather than in counts, and it scales with h2, so changing the sampling changes c. (A.2) is verified by switching the retention of a parabola across the predicted bound.

Two things the paper's own description gets wrong for modern data

The reach is diffusive, not linear. Replacing a point by the mean of its neighbours is one explicit step of the diffusion equation, so the passes do not march outwards one sample each. Measured on Gaussian peaks, the width at which half the height is removed is

FWHM = 2.2 · h · √n (A.3)

for n passes, where h is granularity × step. It holds to 2 % from 5 to 120 passes and over a fourfold range of h. The consequences are the practical content of the granularity slider. The paper's twenty points on a 0.01° film scan, at thirty passes, reach about 2.4° — not the 12° a linear reading of the iteration gives, and well matched to the sharp lines of a Guinier camera. The same granularity on this laboratory's 0.0167° step reaches 4.0°, because granularity is counted in points and the points are further apart; that is, as it happens, the stripping width ClayQuant had already settled on independently (§6). Since the number that matters is the one in degrees and the slider is in points, the interface reports the conversion beneath the slider. Unlike SNIP's window the cutoff is soft: a feature of exactly the stated width keeps half its height.

Granularity510 203040
Spacing on a 0.0167° scan0.084°0.167° 0.334°0.501°0.668°
Width half-removed, 30 passes1.0°2.0° 4.0°6.0°8.1°

The bending factor is weak at the bottom of its range, not inert — a correction. An earlier version of this section reported it as inert to 0.03 % of the intensity range, on the strength of a slider running 0 to 4. The range was the error: HighScore's own runs to 100, and over that span the parameter moves a baseline by 2.3 to 12.4 % of the intensity range on real patterns. The first few units really do almost nothing — 0.08 to 0.16 % from 0 to 1, about 0.4 % by 4 — which is why a slider stopping at 4 made it look like a control that did not work, and why it now runs the full distance.

Bending factor1410 2550100
Baseline moved, glycol mount0.16 %0.35 % 1.4 %3.7 %4.3 %5.4 %
Baseline moved, hectorite0.09 %0.52 % 1.3 %2.4 %4.7 %12.4 %
Rwp penalty, worst of 8 mounts0.5 1.54.27.89.3 11.9

Against bending 0, as a percentage of the intensity range; the last row in points of Rwp.

Granularity from 10 to 40 still moves the baseline by 30 %, so it remains the parameter to set first. And which bending value to prefer is settled rather than open: over eight glycol mounts, Rwp is lowest at 0 on every one and rises monotonically to 4.6–11.9 points worse at 100. The reason is (A.2) — a real clay background's downward curvature far exceeds the bound, so raising the allowance cannot help the baseline follow the background; all it does is let the baseline sit higher and take more of the broad basal intensity out. The slider reaches 100 because HighScore's does and because a control should be able to show what it does, not because the upper end is a good place to work.

One implementation question the paper leaves open answers itself. Their loop is in place, so a sample already lowered in this pass is what its right-hand neighbour sees, which makes a pass asymmetric in the direction of travel. Forming every mean from the previous pass instead gives a different answer while the erosion is still relaxing — 2.8 % of the intensity range after one pass — and an identical one from about 21 passes, where the relaxation reaches its fixed point. At the paper's thirty and above the choice does not matter, so the paper's own order is kept.

Against the stripping, on real patterns

Both estimators were asked for the same thing — remove everything narrower than 4°, keep the rest — on all 39 real patterns available. The disagreement is one-sided for practical purposes: over the whole set Sonneveld–Visser lies between 0.18 % of the intensity range below the stripped estimate and 36 % above it. Where it lies depends on the specimen, and systematically:

MountRange, counts Largest difference% of range
Prochlorite517501820.35
Corundum (background batch)8074460.56
Kaolinite448992880.64
Corundum (clay settings)121991711.41
Chlorite68261251.83
Illite69811672.40
Illite (clay settings)22381798.01
Saponite29082488.53
Montmorillonite251729211.59
Hectorite52619611511.62
Laponite6809714.27
Bentonite254136514.35

Sonneveld–Visser minus peak-stripped, both at a 4° width. Median over the twelve single-phase mounts, 5.2 %.

The ordering is not random. The well-crystallised mounts — prochlorite, kaolinite, chlorite, both corundums — agree to under 2 %, because a pattern of sharp peaks on a smooth background is what both estimators were designed for and there is nothing to disagree about. The disagreement is concentrated in the diffuse specimens: the synthetic hectorite that is close to X-ray amorphous, the bentonite carrying opal-CT, the laponite, the smectites. There the two estimators are deciding whether a broad hump is background or signal, and they decide differently. Of the 11.6 % on hectorite, running the erosion on the logarithm rather than on the counts accounts for about a third and the softness of the cutoff for the rest.

What it changes in the answer

That difference does not stay in the background. Eight glycol-solvated mounts were fitted twice, identically except for the estimator:

Mount123 4567 8
Rwp, peak-stripped42.3 44.546.5 47.250.0 72.377.3 78.6
Rwp, Sonneveld–Visser49.8 47.651.050.956.9 85.583.984.7

Per cent. Same library, same model, same 4° width, same fitting range.

The stripping fits better on all eight, by 2 to 13 points. And the phase percentages move with it: the largest change to any one phase's weight percent is a median of 20 percentage points and reaches 38 — on an illite/smectite, a kaolinite or a chlorite/smectite depending on the mount. A change of that size from a choice invisible in the reported table is the finding of this section.

The fair objection is that 4° may simply suit one estimator and not the other, so the width was swept for both:

Width1°2° 3°4°6° 8°12°
Mount 1, Sonneveld–Visser53.053.8 51.849.849.649.6 49.6
Mount 1, peak-stripped51.843.4 42.642.3 42.442.5 42.5
Mount 4, Sonneveld–Visser64.357.0 53.250.949.749.7 49.7
Mount 4, peak-stripped53.948.6 47.847.246.8 46.746.7

Rwp in per cent. At its own best width Sonneveld–Visser still loses on every mount tried, by 2 to 7 points, so the result is not an artefact of the setting. It also saturates above about 6°, which (A.1) explains: the erosion reaches a fixed point beyond which more passes change nothing, so unlike the stripping it has a floor it cannot go below.

Reading the two parameters off the measurement

Neither parameter has a value that is right in general, and the interface therefore proposes both from the glycol-solvated scan when the patterns are loaded — that mount, because it is the one the quantification is made on (§2.1) and the one whose broad interstratified intensity a background most easily eats. The two are settled differently, because only one of them is determined by the data.

Granularity follows from what has to survive. The erosion removes a feature from the baseline once its reach exceeds the feature's width, so the reach has to clear the broadest reflection meant to stay in the signal. That width is measured rather than assumed, and measured with the paper's own remaining two sections: the pattern is stripped generously, the noise of what is left is σnoise from their §3.2, the stretches standing above μ+3σ are their §3.3 peak groups, and the broadest of those is the width to clear — by a factor of two, which comes from (A.3) rather than from taste: at a reach equal to a feature's width half its height is left in the baseline, and at twice the width a few per cent. Two limits are imposed on the answer. It is never below the 4° that eleven mounts supported for the stripping, because a scan in which no broad reflection rises above the noise is not evidence that none is present, and erring upwards leaves background in the signal rather than taking signal out. And it is never above a quarter of the scan, past which the background would be defined by a handful of samples; where that cap binds, the suggestion says so, because a feature that wide cannot be told from background by any local test and the judgement is the analyst's.

Bending was measured, not chosen. Asking the fit which value it prefers is the wrong question for granularity and the right one here. Asked over eight glycol mounts at eight granularities, and again across the whole 0–100 range, Rwp was lowest at bending 0 on every mount, and worse by up to 11.9 points at 100. The reason is (A.2): a real clay background's downward curvature exceeds the bound any bending factor in HighScore's range can grant, so the allowance cannot do the job the paper introduced it for, and all that is left of it is a baseline sitting slightly higher — which on an oriented mount means slightly more of the broad basal intensity taken out as background. So 0 is proposed. This disagrees with the paper's own advice, and deliberately: they introduced c because a film background on a 0–255 scale really was gently curved enough for the bound to bite, which a clay diffractogram is not.

Granularity is deliberately not chosen by fit quality, though it would have been easy to. Swept against a real fit, Rwp falls almost monotonically as granularity rises — on four of the eight mounts the best value was the largest tried — because a lower baseline always lets the fit explain more of the pattern whether or not what was removed was background. It is the same bias that makes the residual of a whole-pattern fit useless as a measure of missing material (§2.13), and a pre-screen built on it would have recommended taking out as much as possible.

What it gives on real data. Over eleven measured patterns the proposal is granularity 20–22 and bending 0, so on these mounts it mostly confirms the default rather than changing it — which is itself worth having, since it says the default is right for this specimen rather than in general. It separates the two mounts carrying a genuinely broad 2.07° feature, where the measurement rather than the floor decides, from the nine where it does not. On synthetic patterns it tracks a planted reflection from 0.2° to 8°, and reports the cap beyond that.

Planted reflection0.2°2° 4°8°12°
Width measured0.20°2.00° 3.96°9.27°not found
Granularity proposed2020 394320
Decided byfloorfloormeasurementcap floor

A 12° feature is a third of a 37° scan, and no local test distinguishes it from background; the pre-screen does not find it and falls back to the floor, which is the safe direction but is a limit worth knowing.

A defect in the noise level had to be fixed before any of this worked, and it is the paper's own algorithm that carries it. Their §3.2 takes σ over everything, peaks included, then rejects above μ+3σ and repeats until σ settles. On a film scan of sharp lines the contamination is small and the loop tightens. On a pattern carrying a broad feature the feature is a fifth of the points, σ comes out inflated by two orders of magnitude, μ+3σ lands above every point in the pattern, and the first pass rejects nothing — whereupon σ not moving satisfies their stopping rule. Measured on an 8° Gaussian standing on noise of 18 counts, the returned level was 2900, with a threshold above the feature's own height, so the feature was reported as noise and could not set a granularity. Seeding the loop from the median and the median absolute deviation instead, which a fifth of the points does not move, returns 24 and finds the feature. The residual third of overestimate is left as it is: a threshold slightly too high is slightly less sensitive, which is the safe direction here.

The noise level that goes with it

Their §3.2 is implemented too, because a background estimate is only half of what the paper's workflow produces: the other half is the level against which a feature of the difference signal counts as real. Take the background-subtracted data, compute its mean and standard deviation, reject everything above μ + 3σ, and repeat until σ settles; what is left is noise, and the paper takes its full range to be 6σ.

The one thing to get right is that the clipping is one-sided, and the paper's step (4) says so explicitly. The contaminating population is the peaks, which lie above the background and nowhere below it, so rejecting symmetrically at |i − μ| > 3σ discards the lower half of the very noise being measured and returns a σ too small. Tested against normal noise of known width contaminated with peaks two hundred times its height, the plain standard deviation is more than ten times too large and the clipped estimate recovers the true value to 10 %. The paper's N ≈ 500 points was a concession to a 1975 computer; all the data is used by default and agrees with a 500-point subsample to 12 %.

Conclusion, and what the second estimator is for

The method is implemented faithfully, passes every property its paper claims for it, and is offered in the interface and on the command line. Peak stripping remains the default, for a measured reason rather than a preference: Sonneveld–Visser puts the baseline higher, and on an oriented clay mount what lies immediately above the baseline is the broad basal intensity of the interstratified phases — the signal being quantified. Taking it out as background is the error §5.4 warns about, arrived at by a different route. It is also the reason the disagreement is largest exactly on the expandable clays, which are the phases the analysis is least able to check by other means.

What the second estimator is genuinely for is the question that prompted it. The difference between two independent estimators, on the same pattern at the same width, is a direct measure of how much of the background is a matter of method. On a well-crystallised mount that measure is under 2 % of the intensity range and the background can be treated as determined. On a diffuse one it is a tenth of the range, and no amount of care with the model will make it better, because the disagreement is about what the background is and not about how to fit it. Any specimen where the two estimators disagree by more than a few per cent is a specimen whose reported percentages carry that disagreement, and running both is now the cheapest way to find out.

A.20 What an over-complete clay library does to the accompanying minerals

Reasoning. A reference library of 1751 patterns fitted over 1795 points is very nearly a square system, and one of 2501 is under-determined outright. A non-negative least squares with as many columns as rows can reproduce almost any measurement, and the question is what it uses to do it. The concern is not abstract: the interstratified series is 1440 of those columns, its patterns are broad, and a broad pattern with a free coefficient can absorb a sharp peak that belongs to something else. If that is happening, the accompanying minerals are being under-fitted not because their structures or their profiles are wrong but because the clay library got there first.

Method. One real glycolated mount, one background, one set of accompanying minerals (quartz, albite, rutile, sekaninaite calculated from the structure database at the measurement's own geometry), fitted twice: once against the whole library, once against a thinned one holding every sixth interstratified entry and four orientations rather than ten — 145 columns instead of 1755. Nothing else differs, so any change in what the accompanying minerals take is the library's freedom and not the specimen's composition.

PhaseShare of the pattern,
full library (1755 columns)
Share of the pattern,
thinned (145 columns)
Ratio
Quartz1.50 %11.24 %7.5×
Albite4.35 %5.65 %1.3×
Rutile1.31 %2.63 %2.0×
I/S50.1 %9.7 %0.19×
Rwp55.0 %69.1 %—

Result. Quartz takes seven and a half times as much of the pattern once the clay library is thinned, and rutile twice as much, while the interstratified series falls to a fifth of what it had. The composition did not change between the two fits; only how much freedom the clays had to explain peaks that are not theirs.

And the residual says the opposite. Rwp is 14 points worse in the fit that gives the more defensible answer. That is the same bias that makes Rwp useless for choosing a background (§A.19), in a different guise: a fit with more free columns explains more of the measurement whether or not the explanation is right, so the residual rewards exactly the freedom that does the damage. A lower Rwp from a larger library is not evidence of a better analysis and should not be read as one.

Conclusion, and what it does not settle. The mechanism is established: an over-complete clay library takes intensity from the accompanying minerals, and the effect on quartz is nearly an order of magnitude. What the experiment does not establish is which of the two answers is closer to the truth, because the thinning was arbitrary — every sixth entry, chosen to change the column count and nothing else. The fix is not a thinner library chosen by hand; it is a fit that cannot spend a clay family on a peak that is not the family's. Clayfit does this by selecting one member per family and fitting its scale, rather than taking a non-negative combination of all of them, and that is the change this points to. Until it is made, read the status line beneath the fit: where it says there are more library entries than points, the split of the pattern between the clays and the accompanying minerals carries this.

A.21 The orientation a smectite is weighed on

Reasoning. The glycolated smectite is the one clay in the library whose every reflection is basal. The March-Dollase factor for a basal series is one constant — r−3 — so the orientation scales the whole pattern without changing its shape. Three things follow, and the third is a defect.

Method and result. The scaling was measured rather than assumed: the same smectite pattern was calculated at r = 1, 0.3 and 0.1 and compared.

rMaximum intensity Ratio to r = 1r−3 Shape after normalising
1.08.039×10711—
0.32.977×10937.03737.037identical to 10−10
0.18.039×10101000.0001000.000identical to 10−10

So a smectite stored at r = 1, fitted beside illite, chlorite and kaolinite that the same fit put at r = 0.1, was weighed on a basis one thousand times heavier than theirs. On one real glycol mount that turned 0.95 % of the scattering into 22.3 % of the clay weight, on a specimen whose air-dried and glycolated scans show no expansion at all. The smectite was not being over-fitted: its coefficient was tiny and its amplitude 0.38 %. It was being over-weighed.

What was changed. The quantifier now puts such a phase on the coefficient-weighted mean r of the clays whose orientation the fit did choose, and says in the results panel that it did and by what factor. The library's own default moved from 1 to 0.1 to match, and the two routes are tested to give the same weight percent, so an old library is corrected and a new one needs no correcting. The assumption does not disappear — the data does not contain this phase's texture and no arithmetic can supply it — but it becomes this smectite has the texture of the other platy clays in this mount, which is measured, rather than one made before the specimen was seen.

What it does not license. A smectite that really is less oriented than the illite beside it will now be understated, in the same proportion. The reason to prefer the new assumption is not that it is always right but that it is the one under which the clay percentages of a single mount can be compared with each other at all: a table mixing one phase on a random-powder basis with five on an oriented one is not a composition.

A.22 Where the instrumental width is measured

Reasoning. A calculated pattern's peak height is set by its width: a profile ten per cent too broad is ten per cent too short, and a fit of scale factors alone cannot recover that. So the width the library is built with has to be the instrument's. The question is where to measure it, and the answer ClayQuant started with was wrong in a way that showed itself as the program warning about its own library.

That version scaled the width model to the narrowest of the pattern's own isolated peaks. On an oriented clay mount the isolated peaks are the clay basal reflections, and those are broad by nature — crystallite thickness and interstratification both widen them, and neither belongs to the diffractometer. The consequence, measured on three real glycol mounts of one instrument:

MountWidth from the raw pattern Width after the backgroundRatio
Mount A, glycol0.278°0.124°2.2×
Mount B, glycol0.099° (default kept)0.077°1.3×
Mount C, glycol0.099° (default kept)0.234°2.4×

One instrument, three mounts, widths from 0.077 to 0.278° — and each mount's own answer changing by a factor of two depending on whether a background had been subtracted first. Since the library is built with whatever the session holds at that moment and the mismatch warning compares it against whatever the session holds later, a width that moves between the two makes the program report a disagreement it created itself. That is what a user saw: a library built from inside the program, with the right goniometer radius, warned about its own peak width.

Method and result. The width is now measured where it is instrumental — on the quartz 101. A detrital quartz grain in a clay separate is large enough that its size broadening is immeasurable, so what its lines show is the machine; this is why quartz is the standard for the purpose. The fit is Clayfit's: a pseudo-Voigt doublet with the K-alpha wavelength separation and the 2:1 intensity ratio held fixed on a local linear background, returning the width of one component. Holding the doublet fixed is not a refinement: a half-height width read off the unresolved pair at 26.6° is the width of the envelope, and on the same synthetic scans it comes out five times too broad.

Tested against synthetic scans built with the doublet at a known component width, the fit recovers it to better than a part in a thousand from 0.06 to 0.35° — a sixfold range:

Imposed0.0600.0800.110 0.1200.1800.2500.350
Recovered0.06000.08000.1100 0.12000.18000.25000.3499

On the nine real mounts the width now comes back identical whether or not a background has been subtracted, to four decimal places, which is the property the defect needed: the library and the check cannot disagree about it any more.

Three things the fit refuses to do, each of which it did once. It does not centre on the nominal angle: with the centre bounded ±0.035° around 26.64°, a scan whose quartz sat 0.04° away pinned the centre on its own bound and the width came back 15 per cent narrow, so the line is located first. It does not search widely for it either: a clay separate is crowded around 26.6° — illite 003 is at 26.9 — and a window of half a degree found a peak 0.30° away on one real mount and fitted that instead, so the window is tight and takes the displacement the load-time screen measures (§5.2). And it does not return a width sitting on either bound: a bound that the data would exceed is worse than no bound, because the fit then reports it as though it had been measured. Where no quartz can be fitted the old route is used, and says so, and a width measured on quartz is never overwritten by one scaled to a clay peak.

A.23 One orientation per composition

Reasoning. The March–Dollase parameter is not an amount, it is the width of a distribution:

P(α; r) = (r2cos2α + sin2α/r)−3/2 (A.4)

gives the density of crystallites whose basal normal lies at α to the specimen normal. At r = 1 it is flat — a random powder — and as r falls it concentrates towards α = 0, but it never stops containing the whole range: an r = 0.5 distribution already holds its share of randomly oriented crystallites. So a fit that takes half a composition at r = 0.5 and half at r = 1 has counted those crystallites twice, once inside the first distribution and once as the second entry, and the mixture is not the March–Dollase distribution of any r at all.

Three things follow, and all three were visible in a real fit:

Method. ClayQuant's library is a grid of 175 compositions at ten orientations each, so the composition is exactly what an entry is once its orientation is set aside: its phase, its host fraction, its crystallite thickness and its layer spacing. Each composition becomes a mutually exclusive family and the fit keeps one orientation from each, by the search of §A.20. Two compositions of one phase stay available — a specimen may hold two illite populations of different spacing, and that is not the same double count — which makes this a weaker restriction than Clayfit's one entry per phase, and the one the physics requires.

Result. On a real glycol mount the unrestricted fit mixed orientations of three compositions at once:

CompositionOrientations the free fit used
I/S 0.98/0.02 N=49.9 d=9.95r = 0.1 and 0.8
illite d=10.02r = 0.1 and 0.7
kaolinite_2Mr = 0.8 and 0.9

With one orientation per composition, none. And the cost is nothing: Rwp goes from 55.80 to 55.82 % on that mount and from 68.50 to 68.53 % on another, so the freedom that was physically wrong was also buying no fit. What it was buying was a reported orientation, and a weight percent, that meant nothing.

Making it affordable. One family per composition is 176 families of ten members, and the search — a non-negative least squares over 180 columns for each of 25 000 candidates — took four minutes. A screening fit fixes it: one unrestricted solve, which costs 0.3 s, and only the families that took a coefficient in it go into the search. That leaves about fifteen and takes two seconds. Clayfit's own search anticipates this, taking a screening fit's answer as a starting candidate per family.

A.24 Why the air-dried mount is not fitted

The reason glycol solvation exists. An air-dried smectite interlayer is not one thing. It holds zero, one, two or three layers of water — roughly 9.6, 12.4, 15 and 18 Å — depending on the exchangeable cation and on the humidity of the room, and a real specimen carries several of those states at once, interstratified within single crystallites. There is no single air-dried structure to calculate. Ethylene glycol solvation exists precisely to remove that variability: it drives the interlayer to a reproducible two-layer complex near 16.9 Å whatever the cation, and that is what makes the glycolated mount the one a pattern can be calculated for at all.

Every clay pattern ClayQuant calculates is therefore a pattern of the glycolated mount — the smectite is Reynolds' (1965) ethylene glycol–montmorillonite complex, and so is the smectite inside every I/S and C/S built from it. PatternLibrary.for_treatment accepts only "glycol" and refuses the other two mounts by name, because a refusal that says why is worth more than a fit that is quietly wrong:

A.25 The air-dried mount as evidence of movement

What the air-dried mount is for. It is not a second pattern to fit; it is the measurement of whether the basal reflections moved. That is the classical test and it needs no structure at all: a clay whose 001 does not move on glycolation is not expandable, whatever hydration state its interlayer would have been in. shift_evidence reads it off the two scans directly.

Method. The peaks of each mount are found by prominence above the local noise — Clayfit's criterion, §A.19 — over 4 to 16 °2θ, which is where expansion shows: a glycolated smectite 001 at 5.2 °, an illite-rich I/S moving its 10 Å 001 and 5 Å 002, a chlorite/smectite moving its 14 Å 001. Each glycol peak is matched to at most one air-dried peak, positions are refined by a parabola through the maximum, and the quartz lines — which no treatment moves — give both the systematic offset between the mounts and the scatter that offset is known to.

Four details each fix a way the test gave a false positive, and all four were found on real specimens whose mounts are the same pattern:

Without itWhat it reported
one-to-one matchinga shoulder with no air-dried partner matched to its neighbour: 0.15 ° of "movement"
prominence, not heightnoise on a background passed a 5 % floor: a 17 Å smectite 001 that is not there
a signal-to-noise floortwo noise maxima 0.2 ° apart, one per mount, matched to each other
per-peak placementa weak broad peak compared against a sharp one's precision

A reflection is reported as having appeared on glycolation only when the air-dried mount is missing the intensity, not merely the local maximum — the two mounts are separate preparations and rarely carry the same amount of material — and both scans are searched with one threshold, scaled onto each, so that a peak straddling it is not reported as new.

The constraint. The measurement becomes a ceiling, by an argument about spacings that uses no air-dried structure. An interstratified stack's basal reflections lie between those of its two layer types (Méring), so a stack carrying a fraction x of expandable layers moves its 001 by about x(16.86 − sair) on glycolation. The least that can be, over the hydration states an air-dried smectite actually takes, is at sair = 15 Å. A specimen whose reflections did not move by more than m can therefore carry at most x = m/(0.88 × 1.86) expandable layers, and entries above that are left out of the fit. When movement is seen the bound is not applied: the evidence then says expandable clay is present and the fit says how much.

Result. On four real mounts:

Specimenlargest displacementverdict
M_26_10410.010 °nothing moved
M_26_10420.004 °nothing moved
DBB_20_PW0.018 °nothing moved
DBB_17—one reflection at 6.46 Å appears on glycolation

against 0.017 ° of disagreement between mounts on the quartz lines. On M_26_1041 the ceiling is 2.0 % expandable layers, 1351 of the library's 1531 expandable entries are excluded, and the answer becomes chlorite 46.7 %, illite 30.4 %, kaolinite_1M 16.6 % and kaolinite_2M 6.3 % with no expandable clay at all, at a cost of 0.4 points of Rwp. Unrestrained the same fit puts 1 % of the clay into an I/S, which the two mounts give no evidence for.

What would defeat it. A three-water-layer smectite near 18 Å moves barely at all on glycolation. It needs a divalent cation and a humid room, it is rare in a routine air-dried mount, and nothing here would detect it. That is a limit of the evidence rather than of the arithmetic, which is why the ceiling is reported in the fit's own status rather than applied silently.

A.26 The width of a clay peak

Reasoning. A reference pattern that is the wrong width is the wrong height as well, and the fit has no way to say so: it scales the pattern until the peak tops agree and the area is then short, or it matches the area and overshoots the top. Either way the coefficient is wrong, and the coefficient is what the weight percent is made of.

Until now the discrete phases — illite, chlorite and the two kaolinites, calculated as three-dimensional powder patterns — carried the instrumental width and nothing else. On one real glycol mount, measured on a 240 mm goniometer through a 0.5 ° divergence slit, the instrumental FWHM near 12 ° is 0.051 ° and the clay basal reflections are these:

Reflection2θmeasured FWHM÷ instrument
chlorite 0016.24 °0.125 °2.4
illite 0018.88 °0.093 °1.8
kaolinite 001 + chlorite 00212.51 °0.117 °2.3
illite 00217.81 °0.131 °2.6

A factor of two to two and a half is not a detail of the profile shape. The specimen is doing the broadening, and there are two ways it can: a finite number of layers per crystallite, which broadens as 1/cos θ, and a spread of layer spacings within one crystallite — microstrain — which through the Bragg law broadens as

FWHMstrain(θ) = e tan θ (A.5)

The first is already in ClayQuant for the interstratified patterns, where the crystallite thickness distribution of §A.7 sets the basal width and the fit chooses among N = 5, 15 and 50 layers. The second was not there at all.

Method. PeakShape gains a strain term, added in quadrature to the instrumental and size contributions, with e stated as the FWHM in degrees at tan θ = 1 — the convention of TOPAS's Strain_L macro, so that a value refined there can be carried over unchanged. The library gains an axis in it, spanning 0, 0.25, 0.5, 0.75 and 1.0. An entry at zero strain keeps its old name, so nothing that referred to one stops matching, and the strain chosen is reported in the name of the entry the fit picks (kaolinite_1M PO=1 e=1).

Orientation and strain are both chosen rather than mixed: the family of §A.23 now sets aside both, so the fit takes one orientation and one strain per composition. Mixing two strains does not corrupt the weight percent the way mixing two orientations does — broadening conserves area — but five entries of one composition differing only in width can approximate any peak shape at all, and the width that comes out is then the width of nothing while the wings are free to take intensity from the phases next door. One per composition keeps it a measurement, and in the same form a refinement gives it.

Result. On the mount above, which has an independent TOPAS refinement to answer against, giving the axis to more phases always lowers Rwp and does not always improve the answer. Shares are of the clay:

Strain axis onRwpchloritekaoliniteillite
nothing (as before)52.03 %49.1 %22.0 %28.9 %
the kaolinites51.30 %37.8 %34.7 %27.5 %
every discrete clay50.78 %28.9 %28.2 %42.9 %
every discrete clay, to e = 1.550.32 %20.0 %31.2 %48.8 %
TOPAS refinement of the same mount—65.0 %30.3 %4.7 %

So the axis goes to the kaolinites and to nothing else by default. That is not a fit to this one table: it is the rule the table confirms. Illite and chlorite already have a width axis through the interstratified series, which reaches the discrete end member at a host fraction of 1.00; the kaolinites have no such series and so had no width axis at all. Giving illite and chlorite a second one lets the discrete entries outcompete the interstratified ones and takes the illite share from 27 to 43 % of the clay where the refinement says 5 %. Spanning them is one argument away for anyone whose own standards call for it.

Both kaolinites choose the top of the range, e = 1.0, which is where the TOPAS refinement of the same specimen also puts Kaolinite2M — at its own bound of 1. At the kaolinite 001 that is 0.110 ° of broadening, which with the instrument gives 0.121 ° against the 0.117 ° measured.

What it does not settle. Whether that width is strain or crystallite size. The two are told apart by their angular dependence, and the illite basal series says the truth is between them: from 001 to 002 the measured width grows by a factor of 1.41, where pure size broadening predicts 1.01 and pure strain 2.01. For the kaolinites the question cannot be put at all on these mounts — the 001 overlaps the chlorite 002 and the 002 is not resolved — so this axis buys the width, not its cause. A size axis for the discrete phases is the complementary half, and is not in yet.

A.27 Making an expandable clay justify itself

Reasoning. A non-negative least squares has no way to ask whether a phase it used is really there. It has one question - does this column reduce the weighted residual - and a broad interstratified pattern can reduce it for a reason that has nothing to do with the specimen containing expandable clay: the pattern overlaps a strong reflection, a little of it improves that reflection, and the same coefficient then predicts a low-angle reflection which the measurement does not contain. The residual is content, because the gain sits where the counts are and the loss sits where they are not. But that low-angle reflection is the whole evidence for the expandable clay, and a fit which predicts it without its being there has reported a phase it has not seen.

This is Clayfit's screen_isr_diagnostic_peaks, and the test is worth stating exactly because a weaker version of it does not work.

Method. Every entry which carries expandable layers and took a coefficient is made to justify its own diagnostic reflection:

Entries that fail are removed and everything is fitted again, until the decision is stable. The windows are I/S 8.75–10.40 °, which is Clayfit's, and smectite_EG 4.80–6.00 °, its own 001 at 16.9 Å. C/S has none and is left alone, as it is in Clayfit: no equally sharp band has been established for it, and a window chosen by guesswork is worse than no window.

Result. On M_26_1041 the fit selected one expandable entry, I/S 0.98/0.02 PO=0.4 N=5 d=10.02, at 2.98 % of the clay. Its diagnostic order at 10.14 ° would stand 0.4 counts above the fitted pattern where the measurement can distinguish 20, so nothing in the data says those expandable layers are there. It was removed, and Rwp did not change at all - 51.21 % before and after. The entry was buying nothing; it was being reported for free.

An entry too weak to be seen is also removed, and that is a decision rather than an accident. When the diagnostic a phase predicts lies below what the measurement could show, the data neither confirms nor denies it, and this reports the phase only when its evidence is present - the same rule the air-dried mount is read by (§A.25).

What it depends on. The background beneath the diagnostic band. A background left a few per cent high puts a pedestal under the window which the matched filter reads as support, and the screen then keeps an entry it should drop. On synthetic scans with the background estimated rather than known, a pedestal of 40 counts under a 20-count threshold was enough to do it. The screen is no better than what is subtracted beneath it.

A.28 Refining the layer spacing, and why it is left off

Reasoning. The library spans the layer spacing on a grid - four values per host - and a specimen's spacing is not on the grid. A pattern calculated at 10.02 Å fitted to a specimen at 9.97 Å is wrong by 0.09 ° at the 002, most of a peak width, and a non-negative fit answers a peak in the wrong place by taking less of that pattern and making up the difference from whatever else has intensity nearby. That is how a mis-set spacing becomes a mis-stated phase. Clayfit refines one linked Bragg scale per family instead, within ±2 %, which covers the space between the grid points continuously.

Method. Clayfit's bragg_resample_profile: every spacing is multiplied by one factor and every reflection follows Bragg's law, so the pattern is resampled where sin θold = s sin θnew. Peak heights are preserved, which keeps the library's unit-maximum normalisation and so the mass behind a coefficient. The orientation search and the scales are refined alternately rather than jointly - the search runs, then the scales of what it chose are refined by a bounded Powell step with the coefficients re-solved at every trial, then the search runs again on the moved patterns - which avoids the Cartesian product of every orientation and a dense grid of scales while staying deterministic.

One scale per phase, not per family. A specimen has one illite, whose layers are the spacing they are; the library divides that illite into families by crystallite thickness and by which grid spacing it was calculated at, and refining those separately refines twenty numbers where there are five things to measure. At twenty scales the two kaolinites moved to opposite bounds and straddled the chlorite 002 between them.

Result. It fits better at every setting, and it answers worse. On M_26_1041, against the TOPAS refinement of the same specimen, as percentages of the seven phases:

SpacingRwpQuartzChlorite KaoliniteAlbiteRutileIllite
as calculated51.21 %31.919.920.58.0 5.414.5
refined ±0.25 %47.81 %32.411.022.9 8.05.220.5
refined ±0.5 %46.63 %29.617.320.2 7.24.720.9
refined ±1 %45.15 %28.613.924.3 6.04.223.2
refined ±2 %45.08 %26.811.323.7 5.94.028.3
TOPAS refinement—51.8 25.011.76.1 3.31.8

Six points of Rwp, and chlorite falls from 19.9 to 11.3 against a reference value of 25.0 while kaolinite and illite rise away from theirs. The cause is identifiable rather than mysterious: kaolinite_1M goes to its lower bound at every setting, which moves its 001 from 12.36 towards 12.50 ° - onto the chlorite 002. The freedom is not being spent on finding kaolinite's spacing. It is being spent covering an error in the calculated relative intensities, by moving a phase onto a neighbour's peak, and the rest of the kaolinite pattern is not right enough to object.

So it is implemented and left off. The interface offers it at ±0.5, 1 and 2 % and calculates without it by default. It is the right thing to do to a reference pattern whose intensities are trustworthy, and the honest reading of this table is that these are not yet, which is an argument about the reference patterns and not about the refinement. A controlled test confirms the machinery itself: a library at 10.00 Å fitted to a specimen at 10.06 Å recovers the scale to 0.03 Å and fits better than the grid alone.

Two further things the table shows and should not be lost. Albite and rutile move towards the refinement at every step - 8.0 to 5.9 against 6.1, and 5.4 to 4.0 against 3.3 - so what the clays stop stealing goes to the right place. And the chlorite column is not monotonic: 19.9, 11.0, 17.3, 13.9, 11.3. The alternating search is landing in different local minima at different bounds, which is its own reason not to run it yet.

A.29 The cell allowance in the triplet screen

Reasoning. The triplet screen reports a phase when its calculated lines are found at stable positions in all three mounts. It was also allowed to scale each candidate's whole pattern coherently by up to 2 % of its cell and take the best scaling, on the argument - which is true - that most accompanying minerals are solid solutions whose cell differs from the database entry, and that scaling the pattern coherently is the right shape of freedom, far better than a per-line window of the same size (§A.6). Clayfit allows none.

Result. On M_26_1041's three mounts against 209 candidate structures:

Cell allowancePhases reportedQuartzAlbiteRutile
none (Clayfit's)111st2nd3rd
±0.2 %301st2nd4th
±0.5 %421st2nd4th
±1 %631st3rd7th
±2 %651st3rd6th

With no allowance the three phases reported first are the three the specimen contains, and the eight below them - bayerite, a lead thiosulfate, otavite - are recognisably noise. At 2 % they are buried under cotunnite, litharge and qusongite, and sixty-five phases are reported where eleven were. The allowance never recovers sekaninaite, the one solid solution the specimen actually holds: that phase is found by the competitive fit instead, at 40 % coverage.

Why the argument for it fails here even though it is sound in itself. This screen matches two hundred candidates against one set of peaks, so the candidates outnumber the evidence, and any freedom given to all of them is used by the wrong ones more often than by the right ones - there are simply more wrong ones. The freedom is not mis-shaped, it is unaffordable. The interface still offers it, starting at zero, for when a particular solid solution is suspected and can be asked about deliberately.

That is the third measurement in this appendix with the same shape: microstrain beyond the kaolinites (§A.26), the refined layer spacing (§A.28), and this. Each time the extra freedom improved the number being minimised and moved the answer away from an independent determination of it.

A.30 Choosing the crystallite thickness second

Reasoning. Clayfit settles the orientation with every interstratified pattern held at one crystallite thickness, and only then offers each chosen composition its other thicknesses, as a second exclusive family with everything else fixed. Its own comment says what for: keeping the thickness as a second, linear stage stops a much larger joint coordinate search from moving an otherwise better orientation solution. The argument is about how a coordinate search fails rather than about the physics - spanning composition, orientation, layer spacing and thickness at once multiplies the families, and the sweeps then move one family at a time through a space whose good solutions are narrow.

Result. On M_26_1041, as percentages of the seven phases:

SearchRwpQuartzChlorite KaoliniteAlbiteRutileIlliteTime
jointly51.21 %31.919.920.58.0 5.414.56 s
thickness second51.81 %32.121.120.87.9 5.312.82 s
TOPAS refinement—51.8 25.011.76.1 3.31.8—

Half a point of Rwp worse, chlorite and illite each about a point closer to the refinement, the rest unmoved, and three times faster - despite fitting more combinations, 3134 against 2614, because the second stage's design matrix is small. Neither search is better on this evidence, which is worth saying plainly rather than picking a winner: the differences are smaller than the disagreements that remain with the refinement, and one mount cannot separate them. So it is offered in the interface beside the joint search rather than replacing it, and the joint search stays the default.

The one thing the staged search does that is not neutral: it moves clay from illite to interstratified illite/smectite - 23.5 to 12.4 % of the clay for illite, 3.0 to 10.9 % for I/S. On this specimen the air-dried mount says there is no expandable clay, so that is a move in the wrong direction, and the diagnostic screen of §A.27 removes it again. Two stages and that screen belong together.

A.31 Nothing at 7.15 Å is not kaolinite

Reasoning. The collapse test measured whatever was in its window and asked no questions. After a baseline is removed the tallest point in any window is positive, and the area integrated only the points above zero, so an empty window had a positive area by construction and could never be absent. A window holding nothing but noise therefore reported a fraction of its area collapsing on heating, and that fraction was reported as kaolinite.

Method. A reflection now has to stand clear of the background, and three things had to be got right before the threshold worked at all:

Result. Nine near-pure clay standards, each prepared as the three mounts by the same procedure, put the empty windows at 0.9 to 5.4 standard errors and the real reflections at 700 to 7900 - four decades of separation, against a threshold of 5.3.

And then the standards found a second thing, which is not about noise. The test reads the intensity lost on heating as kaolinite and what remains as chlorite 002, on the premise that a chlorite 002 survives. It does not survive intact. On the two chlorite standards, neither of which contains kaolinite, the 7.15 Å area after 1.5 h at 550 °C was 32 % of the air-dried area for the clinochloritic Chlorite and 72 % for the iron-rich Prochlorite - a factor of 2.2 between two chlorites, so no single correction serves both.

So on a chlorite-bearing specimen the test cannot report a kaolinite percentage, only a range. With A the air-dried area, H the heated one and f the chlorite survival, the chlorite accounts for H/f of A and the kaolinite lies between 1 − H/(0.32A) and 1 − H/(0.72A). Kaolinite is reported as present only when the lower bound clears 10 %, which is to say only when no chlorite 002 could have accounted for the loss.

Standard7.15 Å airKaoliniteVerdict
Kaolinite (1)898σ100 % present; the peak wholly disappeared, so no chlorite under it
Kaolinite (2)1529σ92–97 % present
Dickite7932σ25–67 % present, and see below
Chlorite720σ0–55 % not established; chlorite indicated ✓
Prochlorite4697σ0 % not established; chlorite indicated ✓
Illite0.9σ— nothing there ✓
Montmorillonite (1)1.4σ— nothing there ✓
Montmorillonite (2)5.4σ100 % a trace just over the threshold, which wholly collapses
Sepiolite4.3σ— nothing there ✓

Before this, four of these nine - the illite, both montmorillonites and the sepiolite - were reported as containing kaolinite, and the two chlorites as 68 % and 28 % kaolinite. Eight of the nine now answer correctly.

The ninth is worth its own sentence. Dickite is a kaolin-group mineral and contains no chlorite, yet a quarter of its 7.15 Å peak survives the heating and the test reports chlorite. Dickite dehydroxylates above 550 °C, higher than kaolinite, so at this temperature it is only partly destroyed - and a partly destroyed kaolin is indistinguishable here from a chlorite that partly survived. The test cannot tell them apart and should not be asked to.

A.32 Nine pure standards, and what they found

Nine near-pure clay standards - two chlorites, two kaolinites, a dickite, an illite, two montmorillonites and a sepiolite - were prepared as the three mounts by the same procedure and fitted. A standard that is one mineral should be reported as one mineral, so each row of the following is a direct measurement of what the program gets wrong. Shares are of the clay; the figure in bold should be 100.

StandardKaoliniteIlliteChloriteSmectite Rwp
Kaolinite (1)74.914.2 10.80.163 %
Kaolinite (2)78.719.1 2.2—61 %
Dickite85.01.4 13.6—95 %
Illite—90.5 9.6—71 %
Chlorite71.00.9 28.2—49 %
Prochlorite72.70.3 27.1—79 %
Montmorillonite (1)—8.3 2.889.070 %
Montmorillonite (2)—80.9 3.815.478 %
Sepiolite (not in the library)— 94.05.90.1 88 %

Illite and one montmorillonite are nearly right. The kaolinites are acceptable. Both chlorites are catastrophic - 27 and 28 % where they should be 100, with 71 and 73 % handed to kaolinite - and the two are chemically different chlorites, so it is not a property of one specimen.

The cause is not the fit. On the chlorite standard the chlorite patterns took 82 % of the scattering and the kaolinite 16 %, which is very nearly the right answer. The weights inverted it, and the reason is in one column of the contributing-patterns table: the fit put chlorite at r = 0.1 and kaolinite at r = 1. A basal series is enhanced as r−3 (§A.21), so the chlorite entry is calculated to scatter about a thousand times more per gram than the kaolinite one, and 16 % of the scattering becomes 78 % of the mass.

That freedom is not physical. The clays of one mount were settled out of one suspension and dried on one glass plate; they are not oriented differently by a factor of a thousand. Tying every clay to one orientation, searched over the library's own grid, gives:

StandardFree orientation per phaseOne orientation for the mount r
Chlorite28.2 % chlorite 89.7 %0.3
Prochlorite27.1 % chlorite 70.5 %0.4
Illite90.5 % illite 100.0 %0.3
Montmorillonite (1)89.0 % smectite 100.0 %0.1
Kaolinite (2)78.7 % kaolinite 55.2 %0.4

Four of five move towards the mineral the specimen is, and on the chlorite standard the restriction improves the fit - Rwp 46.7 against 48.9 % - so the freedom was buying nothing but a wrong answer. On all five standards r = 1, a random powder, fitted worst by 15 to 45 points, which is what an oriented mount should say.

But it is not the default, because on the one real mixture with an independent refinement the same restriction moves quartz from 31.9 to 44.9 % against a reference 51.8 - much better - and takes the kaolinite from 20.5 to 0.2 % against 11.7, and the illite from 14.3 to 28.0 against 1.8. The restriction is right and it exposes what it was previously papering over: with the orientation no longer free to absorb an error in the calculated pattern shapes, the fit drops phases instead. Which brings this appendix to the thing the standards measure most usefully.

A.33 The calculated basal intensities, against measured ones

Each pure standard is a direct measurement of one phase's basal series, and the mount's texture does not enter the ratios: a March–Dollase factor multiplies every basal reflection of a series by the same constant (§A.23), so an integrated ratio within one series is a property of the structure and the optics alone. Measured against what ClayQuant calculates:

RatioMeasuredCalculatedCalculated / measured
Illite 002/0010.1560.473 3.0
Illite 003/0010.4420.816 1.8
Kaolinite 002/001 (three standards)0.394, 0.506, 0.629 0.6651.1–1.7
Chlorite 002/001 (two standards)1.874, 2.298 1.7950.78–0.96
Chlorite 003/0010.791, 1.3571.229 0.91–1.55
Chlorite 004/0011.142, 1.7011.197 0.70–1.05

The illite 002 is three times too strong, which is the largest single error in the reference patterns and had been an open question since §A.17. The chlorite even orders are too weak, by up to a quarter, which is the direction that invites kaolinite - whose only two reflections sit at 12.36 and 24.85 °, within a peak width of the chlorite 002 at 12.46 and 004 at 25.06 - to fill them in.

The chlorite iron axis was on the wrong sheet. Chlorite's 001 comes from the contrast between the 2:1 layer and the hydroxide sheet and its even orders from their sum, so iron in the 2:1 sheet raises the contrast and lowers the even orders relative to the 001: the library's series took 002/001 from 1.80 down to 0.74 across its four iron contents, away from both standards. Iron in the hydroxide sheet raises them, and finely - 1.93 at 0.01 of an atom, 2.20 at 0.03, 2.52 at 0.05 - because the 001 passes through zero where the two sheets scatter alike, which is why that ratio is so sensitive. The prochlorite's 002, 003 and 004 are all matched to within 15 % at one value, about 0.035; the chlorite's 002 and 004 at about 0.006. Whether that is literally iron or the hydroxide sheet's position or occupancy, one parameter describes both standards and the published structure describes neither.

Supplying that axis is not on its own enough - grafted onto the library it moved the chlorite share by a point - because the orientation freedom of §A.32 was doing the damage. The two findings are one piece of work: constrain the orientation, and correct the basal intensities the constraint then exposes.

A.34 Kaolinite measured against the chlorite, without heating anything

Reasoning. Both windows kaolinite occupies are shared with chlorite: its 001 at 12.36 ° against the chlorite 002 at 12.46, its 002 at 24.85 against the chlorite 004 at 25.06, each pair within a peak width. Neither window can be read alone, and the classical remedy - heat the specimen and call what disappears kaolinite - turns out to be the weaker one.

What heating actually does to a chlorite, measured on two chlorite standards neither of which contains kaolinite, after 1.5 h at 550 °C:

Standard002/001 air002/001 heated001 heated / 001 air
Chlorite1.8620.168 3.51
Prochlorite2.2890.752 2.18

Heating does not simply weaken a chlorite. The hydroxide sheet dehydroxylates, which raises the contrast between the two sheets and lowers their sum, so the 001 - a contrast reflection - grows by two to three and a half times while the even orders collapse. The surviving 002/001 differs by a factor of 4.5 between two chlorites, and nothing can be bounded with that. The air-dried ratio differs by 1.23.

Method. Chlorite's 001 at 6.22 ° and its 003 at 18.73 ° are reflections kaolinite does not have at all. Each of them, times a ratio measured on the standards, is the chlorite's share of an overlapped window, and the rest is kaolinite - from the air-dried mount alone, with no heating:

Windowper chlorite 001per chlorite 003
7.15 Å1.862 – 2.289 1.691 – 2.360
3.58 Å1.133 – 1.696 1.253 – 1.436

Four estimates follow, two windows times two references, and they are reported together. Where they agree the answer is measured; where they do not, the disagreement is the uncertainty and the interface says so rather than averaging it away. A chlorite reflection below the noise is not treated as absent either: it bounds the chlorite at what a reflection at the detection limit would have accounted for, which is what lets a pure kaolinite - having no chlorite reflection at all - be answered at all.

Result. On the nine standards and on a real mixture:

SpecimenKaolinite, share of the overlapped intensityVerdict
Kaolinite (1)99–100 %present ✓
Kaolinite (2)99–100 %present ✓
Dickite100 %present ✓
Chlorite0–34 %not established ✓
Prochlorite0–34 %not established ✓
Illite, montmorillonite, sepiolite—nothing above the noise in either window ✓
M_26_10410–72 %the two references disagree

All nine standards answer correctly, and no chlorite is called kaolinite. The upper bound of 34 % on a pure chlorite is the method's honest resolution with two standards to calibrate it - it comes from the 003 route, the one the standards did not define - and more chlorite standards would narrow it.

On M_26_1041 the two references disagree: via the chlorite 003 the kaolinite is 24 to 46 % of the overlapped intensity, and via the 001 it is zero, the 001 being large enough to account for the whole 7.15 Å peak by itself. A TOPAS refinement of that specimen finds 11.7 wt % kaolinite, so the 003 route is the right one there and the 001 is being over-measured - which is what one would expect of a reflection sitting on the steepest part of the low-angle air scatter. The program reports the envelope and names the disagreement; it does not choose.

In the interface. Both windows are adjustable out to 27 and 30 °, the two chlorite reference windows are drawn on the plot, and each of the two diagnostics has its own checkbox for whether the fit should be restrained by it - the expandable one on, the kaolinite one off, because the kaolinite bound is new and should be read before it is trusted. With it on and the evidence unable to establish kaolinite, the kaolinite entries are left out of the fit, which is the same shape of restriction as the air-dried ceiling on the expandable clays (§A.25). The zero error can also be typed rather than dragged, in steps of 0.01 °, and the expandable comparison takes its own pair of shifts: a separate with no quartz has no line to set the zero error from, and a pattern displaced as a whole otherwise reads as a shift that is not there.

A.35 The illite is not a muscovite, and carries iron

The discrepancy. The largest remaining error in the calculated reference patterns was the illite basal series. Measured on the illite standard, air dried, the three orders are 1 : 0.164 : 0.477. The published structure - ICSD 90144, Gualtieri 2000 - calculates 1 : 0.507 : 0.868: the 5 Å order three times too strong and the 3.33 Å order nearly twice. That is not a small error in a pattern that is fitted against chlorite and kaolinite over the same range, and it is the reason illite came out at 26 % of the clay on M_26_1041 where the independent refinement says 4.7.

The first cause: the interlayer is full. The CIF carries K1 K1+ 4 e 0 0.0901 0.25 0.075 1. - potassium at full occupancy, which is a muscovite. An illite is defined by having less, 0.75 to 0.9 of an atom per O10(OH)2, and the deficit is not a detail of the composition: the K sits at z = 1/4 of a two-layer cell, exactly between the layers, so its phase factor alternates from order to order. Scanning the occupancy:

K occupancy002/001003/001
1.00 (published)0.5070.868
0.900.4900.774
0.800.4750.698
0.700.4620.634
0.600.4490.581
measured0.164 0.477

The potassium corrects most of the 3.33 Å order and almost none of the 5 Å one. Taken to 0.6 - already below any illite - it leaves the 5 Å order 2.7 times too strong. So it is a real error and not the error.

What it is not. Every other parameter the calculation has was moved across its plausible range, at K = 0.8, to see whether any of them could take the 5 Å order down by a factor of three:

VariedRange002/001003/001
mean crystallite thickness4 to 60 layers0.386 → 0.551 0.543 → 0.826
microstrain0 to 0.6 °0.475 → 0.473 0.698 → 0.689
irradiated specimen length10 to 35 mm 0.695 → 0.3391.395 → 0.498
layer spacing9.98 to 10.20 Å0.417 → 0.844 0.658 → 0.908
height of the potassium±0.01 in z0.475 → 0.626 0.698 → 2.163

Microstrain does nothing to a ratio of areas, as it should not. Thickness and layer spacing move both orders together and cannot separate them. Displacing the potassium moves them the wrong way, in both directions, because it is already at the symmetric position. Specimen length matters a great deal - the beam overflows a 20 mm mount at 8.8 ° and not at 17.7 - and at the correct 35 mm it brings the 3.33 Å order to 0.498 against 0.477 measured, which is right; but it still leaves 002/001 at 0.339, twice the measurement. Nothing in the instrument or the crystallite does it.

The second cause: octahedral iron. An illite carries Fe(3+) for Al in the octahedral sheet, 0.05 to 0.2 of the site. That sheet lies at the middle of the 2:1 layer - the plane the layer is nearly symmetric about - and adding an atom with three times aluminium's electrons there reweights the series, hardest on the order the potassium barely touched:

octahedral Fe002/001003/001
0.000.3610.617
0.100.2190.529
0.150.1700.493
0.200.1310.462
measured0.164 0.477

At 0.15 of iron the calculated series is 1 : 0.170 : 0.493 against 1 : 0.164 : 0.477 measured - within 4 % on the 5 Å order and 3 % on the 3.33 Å one, from a structure and no fitted intensity. The discrepancy is closed.

What the library does with it. Neither substitution is known in advance for a given specimen, any more than a chlorite's iron is, so both are spanned and the fit chooses, exactly as for the chlorite octahedra (§A.20). Four compositions are calculated, as (interlayer K, octahedral Fe): (1.0, 0) - the published structure, which keeps its plain name so that nothing already written down stops matching - (1.0, 0.15), (0.9, 0.075) and (0.8, 0.15). They span the published structure, each substitution alone at the value that fits, and the chemically ordinary illite between them. The entry the fit selects reports its pair, so the result says which illite it found.

The interstratified host too. The illite/smectite series is built on an illite layer, and it would be wrong to correct the discrete illite and leave that host a muscovite: the host would be systematically brighter at 5 Å than the discrete illite beside it, and the split between the two - the one number an illite/smectite analysis is really for - would absorb the difference. The host takes one composition rather than an axis, because the series already spans fifteen compositions times ten orientations times three crystallite sizes times four layer spacings and a fourth axis would multiply eighteen hundred entries by four for a distinction the fit cannot make anyway; an illite/smectite is identified by where its interstratification orders fall, not by the relative heights of its host's basal series. The default is the composition that reproduces a measured illite.

At the command line. Both are settable, for an illite measured on your own specimens:

clayquant-build-library --illite-composition 1/0,0.9/0.15 --illite-smectite-host 0.9/0.15

Each pair is (interlayer potassium)/(octahedral iron). --illite-smectite-host published uses the CIF as it stands. The cell mass follows the substitutions, so the weight percent is consistent with whichever composition the fit chooses, exactly as for the chlorite.

The potassium is bounded by the mineralogy, not by the fit. Fitted freely, the measured series is matched marginally better by full potassium with 0.15 of iron. That is a phengite, and a phengite glitters: it is identifiable in hand specimen, so a separate prepared from a sample with no visible mica cannot be one. The axis therefore stays inside the range that defines an illite, 0.75 to 0.9 of an atom, and nothing is given up by that - the best member inside it, K = 0.9 with 0.15 of iron, calculates 1 : 0.173 : 0.449 against 1 : 0.164 : 0.477 measured, within 6 % on both orders. The published structure is kept in the axis as the muscovite end member and under its plain name, so that anything already written down still matches; it calculates the measured series worst of the four.

What the basal series constrains tightly is the combination of the two substitutions, not either alone, so the composition the fit reports should be read as the structure that reproduces the pattern rather than as an analysis of the specimen. An X-ray fluorescence analysis of the same mount settles which member is really the specimen's, and is the right way to close it.

A.36 The chlorite after the oven, calculated rather than assumed

Why it is worth having. The heated mount is the one pattern in the set that contains no kaolinite at all — it has become metakaolinite and left the diffractogram — so it is the one place where the 7.15 Å window is chlorite and nothing else. Fitting it would measure the chlorite directly, instead of inferring it from ratios to its own 001 and 003 (§A.34). What has stood in the way is that the heated chlorite is not the same scatterer as the air-dried one, so the air-dried reference patterns do not describe it.

What heating does, structurally. The interlayer hydroxide sheet gives up its water: 2 OH− → O2− + H2O, so half that sheet's oxygen leaves with all of its hydrogen, while the 2:1 layer's own hydroxyl survives to a higher temperature. One parameter describes it — how far the reaction has gone — and chlorite_crystal(..., dehydroxylation=delta) is that parameter, scaling the sheet's oxygen occupancies by 1 − δ/2 and its hydrogen by 1 − δ. The cell mass falls by about a tenth, which a weight percent from a heated mount has to be corrected for.

Calibration on the two chlorite standards. The octahedral iron is taken from the air-dried pattern and the dehydroxylation from the heated one. Everything in italics below is then a check rather than a fit:

 Chlorite (16)Prochlorite (15)
002/001 air dried, measured1.7982.245
hydroxide-sheet iron it implies0.0450.085
002/001 heated, measured0.1690.749
dehydroxylation it implies0.750.30
001 gain, measured3.422.16
001 gain, calculated5.052.31
003/001 heated, measured0.0900.454
003/001 heated, calculated0.2200.631

The collapse of the even orders is reproduced exactly, because that is what was fitted. The 001 gain is the interesting number: it was not fitted, and on the less altered specimen it comes out at 2.31 against 2.16 measured — within 7 % — from the same δ that fitted the ratio. On the more altered one it is over-predicted by half, and the 003 is over-predicted on both. So the model is right about the mechanism and about the first two orders, and optimistic about how much of the sheet is still crystalline at δ = 0.75; a specimen that far through the reaction is presumably also losing order, which a site occupancy cannot express. Contracting the sheet as it dries was tried and makes every one of these numbers worse, so it is not in the model.

And it has to be spanned. After the same 1.5 h at 550 °C the two standards are at δ = 0.75 and 0.30. Neither is finished, and they are not at the same point, so a heated chlorite is a one-parameter family rather than a second structure to tabulate.

A.37 A clay that is not a platelet, and the pole it settles on

The assumption that had been everywhere. Preferred orientation in ClayQuant was March–Dollase about c*, with no way to say otherwise. For a layer silicate that is not an assumption at all but a statement of what the mineral is: the crystallite is a plate whose flat face is 001, so 001 is the pole it settles on. It stops being true the moment a clay mineral is not a layer silicate.

Sepiolite and palygorskite. Both are clay minerals and neither is a layer silicate: they are chain silicates, built of 2:1 ribbons joined at their edges with channels between them, and their crystallites are laths elongated along c. Their strongest reflection is a 110 — 12.1 Å for sepiolite, 10.4 Å for palygorskite — and not a basal series at all. A lath settling out of suspension comes to rest on a side face, which is a strong texture, but it is not a texture about c*.

What the measurement says. On the sepiolite standard, fitted as a single phase with the zero error and the peak width free:

PolerRwp
c*0.199.8 %
c*0.599.1 %
random powder1.095.5 %
1100.793.5 %
1100.395.2 %

Every orientation about c* makes the fit worse, monotonically, and that is what "this is not a platelet" looks like in a residual. Orientation about the 110 pole improves it. The mineral is oriented — it just is not oriented about the axis the program could express.

What changed. Crystal.angle_to takes any pole in Miller indices, reflections and powder_pattern take a po_axis, and Crystal.po_axis carries a mineral's habit through the phase database. The habit is a property of how the mineral grows rather than of its cell, and clayquant.models.MINERAL_HABIT holds the few that need one; a mineral absent from it is taken to be equant, which is right for quartz, the feldspars and the carbonates in a clay mount, and a layer silicate keeps c* without needing an entry.

An accompanying mineral with a habit is then treated as the clays are: its orientation is spanned and the fit chooses, instead of being forced to a random powder. It is also screened at the middle of that range rather than at r = 1, because a lath puts most of its intensity into one reflection and a random-powder column spreads it over many, which can miss the mineral altogether.

Which minerals those are is answered by name, and that took a correction. The phase database carries an axis of its own, and the first version of this took it as the habit. It is not one. A TOPAS structure library records a preferred-orientation axis for most of its phases — 131 of the 205 in the one this was written against, quartz and the feldspars among them — because a refinement commonly switches a PO correction on, and that says which axis the correction was about, not that the crystallites are laths. Taken as a habit it would have spanned four orientations for every accompanying mineral in every fit, and let an equant quartz grain be fitted at r = 0.3. So only a mineral named in clayquant.models.MINERAL_HABIT is spanned, and the database's axis is used for it when it has one.

The same library also writes 0 0 0 for a phase whose macro carries no axis — 72 of those 205 — and a zero vector is not a direction. It reached the geometry and stopped a fit with "is not a direction", which is a poor way to learn that a field is optional. Crystal now turns a zero pole into no pole as it is constructed, so a database written before any of this still loads and no reader has to remember.

What this does not fix. The sepiolite standard still fits badly — Rwp 93.5 % at best, with the crystallite size and the zero error free. Its 110 is one very broad peak running from 11.4 to 13.5 Å with a tail beyond 15, and essentially nothing above 9 % of it anywhere else in the scan. A structural model of an ordered crystal cannot produce that, and the orientation axis was never going to be what made it, so the reason for the axis is the physics rather than that one specimen. That standard is a pharmacy product and carries at least one other component: a 14–15 Å shoulder in the air-dried scan that weakens on glycolation, as an expandable clay does when it moves to 17 Å.

Not, however, expandable itself. A sepiolite has no interlayer to glycolate; what it has is zeolitic water in the channels. Its 110 moves from 12.12 to about 12.3 Å between the air-dried and glycolated mounts, of which roughly half is the displacement difference between the two mounts — visible as a 0.008 Å shift of the 3.34 Å line, which cannot be swelling. What is left is of order 1 %, against the 15 → 17 Å of a smectite. The channel water does leave on heating, and that is unmistakable: the 110 collapses to 10.07 Å, the folding to sepiolite anhydride.

A.38 Weighing the mount, and the correction it uncovers

What weighing buys. A relative analysis cannot check itself. It says how the phases of one mount divide that mount between them, and it says it whatever the calculated patterns get wrong, because an error common to the numerator and the denominator cancels. Weighing the material on the slide breaks that: the fit then has to account for a known number of milligrams, and one constant — fitted mass per gram — has to serve every mount measured through the same optics. Where it does not, the instrument is not what changed.

This is not the external-standard method of §2.13, and it is better on a clay film. The external-standard relation W = S(ZMV)μm/K holds for a specimen thick enough that its own absorption decides how much material diffracts; the mass cancels out of it, which is exactly what lets a corundum plug stand in for an unknown. A clay film is not thick, so a constant from a corundum plug does not carry over to it — and does not need to, because the mass of a film can simply be weighed, which is the quantity that relation goes round the houses to infer.

The correction it uncovers. Every calculated pattern here is for a flat plate thick enough to absorb the beam completely: that is what the Debye–Scherrer Lorentz factor and the beam-overflow correction describe between them, with the specimen's 1/2μ folded into the scale. A weighed film delivers only a fraction of that,

A = 1 − exp(−2 μm W / sin θ)

with W the mass per area. The exponent carries 1/sin θ, so the factor is not a rescaling: a thin film keeps more of its low-angle intensity than of its high-angle intensity, because the beam's path through it is longest at low angle. For an illite film of 8 mg over 6 cm2:

Order10 Å5 Å3.33 Å
fraction of a thick specimen's intensity0.77 0.520.38
effect on the calculated ratio to 001— ×0.68×0.50

Which is the same direction as the chemistry. Taking potassium out of an illite lowers its higher basal orders; putting iron into the octahedral sheet lowers them; and so does the film being thin. They are not distinguishable from a basal series alone. The composition found in §A.35 was fitted against calculated patterns carrying no film correction, so it stands only as far as that correction is small — and how small it is depends on the area the suspension dried over, which is the one quantity here that has to be measured rather than weighed. Over 3 cm2 the correction multiplies the calculated 002/001 by 0.81; over 12 cm2, by 0.59. That range spans the whole effect attributed to the octahedral iron.

So the order of work is fixed by it. The deposited area, then the film correction, then the composition — not the other way round. An X-ray fluorescence analysis of the same mounts settles the composition independently of all of it, which is why it is worth having: it is the one measurement that breaks the degeneracy from outside.

And then it becomes a test. Nine weighed standards give nine constants that have to be one constant. agreement_between reports the spread and each mount's departure from the mean, and for a pure standard that departure is precisely the factor by which its reference pattern is wrong — texture, microabsorption and structural error together, which is what §2.13 calls k and has never before been measurable here.

A.39 Fluorescence on the same mounts, and how far it can be read

Why it was needed. A basal series constrains a combination of substitutions and not either one alone. Removing interlayer potassium lowers an illite's higher basal orders, adding octahedral iron lowers them, and the film being thin lowers them (§A.38); no diffractogram separates the three. A fluorescence analysis measures the elements instead of their joint effect on an intensity ratio, so it breaks the degeneracy from outside — if it is read for what it can say and not for what it prints.

Three things it cannot say. The instrument normalises to 100 %, so there is no absolute intensity and a blank cannot be subtracted; what can be done is to treat each measurement as a mixture of film and slide and solve for the mixing fraction from an element the film has none of. On these mounts that fraction is large — calcium says the slide is half to nine tenths of the signal, because a few milligrams of clay is nearly transparent at these energies. And the light elements are not measurable at all: Na, Mg, Al and Si fluoresce between 1.0 and 1.7 keV, which both the film and the air path absorb, so their corrected concentrations come out impossible — 30 % potassium in an illite, which is the signature of the method being pushed past what it can do rather than of an error.

What survives is a ratio of two heavy elements, and the reason it survives is that both are minor in the slide, so the ratio hardly moves as the mixing fraction moves. On the illite mount:

slide share assumedK, %Fe, %Fe/K
0.0016.311.4 0.699
0.52 (what calcium says)30.623.1 0.755
0.8591.172.6 0.797

The concentrations change fivefold and are nonsense at the bottom of the table; the ratio changes by 14 %. That envelope is the measurement.

What it gives for the illite. Per O10(OH)2 an illite has two octahedral cations and at most one interlayer potassium, so Fe/K by mass is 2fMFe/kMK and the measured envelope gives

interlayer Koctahedral Fe implied
0.90.22 – 0.25
0.80.20 – 0.22

This is an upper bound, not a measurement: iron in an accessory oxide is counted as octahedral and potassium in a feldspar as interlayer. That the illite mount also carries 2.0 % titanium against the slide's 0.0 settles that accessory oxides are indeed present, so some of the iron is not in the illite.

The three measurements agree, which is the result. Diffraction alone wanted 0.15 of octahedral iron (§A.35); fluorescence bounds the iron at 0.20 to 0.25 with some of it in an accessory; and with the composition pinned at the fluorescence value the calculated basal series comes out 0.124 : 0.414 against 0.164 : 0.477 measured — 13 to 24 % weak in the higher orders, against the threefold error the published structure carried. An independent measurement landing within a factor of 1.5 of a structural inference, in the direction the accessories predict, is as close to closed as this gets.

It also bounds the film. With the iron at the fluorescence value, the film correction of §A.38 has to be negligible: any appreciable correction halves both ratios and takes the calculation further from the measurement, not nearer. That is a quantitative statement about the mount — an 8 mg illite film is effectively thick at 8.8 ° only if it dried over about 3 cm2 or less — and it is consistent with the fluorescence itself, which sees the slide through the film at 3.7 keV while Cu Kα penetrates only some 5 µm at that angle. Two measurements that know nothing of each other agreeing on the film's thickness is worth more than either.

And it reads the other standards. Elements well above the slide's own, on mounts where the marker leaves room to see them:

StandardWhat the analysis adds
Illite (10)Ti 2.0 % — a titanium oxide accessory; the standard is not phase pure
Dickite (7)SO3 4.9 % and P2O5 2.7 % — a sulfate and a phosphate, neither of them a clay
Montmorillonite (50)K 0.0 % against the slide's 3.1 — no illitic component at all
Montmorillonite (9)calcium exchanged, which makes calcium useless as a slide marker here: it credits the slide with more potassium than the mount contains
Chlorite (16) / Prochlorite (15)Fe 16.1 against 14.3 %, so chlorite 16 is the more ferrous of the two

That last row is a disagreement worth recording. Fitting the two air-dried basal series (§A.36) put more iron in prochlorite 15's hydroxide sheet (0.085) than in chlorite 16's (0.045), and the fluorescence has the total iron the other way round. The two are not strictly comparable — the diffraction fits the iron of one sheet with the other held at zero, while the fluorescence sees all of it — but it means the sheet-by-sheet split is not yet established, and the 2:1 sheet has to be allowed to carry iron before those numbers are quoted.

A.40 The mount is a disc, and it is 25 mm

The error. The beam-overflow correction needs the size of the mount, and nothing in a data file records it, so it was being supplied as 35 mm — a full smear on a standard glass slide. The mounts this program is used on are not smears on slides: they are round glass discs 25 mm across, which the separate is dried on. Ten millimetres does not sound like much, and at high angle it is nothing, but the correction acts only where the beam overflows the mount and that is exactly where the clay basal reflections are.

Reflection2θbeam stripas 35 mmas a 25 mm disc
chlorite 0016.22°38.6 mm 0.9070.630
illite 0018.84°27.2 mm 1.0000.895
kaolinite 00112.4°19.4 mm 1.0001.000

The chlorite 001 was being calculated with nine tenths of the beam on the mount where six tenths of it was, which is a 44 % error in the reflection the whole chlorite/kaolinite separation of §A.34 is measured against. Every basal ratio in this appendix computed before this section carries it.

And the mount is round. The correction assumed a rectangle. The beam lights a strip along the surface, and on a disc the strip's corners run off the edge before its middle does, so a little more is lost than the length alone says: 0.630 against 0.648 at the chlorite 001. Divergence now takes shape="round" and computes the exact overlap of the strip with the disc, which agrees with a brute-force integration to better than 0.2 %. The beam's axial width barely enters — widening the mask from 5 to 15 mm moves the low-angle factor by 6 % — because what limits the strip down there is its length.

So the shape is a few per cent and the length is tens of per cent. Both are now right, and instrument_from_measurement defaults to a round mount 25 mm across rather than a 35 mm smear.

What it does to the illite. Correcting the geometry raises the calculated higher orders, because the first order was the one being over-credited with beam. Against the measured 1 : 0.164 : 0.477, at the composition the fluorescence gives (§A.39):

Geometry002/001003/001Rwp, single phase
35 mm smear0.1240.414 69.7 %
25 mm disc0.1390.462 66.8 %
measured0.1640.477 —

The 3.33 Å order comes to within 3 % and the 5 Å order to within 15 %, from a structure, an independent chemical analysis and the measured size of the glass disc, with nothing fitted to the basal series at all. The same fit prefers the fluorescence composition over the diffraction-only one (66.8 against 69.8 %) and both over the published muscovite (77.5 %).

And it settles the film correction: there is none to make. §A.38 left the thin-film absorption open pending the deposited area. The area is 4.91 cm2, which for 8 mg gives 1.63 mg/cm2 and a correction that would multiply the calculated 003/001 by 0.54 — and applying it takes the fit from 66.8 to 70.3 % and the ratios far below the measurement. The pattern says the correction is not there.

The resolution is that mass over nominal area is a lower bound on the areal density in the beam. A suspension drying on a disc does not leave a film of uniform thickness, and the beam reads a strip across the middle rather than the average; a factor of three of central thickening makes the film effectively thick at these angles and fits as well as no correction at all (67.6 %). So thin_film_factor stays available and documented and is not applied by default: computed from the nominal area it is an upper bound on a correction that these mounts do not need.

A.41 The library rebuilt, and what nine weighed mounts say about it

The rebuild. 2901 patterns on the corrected geometry — a round mount 25 mm across (§A.40) — with the instrumental width taken from a corundum scan on the same diffractometer, 0.090 ° FWHM. Fourteen minutes. The illite/smectite host now takes the same composition as the best-fitting member of the discrete illite axis, K = 0.9 with 0.15 of octahedral iron, so the host and the discrete mineral are the same mineral and both are illites.

What the standards come back as. Each fitted with one orientation shared by all the clays of the mount (§A.23), which is the constraint the physics requires and without which the weight percent inverts:

StandardLargest clay shares, by weight
Illite (10)illite 89 %, C/S 9✓
Prochlorite (15)chlorite 88 %, I/S 7, illite 5 ✓
Montmorillonite (50)smectite 89 %, C/S 11 ✓
Kaolinite (12)kaolinite 74 %, I/S 10, illite 9 ✓
Kaolinite (43)kaolinite 57 %, I/S 20, illite 18 ✓ — and the fluorescence finds potassium in it too
Chlorite (16)chlorite 33 %, C/S 30, I/S 35 chlorite family 63 %
Dickite (7)kaolinite 46 %, I/S 39 the fluorescence finds a sulfate and a phosphate
Montmorillonite (9)illite 58 %, smectite 20not a single-phase standard
SepioliteI/S 97 %nonsense; sepiolite is not in the clay library and has to be imported as an accompanying mineral (§A.37)

Then the weighed mounts. Each mount's fitted mass divided by what it weighs should be one constant for all nine (§A.38). The five chlorite and kaolinite mounts agree within ±40 %, which is the first absolute check this program has ever passed and says their reference patterns are mutually consistent per gram — the test the March–Dollase weighting had to survive. The illite comes out ten times low and the smectites a thousand. Two quite different things are behind that, and only one of them is a fault.

First: the mounts are saturated. Counts per milligram, measured over 4 to 38 ° with no model at all:

Mountmgcountscounts / mg
montmorillonite 92.61.88 × 104 7220
montmorillonite 5011.32.01 × 104 1780
kaolinite 432.31.52 × 104 6620
kaolinite 122.61.48 × 104 5680

Four and a third times the material for seven per cent more signal. The two kaolinites, of practically the same mass, give practically the same counts. Across all nine mounts the three heaviest — 8, 11.3 and 12 mg — are the three lowest in counts per milligram, in order. The mount is optically thick and everything beyond the penetration depth is wasted: the factor A = 1 − exp(−2μmW/sin θ) of §A.38 is 0.63 at 2.6 mg and 0.99 at 11.3 mg, which predicts the fall in counts per milligram to within a third.

So there is no point loading more than about 3 mg onto a 25 mm disc. Beyond that the extra material buys nothing, and worse, it makes the mounts incomparable by mass: an absolute calibration from a weighed mount only means anything below saturation, or with this factor taken out.

Second, and this one is a fault. Saturation does not account for a factor of a thousand, and the smectite's does not come from the measurement: across the nine mounts the measured counts per milligram span 21-fold while the fitted constants span 2400-fold, so the rest is in the calculated patterns. It has a specific cause. Every interstratified entry is calculated by the stacking model and then multiplied by basal_scale_factor, which puts intensity per layer onto the intensity-per-unit-cell scale that powder_pattern uses for the discrete minerals. The lone pure-smectite entry is calculated the same way and is not given that factor, so it sits on the stacking model's own scale while everything it is compared with sits on the other. Its weight percent is wrong by whatever that factor is.

The obvious repair — borrow the scale from another phase — does not work: it is not a property of the method alone but of the structure and the crystallite thickness, running from 0.032 for kaolinite 1M at N = 5 to 0.50 for illite at N = 50. The repair that should work is to calculate the pure smectite as the zero-illite end member of the I/S series, which carries a scale by construction, and the weighed montmorillonite mounts are now the way to check it.

A.42 Two calculations, one scale

The two families. A discrete mineral is calculated by powder_pattern, whose unit is one unit cell. An interstratified one is calculated by the stacking model, whose unit is one layer. Their weight percents are compared with each other, so the two descriptions have to give the same intensity for the same mass — and a cell is not a layer. basal_scale_factor exists to reconcile them, by calculating one host both ways and comparing. Weighing the mounts (§A.41) showed it was not doing it.

First fault: the smectite had no scale at all. Every interstratified entry is multiplied by that factor. The lone pure-smectite entry is calculated the same way, by the stacking model, and was added without one — so it sat on the stacking model's own basis while every phase its weight percent was compared against sat on the other. Per unit of mass times volume it was seventeen times the discrete illite, where the four discrete minerals span a factor of two among themselves.

It cannot be given the usual factor, because that needs a three-dimensional cell and the glycolated smectite is a one-dimensional layer transcribed from Reynolds (1965). But the reference the factor compares against needs only the layer: a periodic stack of one layer of thickness d has its 00l at d/l, with the layer's own structure factor, and that is the discrete Bragg series a powder calculation would give. layer_basal_scale_factor builds it that way. Checked against the crystal route on chlorite and kaolinite 1M, whose cells hold one layer, it reproduces it to five figures, and a pure host calculated through it matches powder_pattern per gram to the same. A smectite is modelled as one layer per cell, so this is its scale directly.

Second fault, found on the way: a missing divisor. Equating the areas of the two calculations equates a layer with a cell. An illite cell holds two layers, so every illite/smectite entry came out twice as bright per gram as the discrete illite beside it — and its weight percent half what it should be. A chlorite cell holds one layer, so the chlorite/smectite series was never affected, which is exactly why the error hid: it moved the I/S series against the illite and left C/S alone. basal_scale_factor now divides by layers_per_cell, after which a pure host calculated both ways agrees per gram to four figures for every one of the four minerals.

What it did to the library. Intensity per unit of mass times volume, relative to kaolinite 1M:

Entrybeforeafter
smectite (EG)×17×1.37
chlorite×1.19×1.19
kaolinite 2M×1.01×1.01
illite×0.61×0.61

And to the standards. Refitted on the rebuilt library:

Standardbeforeafter
Montmorillonite (50)smectite 89 %smectite 98 %
Montmorillonite (9)illite 58 %, smectite 20 smectite 55 %, illite 37
Illite (10)illite 89 %illite 94 %
Prochlorite (15)chlorite 88 %chlorite 80 %

Montmorillonite 9 is the one worth pausing on. It had been coming back as more illite than smectite, which was never credible for a montmorillonite standard; it now comes back as more smectite than illite, and the illite it still finds is real — the specimen has an illite 001 and is not single phase.

What is still wrong. The absolute constant from a weighed mount has not come right. Across the nine mounts it still spans 390-fold, and the pattern in it is now legible: a mount whose fit lands on powder_pattern entries gives a high constant (kaolinite 12, ×1.51) and one that lands on stacking-model entries gives a low one (illite 10, ×0.26, whose winning entry is an I/S end member). The continuum strip of PatternLibrary.add was the suspect when this section was written, and it was the wrong one: §A.43 shows the bookkeeping round-tripping a known mixture exactly, and finds the spread in the orientation instead.

A.43 The spread in the weighed constant was the orientation

A retraction first. §A.42 named the continuum strip of PatternLibrary.add as the suspect for the 390-fold spread in the constant from a weighed mount, on the reasoning that a stacking-model pattern loses a large share of its area to that strip and a powder pattern loses almost none. That was wrong, and the test that settles it is simple enough that it should have been run first: build a synthetic mixture out of library entries in a known mass ratio, fit it, and see what comes back.

Put inGot out
illite 89.8 %, kaolinite 10.2illite 89.8 %, kaolinite 10.2
smectite 82.1 %, kaolinite 17.9smectite 82.1 %, kaolinite 17.9
chlorite 81.9 %, kaolinite 18.1chlorite 81.9 %, kaolinite 18.1
I/S 80.2 %, kaolinite 19.8I/S 80.2 %, kaolinite 19.8

Exact, to every digit, across both families of entry. The strip cancels, and the algebra says why: the stored column is the stripped pattern over its own maximum, the fitted coefficient is the phase's scale times that maximum, and the maximum divides out of coefficient / normalization × (ZMV). The bookkeeping was never the problem.

What it was. The orientation. A basal series is enhanced by r to the power −3, so the mass behind a given measured intensity goes as r cubed, and the nine mounts were fitted at orientations from 0.1 to 0.5 — a factor of 125 between the ends before anything about the minerals is considered. Dividing it out:

Mountmgrconstanton one r
Kaolinite (12)2.60.40 8.13 × 1041.27 × 106
Kaolinite (43)2.30.40 1.08 × 1051.69 × 106
Chlorite (16)1.70.20 3.36 × 1044.199 × 106
Prochlorite (15)1.40.30 1.15 × 1054.262 × 106
Illite (10)8.00.20 1.41 × 1041.77 × 106
Montmorillonite (50)11.30.10 2.93 × 1022.93 × 105

393-fold becomes 15. And the two chlorite mounts, different minerals of the family measured on different days at different orientations and different masses, agree to 1.5 %. That is not a coincidence surviving a wrong correction.

What the fifteen is. Not an error but the measurement. One constant has to serve every mount, so a phase whose mounts sit consistently above or below the rest is a phase whose calculated pattern misdescribes the real mineral, by that ratio — the factor §2.13 calls k, texture and microabsorption and structural error together, which nothing inside a single analysis can measure. Weighed standards measure it:

Phasemountsk
smectite (EG)16.64
kaolinite 1M21.31
illite11.10
chlorite20.46

Read as ratios, which is all they are: the calculated chlorite delivers about two and a half times the intensity per gram that it should, and the glycolated smectite about a sixth. Kaolinite and illite sit within 20 % of each other. The two phases with two mounts each are the ones to trust - chlorite's agree to 1.5 %, the kaolinites' to 33 % - and the smectite's single mount is the most saturated in the set, so its factor is the weakest of the four.

In the code. WeighedMount records the orientation the fit chose and reports comparable_constant with it divided out; comparing raw constants is what the old agreement_between did and it is no longer possible to do by accident. calibration_from_weighed_mounts turns mounts of known single phases into a :class:`Calibration`, normalised so the factors average one, since only their ratios matter.

A.44 Calibrating on weighed standards, as a command

What it does. clayquant-standards takes a table of weighed mounts of known minerals, fits each one, and reports the per-phase factors they imply:

clayquant-standards standards.csv -o calibration.json

The table is a CSV with columns name, file, mass (mg), phase and optionally area (cm2); blank lines and lines beginning with # are skipped, because it is a table kept by hand beside a balance. examples/standards.csv is the one these factors were measured from.

What it does for you rather than leaving to you. Two things have to be right before constants from different mounts can be compared at all, and both are easy to forget.

Every clay of one mount is fitted at one orientation. They settled out of one suspension onto one plate, so they share a texture, and a fit free to put one clay at r = 0.1 and another at 1 differs by a thousand in the mass behind the same scattering.

The constants are then compared with that orientation divided out (§A.43). The report prints both, and says what the spread was before and after, because the difference between them is the whole reason the correction exists.

Leaving a standard out. A mount whose phase is empty is fitted and reported but not calibrated on. That is for a standard that is not single phase — the dickite carrying a sulfate and a phosphate, the montmorillonite carrying an illite (§A.39) — because an impure standard puts its impurity into its own factor. Better to have no factor for a phase than a wrong one.

How to mount them. Keep the masses within about a factor of two of each other. A film of a few milligrams on a 25 mm disc is already optically thick at low angle, so counts stop rising with mass — four times the material for seven per cent more signal, on the two montmorillonite mounts (§A.41) — and a heavy mount is not comparable with a light one however well each is fitted. Matching them is what makes the saturation divide out rather than something that has to be corrected; 2 to 3 mg is the band the factors below were measured in, and the two mounts outside it are the two whose factors are weakest.

And two mounts per phase. Their agreement is that phase's uncertainty, and nothing else measures it. Of the four phases here only chlorite and kaolinite have two, and they are the two to trust: the chlorites agree to 1.5 %, the kaolinites to 33 %.

A.45 Giving the accompanying minerals a cell and a texture

What they had. Every clay in the fit chooses among orientations, crystallite thicknesses, layer spacings and compositions. Every accompanying mineral had exactly one column: the published cell, a random powder, no freedom at all. Two peaks on a real separate ran into that — a sekaninaite line at 8.4 Å and an albite line at 6.4 — and the failure is worth stating precisely, because it does not look like a missing phase.

The sekaninaite line sat 0.05 ° from where the structure library put it, after the zero error was corrected. That is half a peak width: raising the phase to match would put intensity where there is none, so a least-squares fit leaves the line 37 % short instead and spends the mineral elsewhere. Sekaninaite is the iron end of the cordierite series and its cell tracks the Fe/Mg ratio, so a specimen-specific cell is expected rather than an error in the library.

The cell. One scale on a, b and c together, spanned symmetrically about no change, with the variants offered once and the winner refitted. On that separate sekaninaite chose ×1.005 — the value a hand calculation from the peak position predicts — and its line went from 37 % short to 30. Nothing else moved: quartz, albite and rutile all chose 1.

A uniform scale shifts a line by an amount proportional to tan θ while a zero error shifts it by a constant, so the two are separable across a scan and trade against each other within a narrow window. Calibrate the zero error first, and give the cell the smallest span that closes the lines rather than the largest that lowers Rwp.

The texture, and the trap in it. Letting every accompanying mineral orient does close the albite line, and lowers Rwp, and is wrong:

Accompanying mineralsRwp8.4 Å short 6.4 Å shortQuartz
as published, powder0.36437 % 53 %40.6 %
cell ±0.5 %0.36330 % 53 %40.5 %
every mineral may orient0.353 26 %13 % 63.7 %
cell + only what cleaves0.36026 % 12 %34.3 %

The third row is the trap. Offered a texture, quartz took r = 0.3; a basal series is enhanced as r−3, so that is 37 times the mass for the same scattering, and quartz went from a third of the specimen to two thirds — at the lowest Rwp of the four. Quartz has no cleavage and its grains in a clay separate are equant. The fit was not measuring a texture; it was spending a parameter, and the residual happened to reward it.

So the offer is restricted to minerals that actually cleave: clayquant.models.MINERAL_CLEAVAGE holds the feldspars on (001), the carbonates on (104), the non-clay sheet minerals and the cleaving sulphates, with the pole each would lie down on. That is a different list from MINERAL_HABIT, and the difference is the point: a sepiolite crystallite is a lath and is oriented whether or not anyone asks, while a feldspar is equant until it breaks and then breaks on (001), so whether its flakes have settled flat is a question about the mount and is offered rather than assumed. Restricted this way, albite chose r = 0.5, its line closed from 53 % short to 12, and quartz stayed where it was.

One mineral, one variant. A mineral offered several cells and orientations is still one mineral. Left alone a non-negative fit will divide it between two neighbouring cells and call the pair a broadened line, which describes the specimen worse than either alone and inflates the phase's share. So the variants are offered once, best_variant_per_phase reads off which one took the scattering, and the fit that counts is run again with one variant each. Two passes rather than a family constraint, because a family here means a clay sharing the mount's one texture and an accompanying mineral does not share it.

Both are off by default, and the fourth row above is why they are worth having and the third is why they are not defaults.

A.46 A weighed film is not a thick plate

Where it came from. A separate was fitting its kaolinite at 0.6 wt % against an independent refinement's 11.7, and the shared clay orientation was the suspect: forcing the kaolinite to r = 0.3 gave 0.58 %, releasing it to 0.8 gave 10.5. The test proposed was to fit a pure kaolinite standard and see what orientation it took on its own. Two were in hand, both weighed.

The test could not work, and the calculation says why. The kaolinite 002/001 ratio does not depend on the orientation:

r0.20.30.51.0
kaolinite 1M, 002/0010.6660.6660.6670.673

March–Dollase is a function of the angle between a reflection's normal and the texture pole, and along a basal series that angle is zero for every order. So the factor is one constant down the whole series and the series carries no orientation information. Both standards duly gave a Rwp flat to within 1 % from r = 0.1 to 0.5. An oriented mount of a single clay cannot determine its own orientation, and that is a property of the experiment rather than of this program.

What the test did find. The measured basal ratio did not match the calculated one at any orientation, and the discrepancy was the same shape on every weighed standard:

standardmassmeasured 002/001thick plate× film factor
Kaolinite_122.6 mg0.4010.666 (+66 %)0.357 (−11 %)
Kaolinite_432.3 mg0.5050.666 (+32 %)0.355 (−30 %)
Illite_108.0 mg0.1440.226 (+57 %)0.169 (+18 %)
Chlorite_161.7 mg1.8882.702 (+43 %)1.470 (−22 %)
Prochlorite_151.4 mg2.2854.661 (+104 %)2.539 (+11 %)

The masses are the weighed ones. What the correction removes is a bias: uncorrected, every standard's calculated ratio is too high, by +32 to +104 % and by 60 % on average, which is the signature of a systematic rather than of scatter. Corrected, the errors straddle zero at −30 to +18 %, averaging 18 % in magnitude. That is a real improvement and not an exact one, and the residual is not yet accounted for.

Every pattern ClayQuant calculates is for a flat plate thick enough to absorb the beam completely — that is what the Debye–Scherrer Lorentz factor and the beam-overflow correction describe between them, with the specimen's 1/2μ folded into the scale factor. A few milligrams smeared on a glass slide is not that plate. It delivers

A(θ) = 1 − exp(−2 μm W / sin θ)

of it, with W the film's mass per area. The exponent carries 1/sin θ, so a film keeps more of its low-angle intensity than of its high-angle intensity, and the correction is a reweighting rather than a rescaling. On a 2.6 mg mount over a 2.5 cm disc it is 0.44 at the chlorite 001 and 0.25 at the kaolinite 001 — a factor of 1.74 between exactly the two reflections that compete for the 7.15 Å peak. Uncorrected, a chlorite whose scale is set by its strong 001 at 6.2 ° over-predicts its own 002 at 12.4 °, which sits under that peak, and the kaolinite is left with what remains.

The coefficient is the mixture's, not the phase's. A photon on its way to a kaolinite crystallite buried in an illite film is attenuated by the illite it passes through, so what governs the correction is the average composition of the film. That is the composition the fit is trying to find, and the range is too wide to fix in advance: about 30 cm2/g for a pure kaolinite against over 50 for a ferrous illite. So it is iterated — a first fit with a provisional coefficient gives weights, the weights give a coefficient, that gives a better fit. It settles in two or three passes, because the correction depends on the coefficient only through an exponential whose argument is around 0.03.

What it does not fix. The illite third order goes the wrong way: measured 0.469, thick plate 0.602, corrected 0.260. That window contains the quartz 101 at 26.640 °, 0.08 ° from the illite 003, so on a natural illite separate the measured third order is an upper bound rather than a value and cannot be used as a check either way. It is recorded here as it stands rather than argued away.

The correction also revises an earlier result rather than adding to it. The octahedral iron of §A.35 was fitted to a basal series that this correction now explains a large part of; the iron content it reports is therefore due to be re-derived against corrected patterns, and until that is done it should be read as a parameter that fits, not as a composition.

It has to be weighed, and it cannot be fitted. The obvious hope, for the historical mounts and for anything measured by somebody else, is to fit the film's mass as one more parameter: it is a single scalar and its signature, 1/sin θ inside an exponential, is distinctive. It does not work. Scanned over 0.4 to 25 mg against the five weighed standards, the best-fitting mass missed the weighed one by 1.4 to 10.9 times, and three of the five ran to the top of the range without an interior minimum at all — that is, the fit preferred no correction, since a large mass drives A to 1. Across a sixtyfold range of mass, Rwp moved by 0.019 to 0.071.

That is not evidence against the correction, and the distinction matters. The basal-ratio comparison above involves no fit: it is five weighed specimens, five measured peak-area ratios, all biased the same way and by the amount predicted. What the flat Rwp shows is something about the fit rather than about the physics — a library of some three thousand columns spanning orientation, composition, spacing and crystallite size is over-complete enough to absorb a smooth angular tilt by reshuffling which entries it selects. A systematic plainly visible in one measured peak ratio can therefore cost almost nothing in the residual, which is a caution about reading Rwp generally and not only here.

Nor may the mass be assumed. On one unweighed separate, varying the assumed mass over the plausible range moved the quartz from 4.5 % to 21.9 % and the illite from 21.5 % to 41.5 %, while Rwp stayed within 0.01 from end to end. An assumed mass buys any answer with no means of telling it is wrong.

It can, however, be measured — from the absolute intensity. That the residual cannot find the mass is a statement about the residual, and taking it for a statement about the measurement was an error. Rwp compares shapes, and a non-negative fit rescales every entry freely, so the absolute scale — which is exactly where the mass lives — is the one thing it discards. What determines the mass is counts per gram, and that is what a weighed standard calibrates. The standards exist for this.

The constant has to be per phase. On the five weighed standards it is consistent within a mineral and varies 3.8-fold between them:

standardweighedcounts per gram at r = 1
Kaolinite_122.6 mg1.68×106
Kaolinite_432.3 mg1.79×106
Illite_108.0 mg1.20×106
Chlorite_161.7 mg4.57×106
Prochlorite_151.4 mg4.19×106

The two kaolinites agree to 6 % and the two chlorites to 9 %, while chlorite sits 3.8 times above illite — which is the per-phase factor of §A.44, texture and microabsorption and structural error together. Averaging over phases discards precisely that, and doing so mis-predicted every standard's mass by 0.71 to 4.12 times.

Validated by leaving one out. Calibrating on one mount and predicting the mass of a different mount of the same mineral, which the constant never saw:

calibrated onpredictedweighedpredictedratio
Kaolinite_12Kaolinite_432.30 mg2.66 mg1.16
Kaolinite_43Kaolinite_122.60 mg2.23 mg0.86
Chlorite_16Prochlorite_151.40 mg1.90 mg1.35
Prochlorite_15Chlorite_161.70 mg1.25 mg0.74

16 % for kaolinite and 35 % for chlorite, against the elevenfold error of the Rwp scan, and tight enough to be worth having: the sensitivity above spans a far wider range than that. Three quantities depend on each other — the mass sets the absorption, the absorption changes the fitted intensities, the intensities give the mass — and solve_film_and_mass iterates them together, with the mixture's attenuation coefficient following the composition throughout.

So an unweighed mount is corrigible after all, provided the instrument was calibrated on weighed standards through the same optics. clayquant-standards writes the counts per gram beside the k factors, and naming that file on the fit panel infers the mass where none was entered. What it returns is an inference of that stated accuracy and not a weighing, and it is reported as such. With neither a mass nor a calibration, the field stays empty and no correction is applied, which puts every such specimen on one basis.

Applying it. The mount's mass and the area the suspension dried over are entered on the fit panel; the area is what the suspension covered, not the area of the glass, and the default is the 4.91 cm2 of a 2.5 cm round mount. Leaving the mass empty applies no correction, which is the honest behaviour for a mount that was not weighed: there is nothing to apply and nothing is invented. The library records each phase's mass attenuation coefficient so the mixture's can be averaged; a library built before this existed carries none, and asking for the correction on one says so rather than guessing.

A.47 One mineral under two names

What was seen. A contributing-patterns table for a real separate held both of these, among nineteen rows:

patternscattering %
C/S 1.00/0.00 PO=0.1 N=49.9221 d=14.1512.45
C/S 1.00/0.00 PO=0.6 N=49.9221 d=14.255.91
C/S 1.00/0.00 PO=0.1 N=14.9787 d=14.353.08
C/S 1.00/0.00 PO=0.1 N=49.9221 d=14.350.85
chlorite Fe=0/0.05 PO=0.2 d=14.151.04

A host fraction of 1.00 is no smectite at all, so every one of those rows is a pure chlorite. The mineral was therefore reported as 1 % under the name chlorite and 22 % under the name C/S, and a reader of the table has no way to know they are the same thing. The illite behaved identically through I/S 1.00/0.00.

Why the fit does it. The two representations are near-duplicates. Comparing every series end member against every discrete entry, the closest pair agree to a cosine of 0.980 for chlorite and 0.963 for illite. Non-negative least squares has no principle for dividing collinear columns — any split that sums correctly fits equally well — so the division is arbitrary and moves with the noise.

No family rule can repair it. A family groups entries within a phase, and these carry different phase names: C/S and chlorite are never in one family however the label is built. That is what made removing the entry the fix rather than relabelling it.

The same defect also let the orientation loose. Under “one orientation per composition” the family is the phase, the host fraction, the crystallite thickness and the layer spacing — only orientation and microstrain are collapsed. So the four rows above are four different families, because their d and N differ, and each was free to choose its own r. Two of them chose 0.1 and one 0.6. Mass per unit measured intensity goes as r3, so those differ by 216 per gram, and the reported chlorite is a blend of two orientations — which is the very error the family rule exists to prevent, arriving through the spacing axis. Fitting one orientation for the whole mount closes that route; it is the physically right constraint in any case, one suspension having dried onto one plate.

What was changed. Both series now stop short of their end member: the illite series at 0.99 and the chlorite series at 0.95. The discrete phases are the entries for a pure illite and a pure chlorite, and they are the better-founded of the two, being three-dimensional patterns with hkl reflections where the series computes 00l alone.

Why the entry was removed rather than merged in the report. The obvious cheaper fix is to keep both entries and add them up under one heading, which would also keep the crystallite-thickness spanning that removal costs. It does not work, and it fails for a reason worth stating because the intuition behind it is nearly right. Collinear columns have an unstable split but a stable sum — of scattering. Mass is not scattering. The discrete chlorite enters the S(ZMV) relation as a unit cell with its own mass and volume; the series end member enters it as one average layer of a stacking model. The same scattering, divided differently between them, converts to a different mass, and adding the two afterwards cannot undo a difference introduced in the conversion.

Measured on the same separate, with five noise realisations of the kind a repeat measurement would produce:

reported chloritemeans.d.range
kept and merged18.70 %5.9015.66
   of which the discrete entry6.02 %0.330.76
   of which the 1.00 entry12.68 %5.6615.03
end member dropped28.77 %0.461.28

Merging is thirteen times less reproducible. The whole of the instability sits on the redundant entry, the discrete one being steady to a third of a per cent throughout, and the two treatments do not even converge on the same answer — which they would if the difference were presentational. Reproducibility, not the readability of the table, is the reason the entry is gone.

What that costs, and the argument it overturns. These axes were extended to 1.00 deliberately, and for a good reason: without the end member the closest a pure illite can be described as is 0.99, so a fit of one piles its coefficient there and reports 1 % of a smectite the specimen does not contain — a bound presented as a measurement. That reasoning was right about the failure and wrong about the remedy, because the cure introduced a worse error than the disease. The bound is now detected rather than designed around: 0.99 is the top of the spanned range, so a fit collecting there is flagged by parameters_at_an_edge, and the honest reading of the flag is that the specimen is a pure illite and the discrete phase is its entry.

The second cost is real and is accepted rather than dismissed. The discrete entries broaden by microstrain; the interstratified ones carry the crystallite thickness distribution of §2.6, which is what actually sets a basal width. A pure illite can no longer be fitted with its thickness spanned, only with its strain spanned. An approximate width on one phase is the smaller error of the two.

A.48 A prismatic mineral shows one line, and the search looked for ten

An amphibole stood at 9122 counts in a real separate — the third largest peak in the pattern, at 8.43 Å — and the accompanying-mineral search did not report it at all. Riebeckite and hornblende were both in the structure database and both on the common list, so nothing was missing; what was wrong was the intensities they were sought with.

As a random powder, riebeckite's 35.3 ° line is 59 % of its 10.4 ° line and its 32.9 ° line 54 %. The measurement holds 127 and 157 counts there against 9592. Hornblende is worse placed still: 35.3 ° is its strongest reflection. Scored over nine of each phase's own lines, every orientation that fits is a (110) or (100) pole at r ≤ 0.6, and no random-powder amphibole comes near:

phasepolermisfit
Hornblende(110)0.350.238
Hornblende(110)0.300.293
Riebeckite(110)0.400.349
Riebeckite(020)any~1.03

The poles are the ones these two phases were refined on rather than an analogy from the shape of an amphibole, and the distinction is measurable: (020) is the b normal and (110) the prism face, predicting different intensities for every line but the one they share. On this specimen hornblende's (110) describes the pattern and riebeckite's (020) does not, at any orientation.

A second phase does not explain it. The natural reading, when a phase's heights are wrong, is that another mineral is also present. It cannot be that here, and the reason is arithmetic rather than mineralogical: superposition is additive and non-negative, so two phases can only add intensity at 32.9 and 35.3 °, where the trouble is an excess. Given both amphiboles and free amounts, a non-negative fit sets hornblende to zero and keeps riebeckite, at Rwp 0.757; the same pair oriented on (110) at r = 0.35 reaches 0.376. This says nothing about whether both minerals are in the specimen - the pattern cannot separate them either way - only that the heights are not evidence for two.

What was changed. The pole was being read from the structure database's refined axis while only being gated on the habit table, so a mineral with a habit whose database entry carried no axis was screened as a random powder anyway. Sepiolite and palygorskite are exactly that case, which means the mechanism written for them had been doing nothing for them. The pole now comes from the table, by name, and all five peak-list sites in the search apply it where before one of four functions considered a habit at all.

What it does not fix. Even screened correctly, an amphibole lying on a prism face offers one line, and the search required two stable reflections. That threshold is reachable now rather than hard-coded, and the cost of lowering it is stated where it is set: at one matched reflection the same separate also offers ankerite and rutile on a single line each. One line at the right angle is a candidate, not an identification.

A related caution about Rwp, since the same arithmetic recurs: scoring the search by line positions alone rather than by expected intensity was tried, on the reasoning that intensities are unreliable for an oriented mineral. Measured, it is the worse test - but only once the habit is right. With the amphibole screened at its pole the predicted intensities become 1.00 at 10.49 ° and 0.22 at 28.50, so matching the single line the mount shows scores 82 % and ranks second, where counting lines gives 50 % and ties it with rutile. The fault was never the weighting but the weights.

A.49 Where the attenuation coefficients come from

A weight percent needs a mass attenuation coefficient for every element in every phase, and the table held 27 of them: the elements a silicate is made of. A real structure database reaches further — a cassiterite, a tungsten carbide, a lithium-bearing amphibole — and a fit that reached one stopped with no coefficient for Sn. The table now runs from hydrogen to uranium.

Two sources, and the seam between them is named. Replacing all 27 original values with one consistent modern tabulation was tried first and broke three tests: the published coefficients of kaolinite, illite and chlorite are reproduced to within 1 % by the original values and 2 to 4 % by the replacement. Those 27 are therefore kept exactly as they were, because they are the ones the program is checked on.

elementssourcewhat it is checked against
H, C, N, O, F, Na, Mg, Al, Si, P, S, Cl, K, Ca, Ti, V, Cr, Mn, Fe, Co, Ni, Cu, Zn, Sr, Zr, Ba, Pb International Tables Vol. C, Table 4.2.4.3 kaolinite, illite and chlorite compound coefficients, to 1 %
the remaining 65 up to uranium Elam et al. at 8047.8 eV not independently checked here

The two tabulations agree to a few per cent on most elements and differ by up to 11 % on individual ones — lanthanum is 393 against 347, strontium 125 against 113, hydrogen 0.435 against 0.391. That is the ordinary spread between published compilations, and it is also why they are stored as two tables merged rather than one list written out: which source a coefficient came from should be answerable by looking, and a value from the second carries the accuracy of its source rather than of the check above.

The series is not monotonic in atomic number and must never be interpolated. Two absorption edges cross the Cu K-alpha energy: the K edge between cobalt and nickel, where the coefficient falls from 313 to 49, and the L3 edge among the heavy elements, where tungsten at 168 sits below lanthanum at 347 before lead rises again to 232. An element missing from a table like this cannot be estimated from its neighbours, which is why the whole table is present and why an element beyond it still raises rather than guessing.

Reading the species. Half of the same failure was not the table but the label. The parser accepted Fe3+ and O-2 and refused Ti(4+), D, FE, and — the one that makes a whole structure unusable rather than one site — a site label left in the species field, Fe1 or O3. These now resolve, as fallbacks reached only after the strict spelling fails, so nothing that already parsed can change meaning. What cannot be read is still refused: OH is two elements, and choosing one would put a wrong mass into a weight percent.

A.50 Three windows, and what each of them is for

Kaolinite and chlorite overlap in two places and chlorite can be measured alone in three, and until this was written the program used five of those five badly: the 3.5 Å region was read as a single window spanning 24.0 to 25.8 °, which holds the kaolinite 002 at 3.579 Å and the chlorite 004 at 3.52–3.56 together. That discards the one place the two minerals separate.

window2θholdswhat it is for
chlorite 0015.6–6.9chlorite onlyreference, and where the 004 is
kaolinite 00111.6–13.2boththe measurement
chlorite 00318.1–19.5chlorite onlyreference
kaolinite 00224.6–25.0both, mostly kaolinitethe second-order test
chlorite 004derivedchlorite onlythe tail correction, and the third reference

The split cannot be at a fixed angle. A chlorite's fourth order is at a quarter of its own 001 spacing, and that spacing varies enough between chlorites to move the reflection across the kaolinite 002: a 14.1 Å chlorite has it at 25.25 °, clear of the kaolinite 002 at 24.86, and a 14.4 Å chlorite at 24.72, on the wrong side of it. The window is therefore derived from the measured chlorite 001 — which is the first window earning a second job — and where the two reflections come closer than 0.22 ° the deconvolution is not attempted and the second order is reported as untestable rather than absent. An unresolved doublet is missing information, not evidence.

The chlorite's tail has to be subtracted. The two windows are adjacent and clay reflections are broad, so splitting them does not separate the minerals by itself. How far the chlorite 004's tail reaches into the kaolinite window is measurable on the two kaolinite-free standards, and it is stable where almost nothing else about these two specimens is: 0.166 and 0.169, on chlorites that differ by 2.2 times in how much of the 004 survives heating. A tail is a peak shape rather than a composition, which is why it transfers when the survival fractions do not.

What the third window buys. Two things that two windows could not give. The first is that a specimen's own chlorite behaviour becomes measurable, instead of being bounded by two other chlorites: on the standards the 002 survives heating in a fixed proportion to the 003 and the 004 (0.79–0.98 and 0.63–0.95), so a specimen's own higher orders predict how its own 002 should behave. The second is that kaolinite's second order becomes a test of its first — a pure kaolinite shows a 002 of 0.21 to 0.29 of its 001 area, so a strong 7.15 Å reflection with no 3.58 Å order has something else at 7.15.

That test has to be made, because the collapse test alone cannot do this job: both chlorite standards lose 66 % and 28 % of their 7.15 Å peak on heating and neither contains any kaolinite at all. All four standards now resolve correctly — the two pure kaolinites found, the two chlorites refused.

And the test must be sized by the kaolinite share, which is the subtle part. The 7.15 Å window is shared. Computing the expected second order from the whole of it assumes every count there is kaolinite, which inflates the expectation by however much chlorite is present, and an inflated expectation turns an undetectably small second order into a refusal. On a real separate that was the difference between expecting 227 counts and expecting 91: the first excluded kaolinite from the fit, the second cannot, because 91 counts would not have been visible. The expectation is therefore taken at the smallest kaolinite share any route allows, so the test refuses only where even the least kaolinite consistent with the evidence would have shown a second order.

A specimen cannot be used to characterise its own chlorite, and that was an error worth recording. Faced with a specimen whose 7.15 Å survival fell outside the range the two standards bracket, the tempting move is to use that specimen's own higher orders to say how its particular chlorite dehydroxylates, and so to narrow the range. It does not work, because the 004 window is shared: a collapsing kaolinite depresses it exactly as it depresses the 7.15 Å window, so a chlorite characterised there is characterised by the mineral it is being used to separate. That is what the standards are for. The deconvolution is done against pure specimens or not at all.

What can be taken from the specimen is the chlorite 003 to 001 ratio, because both of those are reflections kaolinite does not have. It is 0.814 on the clinochlore and 1.373 on the prochlorite, and it moves the same way the survival does, so a specimen's own ratio says which of the two its chlorite resembles and the survival can be interpolated rather than spanned. Two points are a line and not a calibration: inside the bracket the interpolation is reported with the full range beside it, and outside it the value is clamped and the full range kept.

What the method gives on the separate that prompted it. Against the standards alone, its 7.15 Å reflection keeps 0.132 of itself through heating where a pure chlorite keeps 0.32 to 0.72 and a pure kaolinite 0.005, so kaolinite is 59 to 82 % of that window. The range does not contain zero, which is the test: run on the two chlorite standards themselves the same arithmetic gives 0–53 % and 0–0 %, both containing zero, as a specimen with no kaolinite must. The drop at 7.15 Å on this separate is not accounted for by chlorite, and the program no longer removes kaolinite from the fit over it.

A.51 Applying the kaolinite bound instead of reporting it

§A.50 ends with a bound: on the separate that prompted it, the heated mount puts kaolinite at 55 to 80 % of the 7.15 Å window. The fit was never told. It saw one glycolated pattern, and what it did with that window was:

phaseshare of the 7.15 Å window
chlorite55.9 %
C/S27.4 %
kaolinite16.2 %

Kaolinite at 16 % where the heated mount allows 55 to 80, and the chlorite family at 83 % where at most 45 is available. The evidence was computed, printed on its own tab, and then left out of the arithmetic — which is the worst of the three places it could have been, because it reads as though it had been used.

The device already existed. An air-dried mount restrains the expandable clays through ExtraObservation: extra rows appended to the least-squares system, describing a second thing the same coefficients have to account for. The kaolinite bound is the same shape of statement — one row saying that the kaolinite entries, weighted by what each puts in the window, sum to the measured share of what is there. The midpoint of the bound is the target, because a least-squares row takes a value and not an interval, and the width belongs in the weight.

It had no effect, and that was a defect rather than a tuning problem. At weights from 1 to 100 000 the answer did not move by a digit. select_one_orientation narrows the library to one orientation at a time, and was passing the constraint blocks through unsubset, so their design columns no longer lined up with the library they were being applied to. ExtraObservation.subset exists for exactly this and was not being called. Any restraint used with that selection — including the air-dried one — was silently inert.

What it does once applied. With the clays held at one orientation, r = 0.3:

kaolinitechloriteillitekaolinite's share of the windowRwp
unconstrained0.87 %7.18 %24.30 %16.2 %0.3878
held to the bound4.98 %4.16 %23.98 %62.7 %0.4899

The intensity moves from the chlorite to the kaolinite, which is what the heated mount says happened, and the illite does not move at all. The residual gets worse by 0.10, and that is the price of believing a measurement the glycolated pattern cannot make. It is the same trade as §A.45 and §A.47: where a measurement and a residual disagree about a weight percent, the residual is the weaker witness.

It requires one orientation for the whole mount, and this is not optional. Left free to choose orientations per composition, the fit satisfies the constraint without finding any more kaolinite: it slides the clays to r = 0.1, where intensity is cheap, meets the 62 % share exactly, and takes every clay weight to near zero — kaolinite 0.27 %, chlorite 0.22 %, illite 1.31 %. Weight percent goes as r−3, so an orientation left free is always a cheaper way to satisfy an intensity constraint than a composition change. The fit says so when the two settings disagree.

The weight. Fifty, as a named constant. One extra row against some eighteen hundred pattern points needs a weight well above one to be heard at all; 20, 50, 300 and 1000 all give the same answer here, so the number is not delicate. It has not been tried on a specimen whose bound is tighter or whose kaolinite is larger, and that is recorded where it is set rather than discovered later.

The constraint is off by default. Whether to believe the heated mount is the operator's judgement, and giving the evidence its own tab before its own checkbox is the point.

What it does not fix. With the bound applied the separate's largest remaining residual is the 22.054 ° reflection, which is albite's own position and 94 % of its strongest line, and which the fit accounts for to about 10 %. Adding anorthite as a second plagioclase does not help: the misfit over that window moves from 0.905 to 0.906 and the anorthite takes 1.3 % almost entirely out of the albite. So the peak is not a plagioclase composition being wrong, and it is not a texture (§A.45); it is a phase absent from the fit whose strongest lines fall in the crowded 27 to 28 ° cluster, which is where the albite's own scale is being set from.

A.52 Three residuals that were not missing phases

The paragraph above was wrong, and the way it was wrong is worth keeping. Three features of that separate's fit were put to the program as three questions — what is missing from the 27 to 28 ° cluster, why does the 7 Å peak split so badly, and what produces the calculated line near 40 ° where the measurement has nothing. None of the three turned out to be a missing phase, and two of them were defects in this program.

The 27 to 28 ° cluster. At 0.0167 ° steps the cluster resolves into four lines, where the model has two:

measureddnet countsas an 00l
26.411 °3.3720 Å435003 of a 10.116 Å mica — biotite
26.628 °3.3449 Å5958quartz 101 (3.3435 Å)
26.695 °3.3367 Å3886003 of a 10.010 Å mica
26.895 °3.3123 Å6149003 of the 9.937 Å illite the fit has

Three micaceous populations rather than one, which the 10 Å peak cannot show — 0.07 Å in d(001) is 0.06 ° there and 0.20 ° at the third order. It is also what the fit has been expressing all along as illite beside I/S 99/1: two populations the library has no grain-size axis to separate.

Adding muscovite and biotite to the fit as accompanying minerals moves Rwp from 38.66 to 38.62 % and leaves the residual at 26.628 ° at +2697 counts of +2707. So the cluster is not short of phases. It is short of quartz: the fit puts 3252 counts at the quartz 101 where the measurement has 5958, and holds it there because quartz's own weak lines are already over-predicted. Cutting the fit to 4–33 °, which removes both of them, leaves quartz at 56 % of its 101. A positive residual standing on a strong line of a phase already in the fit is a scale that something else is holding down, and looking for a new phase under it finds one that is not there.

The line near 40 °. It is quartz 102 at 39.47 °, 96 % of the calculated intensity in that window, and it is in the library at 8 % of quartz 101, which is the powder-file value. The specimen measures it at 1.0 %, and quartz 110 at 36.54 ° at 1.9 % against a powder 8 %. It is not a background artefact: the raw counts there are 344 against a local level of 266, and that level declines smoothly to the end of the scan, so nothing is being swallowed. Neither absorption nor a displacement parameter can suppress a line by a factor of eight over ten degrees — a thin film reweights by at most the ratio of the sines, 1.47, and a displacement parameter of 2 Å2 by a tenth. What does it is particle statistics: in an oriented mount the quartz is a small coarse fraction, few enough grains that individual reflections depart from powder intensities by factors, and its 101 here has a half width of 0.046 °, below what this geometry can give a powder-averaged line. A quartz whose reflections are spiky is a quartz whose scale factor is not a measurement, and both the 40 ° over-prediction and the under-fitted 101 follow from it.

The 7 Å peak. The split is a position mismatch, and the kaolinite in the structure library is not what is wrong with it. The library puts kaolinite 001 at 12.372 °, d = 7.148 Å, which is the accepted value. The measured maximum is at 12.490 °, d = 7.081 Å, and the specimen's own chlorite 001 at 6.223 ° — d(001) = 14.183 Å — puts its 002 at 12.472 °, 0.018 ° away. The peak sits on the chlorite's position, not kaolinite's, and forcing kaolinite to 67 % of the window area put a profile 0.11 ° below the measured maximum. The derivative-shaped residual is that, and nothing else.

Which exposes the real error: the bound itself. §A.50 sizes kaolinite's share from CHLORITE_002_SURVIVAL, the 32 to 72 % that two pure chlorite standards keep through 550 °C. That is right for a chlorite that behaves like them, and this one does not. Normalising the two mounts on four heat-stable lines (quartz 100 and 101, the K-feldspar at 27.5 °, the albite at 27.9 °; median ratio 0.957, so the mounts are comparable and the 001 tripling to 319 % is real dehydroxylation), the chlorite-only 003 window keeps between 6 and 21 % of its area depending on how a near-invisible heated peak is integrated — against 36.5 and 73.4 % in the two standards.

The 003 is the one window that can say this without circularity. It carries no kaolinite, so measuring it in a kaolinite-bearing specimen is legitimate, which the 002 and the 004 are not: a specimen's own shared window cannot characterise the chlorite it is being used to separate. The standards then supply only the ratio between the orders, which is the stable part of the behaviour — on both of them a chlorite 002 survives 0.89 to 0.98 times as well as its own 003 (CHLORITE_002_OVER_003_SURVIVAL), because dehydroxylation moves intensity into the 001 and takes the orders above it down together.

windowwhat it holdssurvives 550 °C
chlorite 001chlorite only319 %
7 Åkaolinite 001 + chlorite 00215.2 %
chlorite 003chlorite only20.8 %
3.54 Åkaolinite 002 + chlorite 00441.5 %

At a 003 survival of 20.8 % the chlorite 002 is expected to keep 18.5 to 20.4 %, and the shared window keeps 15.2 %: kaolinite is 18 to 26 % of it, not 55 to 80. Applying that bound instead takes Rwp from 48.54 to 38.66 % — ten points from one corrected number — with kaolinite falling from 4.9 to 1.6 wt % and chlorite rising to 4.3. Kaolinite is still there: 15.2 % is below 18.5, so the window does collapse further than the chlorite alone accounts for. It is simply small.

chlorite_002_survival_from_003 implements this and kaolinite_evidence carries its result as measured_collapse beside the standards' route rather than in place of it. The two can differ by a factor of three, and which is right turns on how a heated 003 at the detection limit is integrated — on this separate the peak-fitting integration gives 5.9 % where a clipped trapezoid over the same window gives 20.8. Resolving that silently would hide the one thing the reader has to judge, so both ranges and the sentence saying how each was reached go into the report.

And a defect in the width anchor. §A.37 anchors the library's peak width on the quartz 101, whose width in a clay separate is the instrument's. The search window is 0.45 ° wide where no zero error has been applied, and the line fitted was whichever point in it stood tallest. On this specimen the illite 003 at 26.895 ° stands at 6149 counts against the quartz 101's 5958, so the anchor fitted the mica — and returned 0.101 °, the mica's width, where the quartz 101's is 0.046. The routine said so in its note and built the library anyway. A library built at twice the true width has every strong peak half as tall as it should be with the right area underneath, which reads as a set of missing phases and is not one. The fit now chooses among the local maxima in the window by distance from where the d-spacing puts the line rather than by height, and refuses a result landing further than QUARTZ_CENTRE_TOLERANCE = 0.15 ° from nominal instead of warning about it.

On this specimen the corrected anchor returns 0.046 °, which is below what a 0.5 ° slit on a 240 mm goniometer can give a powder-averaged line — so here the quartz is not a usable width standard either, for the same graininess that makes its scale factor unreliable. That is a judgement about the specimen, and it is now one the note puts in front of whoever is reading it rather than one the program makes silently in the wrong direction.

A.53 The kaolin standards, and what they were really saying

A library that cannot fit the standard it was built from is not describing that standard. Three kaolin-group separates — Kaolinite 12, Kaolinite 43 and Dickite 7, the same mineral from three sources — put their 001 where the library had no column, and the dickite fitted at Rwp 94.5 %: the calculated 001 reached 10,000 counts against a measured 160,000, and the fit reported 32 % chlorite/smectite and 18 % illite/smectite in a specimen that is one mineral. Two separate things were wrong, and only one of them was the library.

Most of it was the mount. Reading each standard order by order:

standardd(001) from the 001from the 002from the 003
Kaolinite 127.197 Å7.1617.148
Kaolinite 437.1907.1617.142
Dickite 77.2157.1897.182

An apparent spacing that falls with order is not a spacing — it is an uncorrected angular offset. A tenth of a degree is a large error in d at a 001 at 12 ° and a small one at the 003 at 37 °, so one offset makes the orders disagree in exactly this pattern, while a wrong spacing would move them all in proportion. Solving one offset per mount, in the form of a specimen displacement, brings all three orders of all three standards into agreement:

standardscorrected d(001), 001 / 002 / 003spread
Kaolinite 120.25 mm7.1272 / 7.1272 / 7.1269 Å0.0004 Å
Kaolinite 430.20 mm7.1345 / 7.1345 / 7.12540.0092
Dickite 70.18 mm7.1648 / 7.1648 / 7.16680.0020

So the library's kaolinite, calculated at 7.154 Å, was never a tenth of an ångström out. The mounts needed about −0.12 ° of correction and got none, because estimate_zero_error works from a known reference line and a pure kaolin standard has no quartz to offer it. That is the larger of the two faults, and §A.55 is what was done about it.

One claim here was overstated and is worth correcting in place, because the reasoning that produced it is the kind that looks sound. A displacement goes as cos θ and a zero error is flat in 2θ, from which it seems to follow that no zero error can absorb a displacement. Over a clay scan that does not follow: cos θ runs from 0.9985 at 6 ° to 0.9468 at 38 °, so 0.25 mm on a 240 mm goniometer shifts every line by between 0.119 and 0.113 °. The shape adds 0.006 ° over the constant — a twentieth of a peak width — and a zero error of −0.117 ° does 98 % of the same job. The two are not separable from a scan that stops at 40 °, and the millimetres below are a way of writing the correction down, not a measurement of where the mounts sat.

And some of it was the library. The corrected spacings are 7.127, 7.135 and 7.165 Å: a real spread of about 0.04 Å, with the published structure near its top rather than in its middle. Every other clay in the library spans its basal spacing — illite 9.90 to 10.10, chlorite 14.05 to 14.35 — on the reasoning that a refined structure is one specimen's and not the mineral's. The kaolinites were left out of that on the reasoning that a kaolinite has no interlayer to vary, which is true of the mineral and false of the measurement, and it left them with no freedom at all while a chlorite/smectite at 14.2 Å stood ready to take the misfit. The axis is now 7.10 to 7.22 Å in steps of 0.03 — finer than the 0.05 that would match the other phases proportionally, because 0.05 is one step wider than the whole spread these three standards show, and the basal reflection is the only strong line a kaolinite has.

Both corrections together are what the diagnostic windows need: the 7.15 Å window is shared with a chlorite 002, and a kaolinite column standing half a peak width from the measured peak cannot be told from a chlorite one that stands on it.

What each correction is worth. Fitting the glycolated mount of each standard against the clay library alone, at one orientation:

standardas it was+ kaolinite 7.10–7.22 Å axis+ displacement removed
Kaolinite 1257.6 %44.7 %38.1 %
Kaolinite 4356.3 %40.2 %32.8 %
Dickite 794.5 %68.2 %49.3 %

Rwp here, and the displacement is worth as much as the axis or more. The weights move with it: on Dickite 7 the two kaolinites take 78 % together once both corrections are in, against a first fit that gave the kaolinite 45 % and handed 32 % to chlorite/smectite and 18 % to illite/smectite. Note also what the axis alone does to the entry names — the fit takes two kaolinite columns one step apart, 7.16 and 7.19 Å, which is a single mineral being described by two spacings because no one spacing fits both its orders. That is the displacement showing through the axis, and it is why the axis alone is not the whole repair.

Thirty to fifty per cent is still high for a specimen that is one mineral, so neither correction is the last one. The measured 001 of all three carries a pronounced low-angle tail the calculated profile does not have, which is axial divergence and is not in the peak-shape model (§A.37); and a chlorite/smectite near 18 % survives in two of the three, which is the ambiguity §A.54 exists to close and cannot, there being no heated-mount restraint on a specimen fitted by itself.

A.54 Restraining both halves of a shared window

§A.51 restrains kaolinite's share of the 7.15 Å window. It says nothing about the chlorite, and a window is not a partition unless both sides of it are named: on the separate the restraint was built for, kaolinite held to 16 % of the window sat beside a chlorite family taking 83 % of the same window, which no division of one peak allows. The restraint now carries a second row saying the chlorite entries must take the complement, which the heated mount measures in the same breath as the first — what survives 550 °C in that window is the chlorite and what disappears is the kaolinite, so the two shares come from one measurement and neither is free.

The chlorite row names the chlorite/smectite entries as well as the discrete chlorite, and that is not a detail. A restraint naming only the discrete chlorite is satisfied by moving the intensity into C/S, which is precisely how a fit comes to report an expandable component that is not there (§A.53).

Both rows are in peak area, not in weight per cent. The restraint says how the window is divided; what that works out to as a mass depends on the orientation and the structure factors, which the fit is still free to settle. That distinction matters because the two are not proportional: the March–Dollase factor scales a basal series as r−3 (§A.24), so the same share of the same peak is a different mass at every texture the fit might choose, and restraining the mass instead would be asserting a texture nobody measured.

A.55 Calibrating 2θ without quartz

estimate_zero_error works from a known reference line, quartz 100 or 101. A clay separate usually has quartz and this is the right way round. A pure mineral standard has none, and the honest thing the program offered in that case was nothing: the axis stayed where the diffractometer put it, which on the three kaolin standards of §A.53 was about 0.12 ° out and cost between 6 and 19 points of Rwp.

A basal series is its own reference. Its orders must be consistent: one layer repeat has to explain the 001, the 002 and the 003 at once. A single reflection cannot separate an angular offset from a spacing, because any position is explained by either, but two orders fix both, since an offset is a large error in d at the 001 and a small one at the 003 while a spacing moves them in proportion. estimate_displacement solves for the correction that minimises the disagreement, and basal_series_positions follows the series from wherever the 001 actually is rather than from where a nominal spacing would put it, so an unexpected spacing is still tracked.

On the three standards, taking the series the mount shows most orders of:

standardorders usedsolvedequivalent zero errorspread before → after
Kaolinite 1212.318, 24.863, 37.696 °+0.140 mm−0.066 °0.0269 → 0.0036 Å
Kaolinite 4312.317, 24.849, 37.683+0.128 mm−0.060 °0.0245 → 0.0015
Dickite 712.265, 24.734, 37.512+0.123 mm−0.058 °0.0238 → 0.0003

Three orders reconciled to between 0.0003 and 0.004 Å. Refitting with the correction the program solves for itself takes Rwp from 44.7 to 40.1 %, 40.2 to 34.0 % and 68.2 to 48.1 %, which is within a point or two of the hand-solved values of §A.53 and needs no hand.

What the millimetres are not. They are not a measurement of the mount. Over a 4 to 40 ° scan a displacement and a constant zero error fit the same data to within 0.006 ° (§A.53), so a specimen genuinely 0.14 mm proud cannot be told from one sitting true on a goniometer 0.066 ° out of zero. DisplacementResult.equivalent_zero_error gives the constant for anyone who prefers to think in degrees, and the solver reports it beside the millimetres rather than letting the choice of units imply a physical claim. What the correction is good for is the axis, and that is all it is used for.

Two consequences follow for how it is used. Where a separate does have quartz, set the zero error from it first and let this take up what is left — a known line beats an internal consistency argument. And where both are set, they compose: MountState.corrected removes the displacement and then the zero error, in that order.

The solve runs on the background-subtracted pattern, not the raw one. A peak sitting on the low-angle air scatter has its centroid dragged down the slope, and at 6 ° that slope is steep enough to move the answer.

A.56 What the standards are for, and where that had been failing

The library is calculated, from published crystal structures. The standards are not fitted to; they decide the ranges the axes span, and then they check the result. That division is deliberate: a library curve-fitted to one chlorite describes that chlorite and nothing else, and the whole point of a reference library is to describe a mineral the operator has not measured yet. So the standards set the span and the span has to be wide enough to contain them.

The check had been failing and the failure was being recorded instead of acted on. The chlorite iron axis was calibrated on these two standards and its own documentation said, of the clinochloritic one, that its 003 was matched “by nothing here, which is left standing rather than tuned away”. Leaving a number standing is right when the alternative is tuning it away. It is not right when the axis simply has not been opened in the direction the standard needs, and that is what had happened.

Measured on the glycol mounts, background removed and the angular offset solved out, as areas against the 002 — on the geometry the data actually record, a 240 mm goniometer with a 0.5 ° slit and the 4.91 cm2 discs the standards table gives, which are 25 mm:

001002003004005
Chlorite 16, d(001) 14.169 Å0.5031.0000.4230.6170.125
Prochlorite 15, d(001) 14.181 Å0.4251.0000.5940.7500.169
hydroxide-only axis could reach0.179–0.3891.0000.666–0.6940.623–0.6760.145–0.203

Neither standard's 001 was reachable and neither 003 was close: whatever the iron content, the calculated 003 sat at 0.67 to 0.69 of the 002 while the standards measure 0.42 and 0.59. The axis moved the 001 strongly and the 003 hardly at all, and the standards differ mainly in the 003.

Why one sheet could not do it. A chlorite's odd orders come from the contrast between the 2:1 layer and the hydroxide sheet, its even orders from their sum. Iron in the 2:1 sheet raises the contrast; iron in the hydroxide sheet lowers it, and steeply, because the 001 passes through zero where the two scatter alike. Each sheet alone therefore trades one order against another. The axis had been tried as the 2:1 sheet alone (worse than the published structure everywhere) and then as the hydroxide sheet alone; the two together had never been tried, and that is what the standards want. Opening both, on a 5 × 5 grid:

largest error on any orderChlorite 16Prochlorite 15
hydroxide sheet only59 %17 %
both sheets22 %14 %

The prochlorite's 003 goes from unreachable to within half a per cent. That matters past the fit: the 003 is one of the three diagnostic windows and the only chlorite order kaolinite does not share, so it is what chlorite_002_survival_from_003 (§A.52) measures the chlorite's collapse on. A chlorite whose 003 the library cannot produce is a chlorite whose collapse cannot be measured, and the kaolinite bound that rests on it inherits the error.

What is still not reproduced. Neither standard is matched better than about 15 %, and Chlorite 16 not better than 22: at its best point the calculated 001, 003 and 004 are all 11 to 19 % low while the 005 is 18 % high, a systematic shape no iron content corrects. Prochlorite 15's 004, at 0.750 of its 002, is outside what the entire composition space reaches — 0.368 to 0.676 — so there it is the layer model that falls short, not the axis. Those two statements are the honest limit of the current chlorite model, and unlike the 003 they are not fixed by widening anything.

The axis did not contain the structure it was built around. The entries are calculated from ICSD 164234, a single-crystal refinement at 298 K of one particular clinochlore, and that structure is not iron-free: its formula is H16Al2.884Fe0.874Mg11.126O36Si5.116, with refined iron on four octahedral sites — 0.087 and 0.088 in the 2:1 sheet, 0.060 and 0.054 in the hydroxide sheet, which average by multiplicity to 0.0877 and 0.0580.

chlorite_crystal sets those occupancies rather than adding to them, so chlorite_crystal(0, 0) is a magnesium end member nobody refined. The build gave that entry the bare name chlorite, with a comment stating that the published structure keeps its plain name. It does not, and the old axis held the 2:1 sheet at zero at every point, so the refinement itself was outside the series calculated from it. Every chlorite entry in the library was an invented composition.

The difference is not cosmetic. On a 240 mm instrument:

001002003004005
ICSD 164234 as refined0.3481.0000.5230.6080.166
what the library called chlorite — (0, 0)0.3891.0000.6940.6760.203
Chlorite 16 measured0.5031.0000.4230.6170.125
Prochlorite 15 measured0.4251.0000.5940.7500.169

On the 003 — the order that matters most, being the only chlorite reflection kaolinite does not share — the refinement at 0.523 sits between the two standards, and the magnesium end member at 0.694 is outside both. The structure actually validated against single-crystal data was the closest thing available and it was the one not on the axis. CHLORITE_PUBLISHED_IRON now leads the series and carries the plain name, and a test re-derives it from the CIF so the constant cannot drift from the file.

Illite and both kaolinites are unaffected: their structures are fully ordered, with no partial occupancies for a composition axis to overwrite.

And a procedural note. Three times in this work a quantity was explained by geometry that the data already recorded: the mount area is in the standards table, the goniometer radius and the slit are in every data file. A specimen length guessed at 35 mm would have moved the calculated chlorite 001/002 from 0.389 to 0.552 and apparently resolved a discrepancy that is really in the structure model. The geometry is a measurement; it is never the explanation of last resort.

A.57 Two tests the pure standards failed, and what they found

Every fit of a standard shown up to §A.56 used the glycolated mount alone, and a pure chlorite came out as 41 % illite/smectite. The program already has the device that should stop that: shift_evidence measures how far each basal reflection moved between the air-dried and the glycolated mount, and expandable_bound turns “nothing moved” into a ceiling on how much expandable layer an entry may carry. Both GUI checkboxes default to on. The fits were missing it because the test harness was not using it, which is a fault in the testing and not in the program — but running the eight standards through the verdict itself found two faults that are.

A weak line was allowed to set the mount offset. The two mounts are put on a common angular scale by a reflection no treatment moves, and that offset is then subtracted from every displacement. A wrong offset therefore does not add noise — it manufactures movement. On Kaolinite 12, which contains no quartz, the window around the quartz 101 held a weak kaolinite line at 26.734 °, 1.7 % of the pattern maximum; the two scans placed that broad feature 0.056 ° apart, and subtracting it turned the kaolinite 001's true −0.003 ° into +0.053. A pure kaolinite was read as swelling and left unrestrained. REFERENCE_MINIMUM_SHARE now requires 5 % of the pattern, measured against the whole scan and not against the search window — the first attempt used _peaks's minimum_share, which is a share of the window's own maximum and so is satisfied by anything that is the tallest thing in an empty stretch.

A reflection that shrank was counted as swelling. Glycolation replaces interlayer water with a larger complex, so an expandable 001 moves to larger d. Illite 10's only movement was a 10.073 Å line going to 10.055 — a reflection that shrank — and taking its magnitude read a pure illite as swelling. Displacements now count only where d increased. Appearances are untouched, which matters because that is what both montmorillonite standards actually rest on: neither shows a displacement the measurement can distinguish from its own placement, and both show a new 17 Å line. The caveat is Mering's rule — a mixed layer's higher orders can move either way — so this discards evidence a 002 or 003 might have carried; it cannot discard the 001's, nor an appearance.

With both corrected the verdict is right on all eight: no swelling on the two kaolinites, the dickite, the illite and the two chlorites; swelling on both montmorillonites. It had been wrong on two.

What the restraint then does, and what it costs.

standardmixed-layer, glycol alone → restrainedRwpfirst phase reported
Kaolinite 1231.9 → 14.8 %40.03 → 40.82kaolinite_1M 52.8
Kaolinite 4329.6 → 13.133.98 → 34.60kaolinite_1M 51.6
Dickite 720.8 → 11.448.07 → 48.12kaolinite_1M 72.4
Chlorite 1668.0 → 35.335.26 → 43.09chlorite 46.5 (was I/S 60/40)
Prochlorite 1543.4 → 19.277.57 → 78.92chlorite 51.0

On Chlorite 16 the chlorite goes from 28 % behind an illite/smectite to 46 % and first place, and it costs 7.8 points of Rwp. That is the third time in this work that the truer answer has fitted worse than the false one, after the 7.10 Å kaolinite column (§A.53) and the window-split restraint (§A.54). It is not a coincidence and it is not a reason to doubt the restraint: a mixed-layer entry has more freedom than a discrete mineral, so it will always absorb residual better, and a criterion that rewards it is selecting for the wrong thing.

What is still wrong. The restraint is not sufficient. A pure chlorite still reports 35 % I/S and 15 % kaolinite; a pure prochlorite still reports 29 % kaolinite. Half of each chlorite standard is still being given to minerals it does not contain, and that is with the composition axis corrected and the swelling verdict right.

And the alternative CIF is not the answer. A TOPAS-refined clinochlore from the same coordinates was tested against the standards and is markedly worse: the largest error on any basal order is 52 % and 66 % against the two chlorites, where ICSD 164234 gives 33 and 19. It also carries a diagnosable defect — its tetrahedral sites refined to Si 0 and Al 1, where a chlorite's tetrahedra are about 60 % silicon, which is a refinement that reached a bound rather than a composition. It is not used.

A.58 Why a pure illite was reported as 99 % illite/smectite

Not because anything looked like smectite. Because nothing else in the library was wide enough.

Illite 10's 10 Å reflection measures 0.418 ° FWHM. The discrete illite entries span 0.080 to 0.100 °; the I/S entries span 0.180 to 1.080. The discrete illite is a factor of four too sharp and cannot be scaled to the measurement at all — a reference peak four times too narrow can match a height or an area but never both. The fit answered with the only columns that could be that wide, which happen to carry a smectite label.

The cause is traceable to a decision made here and is worth setting out, because the decision was right and its consequence was not noticed. The discrete illite and chlorite were deliberately left without a width axis, on the reasoning — recorded in DISCRETE_STRAINS — that their widths were already spanned through the interstratified series' crystallite thickness distribution, "which reaches the discrete end member at a host fraction of 1.00". That was true. The 1.00 end members were then removed, correctly: an I/S at a host fraction of 1.00 is illite, and carrying one mineral under two names split it arbitrarily between two columns no measurement can distinguish (cosine 0.963, and reporting the pair together proved thirteen times less reproducible than dropping one). Removing them also removed the width freedom the discrete illite had been borrowing, and nothing replaced it.

DISCRETE_THICKNESSES replaces it where it belongs: a coherent-domain axis on the discrete illite and chlorite themselves, in ångströms along c*, spanning None — the unbroadened entry, which keeps the plain name — then 600, 250 and 120 Å. On this instrument those calculate 0.100, 0.140, 0.320 and 0.660 ° at the 10 Å reflection, so the measured 0.418 sits between the last two, at about 190 Å or nineteen layers. The end members stay out.

This is spanning, not inventing. How many layers stack coherently is a property every real specimen has and no published structure records, so the library's job is to offer the range and let the measurement choose — exactly as it does for the basal spacing and the octahedral iron. What would be invention is naming one of those points as measured, which is the fault §A.56 describes and not this one.

A.59 Leaving the expandable clays out, and an audit of where numbers come from

The expansion tab now carries a second checkbox: leave the expandable clays out of the fit entirely. It is blunter than the ceiling beside it — the ceiling allows as much expandable layer as the unmoved reflections could have hidden, this removes every entry carrying any — so it is off by default and it is the operator's instruction rather than the evidence's. It will usually make Rwp worse, and that is not a reason to leave it off: a mixed-layer entry has more freedom than a discrete mineral and absorbs residual better whether or not it is present.

The audit. Every module-level constant was checked for whether it says where its value came from. Two faults found by hand had the same shape — the chlorite composition axis naming an invented point as the published structure (§A.56), and the heated mount labelled 500 °C where every bracket in the program was measured at 550 — and neither was a wrong formula. Both were a number that said less about itself than it should have. The label is corrected, and tests/test_constants_are_sourced.py now requires a docstring on every public module-level constant: forty had none. A test cannot check that a docstring is true — only a measurement does that — but it can stop a bare literal appearing with nothing attached to it.

One distinction the audit has to keep, because collapsing it would do real damage. A parameter that is spanned is not invented: the octahedral iron, the basal spacing, the crystallite thickness and the preferred orientation all vary between real specimens, no published structure records them for the specimen in hand, and offering a range for the measurement to choose from is the method rather than a shortcut around it. What must never happen is a spanned point being presented as a measured one, or a range chosen so that it excludes the structure it was built from. Where a value here is a judgement rather than a measurement, its docstring now says so and says what changes if it moves.

A.13 Summary

AreaTestsStatus
Interstratification model25 automated, against closed-form and invariant resultsPass
Basal / three-dimensional consistency9 automated, four phasesPass
External validation4 automated, against Reynolds (1965); R = 0.039 vs his 0.042Pass
Workflow on synthetic data7 automatedPass
Structure import209 phases; 12 positions to 0.03°; origin convention established; every phase checked against the cell mass and volume its block states Pass; one incomplete structure found
File readers33 files; bit-for-bit against vendor exportPass
Zero error11 specimens × 3 mountsPass after correction
Mineral search4 methods compared on known and real data; the two the interface offers compared on one separate Method 4 adopted; position matching ranks albite 38th and quartz 101st of 169 where the competitive fit ranks them 1st and 7th, so the dialog now names the test it ran and pre-ticks nothing without a library
Peak stripping5 widths, with and without peaks, against a known background Defect found and corrected; 12 automated
Background estimators41 automated; two estimators over 39 real patterns and 8 fits; the reach law measured, the two parameters' influence compared, and the parameters read back off eleven measurements and five synthetics; both sliders over HighScore's full spans Offered as a component with HighScore's own parameters and starting values read from the glycol scan; a defect in the paper's noise level found and fixed; an "inert" claim about the bending factor retracted once its slider reached 100; the fitted components keep the default on all 8
Weight percent11 automated, against known masses Exact; needs a texture calibration
Internal standard10 automated, on both bases Pass; the absolute scale and the unaccounted fraction
Interstratification reporting5 automated, across the I/S series Host-layer fraction reported beside the phase name
Parameters on a range edge12 automated, including that the end member is the pure phase and that a physical limit reads differently from a library one Reported by every fit; both series extended to their end member
Pure-mineral basal ratios14 automated; three single-phase mounts; eight candidate causes of the chlorite shortfall Kaolinite 002/001 = 1.05; one conclusion retracted; the chlorite 004 open
Absorption11 automated; six compound coefficients against published values; the Cu edge discontinuity Corundum 31.14 vs 31.1; an unlisted element raises
External standard10 automated; four pure mounts against a corundum on the same settings kp 0.216–0.281, 11 % relative sd over r−3 × 244
Refined structures27 automated; against a refinement of one specimen, and against a CIF written by TOPAS Rwp 35.9 → 31.2 %; adopted for the clays
Quantitative fit11 real specimens, after the correction Rwp 37–68 %, median 45 %
File pairing12 automated, on real naming conventionsPass
Names used but never importedevery source file, checked with pyflakes 3 found in the interface and fixed
InterfaceEnd-to-end in a browser, every tab and buttonPass; 7 defects found and fixed
Peak-list patterns26 automated; integrated intensities against the entry they came from, and the comparison against a stand-in whose answer is known Reproduced to 0.5 %; 8 of 8 lines matched to 0.007°; a clipped arcsin found, which had put an unreachable spacing at 180°
Setup windows and icons13 automated; both windows opened under a virtual display, both jobs run on real files 209 phases imported and 1751 patterns built from the windows' own code paths
File and folder choosers17 automated; the real dialogs opened, cancelled and accepted under a virtual display, and all three driven through the running server Pass; the chosen folder, database and library each reach their box
Clay peak width11 automated; four basal reflections measured against the instrumental width on a real mount; four library variants fitted against an independent TOPAS refinement Microstrain added to the peak shape and spanned for the kaolinites, which had no width axis; extending it to illite and chlorite lowers Rwp and worsens the assemblage, so it is left off by default
Diagnostic reflections10 automated, on a specimen with and without the order that identifies an expandable stack; and on a real mount against its TOPAS refinement An I/S at 3 % of the clay removed for predicting a reflection the measurement cannot show, at no cost in Rwp; the dependence on the background under the window measured and stated
Layer spacing refinement11 automated, including a known spacing recovered from a library that does not contain it; five deviation bounds on a real mount against its TOPAS refinement Implemented, validated, and left off by default: six points of Rwp bought by moving kaolinite onto the chlorite 002
Cell allowance in the screen22 automated; five allowances on a real triplet against 209 candidate structures Set to none, as Clayfit has it: 11 phases reported instead of 65, and the three the specimen contains ranked first, second and third
Two-stage search5 automated, including that the second stage can reach a thickness the first never offered; both searches on a real mount against its TOPAS refinement Offered beside the joint search, which stays the default: half a point of Rwp worse, a point of chlorite and of illite better, three times faster
Diagnostic significance11 automated; nine near-pure clay standards measured as all three mounts A reflection must now stand clear of the background: four of the nine standards had been reported as containing kaolinite with nothing at 7.15 Å at all. The chlorite 002 survival measured at 32 and 72 % on two chlorites, so kaolinite is reported as a range and both chlorites answer zero
Pure standardsNine near-pure clay standards, each as three mounts, through the whole fit; their basal-series ratios against the calculated ones; 7 automated on the shared orientation Both chlorites were reported as 27 % chlorite and 71 % kaolinite. The fit was right and the r−3 weighting inverted it; one orientation per mount gives 90 % and fits better. The illite 002 is measured 3× weaker than calculated and the chlorite iron axis is on the wrong sheet
Kaolinite against the chlorite10 automated; the chlorite basal ratios measured on two standards in both mounts; nine standards and one refined mixture answered Kaolinite measured from the air-dried mount alone against chlorite reflections kaolinite does not have. All nine standards correct and no chlorite called kaolinite; heating shown to enhance a chlorite 001 by 2.2 to 3.5 times, which is why the collapse test could not bound it
Published page and Windows entry points 12 automated; the generated page rendered at two widths; both PowerShell scripts parsed and their probes exercised under both of PowerShell's argument-passing modes Standards mode, no overflow, nothing dropped; a quoting defect found that made the installer unable to see an installed Python, and fixed

The automated suite comprises 654 tests and runs in about a hundred seconds (pytest -q). Those that need the ICSD structures are skipped automatically when they are not installed; the rest, including the whole of tests/test_background.py, run without them.

Appendix D — Provenance of the accompanying-mineral structures

The 209 structures below are those of the TOPAS structure library used during development. They are not distributed with ClayQuant and are not part of it: the library is user-supplied, imported by clayquant-import-structures (§4.3), and every ClayQuant installation may use a different one. The table is given so that any pattern the program calculates can be traced to the structure it came from, and that structure to its source database and entry.

Why the citations are not printed here. Of the 209 entries, 200 are ICSD, 3 AMCSD and 2 COD, and 4 carry no identifier. ICSD is a licensed database with no open lookup from an entry number to its publication, so those citations could not be retrieved and verified for this manual, and they have deliberately not been guessed: an invented reference is worse than an absent one. The identifiers below are exact, taken from the library file itself, and each resolves to its full bibliographic record in the database named — through an ICSD subscription, through rruff.geo.arizona.edu/AMS for AMCSD, or through crystallography.net for COD, all of which report the original publication for the entry. A machine-readable copy with an empty citation column to fill in is in the repository as docs/structure_provenance.csv.

The four clay mineral structures are not in this table: they are integral to the program, are named in §4.2, and their publications are cited in full in §10.

PhaseDatabaseEntry
ActinoliteICSD68319
AegirineICSD156560
AkermaniteICSD158177
AlbiteICSD68913
AliteM3ICSD94742
AlmandineICSD71895
AluminateCICSD1841
AluminateOICSD1880
AluminiumICSD606001
Amorphous——
AnalcimeICSD156593
AnataseICSD9852
AndalusiteICSD84613
AnglesiteICSD92609
AnhydriteICSD16382
AnkeriteICSD66338
AnorthiteICSD34942
ApatiteICSD26204
AphthitaliteICSD26018
AragoniteICSD157992
ArcaniteICSD2827
AugiteICSD90143
AusteniteICSD186833
AzuriteICSD158577
BariciteICSD202099
BariteICSD16904
BassaniteICSD79529
BayeriteICSD26830
Belite Alpha HICSD82997
Belite BetaICSD81096
BiotiteICSD95359
BoehmiteICSD41215
BorniteICSD1963
BredigiteICSD9828
BrookiteICSD36408
BrownmilleriteICSD2842
BruciteICSD79031
BrushiteICSD16132
Ca2P2O7ICSD14313
CalciolangbeiniteICSD290622
CalciteICSD73446
Calcite-SuperlorentzICSD73446
CaledoniteICSD164674
CassiteriteICSD262768
CelestineICSD22322
CementiteAMCSD13523
CerussiteICSD6178
ChalcopyriteICSD2518
ChamositeICSD80080
ChloriteICSD164234
Chlorite PawleyICSD164234
ChloroxiphiteICSD164137
ChromiteICSD171121
ChrysotileICSD77747
CoesiteICSD100749
CopperICSD53247
CorundumICSD51687
CotunniteICSD43344
CovelliteICSD63327
CristobaliteICSD75483
CubaniteICSD42104
CupriteICSD63281
DiaboleiteICSD15382
DiamondICSD52054
DiasporeICSD29344
DickiteICSD98132
DiopsideICSD17043
DolomiteICSD100680
Dolomite-Ankerite SSICSD100680
Dolomite-SuperlorentzICSD100680
EllestaditeICSD262245
EnstatiteICSD9328
Enstatite-Ferrosilite SSICSD9328
EpidoteICSD168464
EpsomiteICSD16595
EskolaiteICSD75577
EttringiteICSD155395
FaujasiteICSD40931
FayaliteICSD54029
FerrosiliteICSD34858
FluoriteICSD60559
ForsteriteICSD9685
Forsterite-Fayalite SSICSD9685
FrankliniteICSD91827
GalenaICSD63095
GehleniteICSD158171
GhiaraiteAMCSD19787
GibbsiteICSD184708
GoethiteICSD245057
GoslariteICSD107287
GraphiteICSD76767
GriceiteICSD41409
GrossularICSD83461
GruneriteICSD24214
GypsumICSD151692
HaliteICSD181148
HematiteICSD40142
HercyniteICSD40093
HeulanditeICSD37064
HornblendeICSD158242
HydrocalumiteICSD51890
HydrocerussiteICSD280932
HydrotalciteICSD81963
IlliteICSD90144
Illite PawleyICSD90144
IlmeniteICSD30664
IronICSD76747
JarositeICSD166799
JasmunditeICSD26407
K2ZnCl4——
Kaolinite 1MICSD63192
Kaolinite 2M——
KieseriteICSD68345
LaB6ICSD248440
LabradoriteICSD100235
LangiteICSD30724
LaurioniteICSD28035
LeadICSD96501
LepidocrociteICSD108876
LeuciteICSD161630
LimeICSD163628
LithargeCOD9012700
LizarditeICSD202358
MaghemiteICSD79196
MagnesioferriteICSD41290
MagnesiteICSD73731
Magnesite-SideriteICSD73731
MagnetiteICSD158504
MalachiteICSD262794
MarcasiteICSD42415
MassicotICSD15403
MayeniteICSD241243
MCPMICSD133
MelanteriteICSD157296
MendipiteICSD93003
MerwiniteICSD26002
MicroclineICSD83531
MiniumICSD42484
MonetiteICSD2745
MontmorilloniteICSD51636
MulliteICSD75305
MuscoviteICSD180081
NatronICSD97922
NewberyiteICSD31281
NordstranditeICSD16018
OldhamiteICSD30236
OrthoclaseAMCSD20540
OtaviteICSD156740
ParalaurioniteICSD74291
PbS2O3ICSD69532
PbSO3ICSD68889
PericlaseICSD159367
PerovskiteICSD62149
PhosgeniteICSD4240
Pigeonite-CICSD9248
Pigeonite-PICSD9247
PortlanditeICSD64950
PrehniteICSD164238
PseudoboleiteICSD67680
PumpellyiteICSD158186
PyriteICSD15012
PyropeICSD71892
QuartzICSD67121
QusongiteICSD246149
RiebeckiteICSD200423
RozeniteICSD23912
RutileICSD36412
SanidineICSD90141
ScotlanditeICSD30993
SideriteICSD100678
SiliconICSD51688
SillimaniteICSD66330
SmithsoniteICSD100679
SpessartineICSD83458
SphaleriteICSD77090
SpinelICSD77583
SpurriteICSD156625
StauroliteICSD53148
StilbiteICSD83469
StishoviteICSD40098
SylviteICSD165593
SyngeniteICSD157072
TaeniteICSD103555
TalcICSD100682
TCP AlphaICSD923
Tenite-SuperstructureICSD56386
TenoriteICSD67850
ThaumasiteICSD185680
TitaniteICSD50144
Tobermorite11AICSD92942
TridymiteICSD34867
TroiliteICSD35005
TronaICSD192710
VateriteICSD181959
VermiculiteICSD192347
VivianiteICSD423390
WadaliteICSD151561
WeddelliteICSD192661
WhewelliteICSD153499
Whitlockite (Ca,Mg)3(PO4)2ICSD1490
Whitlockite Ca3(PO4)2——
WollastoniteICSD201538
WuelfingiteICSD50447
WuestiteICSD27237
WurtziteICSD67453
YeelimiteCOD4001772
ZinciteICSD154486
ZinkositeICSD71018
ZirconICSD9582

Entries without an identifier are either not structural models (the amorphous and mixed-layer entries) or were added to the library without a database reference. Two entries of the library are Pawley (whole-pattern, structureless) phases for illite and chlorite; they carry the ICSD numbers of the structures their cells were taken from, which are the same illite and chlorite structures ClayQuant itself uses.

Appendix B — File formats read

FormatExtensionNotes
PANalytical XRDML.xrdml Intensities from <counts> or <intensities>; multiple appended scans are concatenated; positions from a start/end range or an explicit list. Wavelengths, goniometer radius, divergence slit, counting time and sample identifier are read as metadata.
Two-column text.xy, .txt, .dat, .asc 2θ and intensity. Comment and header lines are skipped; comma, tab and space separation are accepted.
Bruker RAW.raw Binary; the common RAW1.01 and RAW4 variants. Support is best-effort — if a file is not read, export it as two-column text from the vendor software.
CIF.cif The subset produced by ICSD, COD and AMCSD exports: cell, an explicit symmetry-operation loop, and an atom-site loop with occupancies and Biso or Uiso.
TOPAS structure library.xml jEdit macro-menu form; str blocks with cell, space group and site lines.
Pattern library.npz Compressed NumPy archive holding the grid, the pattern matrix, and per-entry and library metadata.

Appendix C — Symbols

SymbolMeaningUnits
sscattering vector length, 2 sinθ/λ = 1/då−1
qsinθ/λ = s/2; argument of scattering and displacement factorså−1
dinterplanar spacing; dA, dB layer repeat distanceså
F(s)layer structure factor, complexelectrons
Bisotropic displacement parameterå2
N, ⟨N⟩layers per crystallite; its mean over the CSDS—
βwidth of the lognormal CSDS in ln N—
G(n)pair weight at layer separation n—
P, PmnMarkov transition matrix and its elements—
W, Wmstationary layer proportions—
Tphase-weighted transition matrix, equation (2.10)—
RReichweite, the range of the stacking correlation—
rMarch–Dollase preferred-orientation parameter—
αangle between a scattering vector and the texture axis c*rad
γequatorial divergence of the incident beamrad
Rgoniometergoniometer radiusmm
cpfitted scale factor of library pattern p—
wistatistical weight of point icounts−1
Rwp, Rpweighted-profile and profile agreement factors—

A.60 The geometry read from the file, and a chlorite axis the standards ruled out

Two things were asked of the beam-overflow correction: that the right geometry reach it, and that it be applied to every reflection and not only the first. The second was already true and is worth saying plainly, because the evidence for it looks at first like evidence against. The correction is the fraction of the beam the specimen intercepts, and it is applied to the whole calculated pattern as a function of 2θ. Above the angle at which the beam is fully intercepted that fraction is exactly one, so every line above it is unchanged — which is why a table of chlorite 00l ratios shows the 002, 003, 004 and 005 identical with the correction and without it, and only the 001 moved. On a 25 mm disc at 240 mm with a 0.5 deg slit and a 14 mm mask, full illumination is reached at 11.61 deg, below the chlorite 002.

Fraction of the beam intercepted, by line. The two columns differ by a constant 1.102 below full illumination and not at all above it.
line2θ (deg)280 mm, rectangular240 mm, round, 14 mm mask
chlorite 0016.200.55330.6100
smectite (EG) 0015.240.46770.5156
illite 0018.840.78850.8693
chlorite 002 and above≥12.41.00001.0000

The first was not true. The goniometer radius and the divergence slit were read from the data file, but the mask was not, so a round mount was corrected with the dataclass default of 10 mm while the measurements were collected with the 14 mm mask; and the library's own build defaulted to 280 mm and a rectangular specimen. The mask is now read from the XRDML (beam_width, the narrowest listed), and the fallback geometry is this instrument's: 240 mm, 0.5 deg, 14 mm, a 25 mm disc. Because the factor below full illumination differs between the two geometries by a constant, the correction is a uniform 10.2 per cent on the low-angle lines and nothing above 11.6 deg — so it moves weight between the phases that scatter mainly below that angle, the expandable ones, and those that do not.

The second request was to put the interlayer hydroxide sheet's position on a spanned axis, as the octahedral iron already is, in the hope of reaching a chlorite 004 that six measured specimens put well above the model. The standards ruled it out. Moving the named sheet (Mg3, Fe3, Mg4, Fe4, O7–O9, H2–H4) along c* lowers the 004 in both directions — the published position is already the maximum the structure reaches — while the 001 collapses, because a chlorite's 001 reflects the contrast between the two sheets and sits near a node, so it is hypersensitive to exactly this parameter.

Calculated chlorite 00l areas over the 002, with the interlayer hydroxide sheet displaced along c*, against the six measured specimens.
hydroxide sheet001003004005
−0.20 Å0.2790.4120.4990.198
−0.10 Å0.1930.4610.5170.126
published0.5190.5200.6210.177
+0.10 Å0.1100.5340.5500.054
+0.20 Å0.0910.5600.5630.038
+0.40 Å0.0710.5930.5770.024
measured, two standards0.347, 0.4070.388, 0.5920.762, 0.8140.169, 0.197
measured, four Clayfit3 chlorites0.37–0.430.63–0.67 0.91–0.94—

So the axis was not added. It would have multiplied the chlorite entries five-fold to give the fit a parameter that cannot reach the quantity it was meant to reach and that ruins one it currently gets right, which is a worse library and not a better one. The chlorite 004 remains open; what it is not is the iron, because the 002 and the 004 are both even orders and the iron moves the odd ones, nor the hydroxide sheet's height, by this table, nor the displacement parameters, which at B = 0 would raise the ratio by three per cent against the forty needed.

A.61 Stacking order on an axis, and which compositions each series mixes at

The interstratification model has always taken a Markov transition matrix and has always been given the random one. That left the library spanning composition, texture, crystallite thickness and layer spacing, but only ever random stacking — and the measured Clayfit3 database is half ordered. The three members ClayQuant fitted worse than Clayfit3 did (ISR0_60, ISR1_65, ISR1_70) are the three where the fit split its answer between an illite/smectite and thirty to forty-five per cent of free illite, which is what a random model does when the specimen's reflections sit where no random stack puts one.

The axis runs between two junction probabilities that are defined and not fitted: PAB = WB is random stacking, Reichweite 0, and PAB = WB/WA is the most ordering stationarity permits, which for a host-rich stack is the Reichweite 1 ideal of no two guest layers adjacent. Calculated at 70/30 the ordered stack reflects at about 31 Å — the pair of layers — where the random one has no maximum at all. At 85/15 the two nearly coincide, because a first-order chain has almost no room left to order an illite-rich stack; that is exactly why R2 and R3 exist, and a first-order chain reaches neither. An R3 specimen is fitted with the nearest R1 entry, and what that costs is in the table below.

The axis is not a free cross-product with composition, because the two series do not order alike and neither orders at every composition.

Illite/smectite. The correspondence between composition and Reichweite is one of the better established facts about the series: random gives way to R1 at 60–70 per cent illite layers in shales and 55–67 per cent in bentonites, R2 appears gradually between 65 and 80, and above 85 the ordering may be strongly R3 (Srodon 1984; Srodon and others, Pathways of smectite illitization). A random stack of 95 per cent illite layers is not something the series makes. So below 0.55 illite only the random entry is calculated and above it both — the onset at the bottom of the quoted range, so that the band the literature disagrees within is spanned rather than cut through. The composition range itself is continuous, and spanning it is right: the smectite-to-illite series runs the whole way.

Chlorite/smectite. Here the composition range is not continuous, and the library is right to span only the chlorite-rich end. The ordered member of this series is corrensite, the 50:50 stack, and the literature treats corrensite as a phase in its own right with a discrete stability field rather than as a point on a join: there is a compositional gap between saponite and corrensite, and between corrensite and chlorite the intergrowth of discrete domains dominates over true interstratification, with the smectite proportion falling discontinuously as grade rises (Beaufort and others 1997, Am. Mineral. 82, 109–124; Shau and others 1990, Contrib. Mineral. Petrol. 105, 123–142). The randomly interlayered chlorite/smectites that are observed are metastable, formed at low water/rock ratio, and chlorite-rich — which is what this library holds, and what the Clayfit3 table holds. Corrensite is therefore a phase to add, with its own entry, and not a degree of this axis. It is not in the library yet, and a specimen containing it will be fitted with something else.

A.62 What the illite/smectite is doing in a pure chlorite

Every one of the four measured chlorites takes some illite/smectite, and the natural objection is that there is no illite in them: the 8.8 deg reflection that an illite layer would give is absent. It is absent. Measured over 8.3 to 9.4 deg, Chlor1 reaches 0.10 per cent of its chlorite 002 peak and Chlor4 0.25 per cent — nothing.

The fitted illite/smectite does not put intensity there either. Of its own calculated area it spends twenty per cent below 4.5 deg and a further forty-seven per cent between 4.5 and 8 deg, and only about a tenth in the 8 to 11 deg window where an illite layer would show. It is not being used as an illite-bearing phase at all. It is being used as a low-angle hump, underneath the chlorite 001.

Share of the observed intensity each phase accounts for, by window, in the fit to Chlor1. The chlorite is short at both ends of its own series.
window (deg)what it holdschloriteC/SI/S smectite
2–4.5continuum0.0 %2.6 %40.6 %14.3 %
4.5–8chlorite 00177.6 %11.5 %4.8 %3.0 %
8–11where illite would be0.0 %1.6 %22.1 %3.4 %
11–14chlorite 00283.9 %8.3 %0.1 %0.0 %
14–21chlorite 00369.0 %7.4 %0.5 %0.2 %
21–27chlorite 00451.9 %5.6 %0.4 %0.1 %

Two deficits are visible and they are the two this appendix has been circling. The 004 window is only three-fifths accounted for, which is the chlorite 004 the model cannot reach (A.60). The 001 window is short by a fifth, and the measured 001 over 002 of these specimens is 0.366 to 0.431 against the 0.335 the model calculates. An interstratified entry is the cheapest thing in the library with which to make up a low-angle shortfall, because at one orientation it carries several times more mass per unit of observable scattering than a discrete phase does, so a few per cent of the intensity converts into tens of per cent of the weight. The remedy is not to forbid the phase; it is to stop the chlorite being short, and until then to read a small interstratified share on a specimen with no reflections of its own as what it is.

A.63 Corrensite, saponite, and a distinction a basal scan cannot make

Two phases were asked for and they turned out to be different kinds of request.

Corrensite is worth adding and is now in the library. It is the one-for-one alternation of a chlorite layer and a trioctahedral smectite layer, built by the same stacking engine as the interstratified series but entered as a phase of its own, because that is what the literature makes it (A.61). It sits at exactly 0.50 with the ordering at its maximum, which at equal proportions means strict alternation, and it is reported as corrensite rather than as a point on the chlorite/smectite axis. Calculated, it gives a rational series on 31.0 Å — 31.0, 15.6, 10.4, 7.8 — collapsing to 26.7 Å on the 12.4 Å one-water interlayer this program defaults to. Its density falls at 2.34 g/cm3, between the chlorite's 2.70 and the smectite's 2.06, as a one-for-one stack of the two must.

It is also well separated from everything it might be confused with, which is the test that decides whether a phase earns its entries: cosine similarity 0.27 against chlorite, 0.23 against the smectite, 0.47 against a random chlorite/smectite at 90/10.

A corrensite's smectite interlayer is magnesian and usually holds two water layers near 15 Å, which would put the dried phase near 29 Å rather than the 26.7 Å the default gives, so a mount known to carry corrensite is better built with air_dried_thickness=15. The glycolated 31.0 Å is unaffected, and that is the reflection the phase is recognised by. It has not been checked against a measured corrensite, because there is none in this collection.

Saponite is a different matter, and the measurement says so. A saponite is a trioctahedral smectite, and the layer is now built and tested: the 2:1 sheet of the chlorite refinement with its hydroxide sheet removed, carrying Reynolds' glycol interlayer unchanged. That sheet expands to six octahedral cations, eight tetrahedral and O20(OH)4, and its planes agree with the ones Reynolds refined for the dioctahedral layer to within 0.06 Å. Nothing in it is invented.

But the two smectites are not separable here. Over a glycolated basal scan their patterns have a cosine similarity of 0.9987, and dried, 0.9985. What distinguishes a trioctahedral smectite from a dioctahedral one is the 060 reflection, near 1.53 Å against 1.50 Å, which sits at about 60 deg 2θ on an unoriented mount; an oriented basal scan never reaches it and never could. Offering both to the fit as two columns would be offering two near-duplicates, and a non-negative least squares divides such a pair on noise — the same failure that puts tens of per cent of illite/smectite into a chlorite with no illite in it (A.62).

00l areas over the 001 of the two glycolated smectites. They differ in detail and not in a way a fit can use.
layer001002003004005cosine
trioctahedral (saponite)1.0000.0770.0200.001 0.0890.9987
dioctahedral (Reynolds)1.0000.0600.0620.012 0.088

So the species is a switch set when the library is built, not a phase the fit chooses between: smectite_species="trioctahedral" for a saponite or hectorite separate, "dioctahedral" for a montmorillonite or bentonite, recorded in the library's metadata either way. The default stays dioctahedral, that being the Reynolds layer the method was built on. Corrensite ignores the switch, because its smectite half is a saponite by definition.

Nor could the saponite standard in this collection settle the layer model: it shows one broad 001 near 11.7 Å and no usable higher order, and a single reflection constrains a spacing rather than a structure. That is said here because the alternative is to let a layer that has never been tested look as though it has been.

A.64 The channel clays, and a reflection that will not move

A sepiolite is not a stack of layers with an interlayer. It is a 2:1 ribbon structure with channels running along the fibre, and the channels hold zeolitic water. The channels are too narrow for ethylene glycol, so a sepiolite does not move between the air-dried and the glycolated mount — and that, not anything in the glycol pattern alone, is what tells one from a smectite.

Sepiolite and palygorskite are now library phases. They are built from the three-dimensional structure like any other mineral rather than from a layer model, with the fibre axis as the texture pole, and they have no air-dried counterpart because they have nothing to collapse. Before this the library had no column that could carry a 12.4 Å reflection except the air-dried smectite, and a non-negative fit has to use what it is given: a line that could not possibly be expandable was fitted as expandable clay, every time, and the fit was never choosing wrongly between the two because it was never offered the choice.

The 110 is spanned, because it is not a fixed number. The published sepiolite (COD 9014723) gives 11.93 Å; a freely refined cell on the specimen below reached 12.35 Å, and the measured maximum sits at 12.44 to 12.52 Å across three mounts. A library holding 11.93 Å alone would put the line a third of a degree from where the specimen has it. The axis scales a and b together, which moves the 110 by exactly that factor whatever the cell angles — every term of 1/d2 for a reflection with l = 0 carries 1/a2 or 1/b2 and nothing else — and leaves the fibre repeat alone. The published value is the first point on the axis.

The test reads the measurement that :func:`shift_evidence` already makes, rather than repeating it, so the two cannot disagree about what moved. A reflection counts as a channel clay when it lies in the 110 window, is tall enough to be a line at all, and did not move by more than its own placement uncertainty — the same criterion the expandable side uses, asked the other way round.

The test on three mount pairs. The sepiolite-bearing specimen is the one its author identified as such from the start.
specimenreflections matched between the mountsverdict
M26-124014.31, 12.47, 10.01, 8.50, 7.12, 6.41 Å; the 12.47 Å held to within 0.265 degsepiolite
M_26_104114.28, 10.01, 8.46, 7.11, 6.41 Ånone
M_26_104214.28, 10.02, 8.48, 7.11, 6.41 Ånone

Two overlaps are built into this and are stated rather than hidden. The sepiolite window deliberately covers the air-dried smectite 001 near 12.4 Å: the two minerals put a reflection in the same place and only the movement separates them, which is the whole reason the test exists. The palygorskite window is the harder one, because the illite 001 at 10.02 Å is held just as firmly and sits only 0.2 Å below it; the window is bounded at 10.20 Å to keep illite out, and a reflection found near that bound is reported with the caveat attached.

On the specimen above the measured 12.5 Å line does not move from air to glycol — it strengthens, from an area of 39.7 to 66.5 against the quartz 101 — while the 16.9 Å region where a glycolated smectite would have to appear gains 0.6 of area, which is noise. It then survives 550 °C still at 12.41 Å. A full Rietveld refinement of the air-dried mount by this program's author put 3.94 per cent sepiolite in it with an RBragg of 1.71 at Rwp 9.84 per cent. The evidence was there in all three mounts and in the refinement, and what ClayQuant lacked was a column to put it in.

A.65 A needle is not a plate, and its orientation cannot be measured here

The channel clays were added (A.64) with the texture model every other mineral in this library uses: a March–Dollase factor about a plane normal, with r spanned from 0.1 to 1. That is the model for a plate, and it is wrong twice over for a needle.

The March model describes the orientation distribution as an axially symmetric compression or expansion of a random one (Dollase 1986, J. Appl. Cryst. 19, 267–272). A plate lies on its face: that is compression about the face normal, and r < 1. A needle lies with its long axis in the specimen plane and rolls freely about it: that is expansion about the fibre axis, and r > 1. Using the first where the second belongs does not merely mis-weight the reflections, it picks the wrong family altogether.

And the axis has to be given in direct space. A needle elongated along c and lying in the plane can only diffract from planes whose normal is perpendicular to c, and by the duality of the two lattices g·t = hu + kv + lw exactly — so for t = c that product is l, and the set at 90 degrees to the fibre is hk0, precisely and whatever the cell angles. Measured from c* instead, which for the monoclinic palygorskite here is 17 degrees away, the 110 comes out at 76 degrees and is under-enhanced. Crystal.angle_to_direction is that angle, and po_axis_space="direct" selects it.

What the plate model did on the sepiolite standard is worth stating plainly, because the symptom was not a wrong number but an unidentifiable one. At r = 0.1 about the 110 pole the factor multiplies that family by r−3 = 1000 and every other reflection disappears: only one line is left above a tenth of the maximum. The pattern's shape then stops depending on r while the mass it implies goes on scaling as r3. The fit took what it was offered — sepiolite carried 46 per cent of the calculated intensity and was reported at 0.3 per cent by weight.

Correcting the model does not remove that, and this is the finding rather than a disappointment. Over the whole needle range the calculated pattern of a sepiolite keeps its shape to a cosine of 0.998 or better while the implied mass runs over three orders of magnitude:

Calculated sepiolite about the fibre axis: the shape against r = 1.5, and the mass the same fitted coefficient implies.
r1.001.251.502.003.00 5.0010.0
cosine with r = 1.50.99160.99901.0000 0.99930.99840.99820.9982
mass, as r31.02.03.48.0 271251000

So the orientation of a channel clay is not something an oriented basal scan measures, in either direction, and an axis in it would not be a parameter the fit determines but a free multiplier on the weight. It is therefore fixed at one value, for the reason the glycolated smectite is one entry: what the single value decides is the basis the weight percent is on, and that is recorded rather than buried. 1.5 is where agreement with the sepiolite standard is best, and the optimum is shallow.

The plate-against-needle figures this section originally gave — a cosine of 0.756 against 0.623 — were taken with every calculated line two and a half times too sharp, and with the pole carrying the width anisotropy as well as the texture, so they compared two things at once. A.68 corrects both the width and the comparison. The conclusion below is unchanged; the numbers are superseded there.

With the texture corrected, the sepiolite entry's share of the calculated intensity and its share of the mass agree: 3.7 and 3.5 per cent, against 46 and 0.3 before. The weight is no longer free. That the fit still did not identify the sepiolite standard as sepiolite was a separate matter, and it was the line width rather than the texture: see A.68.

A.66 One orientation for the mount, and what the standards say about it

The table and verdict below were re-run after A.70 corrected the fit weighting. The conclusion is stronger than the superseded version's, not weaker: nine of nine rather than six of nine. The prose about what the orientation freedom does is unchanged, and the diagnosis in the second half of this section is new.

Running the nine standards through the whole workflow — screen, zero error, background, the air-dried ceiling, the kaolinite share from the heated mount — turned up something larger than any of those steps. Letting each clay choose its own texture is what was wrecking the answers.

A basal series is enhanced as r−3, so intensity at the bottom of the orientation axis is cheap: a phase fitted at r = 0.2 gives 125 times the scattering per gram that the same phase gives at r = 1. When every clay may pick its own, the fit can cover a reflection with whichever phase is cheapest there rather than with the phase that owns it, and the texture it reports is not one the specimen has. Holding the whole mount to a single orientation removes that freedom, which is what the mount physically is: one smear, settled once.

The nine standards, with the workflow otherwise identical. Only the orientation freedom differs. Rwp in brackets.
standardexpectedeach clay freeone orientation
Chlorite_16chloritechlorite 54 %, kaolinite 28 % (43.8) chlorite 90 %, illite 8 (44.5)
Prochlorite_15chloritechlorite 80 %, illite 20 % (61.0) chlorite 95 %, illite 5 (61.1)
Montmorillonite_50smectitesmectite 93 %, chlorite 7 % (48.1) smectite 99 % (49.9)
Montmorillonite_9smectiteillite 39 %, smectite 29 % (43.6) smectite 81 %, illite 12 (46.2)
Illite_10illiteillite 64 %, chlorite 28 % (24.7) illite 99 %, chlorite 1 (29.2)
Sepiolitesepiolitesepiolite 77 %, illite 23 % (48.4) sepiolite 100 % (52.0)
Dickite_7kaolinitekaolinite 90 %, illite 10 % (64.6) — identical, already held to one orientation by the kaolinite restraint
Kaolinite_12kaolinitekaolinite 81 %, illite 16 % (39.2) — identical, as above
Kaolinite_43kaolinitekaolinite 68 %, illite 29 % (34.3) — identical, as above

Eight of nine become nine of nine, the mean share of the dominant phase goes from 72 to 89 per cent, and it costs 1.5 points of Rwp, 45.3 to 46.8. Of the six standards that were not already held to one orientation by the kaolinite restraint, all six improve. That is the same trade this appendix has met repeatedly: the freer fit is the better fit by Rwp and the wrong one.

What the freedom actually buys, measured on Illite_10

Under the free fit this near-pure illite separate reads 28 per cent chlorite. The chlorite carries 5.8 per cent of the scattering; what makes it 28 of the mass is that it was fitted at r = 1, no texture at all, while the illite sat at 0.6 to 0.7 and the I/S at 0.1 — both ends of the axis occupied at once.

Illite_10, free orientation. Mass per unit scattering is the weight share divided by the scattering share.
phasescattering %weight % mass per unit scatteringr
illite47.359.01.250.6–0.7
I/S 0.99/0.0144.44.20.100.1
chlorite5.827.74.811.0
kaolinite1.97.13.761.0

The arithmetic closes. Mass goes as r−3, so against an illite at 0.65 a chlorite at 1.0 needs 0.65−3 = 3.64 times the mass for the same scattering; the measured ratio is 4.81 / 1.25 = 3.85. The orientation difference accounts for essentially all of it. Across the mount the spread in mass per unit scattering is 48-fold.

And the chlorite is not there. Its 7.1 Å 002, which an oriented chlorite shows strongly, measures 0.48 per cent of the strongest line in the pattern — 27 counts against 5800 — and the fit over-predicts that window fourfold, 9462 calculated against 2389 observed, and keeps the chlorite anyway because the window is low-count while the chlorite buys improvements at 4.7 and 3.55 Å. The 14.2 Å region it is nominally explaining is carried by the I/S, not by it. Under one orientation the chlorite falls to 0.5 per cent of the mass and the illite group goes to 99.

This sharpens the objection recorded at the end of A.67, which was that a kaolinite booklet, a chlorite plate, a smectite film and a sepiolite needle have different habits and no reason to share a texture. That is true, and it is not what the free parameter is doing. An oriented basal scan barely determines r per phase — the pattern's shape depends on it weakly while the mass depends on it as the cube — so the freedom does not measure the difference in habit, it supplies an unconstrained mass multiplier per phase. One orientation for the mount is wrong in a known and bounded way; the freedom is wrong in an unbounded one.

Two steps of the workflow were missing from the offline driver and are now in it, and both matter on their own.

The accompanying-mineral screen. It needs quartz to put the three scans on one angle scale, and on a near-pure separate it often cannot find enough and declines, saying so in its note. The note had not been read. Quartz is in all of these separates and its 101 at 3.343 Å is the illite 003 at 3.34 Å, so omitting it does not lose a little accuracy — it hands a whole reflection to illite, and read the sepiolite standard as 92 per cent illite. Where the screen declines, the minerals that are both common in a clay separate and sit on a clay diagnostic line are offered instead, and the fit is told that is what happened. The single-mount detector is not used for this: on these standards it returns ilmenite, corundum, pyrope and halite at scores above 0.88, which is the over-reporting the triplet screen exists to avoid.

The kaolinite share from the heated mount, applied rather than reported. Chlorite 002 and kaolinite 001 coincide at 12.4 deg and their 004 and 002 at 25 deg, so a kaolinite reproduces the two strongest lines a chlorite has. Two refinements to how it is applied came out of running it on the standards. The collapse route is usually the tighter bound but not invariably — on the dickite it gives 25 to 67 per cent where the evidence itself gives 100 to 100, and applying the wider wrong one at weight 50 drove Rwp to 582 per cent — so the narrower of the two is taken. And the share means nothing when the window holds no reflection: on a montmorillonite the 7.15 Å window carries 80 counts against a strongest line of ten thousand, the bounds come back 0 to 1, and a constraint built from them restrains nothing while still forcing the mount to one orientation. Both are now required to be informative before the restraint is built.

What remains is three standards whose dominant phase is still wrong or divided: Kaolinite_43 at 72 per cent kaolinite against 26 illite, Montmorillonite_9 divided 55 to 44 between illite and smectite, and the sepiolite standard at 75 per cent illite with sepiolite recovered only to 24. The last of those is the open problem of A.65: the calculated sepiolite reaches a cosine of 0.756 against the measured pattern and no orientation improves it.

A.67 Which kaolinite bound to apply, and when not to apply one

The Rwp figures quoted here — the dickite's 582 per cent above all — came from the standards driver that weighted by an already-subtracted pattern, which A.70 corrects, and are superseded. What this section rests on is not those: the dickite retaining 19.2 per cent of its 7.15 Å window at 550 °C, and the montmorillonite's window carrying 80 counts against ten thousand, are measurements of the mounts and do not pass through nnls_fit. On the corrected weighting the dickite fits at 90 per cent kaolinite and Rwp 64.6, with both guards doing the same work.

The heated mount's measurement of the 7.15 Å window is applied as a restraint at weight 50 against a single pattern. A restraint that strong is not a neutral thing to pass a wrong bound to, and running the nine standards found two ways of passing one.

The collapse route has an assumption, and a dickite breaks it. Two numbers describe the same quantity: the chlorite-ratio envelope, which infers the share through a survival ratio that varies between chlorites, and the collapse route, which measures it on the heated mount. A measurement before an inference is the right principle, and the program preferred the route always.

The route assumes that what leaves the 7.15 Å window on heating is the kaolinite and what stays is the chlorite. A kaolinite polytype that does not fully dehydroxylate at 550 °C breaks that, and the standards say how far:

Area remaining in the 7.15 Å window after 550 °C, against the quartz 101.
standardsurviving
Kaolinite_120.0 %
Kaolinite_431.8 %
Dickite_719.2 %

The route reads that surviving fifth as chlorite and returns 25 to 67 per cent for a specimen that is entirely kaolinite; applied at weight 50 it drove Rwp to 582 per cent and returned 52 per cent kaolinite beside 48 chlorite. The envelope, which assumes nothing about collapse, gives 100 to 100. KaoliniteEvidence.best_bounds takes whichever is narrower, which recovers 100 to 100 and 99 per cent kaolinite and leaves the route preferred everywhere it is the tighter. That is a proxy for the real question rather than an answer to it, and is written down as one: a route whose assumption fails could in principle come back narrow and wrong, and nothing here would catch it. What is claimed is that the tighter of two bounds on one quantity excludes more, and that the single case where the looser was taken is a case where it was also wrong.

A window with no reflection in it has no share to divide. On a montmorillonite the 7.15 Å window carries 80 counts against a strongest line of ten thousand. Every share measured from it is noise over noise, and the restraint built from it admits every division while still costing the fit an extra row to satisfy - and, because the restraint is only sound when the clays share one orientation, costing it the freedom to give them their own. kaolinite_share_constraint now declines where the window stands below a tenth of the strongest line. Across the nine standards that window stands at 100 per cent of the strongest line on the four kaolinites and the two chlorites and at 0.8 and 5.6 on the montmorillonite and the sepiolite, so the threshold sits in a gap and not through a cluster.

The two guards are independent and neither subsumes the other, which is worth stating because the montmorillonite needs both to be seen clearly. Its envelope says 0 to 1 while a collapse route measured from the same empty window says 1 to 1 - and the narrower of those is narrow, so the width test passes it. What rejects it is the window test, which sees the pattern the evidence does not. informative judges the width of a bound and makes no claim about whether the window supports one.

A note on orientation

A.66 reported that holding the whole mount to one orientation fixes six of the nine standards, and raised whether it should be the default. It should not, and the reason is that the standards cannot answer the question. They are near-pure, so on them "one orientation for the mount" and "one orientation for the single phase present" are nearly the same constraint, and what the experiment really showed is that spurious phases were buying cheap intensity at the bottom of the orientation axis. A real specimen holds several clays that do not settle alike - a kaolinite booklet, a chlorite plate, a smectite film and a sepiolite needle have different habits and no reason to share a texture - so forcing them to agree would be imposing something false to suppress a symptom. The leverage is the thing to address, at its source.

A.68 A fibre has a fibre’s line width, and that was most of the misfit

This section opens by saying the fit would not identify the sepiolite standard as sepiolite. That was the misweighted driver of A.70, not the model, and the width correction below was found while chasing it. The correction stands on its own measurement — a 110 width of 0.618 deg against a calculated 0.251 — which does not pass through nnls_fit; the cosines likewise. On the corrected weighting the standard reads 100 per cent sepiolite.

A.65 closed with the sepiolite standard still unidentified: the texture was corrected, the weight was no longer free, and the calculated pattern reached a cosine of only 0.756 against the measurement. The cause turns out to be neither the texture nor the structure, and it was quiet in the way the worst defects are — every line was in the right place, so nothing looked broken.

The measured 110 is 0.618 degrees wide on the glycolated mount and 0.685 on the air-dried one. The calculated one was 0.251. Two and a half times too sharp, and a line that is too sharp cannot carry the measured peak’s area at the measured height, so the fit could not use the column it was given: it recruited four different 110 spacings at once to synthesise a broad line out of narrow ones, and handed the leftover area to whatever else had something broad in the neighbourhood, which was the illite basal series.

The width of an hk0 reflection is set by the coherent domain across the fibre. The library was calculating it from DEFAULT_PEAK_SHAPE’s size_ab = 400 Å, which is a clay platelet’s lateral extent; a sepiolite fibre is a few tens of nanometres across. Nothing about the geometry was wrong — PeakShape.fwhm weights size_ab by sin2 of the angle to the axis the texture is about, which for a channel clay is c in direct space, so an hk0 takes the diameter in full and a 00l takes size_c, which is None because a fibre is long along c. Only the number was a platelet’s.

Calculated sepiolite against the standard, as the fibre diameter changes. Agreement is on the mineral’s own lines, excluding the windows where this standard carries a glycolated smectite at 17 Å, a mica at 10 Å and quartz at 3.34 Å.
diameter, Å90110130150200 400
110 FWHM, deg0.9020.7520.6350.5510.434 0.251
cosine, glycol mount0.9660.9760.9780.975 0.9560.756
cosine, air-dried mount0.9680.9790.9810.977 0.953—

Both mounts pick 130 Å independently, and the 110 width matches there too (0.635 against 0.618 and 0.685). Agreement on the mineral’s own lines goes from 0.756 to 0.978.

The diameter is therefore a library axis, FIBROUS_DIAMETERS, spanning 90 to 280 Å — 9 to 28 nm, the reported range of sepiolite and palygorskite fibre cross-sections — with the measured value on the axis rather than at an end of it. It is spanned for the reason the platelets’ CSDS is spanned: it is a property of the specimen, not of the mineral.

Spanning it is sound where spanning the orientation (A.65) is not, and the contrast is the whole lesson of both sections. r enters as very nearly a multiplier on a pattern whose shape it barely changes, so a fit handed a range of it spends the range on mass and the residual does not object. A diameter changes the width of a line and not its area, so the measurement determines it — which is why two independent mounts agree on it to the step of the axis. The test for whether a parameter may be spanned is not whether it is physically real but whether the pattern’s shape depends on it.

What the standard does not settle

Correcting the width also made it possible to re-ask A.65’s question properly, and the answer there was weaker than that section claimed. PeakShape refers size_c and size_ab to whatever axis the orientation is about, so moving the texture pole moves the line widths with it: the plate-against-needle comparison recorded in A.65 was measuring both at once. Holding the width anisotropy where the fibre puts it in every row — the check being that all the r = 1 rows then agree exactly, since at r = 1 the axis cannot matter — gives:

Texture alone, with the width held at a 130 Å fibre throughout. Cosine on the mineral’s own lines.
modelcosine
a random powder, r = 10.946
fibre about c, r = 1.50.979
plate on (100), r = 0.70.983
plate on (110), r = 0.70.981
plate on (010), r = 0.70.882

The mount is textured — three axes beat a random powder by 0.03 — and (010) is excluded. Which axis is not determined: the top three sit within 0.004 of each other, which is nothing. That is a statement about the experiment rather than a failure of it. All three do the same thing, because all three enhance hk0 against the rest: the fibre axis by expansion about c, a plate pole lying in the hk0 plane by compression onto it. A lath rolling freely about its length and a lath lying on one of its side faces both put c in the specimen plane, and an oriented basal scan sees only the difference in the roll angle. (010) fails because it lies in that plane too but puts 0k0 at the pole and the 110 at 64 degrees from it, so it enhances the wrong member of the set.

The fibre axis is kept, and on the structural argument rather than on those four thousandths: it is the crystallite’s long direction, so it is the one choice for which the texture axis and the width anisotropy — which this code must take about the same axis — are both referred to the direction that governs them. A (110) pole would sharpen the 110 while enhancing it, since the 110 then sits at alpha = 0 and takes size_c, which is the defect this section exists to remove. A.65’s conclusion stands; its numbers did not, and are corrected here.

A.69 A channel breathes, and the test that finds one should admit it

The palygorskite shares quoted here came from the standards driver that weighted by an already-subtracted pattern, which A.70 corrects. The gate and the criterion are unaffected: the air-to-glycol spacings this section turns on are measurements of the mounts, not fits. On the corrected weighting Illite_10 fits no palygorskite at all and the sepiolite standard reads 100 per cent sepiolite with the channel-clay test firing.

A.68 corrected the channel clays’ line width, and that correction had a cost which has to be reported with it: on the near-pure Illite_10 standard palygorskite went from 4 to 24 per cent. The reason is plain once stated. The palygorskite 110 spans 10.37–10.65 Å and the illite 001 sits at 10.02; a broad line there fits the low-angle tail of a strong illite 001 well, and before A.68 the calculated palygorskite 110 was too sharp to do it. Widening a column correctly made it a better absorber of something that is not palygorskite.

The remedy was already in the program and was not being used. A.64 added the test that identifies a channel clay — a 110 in that mineral’s own window which glycolation could not expand, because the channels take water but are too narrow for ethylene glycol — and the result was computed, reported in the note, and then thrown away. The library kept its channel-clay columns whatever the two mounts said, so a non-negative fit could spend them wherever a broad line happened to help. channel_clay_entries closes that loop: the channel clays are kept when the mounts support them and dropped when they do not.

The asymmetry with every other clay here is deliberate. A chlorite or an illite is reported because it fits better than the alternatives; a channel clay is the one phase group in this program with a positive diagnostic of its own, so it is admitted on that diagnostic and refused without it. A test that could not be made — no air-dried mount — keeps everything, because an unperformed test is not a negative result.

It is a sharp test and not a marginal one. Across the nine standards, nothing at all falls in either channel-clay window except on the sepiolite standard:

What the air-dried and glycolated pair measures inside the channel-clay windows, on each standard.
standardin either window
Chlorite_16, Dickite_7, Illite_10, Kaolinite_12, Kaolinite_43,
Montmorillonite_50, Montmorillonite_9, Prochlorite_15
nothing
Sepiolite12.095 → 12.320 Å, +1.86 per cent, the tallest line in the pattern

The criterion was statistical where it should have been physical

That sepiolite row is the test’s own false negative, and fixing the gate without fixing the criterion would have dropped sepiolite from the sepiolite standard. The test called a reflection held when it had not moved by more than its own placement uncertainty — PeakShift.moved, the same test the expandable side uses. On the expandable side that is exactly right: there the question is whether anything moved at all.

Here it is the wrong question. A channel holds zeolitic water and the cell breathes with it, so a channel clay’s 110 is free to move a little between the two mounts; what it cannot do is take a glycol layer. And the statistical form has a perverse consequence: the threshold moves with the uncertainty, so the sharper and stronger the line, the less breathing it is permitted. The sepiolite standard’s 110 is the tallest line in its pattern and is placed to 0.017 degrees, so its 0.147-degree displacement reads as nine standard errors of movement — which is true, and is not the question. The mineral was refused on the strength of its own best reflection.

CHANNEL_CLAY_MAXIMUM_EXPANSION is a fractional change in d instead, set at 5 per cent, and it sits in the gap between the two populations rather than at one edge of it:

What has to pass and what has to fail.
change in d
this specimen’s 110, air to glycol+1.9 %
the sepiolite 110 over all hydration states, 11.93–12.52 Å 4.9 %
threshold5 %
one glycol layer, 12.4 → 14.2 Å+14 %
two glycol layers, 12.4 → 16.9 Å+36 %

5 per cent is close to the geometric mean of 1.9 and 14, so it is about a factor of three from each. Glycol uptake is not a subtle effect and does not need a tight threshold to be caught.

A.70 The weights, and a fault in the test harness rather than the program

A.68 and A.69 were written while chasing a symptom: the fit would not identify the sepiolite standard as sepiolite. The width correction of A.68 was real and the channel-clay gate of A.69 was real, but neither was the cause, and the cause was not in ClayQuant at all. It was in the driver used to run the nine standards.

nnls_fit weights each point by 1 / raw counts, which is counting statistics, and its own comment explains why it must be the raw counts rather than the subtracted ones: weighting by a subtracted pattern “would put the largest weight on the flat regions between peaks, where the subtracted value is near zero and only noise remains, and almost none on the peaks that carry the information”. The function takes the measurement and, optionally, the background fitted to it, and subtracts one from the other itself. The standards driver had already done the subtraction and passed the result with no background — so raw was the subtracted pattern, and the comment described exactly what then happened. Nothing checked.

The sepiolite standard: the same library, the same structures, only the call changed.
how the fit was calledRwp share of the 110 explainedresult
subtracted pattern, no background86.6 %4.3 % illite 65 %
counts as recorded, plus their background38.9 % 86.0 %sepiolite 66 %

The strongest line in the pattern was being explained to one part in twenty-three, and a column that matched it to a cosine of 0.974 was given almost no weight, because scaling it up would have raised its tails in the flat regions where all the weight had gone. The program was never wrong: the application passes the corrected mount together with its fitted background, which is correct, and so did the driver used for the Clayfit3 members — which is why those results came out at Rwp near 42 per cent while the standards came out at 50 to 134. That difference was visible the whole time and was read past.

The guard

A diffractogram records counts, so a raw one has no non-positive points; a subtracted one is clipped at zero across the flat regions. Measured over the standards, 0.00 per cent of raw points are at or below zero against 5.9 to 14.0 per cent of subtracted ones, so PRESUBTRACTED_ZERO_FRACTION is set at 1 per cent — inside that gap with a factor of six to spare. When more than that share of the fitted points is non-positive and no background was passed, the fit reports it.

Reported, not refused, which is the treatment crowded gets and for the same reason: a caller who means to fit a pre-subtracted pattern and accept the weighting may do so. What is not allowed is for it to happen without being said. The application shows this one in red rather than amber, because it does not mean the numbers need reading with care — it means they are wrong.

What this costs the record

Every number in this manual that came from the standards driver was computed under the wrong weights, and that includes the fit results quoted in A.66 and A.67 and the Rwp figures throughout A.68 and A.69. Where those sections rest on a measurement rather than on a fit — the 110 widths of A.68, the air-to-glycol spacings of A.69, the fraction of its 7.15 Å window a dickite retains at 550 °C in A.67 — the measurement stands, because none of it goes through nnls_fit. Where they rest on a fit, the number is superseded and is marked where it appears.

The general lesson is worth keeping separately from the particular bug. A validation harness is not a test: it has no expected answer to fail against, so a fault in it does not announce itself and instead appears as a property of the thing being validated. Three sections of this appendix were written about a symptom whose cause was in the harness, and the signal that should have caught it — two drivers on the same library disagreeing by a factor of two in Rwp — was in plain sight for the whole of that work.

A second sepiolite structure, which is worth having anyway

The structure was changed while looking for the cause, and on the corrected weighting it earns its place. Of the thirteen COD sepiolite entries, six are room-temperature and in Pncn; the two best-determined put their channel water near x = 0.5, the channel centre, where the Sanchez et al. BAT25 structure previously loaded puts it near x = 0 to 0.07. That is a difference in the projection onto the ab plane, which is precisely what sets every hk0 intensity: for those reflections the phase is 2πi(hx + ky), so z drops out entirely.

Weak hk0 lines of the standard, normalised to the 110, against each candidate structure. The 400 is excluded from the score because the quartz and mica band at 3.34–3.38 Å runs into it.
structure130200060−260error Rwp
measured0.00.62.5 2.6
9010148 Post, Bish & Heaney (2007)3.33.06.07.1 5134.2 %
9015793 Giustetto et al. (2011)4.33.97.47.0 75—
9014723 Sanchez et al. BAT25 (was loaded)4.65.18.3 9.112538.9 %

Post, Bish & Heaney halves the weak-line error and explains 93.4 per cent of the 110 against BAT25's 86.0, so it is now the structure loaded. It is also, as it happens, the paper the CifSource description had named all along while the file beside it was Sanchez's — a mislabel corrected at the same time. Its published 110 is 12.01 Å rather than 11.93, so the spacing axis is re-anchored, with the 12.35 Å that best fits the standard placed on the axis rather than between two of its points.

The weak hk0 lines are still two to three times stronger in the model than in the measurement, and that remains a real and unexplained difference between this specimen and any published structure. What has changed is its standing: it was reported as the thing preventing identification, and it is not — identification works. It is a residual.

A.71 One number, six sentences, and a tool that lied about itself

An operator opened the desktop Build-library window, ran it, and read this in the log:

No scan given, so the library is calculated for a 280 mm goniometer radius, a 0.5 deg divergence slit and a generic peak width. If that is not your instrument, run this again with a scan from it…

Their instrument is 240 mm. They had pulled the latest revision, checked, and asked why the program was still building for somebody else's diffractometer.

It was not. Every library this program has ever built used 240 mm, because build_library passes DEFAULT_GONIOMETER_RADIUS explicitly and that constant is 240. The calculation was right and the sentence describing it was wrong, which is the worst way round: the number that governs the physics was correct, and the only thing the operator could see said otherwise. They were about to rebuild a correct library against a geometry they do not own.

The radius, as the program held it.
wheresaiddid
calibration.DEFAULT_GONIOMETER_RADIUS240—
optics.Divergence field default280 never reached — build_library passes the constant
desktop builder log280240
desktop builder dialog text280240
web GUI status strip280240
web GUI “built blind” warning280240
scripts/inspect_library.py280240

Two definitions and six literals. The constant moved to clayquant.optics, which is the lowest module in the import order — calibration imports pattern imports optics, so it could not go the other way — calibration re-exports it, Divergence's own default reads it, and every message is now an f-string on it.

The test that held the bug in place

There was a test on the status strip. It asserted "280 mm" in said. It passed for as long as the message was wrong and failed the moment it was fixed — so the one check that touched this behaviour was pinning the defect rather than the requirement.

That is the general lesson and it is worth more than the fix. A test that writes down the current output, rather than the property the output must have, converts a bug into a specification. The repaired version asserts that the strip quotes DEFAULT_GONIOMETER_RADIUS, whatever that is, which is the thing actually required.

The new guard, tests/test_geometry_is_one_number.py, scans every source file for a three-digit number written beside the words “goniometer” or “radius” and fails if any of them disagrees with the constant. It carries the exact sentence the operator read as a fixture, so the guard is itself tested against the fault it exists to prevent.

Where this sits among the other faults in this appendix

It is the third of a kind in close succession, and the pattern is sharper than any one of them. A.70 was a fit weighted by the wrong array because a driver passed a subtracted pattern where counts were required; the diagnosis that followed it was a report of parameters at an axis edge, computed by zipping one library's entries against another library's coefficients, which named a spacing bound in all eleven samples that did not exist. This one is a message that contradicted the code beside it.

In all three the computation was sound and the thing reporting on the computation was not, and in all three the error was invisible precisely because the report is what one reads instead of the code. The remedy is the same each time and is now applied in each place: the reporting is given a test of its own, against the property rather than against yesterday's output.

A.72 The background the fit was asked to call a mineral

An operator looked at a fit that was missing a chlorite and asked whether the background might be the reason, “because the fit gets really bad above 20 degrees”. It was, and the fault was larger than the one being chased.

The default background model is Clayfit’s, a exp(−b 2&theta) + c, which only ever falls. That mount’s background does not: it falls to about 300 counts near 11 deg and then rises again into an amorphous hump peaking near 26 deg. A monotonic curve has no shape for a hump, so it ran flat underneath it and left 165 to 240 counts standing under every point from 20 to 34 deg. Nothing in the program said so. The subtracted pattern looked like intensity, because that is exactly what a pedestal of counts looks like.

What each model left, in counts above the pattern’s own floor, per 4 deg band.
model4–88–1212–1616–2020–2424–2828–34sound
Exponential (default)0−117−80−231592100no
Chebyshev−79−41−36015820033no
ALS129−25−1707163−11no
Polynomial24−28−7−741390yes
Sonneveld–Visser110−2−13822−2yes
QPA percentile245−4−46−150yes

What it cost, on one specimen, is not a rounding error. Switching from the default to a model that follows the floor moved the kaolinite bound from the heated mount from 97–99 % of the 7.15 Å window to 82–92 %, the chlorite from 25.7 to 18.7 % of the clay, and the accompanying minerals from 15 to 60 % of the weight. A separate question about the chlorite library turned on a ratio that reads 0.66 under the default model and 1.63 under Sonneveld–Visser — which is to say it was not a measurement at all.

So the program now measures it. background_pedestal divides the fitted range into 4 deg bands, takes the fifth percentile of each as its floor, and reports how far the background sits below it. The Background tab shows the per-band numbers under every curve, red when a band is flagged, so that two models can be compared by the one number that distinguishes them.

Three estimators were written before the one that works, and the two that failed are worth the space because each looked obviously right.

The band minimum. The lowest observed point of a band is the closest thing in it to pure background, so the difference there is the pedestal. It is also biased: the minimum of a few hundred Poisson samples sits two to three and a half sigma below their mean, so a correct background reads 40 to 80 counts low and a 200-count pedestal reads 130. Worse, on the over-subtraction side it is fatal — about half of a correctly fitted band lies below its own background, that being what noise about a curve means, so the obvious test of “how much of the band went to zero” fires on every background that is right. The test that caught this is in the suite.

The clipped mean. Unbiased, and wrong for the opposite reason: on a real clay pattern it measures the broad diffuse scattering as well as the background, and condemned all seven models including the three that reach the floor.

A low quantile, less the median band. The fifth percentile has an exact Gaussian offset whatever the sample size, so subtracting it gives an unbiased floor; and since a correct background still sits under a real pattern’s floor by roughly the same amount everywhere — the diffuse part — subtracting the median band removes what every model has in common and leaves what this one got wrong. That is the measurement in the table.

Two things it cannot do, stated so that nobody relies on the opposite. A band with no peak-free point in it has no floor to find, which is a live risk below about 6 deg on an oriented mount, so a flag on the first band is weaker evidence than a flag further out. And a background wrong by the same amount at every angle has the same profile as one that is right: subtracting the median is what makes a wrong shape visible and it is also what makes a uniform offset invisible. A model that passes here has not been certified correct. It has been found not to be wrong in the way that moves a quantification.

A.73 A texture no mount has, and the weights it bought

With A.72’s background guard in place, twelve clay separates were re-run on a background that passes it. The clay ratios improved — eleven of twelve accounted for more of the measured counts, and the mean difference from Clayfit3 fell from 15.1 to 11.4 points per phase — and the weight percentages fell apart. Four specimens that are clay separates came back at 4.5, 29.7, 33.0 and 39.9 % clay by weight, the first of them against 95 % quartz.

Nine of the twelve had a clay sitting on r = 0.1, the bottom of the orientation axis. That is the whole of it. A basal series is enhanced as r−3, so an entry at 0.1 is calculated to scatter a thousand times more per gram than the same entry at 1, and the fit buys low-angle intensity most cheaply at the bottom of whatever axis it is given. Removing the background pedestal made the clay scattering smaller, and the mass conversion turned that into a collapse.

The fit was not wrong. It was offered a texture that does not exist.

March-Dollase r is not a free shape parameter; it is the width of an orientation distribution, and P(α;r) = (r²cos²α + sin²α/r)−3/2 fixes that width from r alone:

What each value of the axis describes.
rFWHM of P(α)equivalent Gaussian σ*
0.102.8°1.2°single-crystal mosaic spread
0.207.9°3.4°sharper than any film
0.3014.7°6.2°exceptionally well oriented
0.4023.1°9.8°a good mount
0.5033.7°14.3°an ordinary mount
0.6047.4°20.1°a poor one

Moore and Reynolds describe an oriented clay mount by a Gaussian σ*, and put a good settled or smear mount at about 12° and an exceptionally well oriented one at about 6. So r = 0.3 is already the best film anyone makes, and r = 0.1 is a 2.8° distribution — the mosaic spread of a single crystal, not a settled powder. The bottom two steps of the axis described nothing that can be prepared, and they were the two the fit reached for.

The axis now runs 0.3 to 1.0. This is a statement about what exists rather than a tuning parameter, and it is deliberately not a constraint on how orientations are assigned: each composition still chooses its own, and where a fit now collects on 0.3, parameters_at_an_edge reports it as a bound. That is the honest reading — the data wanted a sharper texture than a clay film has, and the reason is somewhere other than the texture.

The fixed orientation of the single glycolated-smectite entry moves with it, from 0.1 to 0.3, so that the one pattern whose texture is assumed stays on the same basis as the clays whose texture is measured.


ClayQuant 0.1.0 — user and reference manual. The program is distributed under the MIT licence. Structure data is not distributed with it and remains subject to the licence of its source. This manual documents the state of the program at the revision noted on the title page; the test record of Appendix A refers to that revision.