XRDiff: Crystal Structure Prediction from Powder X-Ray Diffraction Data Using Diffusion Models
Abstract
Determining the crystal structure of a material from its powder X-ray diffraction (PXRD) pattern is a central challenge in materials science. PXRD is accessible and widely used, yet the loss of phase information makes structure recovery an underdetermined inverse problem. We present XRDiff, a diffusion model that learns the spectrum-to-structure mapping from simulated structure-spectrum pairs, recovering crystal structures from PXRD given either the full stoichiometry or, in a more challenging setting, only the elemental constituents and the total number of atoms in the unit cell. We evaluate on datasets in which each stoichiometry has multiple polymorphs and all polymorphs are held out together, ensuring that high performance reflects genuine use of the diffraction signal rather than composition-to-structure memorization. XRDiff achieves strong recovery rates on simulated benchmarks, learning a mapping precise enough to differentiate polymorphs. To assess generalization to experimental data, we compare a full-spectrum encoding against a peak-descriptor encoding. The peak-based encoding generalizes substantially better, outperforming even a model trained on full spectra with augmentations fitted to the experimental noise distribution. Representations robust to real-world PXRD noise thus offer a practical and scalable path toward zero-shot crystal structure solution from experimental data.