
An AI model adapted from image inpainting can reconstruct missing atoms in crystal structures with a reported 97 percent success rate.
A crystal structure can appear nearly complete yet still be unusable for computer simulations because some of its atoms are missing. Hydrogen is a frequent source of these gaps, and researchers have now adapted an artificial intelligence technique used to repair images to predict where those hidden atoms belong.
The approach was developed by a team led by Giovanni Pizzi of the PSI Center for Scientific Computing, Theory and Data, working with researchers from the universities of Parma and Modena in Italy. Described in npj Computational Materials, the method applies computer vision, in which AI recognizes and interprets visual information, to incomplete crystal structures.
Specialized AI systems already assist materials research. Microsoft’s MatterGen, for example, can build complex crystal structures from basic information about which elements should be included and their proportions. Researchers can then use the generated structures in computer simulations to investigate potential materials.
The new method instead focuses on filling missing positions within structures that are already known experimentally. Completing those records could make previously inaccessible materials available for simulation or substantially improve existing models, supporting searches for properties useful in areas such as hydrogen storage and potentially new superconductors.
Missing hydrogen sidelines promising materials
“For our simulations of material properties, we rely on information in databases telling us where each atom is located in a crystal structure,” says Timo Reents, a doctoral candidate in Giovanni Pizzi’s group.
Hydrogen creates a persistent difficulty. Although it is often part of a crystal lattice, standard X-ray diffraction methods used to determine atomic arrangements do not detect it easily. As a result, crystal visualizations may place hydrogen atoms inaccurately or leave them out entirely.
Simulations require precise atomic coordinates to predict characteristics such as electrical and thermal conductivity. “If the information about the hydrogen atoms is missing, that’s a problem,” says Giovanni Pizzi. “Often, we can’t use several thousand potentially interesting materials for our simulations precisely for this reason.”
The researchers turned to AI to recover that missing information.

An image tool finds missing atoms
Their solution borrows from diffusion models used in computer vision. When these systems restore an absent portion of an image, the process is known as inpainting. A model might, for instance, reconstruct a dog’s paw that was hidden in the original photograph.
Older methods would cover the entire image with random information known as noise, then rebuild the full scene. Modern approaches concentrate stronger noise in the unknown area while disturbing the visible parts much less.
This selective process gives the model a reliable starting point. Rather than recreating everything, it can use the surrounding information to infer what belongs in the gap.
XtalPaint rebuilds only the gaps
Although selective inpainting is well established in computer vision, it had not previously been available for reconstructing missing atomic positions. Pizzi’s group addressed that problem by developing XtalPaint, an open-source model adapted from Microsoft’s MatterGen.
“This combines the advantages of modern computer vision and crystal reconstruction: Noise is added only to the unknown positions within the crystal – the known positions remain largely unchanged during the process,” Timo Reents explains.
Because XtalPaint retains most of the existing structure, it can use the known atoms as a guide throughout reconstruction instead of beginning from a heavily disrupted crystal.
“With step-by-step reconstruction, XtalPaint can orient itself to the existing crystal from the very beginning,” Reents says. “This increases the success rate and also saves computing power.”
Tests reach a 97 percent success rate
The researchers tested XtalPaint by taking crystal structures with known hydrogen positions, removing those coordinates, and asking the model to restore them.
In 87 percent of the tests, XtalPaint recovered the previously known arrangement. In another ten percent, it generated configurations that were more energetically stable than the recorded structures.
“Overall, this means a success rate of 97 percent for XtalPaint,” Reents says.
The model could now be used to restore missing hydrogen coordinates in materials databases. “We can now use our method, for example, to complete structures in databases with the missing hydrogen positions,” says Pizzi.
Pizzi and his colleagues have also used the method to identify database errors that can occur when information is transferred from original scientific papers. Its potential use extends beyond hydrogen. The same approach can reconstruct positions for lithium and sodium, two elements that are important in the search for new battery materials.
Reference: “Score-based diffusion models for accurate crystal-structure inpainting and reconstruction of hydrogen positions” by Timo Reents, Arianna Cantarella, Marnik Bercx, Pietro Bonfà and Giovanni Pizzi, 11 June 2026, npj Computational Materials.
DOI: 10.1038/s41524-026-02090-1
This research was supported by the NCCR MARVEL, a National Centre of Competence in Research, funded by the Swiss National Science Foundation (grant number 205602). This work was supported by a MARVEL INSPIRE Potentials Master’s Fellowship.
Never miss a breakthrough: Join the SciTechDaily newsletter.
Follow us on Google and Google News.