WorksPhysics and Astronomy
Score-based diffusion models for accurate crystal-structure inpainting and reconstruction of hydrogen positions
Abstract
Generative AI models, such as score-based diffusion models, have recently advanced the field of computational materials science by enabling the generation of new materials with desired properties. In addition, these models could also be leveraged to reconstruct crystal structures for which partial information is available. One relevant example is the reliable determination of atomic positions occupied by hydrogen atoms in hydrogen-containing crystalline materials. While crucial to the analysis and prediction of many materials properties, the identification of hydrogen positions can however be difficult and expensive, as it is challenging in X-ray scattering experiments and often requires dedicated neutron scattering measurements. As a consequence, inorganic crystallographic databases frequently report lattice structures where hydrogen atoms have been either omitted or inserted with heuristics or by chemical intuition. Here, we combine diffusion models from the field of materials science with techniques originally developed in computer vision for image inpainting. We present how this knowledge transfer across domains enables a much faster and more accurate completion of host structures, compared to unconditioned diffusion models or previous approaches solely based on DFT. Overall, our approach exceeds a success rate of 97% in terms of finding a structural match or predicting a more stable configuration than the initial reference, when starting both from structures that were already relaxed with DFT, or directly from the experimentally determined host structures.
Introduction
The field of crystal structure prediction (CSP) recently experienced significant progress with the emergence of deep-learning based generative models [1, 2, 3, 4, 5, 6, 7]. In particular, score-based diffusion models have become highly popular in many domains [8, 9, 11, 12, 13, 14, 15] [10]. These are used to learn and sample a complex distribution by adding and removing (typically Gaussian noise according to a stochastic differential equation [9]. While most of these models, and also traditional CSP efforts prior to the deep learning era [16, 17], focus on the generation of stable crystal structures given the target composition [18], another very important challenge is the reconstruction and completion of crystal structures for which only partial information is available [19]. Such applications range from intercalating ions into potential cathode materials to materials for which the experimental determination of the crystal structure is challenging.
One example belonging to the latter category are crystalline materials that contain hydrogen. Hydrogen is one of the most abundant elements on our planet. In addition to its fundamental contribution to life, it is a promising carbon-neutral energy carrier [20, 21], it plays a key role in semiconductor industry [22], and it is intensively studied in many other fields ranging from photocatalysis [23, 24] to fusion reactors [25]. Unfortunately, hydrogen has the lowest X-ray and electron scattering power of all atoms, and at the same time, it has one of the highest incoherent scattering cross sections of all isotopes, which represents an unwanted background contribution for structural refinements with neutron diffraction. Nevertheless, neutron diffraction is the experimental method that sets and has set the reference for accurate identification of H positions [26]. However, this technique requires large facilities and substantial amounts of sample, thus making these experiments orders of magnitude more expensive than standard laboratory X-ray diffraction. Similarly, synchrotron-radiation X-ray powder diffraction has been applied in the context of hydrogen storage materials [27], but again this requires the availability of large facilities. Other techniques like 3D electron diffraction, based on the dynamical diffraction theory (instead of the kinematical approximation of single scattering) [28, 29], are also becoming increasingly popular as alternatives to X-ray diffraction methods, especially when the crystal sizes are limiting the application of single-crystal X-ray diffraction. Their application has successfully been proven for the determination of crystal structures in general [30], but also for hydrogen containing compounds [31, 32, 33]. Finally, thanks to the developments in the field of quantum crystallography [34, 35], the applicability of X-ray diffraction methods to locate hydrogen atoms in materials has greatly improved, based on approaches such as Hirshfeld atom refinement [36, 37] (i.e., using non-spherical electron densities instead of the independent atom model), almost reaching the accuracy of neutron diffraction [38, 39, 40] and, at the same time, these methods have become much more widely applicable [40].
Despite these experimental advances that enable the accurate location of hydrogen positions in materials, to date, the available (historical) data in experimental databases often report lattice structures nominally containing H atoms, with hydrogen positions that have either been introduced with heuristics (it is sometimes stated that H atoms are placed into “chemically sensible positions”) or do not provide H positions at all [41, 42]. Moreover, the quality of the data can be heterogeneous across entries, especially when the uncertainty is large or the data was obtained for a specific purpose, with a different focus than accurately determining the crystal structure [43]. This is particularly severe and relevant in the context of materials databases [44, 45, 46, 47, 48, 49, 50] that rely on the availability of complete and curated crystal structures, such as those that employ atomistic models to predict their properties.
In this work, we directly leverage and retrain a new version of Microsoft’s MatterGen model [10], a diffusion model originally trained to generate stable, unique and novel crystal structures with desired properties [51, 52], to efficiently reconstruct crystal structures with partial information available. We first show how the domain of materials science can benefit from methods originally developed in the context of image inpainting in computer vision tasks [53, 54]. Specifically, we choose the task of finding missing hydrogen positions in materials, due to the challenges related to their experimental measurement, as outlined before. By combining the diffusion model with recent advances in the development of machine learning interatomic potentials MLIPs [55, 56, 57, 58, 59, 60, 61] to drive structural optimization, we achieve success rates greater than 97% in terms of structurally matching our original reference or predicting configurations that are actually more stable than the original reference. Thanks to this high success rate, the method that we present here can also be used to predict new candidate structures for hydrogen related research, which can then be screened for interesting and desired properties. Importantly, the models we present are trained on top of MatterGen in a hydrogen-agnostic way, meaning that the method and models can be easily transferred to other related tasks, such as intercalation, without the necessity of retraining.
Results
Comparison of inpainting approaches
We start by demonstrating how our methodological advances can efficiently and accurately perform crystal structure inpainting. In this first section, we will only focus on actual structural matches, meaning whether our approach is capable of correctly restoring the hydrogen positions with respect to the reference, as determined by pymatgen’s StructureMatcher. Moreover, in this section, we will only generate one trial per structure. While this already achieves a notable performance, we will show later on in section IIC how the performance can be increased even more, yielding the aforementioned 97% success rate. This is achieved by generating several trials per structure and by considering “energetic matches”, i.e., predictions that find a lower energy configuration given the host structure (i.e., the original reference structure with the H atoms removed) compared to original reference.
Figure 1a compares different inpainting approaches and models, that are described in more detail in the Methods § 1.3 C: the MatterGen baseline model (from reference [10], originally trained to denoise the positions, lattice and atomic types, even though the lattice and atomic types are fixed for the denoising in these inpainting experiments), pos-only (our newly (re)trained model to only denoise the positions), pos-only-RePaint (the previous newly trained model, but evaluated in combination with the RePaint algorithm [53]) and the pos-only-TD model (our newly trained model with different noise levels per structure, transferring the concept of TD-Paint [54] from computer vision to materials science).
Figure 1. Comparison of the single-trial performance of different inpainting approaches. a Structural matching rate for multiple models and inpainting approaches: MatterGen, pos-only, pos-only-RePaint and the pos-only-TD, see main text for description of the models. Furthermore, we also show the performance of our DFT-based reconstruction approach discussed in the SI section S2 (dashed line). b Structural matching rate as a function of the denoising steps for the pos-only-TD and pos-only model. c Root mean square deviation (RMSD) of the predictions along the diffusion trajectory with respect to the reference structure, normalized by the number of hydrogen sites. The results are shown for the pos-only-TD and pos-only model and are distinguished into those cases that result in a final structural match and those that do not. The error bars in a and b result from 4 runs for each datapoint and show the min-max range of the single-trial structural matching rates.
As general note, as this will be relevant in the context of this section, we remind the reader that score-based diffusion models are generative models that are trained to iteratively remove noise from samples (typically starting from Gaussian noise), to transform the initial noisy samples into “clean” samples that follow the target distribution. We will call the number of denoising steps in the following. Moreover, we briefly introduce the aforementioned inpainting approaches RePaint and TD-Paint, originally developed for image inpainting (more details can be found in the Methods section). RePaint is an inpainting approach applicable to any unconditional diffusion-based model (without retraining) and improves the inpainting performance by repeatedly going back and forth in the denoising process. By resampling the known pixels during the denoising process, this approach harmonizes the inpainted region with the known region more effectively. TD-Paint is a strategy to (re-)train a diffusion-based model that handles variable noise levels at the pixel level, instead of a uniform noise level per image, thus allowing to directly condition its denoising process on the available image information, keeping known regions fixed (no noise) while iteratively predicting the missing parts. As a result, missing regions can be reconstructed more efficiently by tailoring the noise update to the known context.
We benchmark the inpainting approaches on a DFT dataset which consists of a set of inorganic crystal structures (with known hydrogen positions) that were curated by means of DFT and taken from the MC3D database [50] (version PBE-v1). More details on the datasets can be found in the Methods section IV C. For the rest of this work, we remove the hydrogen sites to generate host structures, then predict back the H position using our method (here: diffusion model + constrained relaxation of hydrogen positions, see Figure S1 for the impact of the constrained relaxation) and compare them against the initial known references.
Figure S1. Impact of (constrained) relaxation on the structural matching rate for different inpainting approaches. Structural matching rate for multiple models and inpainting approaches: MatterGen, pos-only, pos-only-RePaint and the pos-only-TD. Left: structural matching rate for the unrelaxed structures, i.e., the output of the diffusion model. Right: structural matching rate after performing a constrained structural relaxation, i.e., only the positions of the hydrogen sites are optimized, using NequIP.
It is clearly visible that the retraining of a model that only denoises the positions already improves the structural matching rate. It is interesting to note that applying the RePaint algorithm on top of this retrained model only reduces the variance, but does not really impact the overall performance. However, the number of steps increases from 300 to around 1000, making the prediction computationally more expensive. Moreover, to really notice a significant advantage of the RePaint approach in this task, one needs to use even more steps, e.g. by also increasing the number of corrector steps [62], to around 4000. This is further discussed in the corresponding Methods section IV B and the SI Figure S2 and Figure S3. Finally, our new pos-only-TD model yields the highest structural matching rate. This confirms the expectation that the model better “understands” the conditioning on the known positions, as it always conditions on the clean known positions instead of a noisy version of them (analogously to the original TD-Paint for known portions of an image). Finally, we also show the performance of a purely DFT-based approach that we implemented and use as a benchmark and reference (using the electrostatic potential to estimate the hydrogen positions), see Methods IV E, evaluated on a slightly smaller set of structures (only the common structures present in the DFT dataset and in the dataset used for the evaluation of the DFT-based reconstruction approach, more details in the SI section S2), yielding a matching rate of . As described in the Methods section, the DFT based approach might require the so-called pinball method for certain structures [63]. The matching rate increases to almost 87% when neglecting those cases. However, we note that also the pos-only-TD model reaches a higher matching rate of 88% on that subset. While these DFT results show the overall good performance of such a physics-inspired DFT-based approach, they also emphasize its limitations. First, the DFT-based method has a higher computational cost, both due to the cost of running DFT simulations, and to the combinatorial challenge involved in the pinball method [63]. Second, as we discuss in detail in the SI section S2, the performance is limited by the nature of the underlying greedy optimization algorithm (see SI section S2 E) and it is very difficult to further increase the success rate of the method. In the following, instead, we demonstrate how our data-driven score-based diffusion model approach can be seen as an efficient global optimization method and can achieve much higher success rates.
Figure S2. Comparison of several TD-Paint and RePaint based models and the impact of different choices of parameters. The following naming conventions are used: pos-only-TD-- and pos-only-TD----, where is the number of corrector steps, the number of denoising steps, is the so-called jump-length and the number of resampling steps (see Ref. [1]).
Figure S3. Increasing number of steps in the RePaint approach. The timestep (corresponding to a certain noise level) as a function of the actual number of denoising steps that are performed for two different setups of the RePaint [1] algorithm. Without the RePaint approach, the number of timesteps would be equal to the total number of timesteps.
In order to analyze whether the prediction process can be made more efficient, Figure 1b presents the impact of the number of denoising steps on the structural matching rate. We note that the models were trained on 1000 denoising steps (i.e., noise levels). Due to the superior performance and lower computational cost of the pos-only-TD model over the other inpainting pos-only-RePaint model, we only focus on the pos-only-TD and pos-only models here. Again, it is clearly visible that the pos-only-TD model performs significantly better. In terms of computational efficiency, this analysis shows that the number of denoising steps could be reduced from 1000 to 300 steps during inference, almost without any reduction in performance. Notably, even with only 50 steps, the pos-only-TD model performs much better than the pos-only model (even with more steps).
Furthermore, the spread between the unrelaxed and relaxed predictions is much smaller in case of the pos-only-TD model compared to the one that is observed for the pos-only model (not shown but discussed in SI Fig. S1), indicating that the pos-only-TD model generates configurations that are already closer to the local minimum and in better agreement with the known part of the host structure.
To further analyze the denoising process and how it differs between the two models, Figure 1c presents the root mean square deviation (RMSD) of the hydrogen positions along the whole trajectory with respect to the final reference structure (normalized by the number of hydrogen sites). Note that we use the mean at each step, i.e., the term without adding the Gaussian noise in Eq. (4). While the pos-only-TD and pos-only model behave similarly in those cases for which the predictions do not match the reference, two main differences can be observed when focusing on the cases that result in a final structural match. First, the RMSD starts to decrease earlier and exhibits a more negative slope, indicating that the correct manifold is reached faster, in agreement with the underlying idea of the TD-Paint approach [54]. Second, the RMSD of the final prediction is lower in case of the pos-only-TD model, once again highlighting the advantage of the pos-only-TD approach.
The previous analyses clearly demonstrate the efficiency and superior performance of the TD-Paint approach to reconstruct sites in host structures. All of the following results are based on our pos-only-TD model, with the final workflow being structured as follows:
Start from a host structure and randomly initialize hydrogen sites in the unit cell. At this stage, it is assumed that the number of sites to be added is known. We refer to the discussion section III for further remarks and SI Table S1 in § 3 B for some proof of concept on how to estimate the number of missing sites.
Apply the score-based diffusion model pos-only-TD for iterations.
Perform a constrained relaxation of the hydrogen sites using a MLIP (NequIP [64] in this case; we discuss the choice of MLIP in the SI § 3 C, Figure S4-Figure S6), keeping the cell and all remaining sites fixed.
Figure S4. MLIP relaxation convergence rate. Percentage of successfully converged relaxations within 500 steps. The analysis compares 5 pre-trained foundational MLIPs across relaxations using three different optimizers, each of them with 4 different convergence thresholds (in eV/Å). Each row presents the results for a different dataset: DFT, DFT-20-40 and EXP.

Figure S6. Agreement of MLIP and DFT stability classifications. Percentage of correct relative stability classifications, i.e., structures for which both DFT and the MLIPs predict the same sign of the energy difference between the initial reference and predicted inpainted structure. This measures in how many cases the MLIPs correctly classify whether the inpainted structure is more stable than the initial reference. The analysis compares 5 pre-trained foundational MLIPs across relaxations using three different optimizers, each of them with 4 different convergence thresholds (in eV/Å). Each row presents the results for a different dataset: DFT, DFT-20–40 and EXP.
Perform a full relaxation of all positions, again using a MLIP (NequIP in this case), including the non-hydrogen sites.
In addition to the DFT dataset, we now also evaluate our method on the EXP dataset, which consists of the underlying experimental structures (originally obtained from the experimental source databases COD [65], ICSD [66] and MPDS [67]) before the curation by DFT to construct the MC3D database, see Methods section IV C for more details. This dataset is more challenging as MatterGen is trained on DFT data, but it is a representative benchmarking for actual application, where preliminary DFT relaxations (with known H positions) are clearly not available. We note here that certain structures are labeled as theoretical in the source databases.
Moreover, up to now, only one sample (i.e., one trial per structure) has been generated. Since a diffusion model follows a probabilistic approach, several samples per structure can be generated that, in turn, might produce several different solutions. We will discuss later how, if several distinct solutions are obtained, a comparison of their total energies (either with a MLIP or with DFT) can then help to identify the most stable one. To demonstrate how multiple samples improve the success rate of our method, we generate 30 samples for each structure both in the DFT and EXP datasets, which we use for our subsequent analyses to compare the structural and energetic agreement of our predictions with respect to the reference data.
Energetic and structural agreement of the predictions: identification of more stable structures
We start with the discussion of the energy differences between the structures generated by the diffusion model and after relaxing them (i.e., comparing the outputs from step 2 and 4 in the workflow outlined before), shown in Figure 2a, both for the DFT and EXP dataset. In this analysis, we only consider the predictions that result in a structural match. One observes that the DFT structures exhibit a median energy change during relaxation of only 2 meV/atom. Similarly, the structures from the EXP dataset present a median energy change of 5 meV/atom. This indicates that the generated candidates are already energetically close to their final DFT local minimum (estimated by the MLIP).
Figure 2. Analysis of the energetic and structural agreement of the predictions with respect to the references. a Only for the matching predictions: Difference between the energy of the initial structure generated by MatterGen and its energy after structural relaxation using NequIP. The color distinguishes between DFT and EXP datasets. b Kernel density estimate (KDE) plot of the root mean square deviation (RMSD) between the atomic positions of the prediction and the references. The main plot shows the distribution for the samples that result in a structural match, the inset for the non-matching ones. c Cumulative percentage of the energy difference between the prediction and reference (the reference has been relaxed with the MLIP as well, in order to have comparable energies and methods). We distinguish each of the datasets into two sub groups, those resulting in a structural match and those that do not. Negative energy differences indicate predicted structures that are more stable than the initial reference (see discussion in the main text).
To facilitate comparison and analysis with respect to the references, we now also structurally relax the positions of the DFT and EXP references using NequIP, and call the resulting datasets DFT+MLIP and EXP+MLIP, respectively; see Methods section IV C. By relaxing the references, indeed, we can directly compare the energies of the prediction (which we always relax with the MLIP in our algorithm, as mentioned earlier, steps 3 and 4) with the initial reference (now relaxed with the same MLIP) to assess whether the prediction matches the original reference. Moreover, we avoid that different local minima obtained with DFT and MLIPs affect the comparison. Notably, however, we stress that this is only used for the comparison, but the inpainting process always starts from the original DFT and EXP datasets. We highlight that the comparison with the EXP dataset allows us to assess whether we would end up in the same configuration when directly starting from experimental source structures or from our prediction followed by DFT or MLIP relaxations. This does of course not exclude general deviations between experiment and DFT predictions, but is not a limitation of the approach itself, as the inpainting approach can also be applied to training sets computed at higher level of theory, beyond DFT. Figure 2b then shows the RMSD of the predicted structure with respect to the reference, after full relaxation (here, we normalize by the number of atoms and not the number of hydrogen sites, since all atoms are optimized). The main plot shows that the differences are very small in case of +MLIP datasets, with the majority below 0.01 Å, indicating that the predictions (after reconstructing the H positions) relax to the same configuration as if one starts from the references (with H atoms) and relaxes them with the same MLIP. In SI Figure S7 we also compare how close the diffusion model outputs are with respect to the reference datasets without additional relaxation. Slightly larger differences are observed in this case, as expected due to the typical deviations between the MLIP-relaxed structures and the original ones (DFT-relaxed or experimental). Notably, the DFT case gives an estimate of how much the NequIP MLIP results differ from the DFT-relaxed results (i.e., those in the MC3D database), which is valuable additional information since NequIP is trained on a different training set.

Figure S7. Impact of different relaxation approaches on the structural agreement of the predictions. Distribution of the RMSD between the predictions and DFT and EXP reference. We distinguish two versions of each dataset: On the one hand, the output directly taken from the diffusion model, indicated by the suffix “(Diffusion model)”. On the other hand, the prediction of the diffusion model after performing a constrained relaxation of the H-positions using the MLIP, indicated by the suffix “(H constrained relaxation)”. The main plot shows the distribution for the cases that result in a structural match, while the inset shows the results for those not resulting in a structural match. The full relaxation RMSD is normalized by the number of atoms, while in the other two cases it is normalized by the number of hydrogen sites.
The observed structural trends for the MLIP-relaxed predictions and targets (“+MLIP” datasets) are further supported when focusing on the energetic agreement between the predictions and references. In Figure 2c one observes that the cumulative distributions of the energetic differences almost follow a step-like function at around 0 eV when a structural match is observed. This confirms the high structural agreement observed in Figure 2b and indicates that, when a match is detected by the StructureMatcher, the prediction essentially always relaxes to the very same configuration.
As expected, and already observed for the structural RMSD, more significant deviations can be observed for the cases that do not result in a structural match. However, and most notably, the majority of those non-matching cases end up in a configuration that is more stable than the structure from the reference source database (energetic difference below 0 eV), always with respect to the potential energy surface described by DFT or the MLIP. Therefore, these should not be considered failures of our approach, but rather as successful predictions that actually identify an even more stable configuration than the initial reference.
To further validate that this result is not an artifact of the MLIP, but that our method truly discovers new more stable configurations, we perform DFT relaxations (only of the positions) and again compare the energetic differences between the inpainted predictions and references. For this analysis, we only consider those structures for which no structural match was obtained for the most stable candidate (114 and 132 for DFT and EXP, respectively), of which 1 and 17 did not converge successfully in DFT and were discarded for the later analysis; see section IV D for further details on the computational details.
The cumulative distribution of the energy differences after DFT relaxation is presented in Figure 3. We obtain that 84.2% and 77.4% of the model predictions (for the DFT and EXP datasets, respectively) have an energy that is lower than the original reference (i.e. the predictions are more stable; green area in Figure 3), thus validating via DFT what we had observed in the MLIP results: when there is a structural mismatch, our diffusion model typically identifies even more stable structures than the original reference. We stress that the aspect of higher stability than the original reference, especially in the context of the EXP dataset, is always with respect to the DFT potential energy surface. Moreover, it always means more stable than the reported configuration in the source databases, which often contain approximated or guessed hydrogen positions. Nonetheless, having in mind the main application outlined in the introduction, i.e., the extension of materials databases based on known host structures, finding energetically more stable configurations (within the framework of a chosen method, e.g., DFT) is indeed one of the main targets of crystal structure prediction applications.
Figure 3. DFT validation of the relative stability of predictions and references. Cumulative distribution of the energy difference computed with DFT between the original reference and the prediction of the model (the reference and prediction where both optimized by DFT, as indicated by the EXP+DFT in the legend, by relaxing only the atom positions and not the cell). The analysis is limited to structures for which the lowest energy sample among 30 samples does not result in a structural match. For the DFT energy evaluation, we only select the most stable sample according to the MLIP energy evaluation. The green (red) area indicates predictions that are energetically more (less) stable than the original reference.
SI section S1 C further discusses the correlation of the energy differences predicted by different MLIPs, also justifying the selection of the NequIP [57] foundational model [64], as it is the one—among the five we tested—that best agrees with our DFT settings in predicting the relative stability of the inpainted structures and the references in our setup, and generally belongs to the best performing foundational MLIPs at the time of publication [55]. One can rationalize the observation that most of the structurally non-matching predictions are actually more stable since MatterGen (and our extensions) were only trained on materials with an energy above hull smaller than 100 meV/atom, thus naturally including a bias toward predicting stable materials. Moreover, having in mind the underlying challenge of experimentally determining the hydrogen positions, these apparently “non-matching” cases might be those for which the hydrogen positions were only roughly estimated in the experimental source databases.
Based on these insights, we will define a successful prediction in the remaining analyses as either resulting in a structural match, i.e., reconstructing the original reference configuration2, or in an energetically more stable configuration2. To distinguish these successful predictions from the previous discussion considering only structural matches, we will call our new success rate the Lower Energy or Structural (LES) matching rate in the remaining analyses.
Maximizing the performance even beyond the training regime
In Figure 4a we show the newly defined LES matching rate as a function of the number of samples that are generated per structure. We distinguish between pure structural matches (lower part of the bars) and LES matches (upper part of the bars that is “hatched”, i.e., overlayed with diagonal lines). The performance on smaller sample sizes are estimated via bootstrapping, i.e., resampling subsamples with replacement, which is also used to estimate the uncertainty of the success rate. We use the energetically most stable configuration among the samples to determine the structural and LES matches, which is also the recommended algorithm for production runs where no reference is available. Here, the energy is evaluated with NequIP only due to the large number of samples per structure. A significant performance increase is observed when generating several samples compared to the generation of a single sample. Overall, we achieve a notable 99% (98.7%) LES matching rate for the DFT+MLIP (EXP+MLIP) dataset when generating 30 samples (evaluated with NequIP; therefore, small deviations with respect to DFT might occur, resolved in the next section), highlighting the efficiency of our approach in reconstructing the hydrogen positions given a host lattice. In order to balance performance and computational cost (as a reference, the inpainting process for the 862 structures in the DFT dataset with 300 denoising steps and 1 sample per structure takes approximately 30 mins on an Nvidia A100 GPU), we recommend a value of , yielding a performance of 98.6% (98.1%) for DFT+MLIP and EXP+MLIP, respectively, with almost no decrease in performance compared to the results. We note that this recommendation applies to high-throughput workflows. Based on the small computational cost, for more targeted applications one should keep samples and potentially even further increase this value.
Figure 4. Analysis of the multi-trial Lower Energy or Structural (LES) matching rate, resolved with respect to the number of samples and unit cell size. In both panels, the lower solid portion of each bar shows structural matches, while the hatched upper portion indicates additional successes where the final configuration is not a structural match but is energetically more stable. a LES matching rate as a function of the number of generated samples per structure. For each structure, the most stable sample among the generated samples is selected to compute the LES matching rate. For , uncertainty is estimated via boot-strapping and shown as error bars. b LES matching rate as a function of the number of atoms per unit cell for the EXP+MLIP and DFT+MLIP datasets, considering only the most stable sample among and samples per structure, for the ones containing up to 20 and 21 to 40 atoms, respectively. The vertical red dashed line marks the atom-count cutoff of 20 atoms/cell for the Alex-MP-20 training dataset [10] of MatterGen. Furthermore, the black dotted and dashed lines indicate the average performance (across the range 1–20 and 21–40 atoms) in terms of structural and LES matches of the direct DFT-based reconstruction approach, discussed in the SI. Those values should only be compared to the red DFT+MLIP dataset.
Another related way to improve the performance, at higher computational costs, is to perform the selection of the energetically most stable sample fully with DFT. As a reminder, here we used NequIP to select the most stable sample and only relax that sample with DFT. Fig. S8 and S9 in the SI discuss in more detail the differences in the energetic ranking of the 30 samples for each structure, obtained with DFT and NequIP. In that analysis, we focus on the 18 structures in the DFT dataset that did not result in a LES match. When replacing NequIP with DFT to select the most stable sample, 11 out of the 18 cases also result in a LES match, increasing the LES matching rate to more than 99%, which is actually in agreement with the MLIP-evaluated result discussed in the context of Figure 4a. This highlights that, even though the MLIP-based energetic ranking of the samples introduces some uncertainties, the overall estimation of the success rate is very reliable. The difference is not necessarily a shortcoming of the NequIP model but could also be related to the different DFT settings (compared to the training set) and can potentially resolved by fine-tuning the foundational model.
Lastly, one relevant aspect is whether the differing configurations occur because of the differing hydrogen positions, or due to a significant change of the positions of the host sites after predicting the hydrogen positions and performing structural relaxations. To quantify this, we used again the StructureMatcher, but this time considering only the non-H atoms, and applied it to compare the MLIP-relaxed prediction (full atomic relaxation at fixed cell, so that the host atoms can in principle move) with the reference (also MLIP relaxed, to be comparable). We observe that only in 4.4% and 4.1% of the DFT and EXP structures, respectively, the host positions do not match anymore. Hence, especially in the context of the EXP dataset, one can note that even when the hydrogen predictions do not result in a full structural match, most of the lower energy matches do still match the host structure, which is the part that is assumed to be measured with a higher confidence in experiment. This also hints at the fact that the hydrogen positions and small adjustments of the host sites are the aspects that lead to a lower energy prediction, rather than a major change in the atomic positions of the original host structure.
In addition to the previous improvements, we now discuss how the method yields promising results beyond the training regime. First, as outlined in the Methods section describing the data, we note that we carefully removed any overlapping structures from the training and validation set, with respect to the DFT dataset, when training our pos-only and pos-only-TD models, to ensure a valid comparison. One of the current (potential) limitations of the MatterGen model [73] (and of our extension) is that it is trained only on structures with up to 20 atoms per unit cell. This is a practical limitation to reduce the computational cost of the training. While it can be lifted, it is important to verify how well the model performs beyond this limit. In Figure 4b we therefore show the LES matching rate resolved by the number of atoms per unit cell, up to a value of 40. Here, we consider the previous samples for each structure containing up to 20 atoms from the previous analysis, and generate samples for the structures containing 21 to 40 atoms (as this was determined as the optimal trade-off and in order to reduce computational cost). Moreover, as this is used to estimate the final performance, the energies of the most stable sample (selected based on NequIP) were calculated by relaxing the predictions with DFT. Thus, all the LES matches are actually confirmed by DFT (we note that 98 out of 4588 structures for which the DFT relaxation failed were removed).
We observe that the performance of the model remains very large even when applying it to structures much larger than those seen during training. Only for much larger systems ( atoms per unit cell), a reduction in performance starts to be observed, especially when starting from experimental structures. Nonetheless, the LES matching rate remains well above 90%. In Figure 4c we also indicate the average performance (averaged over systems with 1–20 and 21–40 atoms) for the DFT-based approach that is discussed in detail in the Methods section and the SI. For those results, we also distinguish between pure structural matches and LES matches. Compared to the DFT-based approach, the diffusion model and MLIP based approach achieves a higher structural matching rate across almost all bins on the DFT+MLIP dataset. Moreover, the pos-only-TD predictions also shows a higher ratio of lower energy matches in addition to the purely structural matches.
In summary, this analysis highlights that the method that we present here works well even beyond the training regime, although with some expected degradation in the performance. This is especially promising as our model can act as a foundation to be efficiently fine-tuned with larger structures to further increase its performance, without the necessity of full retraining. However, this goes beyond the scope of the present work and is left for future work.
Based on the previous discussion, we summarize our recommended algorithm in Table I, together with the corresponding performance. We use our newly trained pos-only-TD model, i.e. the MatterGen architecture in combination with the TD approach [54] to only denoise positions, generate samples per structure, and select the lowest energy one as the final prediction (either based on DFT or MLIPs, depending on the trade-off between computational cost and slightly higher accuracy; as outlined before, using DFT for all samples could even further boost the performance).
| model | samples | DFT+MLIP | EXP+MLIP |
| pos-only-TD | 10 | 97.8% (97.2%) | 97.2% (95.6%) |
Table I. Summary of the final algorithm. Performance of our final algorithm based on the pos-only-TD model and samples per structure. The performance is shown for the DFT+MLIP and EXP+MLIP dataset containing up to 20 atoms (i.e., the training regime). Furthermore, the performance on structures with 21 to 40 atoms per unit cell is shown in brackets, as a reference for the performance beyond the training regime.
Inspecting mismatches and lower energy matches
After having discussed the generally very high LES matching rate, we now explicitly discuss in more detail some of the mismatching predictions of our algorithm (i.e., cases in which our algorithm predicts a higher-energy structure than the reference) and some of the predictions that are more stable than the original reference. We focus on the EXP dataset for this analysis, but the observed patterns are similar also in the case of the DFT dataset.
We first note that several of the mismatches actually correspond to structures that are labeled as theoretical in the MC3D database. This label is derived from the information available in the underlying source databases and typically indicates structures that have been just postulated and then used in simulations, but never experimentally identified. If we filter out such theoretical structures, thus reducing the EXP dataset to 577 structures, we only find five structures for which the prediction does not result in a LES match. Hence, when only focusing on structures that are actually experimentally known, the success rate even exceeds 99%.
Figure 5a-Figure 5d present four examples that do not match the reference and result in a configuration that is higher in energy. We note that the visualized crystal structures show the prediction after the constrained MLIP relaxation, but the values correspond to the energy differences obtained after a subsequent DFT relaxation (of the reference and prediction) as explained earlier.
Figure 5. Visualization of predicted hydrogen positions that do not result in a structural match. The examples are taken from the EXP dataset. In the panels, the small green and orange spheres represent the positions of hydrogen atoms in the reference structures and in our approach, respectively. a-d Four example structures that do not result in a structural match and exhibit a higher energy than the experimental reference structure (evaluated after a subsequent DFT relaxation). The IDs in the source databases are: a) ICSD-10429, b) MPDS-S1706693, c) MPDS-S1129483, d) ICSD-195137. e-h Examples that do not result in a structural match but relax to configurations that are lower in energy than the original references. The IDs in the source databases are: e) ICSD-425888, f) MPDS-S1903387, g) MPDS-S1832431, h) ICSD-291483.
In the cases of TcHNO and KSiH (Figure 5a, Figure 5b), the final energy difference is very small and is only based on slightly different orientations of the hydrogen positions, with some of them actually overlapping with those in the original reference. Moreover, TcHNO (and also the fifth structure that does not result in a LES match, KHPt, not shown here), belong to the examples for which a different sample identified by the algorithm would actually match the reference, but the lowest energy one according to NequIP does not. In the case of the molecular crystal HCN (Figure 5c), the hydrogen site is essentially located at the opposite position of the molecule and results in a significantly higher energy. Similarly, two of the four hydrogen sites in HPdPbO (Figure 5d) are located close to their reference positions, while the other two are located differently and also show a different bonding behavior, and result in an energy that is 58 meV/atom higher than the energy of the reference.
We now discuss the examples in Figure 5e-Figure 5h, for which the predictions are energetically more favorable than the reference. The underlying reference [74] of RbHSO (Figure 5e) reported that the unambiguous determination of the hydrogen positions of the water molecules was not successful (the measurement was based on XRD). The water molecules are slightly rotated in our prediction to be aligned within the layers, and the relaxed configuration is more stable according to DFT. The examples of BaLiH and YMnH (Figure 5f, g) correspond to cases where it seems that issues might have occurred in the transcription from the experimental papers to the source databases. Our predictions do not match the references obtained from the source databases, but they actually agree with the experimental data from the original papers. These examples highlight how our method can help to potentially identify insufficient data quality and detect structures that might require more careful inspection. Finally, SrAlH (Figure 5h) is an example in which our method can actually help in the refinement process. The underlying paper already stated that the determination of the hydrogen sites using XRD was difficult due to the low X-ray scattering [75]. Our prediction indicates that the assignment of the hydrogen sites to a different Wyckoff position in the perovskite structure results in an energetically much more favorable configuration (while still having a very similar XRD pattern, see SI Figure S10 for a comparison).

Figure S10. XRD pattern for the compound. The blue curve shows the XRD pattern of the reference structure originally obtained from the source database, whereas the orange curve corresponds to the XRD pattern of our prediction.
More details on these examples can be found in SI section S1 F. Furthermore, we point the interested reader to
SI section S1 G for further comments about the application of our method to experimental structures to support the refinement process.
Discussion
In summary, we presented how inpainting techniques, originally developed in the field of image vision, can be adapted in materials science to accurately and efficiently reconstruct crystal structures from partially known information. In particular, we extended the recently published MatterGen [10] model adapting it for crystal structure inpainting, by leveraging the TD-Paint inpainting technique from computer vision and applied it to the problem of finding missing hydrogen positions in inorganic crystal structures. The method has been successfully benchmarked on a set of reference structures with known hydrogen positions (obtained from three different experimental crystallographic databases), by artificially removing hydrogens and then reconstructing their positions using our method. The results show that the inpainting approach significantly outperforms both unconditioned diffusion models and previous DFT-based approaches, leading to an overall success rate of 97% (defined as either structural matches with the reference structures, or an even more energetically stable prediction). In case of the EXP dataset, this success rate can be pushed even further to 99% when excluding structures flagged as theoretical in MC3D. Moreover, the same success rate can be achieved for the DFT dataset by replacing MLIP energy evaluations with DFT calculations to select the most stable candidate among those identified by the algorithm. We also show how the model performs beyond the training regime, achieving high performance on structures containing up to 40 atoms per unit cell, although being trained only on structures with up to 20 atoms per unit cell. Moreover, by explicitly discussing some of the mismatches as well as predictions that are energetically more stable than the original references, we also highlight how the method can help to detect cases for which the underlying experimentally derived data might require additional checks.
Our method and trained models are completely hydrogen-agnostic and can thus also be directly applied to any other problem where one seeks to place additional sites into a host crystal structure. One example application is the study of Li intercalation in cathode materials to identify the most stable Li arrangement for partially lithiated states, and similarly for other ions (such as Na in sodium-battery materials). In such applications, it might be of interest to re-enable the adjustment of the unit cell during the denoising process, which was not required for the present study, but might be beneficial when intercalating ions into pristine materials. Another example is the prediction of potential muon stopping sites, which normally requires the generation of several symmetrically distinct trial arrangements [76, 77, 78]. By leveraging the method presented in this work, this process could potentially be accelerated by directly generating fewer promising trial configurations. Furthermore, hydrogen-related research topics might benefit from this work for finding interesting candidate structures that could potentially be studied in more detail. The main applications we envision are two-fold. First, extending computational databases (such as, e.g., MC3D) with several additional hydrogen-containing materials will enable computational screening studies that might detect hydrogen-containing materials with desired properties that had not been considered before. Second, similar to the aforementioned example of partially lithiated cathode materials, one could screen host materials and search for favorable positions of interstitial hydrogen sites.
Finally, we leave the determination of the number of (missing) sites to be inpainted for future work, as the main goal here was to demonstrate the high performance of the method. In the context of missing hydrogens, this is also motivated by the fact that experimental crystallographic files often report the expected number of missing hydrogen sites, e.g. based on other experimental techniques or chemical reasoning. Moreover, in other applications, such as the intercalation mentioned before, the number of sites to be added is anyway known. A potential extension towards the determination of the number of missing sites could be to screen a range of sites to be added and exclude unstable ones based on a convex hull and formation energies approach. While this will still yield several possible , it already presents a first step to exclude unlikely compositions. A promising proof of concept on a small set of structures is discussed in the SI section 1B.
All the methods and extensions on top of MatterGen presented in this work are publicly available in our xtalPaint package [citep][79] and also integrated into the AiiDA framework [80, 81, 82].
Methods
Score based diffusion models
In this work, we use MatterGen [10] as the underlying diffusion model. Except for small technical modifications which are described in the following two sections, the model architecture remains the same. Nonetheless, hereafter, we briefly summarize the diffusion and denoising of the fractional coordinates. The original MatterGen was trained to also denoise the cell and atomic types. However, this is not used in the present study as removing this degree of freedom improves the model result for our application, as we show in Figure 1a. We refer the interested reader for further details on the architecture and original training to the original reference [10]. As shown by Song et al. [9], score-based diffusion models can be formulated as forward and reverse processes governed by a stochastic differential equation (SDE). The forward process is given by
where is the drift coefficient, is the diffusion coefficient, and represents standard Brownian motion. The corresponding reverse process, transforming noise into actual samples, is governed by
Here, is the score function approximated by our score network. In particular, the forward process is following a so-called Variance-exploding SDE (VE SDE)
where is an exponentially increasing sequence of standard deviations.
In practice, the process is discretized and numerically iterated, as described in the following [10]:
where is sampled from a standard Gaussian, is the noise level at timestep and is the score function approximated by our score network. These results show the process for an unconditional model. However, for our inpainting task, we do not want to adjust all positions but rather mask certain sites in the structure. The next subsection discusses this aspect in more detail.
Improved inpainting techniques
While unconditioned diffusion models can be directly used for inpainting tasks [9], i.e., completing and reconstructing a masked region in an image, several approaches have been proposed in the field of computer vision to improve their performance [53, 83, 84]. Among others, Luan et al. proposed the so-called RePaint approach [53] which has also been adopted in other fields, such as materials science and computational chemistry [62, 85]. The motivation was the observation that in images, but also molecules, the inpainted regions are often not fully homogenized with respect to the known region.
The RePaint approach addresses this inconsistency by going back and forth in the denoising process, by adding corresponding noise level at timestep to the known region. Since the noise on the known regions is not passed between iterations, i.e., it is always added to the exactly known values, the final prediction will still contain the correct known part. In addition to the pure number of resampling steps, one can also specify the so-called jump length that defines for how many steps the noise is added again, before continuing the denoising process for the same number of steps. Although RePaint can significantly improve the performance, it comes at the cost of potentially many more denoising steps. Figure S3 in the SI shows the denoising schedule for some parameter combinations that have been used in other works [62], i.e., 200 noise levels (“standard” denoising steps), 3 resample iterations and a jump length of 10. This results in 961 steps compared to the 200 one that one would use when just applying the unconditional diffusion model. In the context of crystal structures, one can rationalize this in the following way. The model is trained under the assumption that all the sites exhibit the same level of noise, as one timestep is sampled per structure during training. While this is true for actual structure generation tasks, in the context of inpainting the known region should essentially not contain any noise and only the inpainted region should be updated.
To avoid this significant increase in the number of steps that makes the generation process much slower, further approaches have been proposed. One example is TD-Paint [54], which also addresses the problem of the aforementioned inconsistency. Transferring the underlying idea from computer vision to the present problem of inpainting missing sites in crystal structures, this approach retrains the model so that it “understands” that different sites in a given structure can have different noise levels, so that it can always condition on the known information without adding noise to it. In practice, in the context of inpainting, we first randomly sample one timestep per structure, that is identical for all sites, as done before. Afterwards, we replace the timestep for percent of the sites in a training batch with a timestep that is close to 0, which corresponds to a small level of noise. The presented model uses a fraction of . In this way, the model is aware of the fact that some sites in a structure contain a given level of noise, while others are essentially noise-free and do not have to be updated. The actual denoising step according to Eq. (4) can then be performed as before, with the small adjustment of combining the known and inpainted sites:
where is the adjusted time consisting of the noisy timestep and the for the inpainted region.
Model training and data
Within the main text, we refer to four different models that are described in this section. As mentioned before, we leverage the MatterGen architecture (more details in [10]) as the underlying diffusion model in this work and modify it to handle individual timesteps per site. We also keep the original training and sampling parameters, only adjusting the signal-to-noise ratio in the Langevin dynamics of the sampling process from 0.4 to 0.2 (see SI Figure S11). We refer the interested reader for further details on the curation of the training set and the underlying model architecture to the corresponding reference [10]. The different models and their differences are briefly listed below:

Figure S11. Impact of the SNR on the structural matching rate. Structural matching rate as a function of the SNR that is used in the Langevin dynamics during the reverse diffusion process.
MatterGen: the baseline model from Ref. [10], originally trained to denoise the positions, lattice and atomic types, even though the lattice and atomic types are fixed for the denoising in our inpainting application.
pos-only: a newly trained model to only denoise the positions.
pos-only-RePaint: the previous newly trained pos-only model, but evaluated in combination with the RePaint algorithm [53].
pos-only-TD: newly trained with different noise levels per structure, following the concept of TD-Paint [54]. In this case, we adjust and extend the MatterGen source code to be compatible with the definition of noise levels per site instead of a single noise level per structure, which is then expanded for each site in a structure.
To showcase the performance of our approach, we test the success rate of reconstructing unknown hydrogen positions on the structures containing hydrogen from the MC3D database [50]. The MC3D database was chosen as it is focusing on, and starting from, experimentally known compounds. Therefore, the issue of unknown hydrogen positions is of high practical relevance in order to extend the coverage of the database. We distinguish two groups of datasets throughout this work:
EXP and DFT: These are the initial experimental structures that form the foundation of MC3D and their DFT-relaxed counterparts, respectively. EXP contains 915 and DFT 862 structures, respectively. The EXP dataset is slightly larger as it also contains the structures for which the DFT calculations failed when constructing MC3D.
DFT+MLIP and EXP+MLIP The same datasets as before, but where each structure is further relaxed using the NequIP MLIP (only the positions, the unit cell is kept unchanged throughout this work). These datasets are used in the manuscript to assess whether our approach is generally suitable to predict the correct starting point that would relax to the same configuration (even if the outcome of the diffusion model might differ from the original reference). This aspect is particularly important for the construction of DFT curated databases, where one is mainly interested in getting the same configuration after structural optimization.
In section II C, we also extend the discussion to unit-cell sizes beyond the training regime, by considering structures with up to 40 atoms per unit-cell. This extension of the DFT and EXP datasets (21 to 40 atoms) contain 1276 and 1709 structures, respectively (again, we remove any compounds that we could not structurally match with our approach nor validate with DFT).
To ensure a robust benchmarking, we slightly adjust the MatterGen training set, Alex-MP-20, when retraining the pos-only and pos-only-TD models. Any structure which resulted in a match with a structure in the DFT and EXP datasets (according to pymatgen’s StructureMatcher) was removed when retraining the pos-only and pos-only-TD model. In a post-processing step, we also identified the prototypes (aflow_sym_label:chemsys, where aflow_sym_label refers to the AFLOW label [86, 87] and chemsys to the alphabetically sorted chemical system) of each structure and removed any structure from the evaluation that resulted in a matching prototype, to further reduce the risk of any “data leakage”. After these filtering steps, the dataset sizes reduce to 831 and 776 in case of DFT and EXP, respectively (the datasets with 21 to 40 atoms do not exhibit any overlap). The similarity of the training and testing datasets is further discussed in the SI Fig. S12.
DFT calculations to validate stability
All the DFT calculations to validate the energetic stability of the references and our inpainted predictions were performed using Quantum ESPRESSO [88, 89] in combination with the corresponding Aiida plugin, aiida-quantumespresso [90], the latest computational protocols [91], and the pseudopotentials from the SSSP PBE Efficiency v1.3.0 library [92]. The computational parameters are discussed in detail in the aforementioned references. Nonetheless, we list the main parameters in the following: the k-point mesh is chosen to ensure a maximum distance of at least in each direction in reciprocal space. The force and energy thresholds for ionic optimization are set to and , respectively. The wavefunction and charge density cutoffs are chosen based on the recommended cutoffs provided by the SSSP PBE Efficiency v1.3.0 (sssp.materialscloud.org).
The same DFT parameters were used for the DFT based reconstruction approach, with the only two exceptions that we used the scalar-relativistic pseudopotentials from PseudoDojo [93] version 0.4 with PBE as the exchange correlation functional, and a cold smearing which is set to 0.01 Ry instead of 0.02 Ry.
Structural matches
Structural matches were determined using pymatgen’s StructureMatcher with the default tolerances ltol=0.2, stol=0.3 and angle_tol=5. Additional checks were done and decreasing the thresholds had only minor impact on the matching rate. Also, compared to other works related to crystal structure prediction, the thresholds adopted here are sometimes even a bit tighter (which is intended, as we only predict parts of the structure and not the whole structure).
DFT based algorithm
We also compare our diffusion-model based strategy against a more physically motivated approach based on DFT that relies on the electrostatic potential to identify candidate hydrogen sites. Additional electrons, equal to the number of absent H atoms, are introduced and the resulting electrostatic potential
is evaluated to identify electron-rich regions. Local maxima of , sampled on a fine grid and filtered by distance and proximity criteria, are taken as candidate H sites. When the number of maxima matches the missing H atoms, hydrogen sites are placed at these sites and relaxed, while keeping the host atoms fixed. If the number of candidate sites exceeds the required H atoms, a combinatorial “pinball” scheme is applied [63], in order to find the energetically most favorable one among all possible arrangements. The process is iterated in a greedy manner until all hydrogen sites are restored, followed by a full structural relaxation.
The algorithm is implemented in Python within the AiiDA infrastructure as the RestoreHydrogenWorkChain workflow [94], interfacing with Quantum ESPRESSO for self-consistent DFT runs and using peak-finding routines from skimage [95]. More details on the DFT based approach in SI section S2, in particular Figure S13 and S14 in terms of the performance and Figure S15 related to the challenges of this approach.

Figure S13. LES matching rate based on the dimensionality of the structure (and of its sub-components). Comparison of successful and failing structures, differentiated according to their dimensionality. The x axis labels denote the different dimensions identified in the compounds. Structures that match are shown in light green, structures that do not match but have lower total energy than the reference one are in dark green, while those not matching and having a higher energy than the initial structure are in red. The dotted areas show the results that required the pinball strategy to complete.

Figure S15. Illustrating the challenges of the greedy DFT-based approach. The electrostatic potential along the diagonal of the rhombohedral crystal cell of CrH, shown in the inset, used in the first step of the algorithm. The crystal structure image presented here was generated using VESTA [31].
Data availability
All data generated in this work, as well as scripts to generate relevant plots, are available on the Materials Cloud Archive [96] at https://doi.org/10.24435/materialscloud:gz-mt [97]. This entry also includes AiiDA [81] archive files with the full provenance of all DFT simulations, ML calculations and data.
Code availability
The XtalPaint code [79] is publicly available on GitHub: https://github.com/psi-lms/XtalPaint. The code is based on the most recent workflow developments of aiida-workgraph [98] and aiida-pythonjob [99], so that it is possible to use the whole code also without AiiDA [80, 81, 82] as pure Python functions. However, if the user wants to take advantage of remote execution and provenance tracking, one can simply take advantage of the corresponding AiiDA counterparts in the repository.
Acknowledgements
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. We acknowledge access to Alps at the Swiss National Supercomputing Centre, Switzerland under MARVEL’s share with the project ID mr32. Moreover, we acknowledge the use of the Merlin7 cluster run by the Paul Scherrer Institute PSI. M.B. and G.P. acknowledge financial support by the SwissTwins project, funded by the Swiss State Secretariat for Education, Research and Innovation (SERI). We acknowledge fruitful discussions with Leonid Kahle, Aris Marcolongo, Nicola Marzari and Daniele Pontiroli.
Author contributions
G.P. and P.B. conceived the project. T.R. contributed to the planning of the project, implemented the XtalPaint code, and performed the calculations and analyses related to the score-based diffusion model approach, under the supervision of G.P. A.C. implemented the DFT based approach and performed all the related calculations and analyses, under the supervision of M.B., P.B. and G.P. T.R. wrote the initial version of the manuscript with input from A.C., M.B., P.B. and G.P. All authors discussed the results and contributed to editing and the final version of the manuscript.
Competing interests
The authors declare no competing financial or non-financial interests.
Supporting information: Score-based diffusion models for accurate crystal-structure inpainting and reconstruction of hydrogen positions
Timo Reents; Arianna Cantarella; Marnik Bercx; Pietro Bonfà; Giovanni Pizzi
Deep learning based approach
Extended comparison of different inpainting approaches
Impact of MLIP relaxation on matching rate
Fig. S1 extends the comparison of the different inpainting approaches (see Figure 1a in the main text) by also showing the structural matching rate without the constrained relaxation of the hydrogen sites (the relaxed results are shown on the right hand side of Figure S1 and also in the main text). One clearly sees that the relaxed performance is generally better than the direct output of the diffusion model, indicating that the output is not yet in the configuration corresponding to the local minimum. Nonetheless, this also indicates that in these cases the output of the diffusion model is still reasonably close to the final (local) minimum. The strongest difference and improvement is observed for the (original) MatterGen model. Already the pos-only model performs much better, even without relaxation. Furthermore, the pos-only-TD model shows essentially the same performance, only the variance is slightly larger when directly considering the output of the diffusion model. Once again, this highlights the ability of the pos-only-TD model to efficiently condition the inpainted sites on the known information. The error bars indicate the minimum and maximum structural matching rate that was obtained among 4 individual runs.
TD-Paint vs. RePaint
Fig. S2 further compares different parameter setups for the models using the TD-Paint and RePaint approaches. The main point to highlight is that while the RePaint models do indeed improve the matching rate compared to the pos-only model, a lot of this improvement seems to be related to the larger number of denoising steps. This is also true for the impact of the number of corrector steps in the predictor-corrector sampling. The pos-only-TD models indicate the number of corrector steps and denoising steps in the labels pos-only-TD--. Moreover, the RePaint models follow the following convention: pos-only-TD----, where is the so-called jump length and the number of resampling steps (see Ref. [1]). First of all, one observes that the number of corrector steps does not have a significant impact except for the increased number of steps, e.g., comparing pos-only-TD-5-300 with pos-only-TD-1-1000. Similarly, the significant performance gain in case of the pos-only-RePaint models is only observed when significantly increasing the number of steps. As an example, pos-only-RePaint-1-200-3-10 does not really improve compared to pos-only-RePaint-1-300, except for a reduction in the spread. While pos-only-RePaint-1-200-10-10 improves over our standard pos-only-1-300, it significantly increases the number of steps, see section S1 A 3. Again, the number of steps (noise levels) seems to be more relevant than increasing the number of corrector steps, as shown for pos-only-RePaint-1-200-10-10 and pos-only-RePaint-5-200-3-10.
Computational cost of the RePaint approach
As already mentioned in the main text and the previous section, while the RePaint approach is commonly adopted and improving the performance, it can significantly increase the number of denoising steps and thus the computational costs. In Figure S3, two common choices [1, 2] of the number of resampling steps and the so-called jump length (see Ref. [1]) are compared, and highlight the significant increase in the number of steps that are performed.
How to estimate the number of hydrogen sites to be added
In this section, we analyze a potential way of determining the number of hydrogen sites to be added. We randomly select 20 structures. For each structure, we generate samples with added hydrogen sites. Moreover, for each , we generate 5 samples. Afterwards, we perform structural relaxations using NequIP and calculate the formation energies. For each of the 20 structures, we construct the phase diagram (formation energies as a function of composition) and calculate the energy above the resulting convex hull. Since the phase space is very sparsely covered, these results are of course not representing the actual stability. Nonetheless, Table S1 shows that the stability is indeed a good estimator to select the number of hydrogen sites to be added. In addition to the original composition, all stable compositions are listed (energy above the convex hull is 0 eV/atom, i.e., that sample is part of the convex hull). We consider this approach as successful when the correct composition is included in the stable compositions. As shown in the table, in most cases several samples are obtained. Nonetheless, this approach significantly reduces the number of compositions to be checked compared to the number of different initial compositions (given by ). In some cases, only the correct composition is labeled as stable. Overall, the approach correctly identifies the number of sites to be added (potentially among other candidates) in 17 out of 20 cases. This result is already promising and builds the foundation to be further extended in future work.
| Original Composition | Stable Compositions | Recovered | |
| , , | 12 | True | |
| 16 | True | ||
| 16 | True | ||
| , , , | 12 | True | |
| , , , | 8 | True | |
| , | 6 | True | |
| , , | 16 | True | |
| , , , , | 8 | True | |
| , , , | 11 | True | |
| , | 10 | True | |
| , , | 8 | True | |
| , , , , | 10 | True | |
| , , , | 12 | True | |
| , , | 8 | True | |
| , , , | 16 | False | |
| 17 | False | ||
| , , | 14 | True | |
| , , | 8 | True | |
| 16 | True | ||
| None | 10 | False |
Table S1. Proof of concept to determine the number of hydrogen sites in a given host structure. We list the original composition to be determined, the stable compositions according to the formation energies when considering different compositions (with the number of hydrogen sites ranging from ) and whether the correct number of hydrogen sites is recovered, i.e., the composition is stable.
Benchmarking of MLIPs against DFT
Even though MLIPs typically achieve good performances nowadays, they should always be benchmarked for the specific applications. The following subsection discusses some benchmarking of various pretrained foundational MLIPs to select the most appropriate one for the present application. Each analyses compares 3 optimizers (FIRE, BFGS, BFGS-linesearch) that are available in the ASE [3] package, with 4 different values for the target relaxation threshold on 3 different datasets (DFT, EXP, DFT-20–40) that were discussed in the main text. Each of the data subsets contains around 100 selected structures from those cases that do not directly result in a structural match.
Figure S4 starts with the discussion of the convergence rate (fraction of structures for which the final maximum force on an atom is smaller than , when maximum 500 optimization steps are performed). Overall, most of the models manage to achieve convergence within 500 steps for almost all the structures. Only the FIRE algorithm struggles with very tight thresholds. This is also observed for the larger structures and the smallest threshold in case of the BFGS-linesearch. Among all the thresholds and datasets, the standard BFGS yields the most stable results.
Next, in Figure S5 we discuss the MAE of the energy difference between the initial reference and the inpainted calculated with DFT and the MLIP. Important to note, we perform relaxations of the positions on the initial reference as well as on the inpainted one. It is especially important to understand how well the predicted energetic trends and differences agree between DFT and the MLIPs, with respect to the reference and prediction, as this was used in the main text (i) to select the most stable sample per structure and (ii) to determine the number of lower energy matches. First of all, one observes that the dataset can be ranked in ascending order with respect to the overall magnitude of the MAE as DFT-20-40, DFT and EXP. Again, and especially in case of the EXP dataset, the BFGS optimizer shows the best agreement. Moreover, significant differences across the different models can be observed in this benchmark. The NequIP model turns out to be the one that yields the best results. Finally, especially in case of the experimental structures, one also notices that the very tight threshold of leads sometimes to worse results (most likely due to the larger noise as those structures are farther away from the (close to) equilibrium configuration that the models were mostly trained on). Based on this observation, the independence of the convergence rate with respect to , and the fact that it also leads to better results in case of the experimental structures (with almost no effect on the other datasets), we will use in the final relaxations of this study. While the DFT relaxations were performed with a threshold of , it is not required and—as shown—not beneficial to use the same strict thresholds for the MLIPs.

Figure S5. MAE of the energy difference between the initial reference and predicted inpainted structure evaluated by MLIP and DFT. The analysis compares 5 pre-trained foundational MLIPs across relaxations using three different optimizers, each of them with 4 different convergence thresholds (in eV/Å). Each row presents the results for a different dataset: DFT, DFT-20-40 and EXP.
Finally, we discuss the previous aspect as a classification problem, which is even more in line with the application discussed in the main text. Figure S6 shows the percentage of structures for which the stability prediction of the MLIP and DFT with respect to the energetic difference between the initial and inpainted structures agree, i.e., both predict the inpainted structure to be more stable or both classify it as less stable. This is exactly the information that was used in the main analysis.
Structural agreement with DFT and EXP targets
Figure S7 presents the distribution of the RMSD between the reference structure and the predicted one using the pos-only-TD model. The inset shows the distribution for the predictions that do not result in a match, while the main plot shows the distribution for the matching ones. The Diffusion model categories refer to structures that did not undergo any structural relaxation, that is, those that are directly taken from the output of the diffusion model. In case of the H constrained relaxation, the hydrogen sites were optimized using the NequIP MLIP. Similarly, the Full relaxation refers to a NequIP relaxation where all ionic positions are optimized.
First of all, the diffusion model output is already very close to the reference in many cases, both for the DFT and EXP datasets. In case of the EXP dataset, a wider tail is observed, which is expected to some extent. After performing the constrained relaxation of the hydrogen sites, the distributions can be significantly sharpened and pushed towards 0 Å. Important to note, the reference here are the structures from MC3D (either the Quantum ESPRESSO DFT relaxed ones or the EXP ones), i.e., they were not relaxed using the MLIP, in contrast to the comparisons in the main text. Thus, the deviations observed in this figure indicate the performance and deviations with respect to different methods, e.g., a different DFT code and settings, and still confirm a high agreement. This suggests the ability of the model to extend to different domains, in the sense that it can be used for crystal structures that are curated in different ways. Moreover, it is observed that the constrained relaxation tends to work slightly better for the EXP dataset, due to the different underlying methodologies outlined above, as it avoids that the host sites move too much. This trend is further confirmed for the DFT dataset.
Energetic ranking and performance impact
This section analyzes the energetic ranking of the samples for each structure that we obtain based on the MLIP, in our case NequIP, with respect to DFT. We select the 18 structures for this test for which neither a structural match nor a lower energy prediction is obtained for the MLIP+DFT dataset. As a reminder, we only discussed the sample with the lowest energy according to the MLIP in the main text. Here, we relaxed all the 30 samples for each of the 18 structures with DFT. Afterwards, we rank the samples by energy for each structure, with rank 0 corresponding to the minimum energy sample.
In Figure S8, we present the NequIP energy difference of the DFT rank 0 sample with respect to the NequIP rank 0 configuration. As can be seen in the figure, 9 out of the 18 structures show energy differences of less than 1 meV/atom. Hence, in those cases, the difference in the ranking is essentially due to numerical noise. On the other hand, some significant energetic differences according to NequIP are observed, indicating actual differences in the energetic ranking.

Figure S8. Comparison of the energy ranking obtained with NequIP and DFT. a NequIP energy relative to the rank 0 sample as selected by DFT relaxation. b DFT energy relative to the rank 0 sample as selected by NequIP. c SCF DFT energy relative to the rank 0 sample as selected by DFT after relaxation.
Similarly, we revert the previous analysis and analyze the energy difference based on DFT when selecting the NequIP rank 0 sample. In general, similar observations as before can be made, e.g., for many structures several samples relax to the same configuration and the different ranking is only due to numerical noise. However, more samples show energetic differences of a few meV/atom and 3 larger values are observed as well, indicating cases for which the sample selected based on NequIP is notably less stable according to our DFT results.
In summary, these analyses suggest that, in order to further improve the performance, the most reliable approach would be to run DFT calculations for all the samples. However, especially in a high-throughput context, running 30 relaxations per structure that one tries to reconstruct represents a significant computational cost. Figure S8 compares the energy differences of the relaxed DFT structures with respect to the rank 0 sample when selecting it only based on a DFT SCF calculation, i.e., no structural relaxation. It can be seen that, except for 2 small differences of the order of 5 meV/atom, the SCF would already select the correct sample. In this way, one trade-off could be to do single-point energy evaluations based on DFT and only run the relaxation for the most stable one. Nonetheless, we highlight again the generally very good agreement of the NequIP energy ranking that allow to process a larger number of structures much faster.
In general, the spread across the samples for each structure, i.e., the difference between the highest and lowest energy is captured quite well by NequIP with respect to DFT, as shown in Figure S9. One potential source of the wrong energetic ranking could be the known over-softening of MLIPs [4]. Nonetheless, one has to keep in mind that NequIP is a pretrained foundational model that was trained on a dataset with different DFT settings. Hence, finetuning could potentially resolve the differences as well.

Figure S9. Comparison of the energy spread obtained with NequIP and DFT. DFT energy spread (difference between the maximum and minimum energy across the 30 samples per structure) vs. the energy spread evaluated by NequIP. All the samples have been relaxed with the corresponding methodology. The black dashed line represents the diagonal.
Finally, taking the previous 18 structures, we also see that we can even further improve the performance of our approach. When selecting the rank 0 sample according to DFT, we can find 9 additional structural matches. Based on the previous samples selected by NequIP, no structural or lower energy match could be obtained. However, relaxing all samples by DFT reveals that the correct DFT minimum would result in a match (meaning that the NequIP relaxation ends up in another local minimum that is less stable). In two additional cases, a lower energy prediction could be obtained with respect to the original reference. Therefore, by evaluating everything with DFT, we could further increase our LES matching rate for the DFT+MLIP dataset to 99%. Similarly, just running a SCF DFT energy evaluation to select the most stable sample also results in 10 out of 18 additional LES matches.
Details on lower energy matches
As discussed in the main text, the original reference stated that the unambiguous assignment of hydrogen positions was not successful. In our prediction, hydrogen positions change their orientation with respect to the database reference to be aligned within the layer. We performed some further checks to assess whether this material is really layered and the presented result might require a different treatment, but neither our tool to detect layered materials gave an indication of this, nor the inclusion of Van der Waals corrections did affect the results.
The structure crystallizes in the spacegroup (perovskite structure). The hydrogen atoms were assigned to the Wyckoff position in the database reference, while our method predicts them at the Wyckoff position. Our prediction is actually in better agreement with the reports in the original paper [5] when comparing the interatomic distances. Indeed, it seems that an issue occurred during the transcription process from the original paper to the source database that we accessed. The interatomic distances reported in reference [5] perfectly match the ones obtained for our prediction ( Å and Å), whereas the ones observed in the structure that was reported in the source databases are swapped, due to the different Wyckoff positions. This highlights that our approach can provide additional insight by also identifying materials for which the data might need revision.
The example of is similar to the previous one, as it again agrees with the original paper [6] but differs from the reported structure in the source database. While the hydrogen atoms bind to the Y atoms in the reference from the source database, the predicted hydrogen atoms bind to the Mn atoms. Similarly to the previous example, the predicted arrangement seems to be in closer agreement with the experimental reference work [6, 7], as the authors also discuss the presence of anions, observed in our predictions.
In case of , another perovskite structure, it is already mentioned in reference [8] that the determination of the hydrogen sites using XRD is challenging. Based on the Rietveld refinement, the hydrogen locations were assigned to the 3c Wyckoff position, whereas our prediction suggests that the 3d Wyckoff position is energetically significantly more favorable. Moreover, as shown in Figure S10, the XRD patterns of the previous reference and our new prediction are very similar, so that both assignments would be supported by the original experimental data (e.g., compare with Figure 2 in Ref. [8]). Hence, this example highlights how our method could actually support the experimental refinement process by computationally suggesting and ranking potential hydrogen arrangements.
Considerations to support experimental refinements
As we have pointed out throughout the manuscript, the initial target application is the reconstruction of missing hydrogen sites to enable the extension of databases used as starting point for computational studies. Therefore, the discussion of the EXP dataset was always focusing on whether the results obtained directly starting from these experimental reference (as one would do in practice) are the same as those obtained after an initial DFT or MLIP relaxation (which is what we used as testing set, but would in general not be available before knowing the actual positions of the hydrogen atoms). Our results indicate that this is indeed the case for a large fraction of the structures. Based on this performance, one could thus apply the method to directly support the experimental structure-refinement process. For interested readers, we provide here some additional considerations that highlight some limitations (not necessarily limited to the inpainting approach, but often more general to computational approaches).
If we use the experimental source structures without any computational relaxation as the reference, the structural matching rate slightly reduces to 82.6% from 85.6%. However, the differences with respect to the MLIP-relaxed references in the context of Figure 4a in the main text can be fully explained as they all correspond to cases in which DFT or MLIPs significantly change the experimental structure, so that the reference does not match its relaxed version even without involving our predictions. Moreover, if we ignore these cases where the structure is significantly changed by DFT, and if we consider a prediction to be successful when a structural match is found with at least one of the 30 samples—instead of only the lowest energy one—the matching rate increases to 93%.
The previous two aspects highlight the following: (i) there are certain structures (maybe due to insufficient experimental data quality or due to limitations in their description with DFT) for which a simple DFT or MLIP relaxation will change the experimental structure to such an extent that the relaxed version will not match the original structure, independent of our our inpainting approach. (ii) For a relevant fraction of the structures, our approach is capable of predicting the experimental structure among a set of samples, even if in some cases this might not be identified as the most stable one. Those cases could indicate that the experimental data quality seems to be sufficient, since we can recover the structure, and might potentially be a limitation of the description by MLIPs (or possibly by DFT). Therefore, future applications might consider developing further selection criteria, e.g., considering as potential candidates any sample with energy within a given threshold from the lowest one, rather than only considering the lowest-energy sample.
We have shown throughout the manuscript that it is very likely that non-matching cases end up in configurations that are energetically more favorable with respect to DFT, and in several cases actually lead to real improvements with respect to experiment (see discussion in section II D in the main text). Unfortunately, it cannot be easily determined a priori whether the predicted experimental structure of interest might belong to the very small fraction of structures that do not match the real data but are incorrectly considered as more energetically favorable by MLIPs or DFT. Therefore, when combined with experiments, results might require a particularly careful inspection. Nonetheless, the presented method predicts the correct positions in the vast majority of the cases and still adds value to potentially detect insufficient data quality.
Impact of the SNR parameter on the performance
The impact of the signal to noise ratio ()—which is used in the Langevin dynamics process and generally impacts how diverse the generated results are—on the structural matching rate is visualized in Figure S11. For this analysis, we only use the pos-only–TD model. One observes that the performance only slightly varies across different SNR values and remains almost constant between 0.1 and 0.6. Nonetheless, it identifies an optimal value of (that was chosen in the main text) as it exhibits both the highest performance and smallest spread of the minimum and maximum performance across the 4 independent runs.
Similarity with training set
This subsection briefly investigates the similarity of the training set with the test set, a very important aspect in order to accurately estimate the performance for actual applications. To quantify the similarity between the training set and the testing sets, in addition to removing overlapping compounds as described in section IV C in the main text, we follow the approach described by Mazitov et al. in Ref. [9]. We use the features of their PET-MAD MLIP and treat them as a structural fingerprint. The similarity is then evaluated by calculating the Euclidean distance of two fingerprints in that high-dimensional feature space.
Figure S12 shows the similarity when comparing the Alex–MP–20 training dataset with itself. This is done to have a reference of how similar structures are in a pre-filtered and unique training dataset. Moreover, it shows the smallest distance for each structure in MC3D–DFT and MC3D–EXP against all structures in Alex–MP–20. In Figure S12, the distribution of all pairwise distances is shown. Here, the different datasets show more similar distributions, with the main difference in the intensity of the peaks and broader tails in case of the MC3D datasets. This subplot is mainly intended to visualize the overall similarity and to sanity check the method with the findings reported in Ref. [9], where this similarity approach was presented and also applied to MC3D.

Figure S12. Structural diversity and similarity of the training and testing datasets. Euclidean distance of the 1024-dimensional features of the PET-MAD model [10] as a measure of structural diversity, as presented in [9]. (a) The minimum distance for each structure compared to all other structures in the reference dataset, (b) Distances for each structure compared to all other structures in the reference dataset. As a reference, the training dataset Alex-MP-20 is compared against itself, MC3D relaxed against Alex-MP-20 and the initial experimental structures from MC3D against Alex-MP-20. In all cases, we only consider structures that contain hydrogen.
In Figure S12 one observes that the distributions of the MC3D based test datasets are clearly shifted towards larger distances, compared to the already cleaned and filtered Alex–MP–20 dataset. We use this as another indication that the performed tests are valid and that our data curation process was indeed careful.
DFT BASED RECONSTRUCTION APPROACH
Underlying physical motivation
Hydrogen generally forms a covalent bond with one anion and may exhibit a weaker interaction with another, more distant, one. While the former implies a substantial charge redistribution, the latter, commonly referred to as a hydrogen bond, is mainly due to electrostatic and polarization effects that also include partial charge rearrangement [11, 12].
In both scenarios, a key information for developing an algorithm to restore the H atoms is the identification of electron density accumulating on the most electronegative atom(s) subsequent to the formation of the bond(s). A simple way to identify these elements is to introduce the electrons associated with the missing H atoms in a first principles simulation aimed at emphasizing the most probable candidate atoms for H to bind.
As a next step, rather than directly analyzing the charge density, the accuracy of the prediction can be improved by evaluating the electrostatic potential generated by the nuclei and the electrons in the aforementioned system, which immediately reveals electron-rich regions [13, 14]. The following quantity is thus used to formulate an algorithmic procedure aimed at identifying preferential hydrogen bonding sites:
where is the number of nuclei in the system, is the “balanced” charge density obtained by subtracting the constant background charge density (with unit cell volume) from the electronic density to compensate for the difference between the number of positive and negative charges in the system. The electrostatic potential has already extensively been used in the literature not only to identify H positions [14], but also to study the catalytic activity of nanoparticles [15] and more generally to study electrophilic and nucleophilic sites of molecules.
The method also takes inspiration from the approach that has been previously proposed to analyze Li motion in solid-state electrolytes but differs in many details that are described in the next section [16]. A similar approach has also been adopted for a high-throughput study aiming at identifying novel Li-ion cathode materials [17].
Algorithmic procedure
The approach outlined in the previous section is turned into an iterative algorithmic procedure that starts with two inputs: the crystal structure of the material lacking hydrogen atoms in the crystallographic information provided, and the number of H atoms nominally present in the compound. The electrostatic potential in Eq. (7) is obtained from a plane-wave (PW) based DFT simulation of a negatively charged system with as many additional electrons as the missing hydrogen atoms. The PW basis set is an effective choice since is only required in interstitial regions of the lattice where its description is not impaired by the use of pseudopotentials. Electrons accumulate on the most electronegative atoms and the tentative positions for placing hydrogen atoms are revealed by the maxima of .
The electrostatic potential is sampled on a fine grid and all the points that fall within a threshold of 99.5% of the highest value of are identified as candidate H sites. A minimal allowed distance separating peaks in the electrostatic potential, set to 0.25 Å, is introduced in order to avoid placing H atoms too close to each other. An additional “proximity validation” is used to avoid placing H atoms on top of other atomic sites (in which case the algorithm fails). The electrostatic potential has, by definition, the same symmetry of the starting lattice and most often this procedure yields all symmetry equivalent positions for placing H, but it may happen that high symmetry points are not part of the grid. In that case the symmetry of the starting lattice is broken by the insertion of the H atom(s).
Depending on the number of maxima revealed by this first step, a decision is taken. When the available maxima can only accommodate a fraction of the hydrogen atoms to be restored, or when they match exactly, they are incorporated into the lattice. The position of the newly inserted atoms is then optimized with a relaxation of the H atoms, allowing the reorganization of the electronic density along the hydrogen bonds. It is worth mentioning that the structural relaxation is performed with a negatively charged cell accounting for the electrons of the hydrogen atoms that are yet to be restored and by keeping all the host atoms fixed, in order to preserve the initial symmetry and to avoid the dissociation of other bonds in the pristine lattice. The aforementioned procedure is reiterated with the new modified structure, now incorporating some of the hydrogen atoms to be reinstated.
Conversely, when the number of maxima exceeds the remaining hydrogen atoms to be restored in the structure, it is not possible to determine where to place them. This can happen for example when the multiplicity associated with with the candidate position is higher than the one of the correct position (due to a small displacement from a high symmetry point) or when the charge state of a group, for example or , is not correctly identified. To alleviate these issues, the energy arising from the mutual interaction among the protons is added to the contribution resulting from their interaction with the electrostatic potential in Eq. (7). We will refer to this alternative final step as the pinball strategy. A combinatorial approach is used to compute the energy of all possible arrangements for hydrogen in the various positions identified from . While this problem grows like for a given number of H atoms and of maxima found for a given set of H, in the currently adopted scheme it requires a negligible amount of time for all cases considered in this work. After identifying the most energetically favorable configuration, similar to the previous case, the positions of H atoms are subsequently relaxed.
When all H atoms have been inserted, a final relaxation of the entire structure is performed.
The algorithm has been entirely built through the AiiDA infrastructure and written in Python. It is called RestoreHydrogenWorkChain and is included in the AiiDA plugin package “aiida-hydrogen-restorer”, available on GitHub [18]. It leverages on the PwBaseWorkChain, already developed in the AiiDA framework, that interfaces with Quantum ESPRESSO [19, 20] submitting the self-consistent calculation, and on the skimage.feature.peak package, using the peak_local_max function to find the maxima of the electrostatic potential. For its validation we also use the StructureMatcher tool from the pymatgen.analysis.structure.matcher module to compare lattice structures. The computational details were listed in the Methods section of the main text.
Results and discussion
The effectiveness of the algorithm was assessed by applying it to a set of structures obtained from the Materials Cloud three-dimensional crystals database (MC3D) [21] version PBEsol-v1, which is the PBEsol counterpart of the DFT dataset that was discussed in the main text. The algorithm presented here is not benchmarked on experimental structures.
For our study, we extracted all optimized hydrogen-containing structures, resulting in a set of 2909 structures. When running the RestoreHydrogenWorkChain, we encountered 116 failures unrelated to our algorithm (either due to an electronic convergence issue with Quantum ESPRESSO or node failures on the cluster). We subsequently removed those structures, obtaining a subset of 2793, henceforth referred to as the “test set”. The total number of atoms per formula ranges up to 50. The percentage of hydrogen atoms per unit cell ranges up to 92%. The dataset contains different types of compounds, including organic minerals, composite crystals, and, by far the most abundant entry, inorganic crystals characterized by ionic, covalent or metal bonding. The structures were also categorized into subgroups based on their dimensionality, determined using the Low Dimensionality Structure Finder lowdimfinder [22, 23, 24] tool. This tool identifies sub-components within a periodic structure and provides their dimensionality. As expected, the predominant portion of the dataset comprises 3D structures, which are the focus of our study. Nonetheless, hydrogen is part of low dimensional fragments in 50% of the entries of the set. Other approaches [25, 26, 27, 28, 29] have already been developed for restoring hydrogen atoms in proteins and molecular systems and we expect these approaches to be easily extendable to low dimensional crystals or low dimensional fragments embedded in crystal voids. Nevertheless, we ran our algorithm on all structures, irrespective of their dimensionality, to verify the versatility of the proposed method.
In order to proceed with the validation of the algorithm, all hydrogen atoms are removed from the optimized structures and the iterative procedure described in the previous section is applied. Upon the successful completion of the hydrogen restoration algorithm, the total energy and the lattice structure obtained for each compound are compared with those obtained from the structural relaxation of the entry originally appearing in the “test set”. We present the results in Figure S13, distinguishing between cases that require the pinball procedure as the final step (dotted pattern) and those that do not (no additional pattern). On the axis, the compounds are divided into separate groups based on their dimensionality. In the histogram, green bars represent successful results. More specifically, light-green bars are used to represent the cases where the output structures match the input ones, while dark-green bars refer to structures that do not structurally match, but whose total energy is lower than the reference one. Red bars show instead structures that do not match and have higher total energy than the original ones. We start our discussion focusing on the structures that do not require the pinball method (hence, the success rates will be different from the ones seen in Figure S13, as they are normalized with respect to all structures).
For zero-dimensional systems, i.e. molecular crystals, the success rate is 80%, which is understandably low, considering our focus on 3D systems. For 1D, 2D and 3D systems containing interstitial molecules (i.e. 0D components), a 82%, 72% and 84% success rate is respectively obtained. In this case, the main source of error is the charge state of interstitial molecules, and the presence of multiple relative minima in the potential energy surfaces, as will be discussed below. The accuracy increases when zero-dimensional systems are absent in the compounds. For 1D, 2D and 3D compounds we obtain 84%, 85% and 92% accuracy, respectively. In summary, a success rate of 87% is obtained on the subset of structures that do not require the application of the pinball method.
Overall, 76% of the structures did not require the application of the pinball method. We continue the discussion with the remaining 24% that required the pinball method. In the presence of 0D components, a success rate of 58%, 76% and 88% is obtained for 1D, 2D and 3D, respectively. When 0D components are absent, a success rate of 91%, 72% and 68% is found for 1D, 2D and 3D, respectively. The pinball scheme achieves an overall success rate of 71% on the subset of structures that required its application. Surprisingly, the pinball method seems to perform well even in the presence of low-dimensional structures, but the statistical analysis is hindered by the small size of these sets. Combining the two aspects, as in Figure S13, we observe a success rate of 78%, 73% and 86% for 1D, 2D and 3D systems in the presence of 0D components, respectively. As discussed before, these success rates increase in the absence of 0D components to 85%, 82% and 86% for 1D, 2D and 3D systems, respectively. In summary, the algorithm achieves a success rate of 83% on the whole test set.
Further insight into the algorithm outcomes is provided by the total energy difference per atom for the 3D structures subset, , defined as: , where represents the energy of the structure as output of the algorithm, is the energy of the structure used as input and previously geometrically optimized, and is the total number of atoms per crystal cell. The distribution of is shown in Figure S14. We note that both matching and non-matching structures, represented by green and red bars respectively, extend well below and above . A broad, asymmetric distribution is observed for both cases, with the matching results piling up at but also extending up to meV/atom. Non-matching structures are spread out in the positive part of the x axis up to meV/atom, but also, as already anticipated, for many of them the total energy of the newly identified structure is significantly lower than the one of the reference system, extending up to -950 meV/atom.

Figure S14. Energetic comparison of the predictions and references. Difference between the total energy for the original structure appearing in the test set and the final one obtained from the hydrogen restoration algorithm, only considering the 3D compounds, for which all the atoms positions were relaxed. The green (red) bars display matching (non-matching) input and hydrogen-restored output structures.
The challenge related to a greedy approach
Here, we present one example, CrH [30], where the algorithm performs two steps placing one H at a time, first using electrostatic maxima (Figure S15), then using the pinball method for the second H atom. This example highlights the challenges related to the greedy approach of the DFT-based algorithm. The final result is shown in the inset of Figure S15, where our algorithm identifies the central position along the diagonal of the rhombohedral cell as optimal for placing the first H atom, thus spoiling the next step performed with the pinball strategy. The optimal atomic coordinates for placing two H atoms correspond instead to the two relative maxima of the electrostatic potential shown in the same figure obtained at the first iteration. The lack of inter-hydrogen interaction is clearly responsible for the mismatch and the resulting structure with a total energy 166.53 meV/atom higher than the experimental one. In fact, applying the pinball method from the beginning and suggesting as positions for the H insertion the three maxima in the potential shown in fig. S15, this results in the correct placement of the two H at [0.25, 0.25, 0.25] and [0.75, 0.75, 0.75]. While this example suggests that inter-hydrogen interactions should be included from the very beginning, the combinatorial explosion described above makes this strategy technically challenging. Moreover, it highlights the challenge related to the greedy nature of the algorithm and visualizes the advantage of the “global” approach as highlighted in the main text.
In summary, also the DFT based approach, which is more physically motivated, and has been used as a benchmark to validate the deep-learning based approach discussed in the main text, achieves quite good results in terms of structural matching rate, including identification of structures more stable than the original reference. The DFT based algorithm also performs well on the target lattice structures, i.e. 3D inorganic compounds (which do not require the pinball method), where it reaches 87% accuracy, but also shows good performance on low dimensional structures, with an overall accuracy of 83% on the materials composing our test set, thus suggesting the good versatility of the proposed algorithm. Further work would be required to fine tune the method especially concerning the orientation of interstitial molecules and a more gradual addition of inter-hydrogen interaction, but is beyond the scope of this work, also considering the extremely high success rate of the deep-learning based approach presented in the main text.
References
- [1]K. Ryan, J. Lengyel, and M. Shatruk, Journal of the American Chemical Society 140, 10158 (2018).
- [2]G. Cheng, X.-G. Gong, and W.-J. Yin, Nature Communications 13, 1492 (2022).
- [3]T. Xie, X. Fu, O.-E. Ganea, R. Barzilay, and T. Jaakkola, arXiv preprint arXiv:2110.06197 (2022).arXiv
- [4]H. Park, Z. Li, and A. Walsh, Matter 7, 2355 (2024).
- [5]E. V. Podryabinkin, E. V. Tikhonov, A. V. Shapeev, and A. R. Oganov, Physical Review B 99, 064114 (2019).
- [6]S. Kim, J. Noh, G. H. Gu, A. Asparu-Guzik, and Y. Jung, ACS Central Science 6, 1412 (2020).
- [7]Y. Zhao, E. M. D. Siriwardane, Z. Wu, N. Fu, M. Al-Fahdi, M. Hu, and J. Hu, npj Computational Materials 9, 38 (2023).
- [8]Y. Song and S. Ermon, arXiv preprint arXiv:1907.05600 (2020).arXiv
- [9]Y. Song, J. Sohl-Dickstein, D. P. Kingma, A. Kumar, S. Ermon, and B. Poole, arXiv preprint arXiv:2011.13456 (2021).arXiv
- [11]D. Levy, S. S. Panigrahi, S.-O. Kaba, Q. Zhu, K. L. K. Lee, M. Galkin, S. Miret, and S. Ravanbakhsh, arXiv preprint arXiv:2502.03638 (2025).arXiv
- [12]R. Jiao, W. Huang, P. Lin, J. Han, P. Chen, Y. Lu, and Y. Liu, arXiv preprint arXiv:2309.04475 (2024).arXiv
- [13]X. Luo, Z. Wang, P. Gao, J. Lv, Y. Wang, C. Chen, and Y. Ma, npj Computational Materials 10, 254 (2024).
- [14]Z. Li, R. Mrad, R. Jiao, G. Huang, J. Shan, S. Chu, and Y. Chen, iScience 28, 111659 (2025).
- [15]T. Pakornchote, N. Choomphon-anomakhun, S. Arrerut, C. Atthapak, S. Khamkaeo, T. Chotibut, and T. Bovornratanaraks, Scientific Reports 14, 1275 (2024).
- [16]A. R. Oganov, A. O. Lyakhov, and M. Valle, Accounts of Chemical Research 44, 227 (2011).
- [17]S. M. Woodley and R. Catlow, Nature Materials 7, 937 (2008).
- [18]P.-P. D. Breuck, H. A. Piracha, G.-M. Rignanese, and M. A. L. Marques, arXiv preprint arXiv:2501.16051 (2025).arXiv
- [19]X. Dai, P. Zhong, B. Deng, Y. Chen, and G. Ceder, in ICML 2024 AI for Science Workshop (2024).
- [20]K. Mazloomi and C. Gomes, Renewable and Sustainable Energy Reviews 16, 3024 (2012).
- [21]L. Ge, B. Zhang, W. Huang, Y. Li, L. Hou, J. Xiao, Z. Mao, and X. Li, Journal of Energy Storage 75, 109307 (2024).
- [22]C. G. Van de Walle and J. Neugebauer, Annual Review of Materials Research 36, 179 (2006).
- [23]S. Guo, X. Li, J. Li, and B. Wei, Nature Communications 12, 1343 (2021).
- [24]K. C. Christoforidis and P. Fornasiero, ChemCatChem 9, 1523 (2017).
- [25]J. Roth, E. Tsitrone, A. Loarte, T. Loarer, G. Counsell, R. Neu, V. Philipps, S. Brezinsek, M. Lehnen, P. Coad, C. Grisolia, K. Schmid, K. Krieger, A. Kallenbach, B. Lipschultz, R. Doerner, R. Causey, V. Alimov, W. Shu, O. Ogorodnikova, A. Kirschner, G. Federici, and A. Kukushkin, Journal of Nuclear Materials 390-391, 1 (2009).
- [26]A. Machida, H. Saitoh, H. Sugimoto, T. Hattori, A. Sano-Furukawa, N. Endo, Y. Katayama, R. Iizuka, T. Sato, M. Matsuo, S.-i. Orimo, and K. Aoki, Nature Communications 5 (2014).
- [27]H. Cheng, C. Lu, J. Liu, Y. Yan, X. Han, H. Jin, Y. Wang, Y. Liu, and C. Wu, Progress in Natural Science: Materials International 27, 66–73 (2017).
- [28]L. Palatinus, C. A. Corrêa, G. Steciuk, D. Jacob, P. Roussel, P. Boullay, M. Klementová, M. Gemmi, J. Kopeček, M. C. Domeneghetti, F. Cámara, and V. Petříček, Acta Crystallographica Section B Structural Science, Crystal Engineering and Materials 71, 740–751 (2015).
- [29]L. Palatinus, V. Petříček, and C. A. Corrêa, Acta Crystallographica Section A Foundations and Advances 71, 235–244 (2015).
- [30]M. Gemmi, E. Mugnaioli, T. E. Gorelik, U. Kolb, L. Palatinus, P. Boullay, S. Hovmöller, and J. P. Abrahams, ACS Central Science 5, 1315–1329 (2019).
- [31]L. Palatinus, P. Brázda, P. Boullay, O. Perez, M. Klementová, S. Petit, V. Eigner, M. Zaarour, and S. Mintova, Science 355, 166–169 (2017).
- [32]A. Kumar, K. K. Jha, B. Olech, T. Goral, M. Malinska, K. Woźniak, and P. M. Dominiak, Acta Crystallographic Section C Structural Chemistry 80, 264–277 (2024).
- [33]P. B. Klar, Y. Krysiak, H. Xu, G. Steciuk, J. Cho, X. Zou, and L. Palatinus, Nature Chemistry 15, 848–855 (2023).
- [34]S. Grabowsky, A. Genoni, and H.-B. Bürgi, Chemical Science 8, 4159–4176 (2017).
- [35]A. Genoni and P. Macchi, Crystals 10, 473 (2020).
- [36]D. Jayatilaka and B. Dittrich, Acta Crystallographica Section A Foundations of Crystallography 64, 383–393 (2008).
- [37]S. C. Capelli, H.-B. Bürgi, B. Dittrich, S. Grabowsky, and D. Jayatilaka, IUCrJ 1, 361–379 (2014).
- [38]M. Woińska, S. Grabowsky, P. M. Dominiak, K. Woźniak, and D. Jayatilaka, Science Advances 2, e1600192 (2016).
- [39]M. Woińska, M. L. Chodkiewicz, and K. Woźniak, Chemical Communications 57, 3652–3655 (2021).
- [40]F. Kleemiss, O. V. Dolomanov, M. Bodensteiner, N. Peyerimhoff, L. Midgley, L. J. Bourhis, A. Genoni, L. A. Malaspina, D. Jayatilaka, J. L. Spencer, F. White, B. Grundkötter-Stock, B. Steinhauer, D. Lentz, H. Puschmann, and S. Grabowsky, Chemical Science 12, 1675–1692 (2021).
- [41]R. I. Cooper, A. L. Thompson, and D. J. Watkin, Journal of Applied Crystallography 43, 1100–1107 (2010).
- [42]P. V. Afonine, R. W. Grosse-Kunstleve, V. B. Chen, J. J. Headd, N. W. Moriarty, J. S. Richardson, D. C. Richardson, A. Urzhumtseva, P. H. Zwart, and P. D. Adams, Journal of Applied Crystallography 43, 669–676 (2010).
- [43]A. L. Spek, Acta Crystallographica Section E 76, 1 (2020).
- [44]A. Jain, S. P. Ong, G. Hautier, W. Chen, W. D. Richards, S. Dacek, S. Cholia, D. Gunter, D. Skinner, G. Ceder, and K. A. Persson, APL Materials 1, 011002 (2013).
- [45]S. Kirklin, J. E. Saal, B. Meredig, A. Thompson, J. W. Doak, M. Aykol, S. Rühl, and C. Wolverton, npj Computational Materials 1 (2015).
- [46]J. Schmidt, H.-C. Wang, T. F. T. Cerqueira, S. Botti, and M. A. L. Marques, Scientific Data 9, 64 (2022).
- [47]L. Barroso-Luque, M. Shuaibi, X. Fu, B. M. Wood, M. Dzamba, M. Gao, A. Rizvi, C. L. Zitnick, and Z. W. Ulissi, arXiv preprint arXiv:2410.12771 (2024).
- [48]M. K. Horton, P. Huck, R. X. Yang, J. M. Munro, S. Dwaraknath, A. M. Ganose, R. S. Kingsbury, M. Wen, J. X. Shen, T. S. Mathis, A. D. Kaplan, K. Berket, J. Riebesell, J. George, A. S. Rosen, E. W. C. Spotte-Smith, M. J. M. McDermott, O. A. Cohen, A. Dunn, M. C. Kuner, G.-M. Rignanese, G. Petretto, D. Waroquiers, S. M. Griffin, J. B. Neaton, D. C. Chrzan, M. Asta, G. Hautier, S. Cholia, G. Ceder, S. P. Ong, A. Jain, and K. A. Persson, Nature Materials 24, 1522–1532 (2025).
- [49]A. D. Kaplan, R. Liu, J. Qi, T. W. Ko, B. Deng, J. Riebesell, G. Ceder, K. A. Persson, and S. P. Ong, arXiv preprint arXiv:2503.04070 (2025).
- [50]S. P. Huber, M. Minotakis, M. Bercx, T. Reents, K. Eimre, N. Paulish, N. Hörmann, M. Uhrin, N. Marzari, and G. Pizzi, arXiv preprint arXiv:2508.19223 (2025).arXiv
- [51]J. Chen, J. Guo, E. Fako, and P. Schwaller, arXiv preprint arXiv:2511.03112 (2025), arXiv preprint arXiv:2511.03112.arXiv
- [52]H. Park and A. Walsh, “Guiding generative models to uncover diverse and novel crystals via reinforcement learning,” (2025), arXiv preprint arXiv:2511.07158.arXiv
- [53]A. Lugmayr, M. Dannelljan, A. Romero, F. Yu, R. Timofte, and L. V. Gool, arXiv preprint arXiv:2201.09865 (2022).
- [54]T. Mayet, P. Shamsolmoali, S. Bernard, E. Granger, R. Hérnault, and C. Chatelain, arXiv preprint arXiv:2410.09306 (2024).
- [55]J. Riebesell, R. E. A. Goodall, P. Benner, Y. Chiang, B. Deng, G. Ceder, M. A. A. Lee, A. Jain, and K. A. Persson, Nature Machine Intelligence 7, 836 (2025).
- [56]H. Yang, C. Hu, Y. Zhou, X. Liu, Y. Shi, J. Li, G. Li, Z. Chen, S. Chen, C. Zeni, M. Horton, R. Pinsler, A. Fowler, D. Zügner, T. Xie, J. Smith, L. Sun, Q. Wang, L. Kong, C. Liu, H. Hao, and Z. Lu, arXiv preprint arXiv:2405.04967 (2024).arXiv
- [57]S. Batzner, A. Musaelian, L. Sun, M. Geiger, J. P. Mailoa, M. Kornbluth, N. Molinari, T. E. Smidt, and B. Kozinsky, Nature Communications 13, 2453 (2022).
- [58]I. Batatia, P. Benner, Y. Chiang, A. M. Elena, D. P. Kovács, J. Riebesell, X. R. Advincula, M. Asta, M. Avaylon, W. J. Baldwin, F. Berger, N. Bernstein, A. Bhowmik, F. Bigi, S. M. Blau, V. Čarare, M. Ceriotti, S. Chong, J. P. Darby, S. De, F. Della Pia, V. L. Deringer, R. Elijošius, Z. El-Machachi, E. Fako, F. Falcioni, A. C. Ferrari, J. L. A. Gardner, M. J. Gawkowski, A. Genreith-Schriever, J. George, R. E. A. Goodall, J. Grandel, C. P. Grey, P. Grigorev, S. Han, W. Handley, H. H. Heenen, K. Hermansson, C. H. Ho, S. Hofmann, C. Holm, J. Jaafar, K. S. Jakob, H. Jung, V. Kapil, A. D. Kaplan, N. Karimitari, J. R. Kermode, P. Kourtis, N. Kroupa, J. Kullgren, M. C. Kuner, D. Kuryla, G. Liepuoniute, C. Lin, J. T. Margraf, I.-B. Magdāu, A. Michaelides, J. H. Moore, A. A. Naik, S. P. Niblett, S. W. Norwood, N. O’Neill, C. Ortner, K. A. Persson, K. Reuter, A. S. Rosen, L. A. M. Rosset, L. L. Schaaf, C. Schran, B. X. Shi, E. Sivonxay, T. K. Stenczel, C. Sutton, V. Svahn, T. D. Swinburne, J. Tilly, C. van der Oord, S. Vargas, E. Varga-Umbrich, T. Vegge, M. Vondrák, Y. Wang, W. C. Witt, T. Wolf, F. Zills, and G. Csányi, The Journal of Chemical Physics 163 (2025).
- [59]B. Rhodes, S. Vandenhaute, V. Simkus, J. Gin, J. Godwin, T. Duignan, and M. Neumann, arXiv preprint arXiv:2504.06231 (2025).arXiv
- [60]H. Yu, M. Giantomassi, G. Materzanini, J. Wang, and G.-M. Rignanese, Materials Genome Engineering Advances 2, e58 (2024).
- [61]A. Mazitov, F. Bigi, M. Kellner, P. Pegolo, D. Tisi, G. Fraux, S. Pozdnyakov, P. Loche, and M. Ceriotti, Nature Communications 16 (2025).
- [62]P. Zhong, X. Dai, B. Deng, G. Ceder, and K. A. Persson, Materials Horizons 12, 9669–9678 (2025).
- [63]L. Kahle, A. Marcolongo, and N. Marzari, Physical Review Materials 2, 065405 (2018).
- [64]S. R. Kavanagh and M. G. . Harvard, “Nequip & allegro foundation potentials,” (2025).DOI
- [65]S. Gražulis, A. Daškevič, A. Merkys, D. Chateigner, L. Lutterotti, M. Quirós, N. R. Serebryanaya, P. Moeck, R. T. Downs, and A. Le Bail, Nucleic Acids Research 40, D420 (2012).
- [66]D. Zagorac, H. Müller, S. Ruehl, J. Zagorac, and S. Rehme, Journal of Applied Crystallography 52, 918 (2019).
- [67]“Materials platform for data science,” https://www.mpds.io/.mpds.io
- [68]S. P. Vecham and M. Head-Gordon, Journal of Chemical Theory and Computation 16, 4963–4982 (2020).
- [69]E. C. Mitchell, L. Azevedo Santos, P. Vermeeren, M. E. Lahm, C. Fonseca Guerra, H. F. Schaefer, and F. M. Bickelhaupt, Journal of Computational Chemistry 46 (2025), 10.1002/jcc.70265.DOI
- [70]S. Dasgupta, C. Shahi, P. Bhetwal, J. P. Perdew, and F. Paesani, Journal of Chemical Theory and Computation 18, 4745–4761 (2022).
- [71]S. Dasgupta, E. Lambros, J. P. Perdew, and F. Paesani, Nature Communications 12 (2021), 10.1038/s41467-021-26618-9.DOI
- [72]B. Santra, A. Michaelides, and M. Scheffler, The Journal of Chemical Physics 127 (2007), 10.1063/1.2790009.DOI
- [74]A. J. Lehner, L. V. Schindler, and C. Röhr, Zeitschrift für Naturforschung B 68, 323–337 (2013).
- [75]A. Kamegawa, T. Abiko, and M. Okada, Materials Science Forum 783–786, 1686–1691 (2014).
- [76]J. S. Möller, D. Ceresoli, T. Lancaster, N. Marzari, and S. J. Blundell, Physical Review B 87, 121108 (2013).
- [77]J. S. Möller, P. Bonfà, D. Ceresoli, F. Bernardini, S. J. Blundell, T. Lancaster, R. De Renzi, N. Marzari, I. Watanabe, S. Sulaiman, and M. M. Mohamed-Ibrahim, Physica Scripta 88, 068510 (2013).
- [78]I. J. Onuorah, M. Bonacci, M. M. Isah, M. Mazzani, R. De Renzi, G. Pizzi, and P. Bonfà, Digital Discovery 4, 523 (2025).
- [79]XtalPaint. (2025). XtalPaint. <a href="https://doi.org/https://github.com/psi-lms/XtalPaint" rel="noopener noreferrer" target="_blank">https://doi.org/https://github.com/psi-lms/XtalPaint</a>
- [80]G. Pizzi, A. Cepellotti, R. Sabatini, N. Marzari, and B. Kozinsky, Computational Materials Science 111, 218 (2016).
- [81]S. P. Huber, S. Zoupanos, M. Uhrin, L. Talirz, L. Kahle, R. Häuselmann, D. Gresch, T. Müller, A. V. Yakutovich, C. W. Andersen, F. F. Ramirez, C. S. Adorf, F. Gariglio, S. Kumbhar, E. Passaro, C. Johnston, A. Merkys, A. Cepellotti, N. Mounet, N. Marzari, B. Kozinsky, and G. Pizzi, Scientific Data 7, 300 (2020).
- [82]M. Uhrin, S. P. Huber, J. Yu, N. Marzari, and G. Pizzi, Computational Materials Science 187, 110086 (2021).
- [83]J. Zhuang, Y. Zeng, W. Liu, C. Yuan, and K. Chen, arXiv preprint arXiv:2312.03594 (2024).arXiv
- [84]C. Cornean, R. Gadde, and A. M. Martinez, in 2024 IEEE/CVF Winter Conference on Applications of Computer Vision (WACV) (IEEE, Waikoloa, HI, USA, 2024) pp. 4322–4331.
- [85]A. Schneuing, C. Harris, Y. Du, K. Didi, A. Jamasb, I. Igashov, W. Du, C. Gomes, T. L. Blundell, P. Lio, M. Welling, M. Bronstein, and B. Correia, Nature Computational Science 4, 899 (2024).
- [86]R. E. A. Goodall, A. S. Parackal, F. A. Faber, R. Armiento, and A. A. Lee, Science Advances 8, eabn4117 (2022).
- [87]A. S. Parackal, R. E. A. Goodall, F. A. Faber, and R. Armiento, Physical Review Materials 8, 103801 (2024).
- [88]P. Giannozzi, S. Baroni, N. Bonini, M. Calandra, R. Car, C. Cavazzoni, D. Ceresoli, M. Cococcioni, G. L. Chiarotti, M. Cococcioni, I. Dabo, A. Dal Corso, S. de Gironcoli, S. Fabris, G. Fratesi, R. Gebauer, U. Gerstmann, C. Gougoussis, A. Kokalj, M. Lazzeri, L. Martin-Samos, N. Marzari, F. Mauri, M. Razzoli, S. Paolini, A. Pasquarello, L. Paulatto, C. Sbraccia, S. Scandolo, G. Sclauzero, A. P. Seitsonen, A. Smogunov, P. Umari, and R. M. Wentzcovitch, Journal of Physics: Condensed Matter 21, 395502 (2009).
- [89]P. Giannozzi, O. Andreussi, T. Brumme, O. Bunau, M. B. Nardelli, M. Calandra, R. Car, C. Cavazzoni, D. Ceresoli, M. Cococcioni, N. Colonna, I. Carnimeo, A. D. Corso, S. de Gironcoli, P. Delugas, R. A. Di Stasio, A. Ferretti, A. Floris, G. Fratesi, G. Fugallo, R. Gebauer, U. Gerstmann, F. Giustino, T. Gorni, J. Jia, M. Kawamura, H.-Y. Ko, A. Kokalj, E. Kučkenbenli, M. Lazzeri, M. Marsili, N. Marzari, F. Mauri, N. L. Nguyen, H.-V. Nguyen, A. O. de-la Roza, L. Paulatto, S. Poncé, D. Rocca, R. Sabatini, B. Santra, M. Schlipf, A. P. Seitsonen, A. Smogunov, I. Timrov, T. Thonhauser, P. Umari, N. Vast, X. Wu, and S. Baroni, Journal of Physics: Condensed Matter 29, 465901 (2017).
- [90]AiiDA Quantum ESPRESSO. (2025). AiiDA Quantum ESPRESSO. <a href="https://doi.org/https://github.com/aiidateam/aiida-quantumespresso" rel="noopener noreferrer" target="_blank">https://doi.org/https://github.com/aiidateam/aiida-quantumespresso</a>
- [91]G. d. M. Nascimento, F. J. dos Santos, M. Bercx, D. Grassano, G. Pizzi, and N. Marzari, arXiv preprint arXiv:2504.03962 (2025).arXiv
- [92]G. Prandini, A. Marrazzo, I. E. Castelli, N. Mounet, and N. Marzari, npj Computational Materials 4, 72 (2018).
- [93]M. van Setten, M. Giantomassi, E. Bousquet, M. Verstraete, D. Hamann, X. Gonze, and G.-M. Rignanese, Computer Physics Communications 226, 39–54 (2018).
- [94]aiida-hydrogen-restorer. (2025). aiida-hydrogen-restorer. <a href="https://doi.org/https://github.com/psi-lms/aiida-hydrogen-restorer" rel="noopener noreferrer" target="_blank">https://doi.org/https://github.com/psi-lms/aiida-hydrogen-restorer</a>
- [95]S. van der Walt, J. L. Schönberger, J. Nunez-Iglesias, F. Boulogne, J. D. Warner, N. Yager, E. Gouillart, T. Yu, and the scikit-image contributors, PeerJ 2, e453 (2014).
- [96]L. Talirz, S. Kumbhar, E. Passaro, A. V. Yakutovich, V. Granata, F. Gargiulo, M. Borelli, M. Uhrin, S. P. Huber, S. Zoupanos, C. S. Adorf, C. W. Andersen, O. Schütt, C. A. Pignedoli, D. Passerone, J. VandeVondele, T. C. Schulthess, B. Smit, G. Pizzi, and N. Marzari, Scientific Data 7 (2020).
- [97]T. Reents, A. Cantarella, M. Bercx, P. Bonfà, and G. Pizzi, Materials Cloud Archive (2025), 10.24435/materialscloud:gz-mt, 10.24435/materialscloud:gz-mt.DOI
- [98]AiiDA WorkGraph. (2025). AiiDA WorkGraph. <a href="https://doi.org/https://github.com/aiidateam/aiida-workgraph" rel="noopener noreferrer" target="_blank">https://doi.org/https://github.com/aiidateam/aiida-workgraph</a>
- [99]AiiDA PythonJob. (2025). AiiDA PythonJob. <a href="https://doi.org/https://github.com/aiidateam/aiida-pythonjob" rel="noopener noreferrer" target="_blank">https://doi.org/https://github.com/aiidateam/aiida-pythonjob</a>