Introduction

The search for a stable crystal structure is a very challenging task, amounting to finding the structure with the lowest free energy among an astronomical number of possible structures, for each of which the free energy has to be computed. Today, this can only be done at zero Kelvin1,2,3,4,5: relaxing crystal structures and computing their free energies at finite temperatures would require extensive statistical sampling, increasing the number of configurations by several orders of magnitude. The challenge of crystal structure prediction at finite temperatures must be addressed because high-temperature phases often possess interesting properties and are of fundamental and practical interest. Such elements as titanium, iron, calcium, as well as many compounds (for example, cubic paraelectric BaTiO3 or ultrahard borides, carbides, and nitrides) have high-temperature phases which have no stability fields at zero temperature and some may not even be metastably quenched at low temperatures. Another important example is planetary science: properties of planet-forming materials at extreme conditions of planetary interiors are responsible for the observed seismic profiles and dynamical processes occurring within planets. For example, the exact structure of iron in the Earth’s core6,7,8,9,10 and exact location of the perovskite–post-perovskite MgSiO3 boundary at conditions of the lower mantle11,12,13,14,15 are still under debate.

Here we develop a new method, T-USPEX, extending crystal structure prediction beyond the zero Kelvin regime. It is based on a previously developed evolutionary crystal structure prediction method USPEX1,2,3, which predicts the lowest-energy crystal structure for a given chemical composition. Due to the need for statistical sampling in the calculation of the free energy, the computing costs of T-USPEX may increase by several, roughly 3–5, orders of (in comparison with USPEX). However, this can be offset when taking advantage of two factors.

First, the energy landscape is dramatically simplified as temperature increases, greatly simplifying the combinatorial problem. As a consequence, the global minimum is found in fewer generations. This was confirmed, e.g., by results on molecular crystals in ref. 16, and our tests for MgSiO3 system at 110 GPa and different temperatures (Supplementary Fig. 1 and chapter “Free energy surface calculations” in Supplementary Materials). This decrease must be very fast (at zero temperature, the number of minima C is very large, let’s say, »106 for medium-size systems, whereas near the melting temperature there is only one or very few local minima). This has led Oganov17 to conjecture exponential decrease of the number of local minima C:

$$C=exp ({\alpha }\frac{{T}^{* }-T}{{T}^{* }}),$$
(1)

where α is a constant, and T* is a characteristic temperature (higher than the melting temperature), at which only one free energy minimum exists. We have verified this conjecture for MgSiO3 at 110 GPa, where fitted values of the parameters were: \({\alpha }=2.97\), \({T}^{* }=7935 {K}\) (see Supplementary Materials), while the melting temperature of MgSiO3 at such conditions is about 6000 K18. Such rapid decrease of the number of minima (Fig. 1) makes the problem much simpler: the number of structure relaxations and free energy calculations needed to find the global minimum decreases strongly.

Fig. 1: Free energy surfaces of MgSiO3 calculated with T-USPEX.
figure 1

Free energy surfaces were calculated at 110 GPa and 300 K, 2000 K, 4000 K, and 6000 K. Positions of perovskite and post-perovskite MgSiO3 phases are shown with red arrows.

Second, each structure relaxation and free energy calculation can be made much cheaper if one replaces ab initio calculations with a machine learning (ML) forcefield19,20,21,22,23,24,25,26,27,28, which speeds up the calculations by at least two orders of magnitude29 with only a small reduction of accuracy (usual mean average errors are ~10 meV/atom29). Moreover, with ML one can consider large supercells, thus considering long-wavelength phonons, which are so important for thermodynamics. ML forcefields have been applied to many different problems19,20,21,22,23,30,31,32,33,34,35, for a comparison of different ML approaches, see ref. 36. ML forcefields were used to build the phase diagram of uranium34, accelerate crystal structure prediction29, calculate thermal conductivity37, lattice dynamics38 and so on. Here we mostly use the MTP potential39, which showed outstanding performance36. Structure relaxation at given P–T conditions is equivalent to taking statistical averages for lattice translation vectors and for atomic fractional coordinates, while Gibbs free energy is calculated for each structure as:

$$G={PV}+F={PV}+{F}_{0}+{\int}_{\!0}^{1}\left(U\left(\lambda \right)-{U}_{0}\right)d\lambda \,,$$
(2)

where P is the external pressure, V the equilibrium volume, and F is the Helmholtz free energy which is computed by thermodynamic integration using adiabatic switching from a reference system with known free energy F0 and potential U0 (here we use the Einstein crystal as reference system) to the system with potential U(λ = 1) whose free energy we wish to compute40,41.

It is very important that we correct the errors of the ML potential to obtain free energies equivalent to full ab initio values FAI using thermodynamic perturbation theory, to second order42:

$${{\rm{F}}}_{{\rm{AI}}}\simeq F+\frac{1}{{N}_{{at}}}\left[\left\langle {U}_{{AI}}-U\right\rangle -\frac{1}{2{k}_{b}T}\left\langle {\left[{U}_{{AI}}-U\right]}^{2}\right\rangle \right],$$
(3)

where UAI is the total energy of the ab initio system, \({k}_{B}\) and T are Boltzmann constant and temperature, respectively, and angle brackets denote ensemble averages. Free energy calculations (2) are done on large supercells with ~10,000 atoms, in the NVT ensemble (typical duration of a run is 40 ps). Free energy corrections (3) are done on smaller ~60-atom supercells (this required a classical NVT run of 10 ps duration, where DFT energies and ensemble averages in (3) were computed for 100 equally spaced snapshots). Convergence of values of free energies corrections is documented in Supplementary Materials section 8).

To summarize, crystal structure prediction at finite temperatures is difficult because for each candidate structure extensive sampling is needed to compute the entropy. However, two factors were identified that give hope—the reduction of the complexity of the free energy surface on increasing temperature, and the possibility of computing highly precise (to within 1 meV/atom) free energies in an economic way via ML forcefield using thermodynamic integration and thermodynamic perturbation theory corrections. This allowed us to develop an efficient and reliable approach for crystal structure prediction at finite temperatures, and we illustrate its performance on five substances—aluminum (calculating its phase diagram and searching for possibly missed unknown phases), iron (to figure out the stable crystal structure at conditions of the Earth’s inner core), MgSiO3 (calculating its important phase diagram and searching for possibly overlooked phases at conditions of the lowermost mantle of the Earth), WB (testing our approach for a system with complex chemical bonding and predicting stability of a temperature-induced phase), and HfO2 (studying its high-temperature phases and looking for potential ferroelectric phases).

Results

T-USPEX scheme

The scheme of the T-USPEX algorithm is shown in Fig. 2. The initial population of structures was created using symmetric5 and topological43 random structure generators. Each produced structure was then relaxed, first using density functional theory (DFT) calculations at zero Kelvin, and then using a forcefield-based molecular dynamics in the NPT ensemble for a relatively small ~60-atom supercell (types of interatomic potentials, used in this work, will be discussed below in the section “Interatomic potentials”). After a preliminary forcefield-based NPT-MD run, we obtained equilibrium lattice vectors. Then, for equilibrium lattice vectors averaged atomic coordinates were calculated from NVE-MD run.

Fig. 2: The scheme of the T-USPEX algorithm.
figure 2

Left panel shows general workflow of the developed algorithm, and right panel shows process of crystal structure relaxation and free energy calculation.

Even the best ML forcefields give rise to non-negligible errors in pressure estimations, and this will affect the densities of the final structures and the PV-term in the free energy. For this reason, we calculate the pressure correction: we perform a molecular dynamics simulation in the NVE ensemble using the forcefield for 20 ps, and intermediate structures are saved every 1 ps—for each of which we calculate the pressure using DFT, and pressure correction is calculated as an ensemble average.

Then we created a large, ~1000-atom supercell and relaxed the structure using NPT (for 40 ps) followed by NVE (for 20 ps) molecular dynamics, taking pressure correction into account. This gave us final averaged supercell vectors and fractional coordinates of each atom. From them, using ASE44 and Spglib45 libraries, we obtained space group, primitive cell vectors and all atomic coordinates of the final structure. Structures with P1 symmetry and unusually large unit cells were counted as defective and were discarded.

For the remaining structures, we proceeded to compute Gibbs free energy. First, using ~10,000-atom supercells, we computed the Helmholtz free energy using thermodynamic integration as the most accurate method46. To obtain accurate Gibbs free energies, these Helmholtz free energies were combined with the PV-term and 1st- and 2nd-order corrections of thermodynamic perturbation theory. To determine these corrections, we ran NVE-MD using the same forcefield, and took statistically independent (separated by ~1 ps) snapshots of the MD trajectory, at which we computed DFT energy. While the 1st-order correction is quite large, the 2nd-order correction in all cases here is tiny, indicating extremely high reliability of the final free energies and robustness of our procedure.

Next, we test our method on five very different systems—aluminum, iron, WB, MgSiO3, and HfO2—in order to check the possible presence of unknown stable phases and refine phase diagrams.

Phase diagram of aluminum

For aluminum, three phases are experimentally known to be stable at different P–T conditions: fcc (at normal conditions), hcp and bcc. First, using DFT we determined that at zero Kelvin fcc-Al transforms to hcp-Al at 162 GPa (Supplementary Fig. 1), and hcp-Al transforms to bcc-Al at 373 GPa (Supplementary Fig. 2). These values agree well with previous theoretical calculations47,48,49, but in experiment fcc-Al transforms to hcp-Al at 217 ± 10 GPa50 at 300 K. Then, we ran T-USPEX calculations for Al at 0 GPa and 300 K, 100 GPa and 2000 K, 400 GPa and 2000 K. Each generation consisted of 20 randomly generated structures, and used the MTP potential trained on results of ab initio molecular dynamics (see “Methods”). We saw that during subsequent NPT molecular dynamics calculations (used for relaxing structures at finite temperatures) almost all randomly generated structures transformed either to the fcc, hcp and/or bcc structures, or to defective structures with large unit cells (the latter structures were discarded). The transformation of a randomly generated Al structure to bcc-Al in a T-USPEX calculation is shown in Fig. 3. It is worth noting that at the first step the number of atoms in the unit cell decreased. This happens after symmetrization (these steps are shown in Fig. 2), when lattice vectors and the number of atoms in the unit cell are transformed to a standard setting corresponding to the space group with higher symmetry (with Spglib45).

Fig. 3: Relaxation of randomly generated Al structure in the T-USPEX algorithm.
figure 3

After a series of consequent MD relaxations and symmetrizations, random Al structure transforms to bcc-Al.

The model potential has two kinds of errors (relative to ab initio calculations)—a small error in density (which we compensate by a shift of pressure to bring pressure in exact agreement with ab initio result) and (at a given density) a small error in the free energy (which we correct for by thermodynamic perturbation theory). The pressure correction turned out to be several GPa at most (Supplementary Fig. 3); at the simulated pressure of 400 GPa it varied from 5 to 12 GPa. In the calculation at 0 GPa and 300 K 15 structures (out of 20) transformed to fcc-Al with free energies equal to (−3.8474 ± 0.0002) eV/atom and densities (2.660 ± 0.0044) g/cm3, 1 structure to I4/mmm phase with free energy of −3.7490 eV/atom (clearly, this structure is not competitive), the other 4 structures being defective supercells (Supplementary Table 1). We find that in the P–T region of interest (temperature up to 5000 K and pressures up to 400 GPa) only fcc, hcp, and bcc structures have stability fields.

In order to calculate the P–T phase diagram, we used the fcc, hcp, and bcc structures as seeds and performed T-USPEX calculations close to the previously calculated phase transition boundaries47,49. These calculations can be viewed as computer experiments akin to real experiments sampling the phase diagram. The resulting P–T phase diagram for Al is presented in Fig. 4 (see also Supplementary Fig. 4). Clearly, the hcp phase occupies a much larger region of the phase diagram than in previous studies47,48,49. Our fully anharmonic result should be more reliable than previous calculations47,48,49 based on the quasiharmonic approximation. The melting curve was taken from refs. 47,49,51,52.

Fig. 4: P–T phase diagram of Al.
figure 4

Vertical dashed line shows the pressure of the Earth’s core–mantle boundary.

Iron in the Earth’s inner core

Until now, an open question is which phase of iron (bcc or hcp or perhaps some new structure) is stable at conditions of the Earth’s solid inner core (pressures in the range 330–350 GPa and temperatures of approximately 5400–5700 K). Available experimental results are not fully consistent 6,7,8,9,10. Computational studies up to now either checked a few simple structures at relevant temperatures and pressures, or performed crystal structure prediction, but at zero Kelvin. Here, we perform crystal structure prediction at actual P–T conditions of the Earth’s inner core, namely at the pressure of 330 GPa and temperatures of 5400 K, 5700 K and 6000 K. We trained a single ML forcefield for iron at each P–T point. An iterative approach was used to prepare a suitable training set. First, we generated random crystal structures of iron with up to 16 atoms in the unit cell at 330 GPa. Then, we collected new configurations for our training set from ab initio MD trajectories at 330 GPa and 5700 K using the generated random structures as initial configurations. The sampled configurations were pruned to remove identical structures, and their energies, interatomic forces, and stresses were calculated within DFT. Finally, using active learning, the existing training set was updated with new data, and the interatomic potential was re-trained. This process was repeated iteratively until no new configurations were actively sampled from molecular dynamics runs. The resulting training set contained 494 configurations, and the ML forcefield had the mean absolute error (MAE) on energies prediction of 29 meV/atom, while the MAEs for forces and stresses were 0.43 eV/A (1%) and 3.2 GPa (1.7%), respectively. The non-negligible MAE in energy prediction is the price for the generality of the forcefield in a wide range of configurations, but this error was canceled by corrections due to thermodynamic perturbation theory. On the other hand, high accuracy of interatomic forces and stresses prediction was essential for relaxations and free energy calculations.

Using T-USPEX and pre-trained MTP potential, we searched for stable Fe phase at 330 GPa and 5700 K. In the first generation consisting of 20 random structures, 3 structures relaxed into the hcp phase with the Gibbs free energy 6.0652 ± 0.0008 eV/atom, 4—into fcc phase with the free energy of 6.0859 ± 0.0005 eV/atom, 2—into newly found \(R\bar{3}m\) phase (which is a close-packed structure, its crystal structure parameters are shown in Supplementary Table 10) with free energy of 6.0768 ± 0.0019 eV/atom (see Supplementary Table 3). We also found that at 330 GPa and 5400 K all initially random structures relaxed either to hcp or to fcc phase, and hcp phase had the lowest free energy (T-USPEX results are shown in Supplementary Table 4). Thus, our calculations showed that hcp structure is stable for iron at P–T conditions corresponding to the Earth’s inner core, in agreement with results from ref. 8. In order to check the stability of bcc phase, we used it as a seed in the T-USPEX calculation. At 330 GPa and all temperatures we studied (5400 K, 5700 K, 6000 K) it relaxed to the hcp phase. Thus, at our level of theory (PBE-DFT) we rule out the stability of the bcc phase of pure iron in the inner core of the Earth—however, impurities may still stabilize it9.

Phase diagram of MgSiO3 at the Earth’s core–mantle boundary

Using T-USPEX, we explored the main Earth-forming compound—MgSiO3 (comprising ~40 vol.% of our entire planet, or ~80 vol.% of its lower mantle)—searching for phases stable at conditions of the lowermost mantle. Throughout most of the lower mantle this compound exists as bridgmanite, a perovskite-type modification, while in the lowermost D” layer a post-perovskite polymorph is stable11,12. Here we followed a scheme somewhat different from what we used above, to illustrate the flexibility of our approach. For crystal structure relaxation and free energy calculations, we used the classical interatomic potential developed in ref. 53, which showed good agreement with experimental crystal structures and many properties. Here, using this interatomic potential, we ran T-USPEX for 20 generations (each containing 20 structures) at 135 GPa and 2700 K. Instead of applying expensive pressure and free energy corrections within crystal structure prediction runs, we ran highly efficient T-USPEX searches based solely on this interatomic potential, then selected structures with the lowest free energies and for these performed very accurate crystal structure and free energies calculations as described above.

In the T-USPEX search at 135 GPa and 4000 K, already in the first generation, we saw post-perovskite (pPv) Cmcm-MgSiO3 as the most stable structure, and in the second generation— bridgmanite, the phase with Pnma-perovskite (Pv) structure, and no other competitive structures with up to 80 atoms in the primitive cell. Then we obtained reliable structures and their free energies using pressure and free energy corrections as described above; this was done at 120 GPa and 1500 K, 2000 K and 2500 K; at 130 GPa and 500 K, 1500 K, 3000 K, 4000 K. At 120 GPa pPv phase was stable up to 2000 K, at 130 GPa—up to 3700 K. Using these values, the phase transition boundary between Pv and pPv MgSiO3 phases was calculated (Fig. 5). The result is right in the middle of the previous theoretical12,13 and experimental11,14,15,43 works (see Fig. 5) and has a positive Clapeyron slope of +5.88 MPa/K. This value is important for calculating the heat flow from the core into the mantle and for determining the thermal structure of the lowermost mantle19. Here, we give its most accurate theoretical calculation, with full account of the anharmonic terms in the free energy.

Fig. 5: P–T phase diagram of MgSiO3.
figure 5

Vertical dashed line shows the pressure of the Earth’s core–mantle boundary.

Temperature-induced phase transition in WB

Next, we applied our method to WB - a hard refractory ultrahard compound, undergoing a temperature-induced phase transition and characterized by a nontrivial chemical bonding and lack of an accurate and transferable forcefield. The temperature-induced phase transition from the low-temperature α-phase into the high-temperature β-phase takes place at ~2100–2700 K44,45,46. We ran T-USPEX at 0 GPa and 2000 K with MTP forcefield, and obtained both I41/amd-WB (α-phase) and Cmcm-WB (β-phase) and a hitherto unknown low-energy Pnma structure of WB to have the lowest free energies (within a few meV/atom of each other, see Supplementary Table 2). In order to find stability fields of the discovered tungsten monoborides, their equilibrium crystal structures and free energies were calculated with higher accuracy in the temperature range of 300–3000 K at zero pressure. Our calculations show that the α-β transition takes place at 2789 K (Fig. 6), in agreement with experimental results45, while Pnma-WB remains a low-energy metastable phase at all temperatures.

High-temperature phase transitions in HfO2

We also applied T-USPEX to predict high-temperature phase transitions in a ceramic material - HfO2. This material is particularly interesting due to the recently found ferroelectricity in its thin films54. Experimental studies55 showed that at ambient pressure and room temperature, it adopts a monoclinic P21/c structure, which then transforms at ~2000 K to tetragonal P42/nmc phase and after at ~2800 K to cubic \({Fm}\bar{3}m\) phase. At higher pressures, HfO2 transforms to Pbca and Pnma polymorphs. Yet, none of the experimentally found phases can explain ferroelectricity in HfO2. Possible explanations include metastable Pca21 or Pmn21 structures 56,57,58,59,60. Previously, machine learning interatomic potentials for HfO2 were constructed based on PBE61 and PBEsol62 exchange-correlation functionals, yet for the closely related compound ZrO2 it was shown that Δ-ML approach (based on the RPA approximation) gives the most accurate results for phase transition boundaries63. Here, using the T-USPEX method (within PBE and PBEsol approximations), we searched for stable HfO2 phases at 300 K, 1000 K and 2000 K. The results are shown in Supplementary Tables 59 and Supplementary Figs. 6 and 7.

Using T-USPEX (within the PBE approximation) at 300 K for HfO2 we found the experimentally known P21/c structure as the most stable one. We also found likely candidates for the ferroelectric phase: Pca21 (~25 meV/atom above ground state) and Pmn21 (~30 meV/atom above ground state). At higher temperatures (1000 K and 2000 K) we found anatase I41/amd phase to be the most stable one, and experimentally known P42/nmc phase to be metastable (detailed results are given in Supplementary Tables 57). Supplementary Fig. 6 shows that at T > 300 K anatase I41/amd phase is the stable phase within PBE functional, which contradicts experiment. Given small free energy differences between phases, one can expect that small errors of the PBE exchange-correlation functional can lead to incorrect phase stability. It is known64 that PBEsol is more accurate for HfO2, so we decided to use it.

Fig. 6: Thermodynamics of WB polymorphs.
figure 6

Here we show the calculated Gibbs free energies of Cmcm and Pnma structures of WB (relative to I41/amd).

Doing T-USPEX calculations for HfO2 within PBEsol exchange-correlation functional (Supplementary Tables 8 and 9), we find P21/c-HfO2 to be the most stable phase at temperatures up to about 2000 K (Supplementary Fig. 7), while at higher temperatures \({Fm}\bar{3}m\)-HfO2 is thermodynamically stable. The P42/nmc-HfO2 phase is found to be metastable, while in experiment it has stability field between P21/c and \({Fm}\bar{3}m\) phases. Anatase-type phase is no longer stable within PBEsol functional. The tiny free energy differences between these phases are calculated by T-USPEX with remarkable numerical robustness. Clearly (just as for zero-temperature crystal structure prediction) the global minimum depends on the choice of the exchange-correlation functional when energy differences are small.

Discussion

Until now, finite-temperature crystal structure prediction was thought to be prohibitively expensive. Here we showed a computationally efficient approach solving this problem, and illustrated its power by applying it to five very different substances: a simple metal (Al at high pressures and temperatures), a transition metal (Fe in Earth’s core), a geologically important silicate (MgSiO3 at conditions of the lowermost mantle), a hard refractory compound WB with a temperature-induced phase transition and a ceramic oxide (HfO2). We find that the hcp phase of aluminum has a wider stability field than previously thought, and the temperature-induced α-β transition in WB occurs at 2789 K. It is also found that iron has hcp structure at conditions of the Earth’s inner core, and the much debated (and important for constraining Earth’s thermal structure) Clapeyron slope of the post-perovskite phase transition in MgSiO3 is 5.88 MPa/K. For HfO2 we find a number of competitive phases with small free energy differences, making the choice of exchange-correlation functional critical for correct predictions. We also show how this method can be used, in the spirit of a computational experiment akin to a real experiment, to probe phase diagrams, resolve long-standing disputes, and open new horizons in the search for unique materials with improved properties. Our method takes advantage of increasing simplification of the topology of the free energy landscape on increasing temperature, and of reliable machine learning forcefields and thermodynamic perturbation theory which allow highly accurate and affordable calculations of free energies. This development enables crystal structure prediction at any temperature for ordered materials. Further work is needed to extend T-USPEX approach to configurationally or magnetically disordered systems in a numerically robust and computationally affordable way.

Methods

DFT calculation details

Crystal structure relaxations, energy calculations at 0 K and ab initio molecular dynamics were performed using density functional theory (DFT) as implemented in the VASP code65,66,67 within Perdew–Burke–Ernzerhof (PBE)68 functional. Projector-augmented wave (PAW)69 method was used to describe core electrons and their interaction with valence electrons. The plane wave kinetic energy cutoff was set at 500 eV and Γ-centered k-points meshes with a resolution of 2π × 0.05 Å−1 were used for sampling the Brillouin zone. For metals, the electronic free energy was calculated and included in the total free energy. Ab initio molecular dynamics was performed in the NPT ensemble during 5 ps with 1 fs timestep. The convergence criterion for electronic step was set to 10-6 eV. Molecular dynamics with classical or ML forcefields was performed using the LAMMPS code70.

Interatomic potentials

The choice of interatomic potential plays an important role in T-USPEX calculations. If, for a given system, a good classical forcefield is known, then it can be applied in molecular dynamics simulations (as we did for MgSiO3). However, for most systems there is no classical forcefield which can work in a vast configurational space (created by random structures from T-USPEX). In this case, we use a machine learning forcefield trained on ab initio data. We used MTP machine learning forcefield23, due to its outstanding performance33 and ability to perform active learning27, i.e., re-train the forcefield whenever a structure different from its original training set is encountered. We considered MTP potential to be reliable if the error on energies was about few meV/atom and the error on forces not more that 10%. For Fe, we trained one ML forcefield and then applied it to all structures. For the other cases (Al, WB, HfO2), we separately trained a ML forcefield for each structure at a given P–T-point, which allowed us to check and confirm numerical stability of our procedure.