Pawley fit
Model
A Pawley refinement fits a whole powder pattern without a structural model. Every allowed reflection k of the cell and space group gets its own intensity I_k:
y(x) = sum_k I_k P(x; 2theta_k, w_k) + sum_j c_j T_j(x)P is the profile (Gaussian, Lorentzian or pseudo-Voigt), T_j a Chebyshev background of the requested order, and 2theta_k is computed from the cell, the zero shift and the reflection's Miller indices. The intensities are integrated intensities: the profile is area-normalised, so I_k matches the PXRD reflection scale.
Linear and non-linear parts
For fixed cell, zero shift and widths the model is linear in the intensities and the background coefficients. The normal equations are assembled only over the reflections whose profile reaches each observed point, which keeps the fit fast even for a few hundred reflections, and one weighted solve gives the intensities, the background and their covariance. The covariance diagonal scaled by the reduced chi-squared gives the intensity esds.
The cell, zero shift and width model move the reflections, so they are non-linear. They are refined with a Nelder-Mead simplex over the small non-linear vector; every objective evaluation re-solves the linear part (variable projection). The width model is
w(theta)^2 = size^2 + (strain * tan(theta))^2with size in degrees and strain dimensionless, so a constant broadening and a tan(theta) broadening can be refined together.
Constraints
The refined cell only offers the numbers its metric family leaves free, and the family ties are enforced on every evaluation: a cubic cell keeps a = b = c (not only a), a tetragonal or hexagonal cell keeps a = b, and a monoclinic cell keeps alpha = gamma = 90. Without those ties a refined a would no longer equal the untouched b and the symmetry-equivalent reflections would split apart.
Figures of merit
Rp = sum |y_obs - y_calc| / sum |y_obs|Rwp = sqrt(sum w (y_obs - y_calc)^2 / sum w y_obs^2)Rexp = sqrt((N_obs - N_par) / sum w y_obs^2)chi^2 = sum w (y_obs - y_calc)^2 / (N_obs - N_par)
The weight is 1 / uncertainty^2 when the point carries one and 1 / max(y, 1) otherwise. The number of parameters is the reflections, the background terms and the non-linear parameters together.
Profile mismatch and weights
The default profile is pseudo-Voigt (eta = 0.5). With the weight 1 / max(y, 1) a noise-free pattern whose lines are Gaussian (for example the calculated PXRD pattern, which has zero background) is fitted badly: the Lorentzian tails of the model fall on baseline points that carry weight 1, while the peaks carry weight 1 / y, so the weighted least squares prefers small intensities and Rwp approaches 1 for counts in the millions. The same data fit with --profile gaussian give Rwp 0.07 and a = 5.620. Use the profile that matches the data, or give the pattern an uncertainty column, when refining a synthetic or very clean pattern.
Documented conventions and limits
- Intensities are profile heights under the area-normalised profile, reported per powder line; a P1 cell lists
+hkland-hklseparately, as the reflection list does. - The profile width is the same for every reflection except through the size/strain model; a Pawley fit with a separate width per line is not implemented.
- The non-linear esds use a finite-difference Jacobian with the intensities fixed at their fitted values, so they are approximate; the intensity esds use the exact linear covariance.
- A Bragg-Brentano cell carries a systematic error of order
1e-4Angstrom from the sample displacement that no esd includes. The reference says the same; this is the documented deviation. - The reflection count is capped by
PawleyOptions::max_reflections(400 by default) so a pathological cell cannot turn the fit into a huge dense problem.
Validation
crates/xtalforge-analysis/tests/pawley_golden.rs reads tests/golden/phase-7/pawley/one-atom-cubic.json, generated by scripts/golden/pawley.py from an independent point-scatterer model: a cubic cell, every signed hkl, known integrated intensities, a linear background and a 0.02 degree zero shift. The Rust fit must recover the cell to 2e-3 Angstrom, the zero shift to 5e-3 degree, every one of the 80 intensities within three esds, Rwp < 0.02 and chi^2 < 0.02. The unit tests add a width model with known size and strain, the input validation and the esd positivity.