Diffusion Models Enable Precise Atomic Inpainting for Crystal Structures
Researchers have adapted computer vision techniques to solve the challenge of missing hydrogen atoms in crystal lattices with high accuracy.

A research team led by Giovanni Pizzi at the PSI Center for Scientific Computing, Theory and Data has developed a novel application for diffusion models to address a persistent bottleneck in materials science: the accurate identification of missing atomic positions within crystal structures. By repurposing techniques commonly found in image processing, the team successfully reconstructed hydrogen atom locations that were previously inaccessible to traditional experimental methods like X-ray diffraction.
The methodology relies on an open-source model dubbed XtalPaint, which is built upon the architecture of Microsoft’s MatterGen. The researchers published their findings in the journal npj Computational Materials on June 12, 2026, detailing how the model functions as a specialized tool for crystal-structure inpainting. This approach allows for the simulation of materials that were previously excluded from computational databases due to incomplete structural data.
The core innovation involves applying noise selectively to unknown atomic coordinates rather than the entire crystal lattice. This strategy mirrors modern image inpainting, where diffusion models reconstruct obscured visual information by focusing computational resources on the missing segments. By keeping known atomic positions static, the model significantly reduces the required computational overhead while maintaining structural integrity.
Timo Reents, a doctoral candidate in the Pizzi group, noted that the model’s ability to orient itself to the existing crystal structure from the start is a critical efficiency gain. This targeted reconstruction process ensures that the model remains grounded in the physical reality of the known lattice. The team validated the approach by removing hydrogen positions from known structures and tasking the model with their recovery.
The results demonstrated a 97% success rate, with the model correctly identifying known positions in 87% of cases and discovering more energetically stable configurations in the remaining 10%. This performance indicates that the model is capable of both correcting existing database errors and predicting accurate atomic arrangements for future material simulations. The researchers have already identified discrepancies in existing databases caused by data transfer errors from primary literature.
Beyond hydrogen, the team confirmed that the XtalPaint architecture is applicable to other light elements, including lithium and sodium. These elements are essential components in the development of next-generation battery technologies, making the model a versatile asset for materials informatics. The ability to complete these structures allows for more precise predictions of material properties such as thermal and electrical conductivity.
The reliance on X-ray diffraction has historically limited the visibility of hydrogen atoms, which often results in incomplete or inaccurate crystal representations in scientific databases. Because precise atomic positioning is a prerequisite for reliable computer simulations, this data deficit has prevented researchers from exploring thousands of potentially valuable materials. The integration of diffusion-based inpainting effectively bridges this gap between experimental limitations and computational requirements.
By leveraging the structural constraints inherent in crystal lattices, the model provides a more stable framework for material discovery than generic generative models. The success of this implementation highlights the potential for cross-disciplinary applications where computer vision principles are mapped onto physical data structures. This transition from image-based tasks to material science applications represents a shift in how researchers utilize generative AI to solve domain-specific problems.
Future development will likely focus on scaling the model to handle more complex multi-component crystals and refining the energy-minimization algorithms. As the team continues to integrate XtalPaint into existing workflows, the accuracy of material property predictions is expected to improve across the broader scientific community. The project serves as a practical example of how specialized AI models can overcome specific data-quality hurdles in high-stakes scientific research. By automating the identification of missing atoms, the team has effectively unlocked a vast repository of previously unusable structural data for future computational exploration.


