Machine learning models have been used to aid in predicting lattice parameters from powder X-ray diffraction (XRD) data. The lattice parameters of a crystal are subject to conventions (e.g., primitive vs. conventional cells) and can change discontinuously at symmetry boundaries between Bravais lattices. We present an invariant representation of the reciprocal lattice, based on spherical harmonic projections, that is independent of cell convention, differentiable, and invertible. When predicting unit cells from powder X-ray diffraction data, replacing lattice parameters with this representation as the learning target reduces errors by a up to a factor of five.
Powder X-ray diffraction (XRD) is a core tool for characterizing materials. In general, traditional methods extract peak positions and then assess trial unit cells in order to determine the correct lattice parameters, a process known as indexing. This can be difficult in the presence of severe peak overlap, for low-symmetry crystals, or for materials with a large unit cell axis (dominant zones). Discriminating between competing solutions can become an art form relying on the prior knowledge of the crystallographer. There has been growing interest in using machine learning (ML) to narrow this search.
Recent work trains neural networks to predict the six lattice parameters \((a, b, c, \alpha, \beta, \gamma)\) directly from a powder pattern
A lattice can be generated by three vectors, whose lengths and relative angles give the lattice parameters. However, infinitely many sets of vectors generate the same lattice. Unit cell reduction procedures select a canonical set, but they are defined piecewise across crystal systems. Small continuous changes in a lattice can therefore produce discontinuous jumps in the lattice parameters near symmetry boundaries, even though the underlying geometry changes smoothly. This has practical consequences for ML, as the lattice parameters are a discontinuous learning target. A model predicting lattice parameters must implicitly learn a single consistent convention.
In dominant zone structures, usually those with one axis much longer than the others, most reflections can be indexed with only two Miller indices. The diffraction pattern then leaves the remaining lattice geometry underconstrained, which is difficult for both traditional indexing algorithms and neural networks.
A useful lattice descriptor should be independent of primitive cell choice, continuous under smooth lattice deformations, and expressed in reciprocal space, where diffraction operates. Our workflow predicts such a descriptor from the XRD pattern, inverts it to obtain a set of lattice vectors, and then converts these vectors to standard lattice parameters.
Given reciprocal lattice vectors \(\{\mathbf{b}_1, \mathbf{b}_2, \mathbf{b}_3\}\), each reciprocal lattice point is \(\mathbf{G} = h\mathbf{b}_1 + k\mathbf{b}_2 + l\mathbf{b}_3\) with \(h, k, l \in \mathbb{Z}\). We take all points within a cutoff \(k_{\max}\), which corresponds to the limiting resolution of the detector, and write the lattice as
\[\rho(\mathbf{k}) = \sum_{|\mathbf{G}| \leq k_{\max}} \delta(\mathbf{k} - \mathbf{G})\]We then expand \(\rho\) using spherical harmonics \(Y_{lm}\) for the angular part and radial basis functions \(g_n\) for the radial part, which gives the coefficients
\[c_{nlm} = \sum_{|\mathbf{G}| \leq k_{\max}} Y_{lm}(\hat{\mathbf{G}})\, g_n(|\mathbf{G}|)\]Invariant descriptors can be obtained from successive tensor products of these coefficients. The simplest is the power spectrum, \(\sum_m \lvert c_{nlm} \rvert^2\), but this loses information about correlations between different \(l\) channels. To retain more information, we couple coefficients from three channels \((l_1, l_2, l_3)\) into scalars through a symmetrized Clebsch-Gordan tensor product, following the standard construction from the atomistic ML literature
where \((0_e \oplus 0_o)\) indicates that we keep scalars and pseudoscalars. All pseudoscalars vanish for Bravais lattices since they are centrosymmetric, but we retain these channels for generality. In this work, we use \(l_{\max} = 6\) and 10 Bessel radial basis functions, with \(k_{\max} \approx 2/3\) Å⁻¹. Each row of the resulting descriptor corresponds to a radial basis function and each column to an allowed coupling, so the bispectrum can be visualized as a 2D heatmap.
This construction has the following properties:
The bispectrum is not guaranteed to be a one-to-one mapping, but it can be inverted empirically
We use a transformer to predict the bispectrum from the XRD pattern. Previous works have used convolutional neural networks (CNNs), but these are translation invariant and cannot directly relate peaks across the full pattern. Self-attention allows every peak to attend to every other peak, and preserves absolute peak positions. To evaluate the effect of the representation, we train the same architecture to output either the lattice parameters or the bispectrum, changing only the output dimension. Both the true and predicted lattices are passed through cctbx before computing errors, so that all comparisons are made in a consistent setting.
We train on four sets of simulated patterns: MP-20 (Materials Project structures with up to 20 atoms per unit cell
This improvement is likely due in part to the bispectrum preserving lattice symmetry. Without separate models for each crystal system, direct prediction may yield values that do not align with the correct Bravais lattice, such as cubic angles that are not exactly 90°. The bispectrum does not show this behavior, as it already encodes the symmetry of the lattice.
We define dominant zone patterns as those with at least 50% of their total intensity in a single zero-index family of reflections (\(h = 0\), \(k = 0\), or \(l = 0\)), which applies to 1,100 of the 30,000 structures in the full Materials Project test set. Using the model trained on the augmented full Materials Project, 76.6% of bispectrum predictions on these structures have both length and angle MAPE below 5%, compared to 5.8% of direct predictions. Direct prediction also often mispredicts symmetry-fixed angles of 90° and 120°, whereas bispectrum inversion largely preserves them.
We first evaluate on the 134 experimental RRUFF
| Method (trained on MP-20 Aug) | Length MAE (Å) | Length MAPE (%) | Angle MAPE (%) | Volume MAPE (%) |
|---|---|---|---|---|
| Bispectrum + inversion (ours) | 0.91 | 14.4 | 8.9 | 35.7 |
| Crystalyze | 0.90 | 16.1 | 9.9 | 43.4 |
| Direct prediction (ours) | 1.86 | 30.9 | 10.3 | 94.8 |
On the 240 RRUFF patterns used to evaluate AlphaDiffract
We also evaluate on single-phase CNRS patterns from the opXRD database
There are several limitations to our approach:
The lattice bispectrum could also be useful for other crystallographic ML tasks. For example, structure generation models could condition on the bispectrum rather than on raw lattice parameters. Since determining a lattice from an XRD pattern is fundamentally a one-to-many problem, a generative version of our approach that samples candidate lattices would be a natural extension. Incorporating the structure factor could also yield a descriptor sensitive to both the lattice and the atomic basis, which could aid in full structure determination.
We introduce an invariant, invertible representation of the reciprocal lattice and show that using it as the prediction target improves lattice parameter prediction from powder XRD. While ML for science often focuses on inputs and architectures, these results suggest that the choice of target deserves more attention, particularly when the standard representation is ambiguous or discontinuous.
We thank Nina Andrejevic for helpful information about AlphaDiffract, Eric Riesel for discussions regarding Crystalyze, and Emily Oliphant and Ameya Daigavane for helpful discussions regarding our methodology.
Here are some more articles you might like to read next: