Introduction

Facile formation of high-quality metal halide perovskites (MHPs) in various forms ranging from nanocrystals to thin films using solution-based facile approaches provides them leverage over Si and III-V semiconductors1,2,3. In fact, the growth of MHP structures largely dictates their optoelectronic properties, which translate into remarkable performances for perovskite devices4,5,6,7,8. Generally, single- or two-step methodology is employed to grow high-quality perovskite structures9,10,11. The two-step method, which was developed for the deposition of Sn-based Ruddlesden-Popper (RP) perovskite phases12,13, involves the conversion of metal halide (MX2) into AMX3 perovskite phase (M=Pb2+, Sn2+, X= I-, Br-, Cl-, and A = methylammonium (CH3NH3+), formamidinium (NH2)2CH+), Cs+). Although these perovskite conversion reactions (PCRs) are as important as electrochemical conversion reactions involving lithium-ion insertion14, their fundamental understanding has been still evolving15.

By optimizing the deposition and formation of perovskite thin films, an unprecedented advancement in terms of power conversion efficiencies for perovskite solar cells (PSCs) and external quantum efficiencies for perovskite light-emitting devices has been realized6,7. While much of the focus had remained on improving the device performances, in the recent past several attempts have been made to understand the PCRs16,17. For example, a fractional diffusion of the MAI solution into the PbI2 film was reported by investigating the crystallization dynamics of the perovskite phase18. Fundamentally, the solvation affects the chemical potential of A-cations and X-anions and the studies concerning the role of isopropyl alcohol, organic-halide salt concentration, additive ions and temperature revealed the variations in perovskite formation and crystallization while employing x-ray and spectroscopy-based techniques19,20,21,22.

In addition to nucleation, the experimental conditions substantially influence the growth and orientation of perovskite grains23. While the symmetry of morphology seems to remain largely conserved, a diverse range of shapes has been observed in the case of thin films23. As solvation plays a critical role, substantial changes in the crystallization dynamics during the drying process cannot be ruled out. This also implies that the growth models applied to the data acquired from the post-growth scans, i.e., after drying or annealing the films, are inadequate to reveal the complete phenomenology of the kinetics of these conversion reactions18. Besides inherent energetic factors, the PCRs are strongly dependent on extrinsic factors, such as the dimensions and orientation of PbX2 structures, which need to be considered while proposing the mechanism of PCRs. Furthermore, the sensitivity of the PCRs to illumination and vulnerability of lead halide and perovskite framework to the electron beam pose intricate challenges, which consequently could render employing spectroscopy or electron microscopy-based techniques to study these PCRs inadequate17,18. In brief, the detailed kinetic and thermodynamic understanding, particularly from the structural point of view at the nano-regime, is still missing24,25.

Given the fundamental as well as the technological significance of these PCRs, herein, we examined the structural evolution of precursor and perovskite phase using in situ synchrotron x-ray scattering to investigate the phenomenology of formation of APbX3 from PbX2 and AX for MAPbI3, FAPbI3, FAPbBr3 and MAPbBr3 systems. Such an in-depth investigation allowed us to correlate the kinetics of the conversion reactions with the nature of both the lead halide framework and A-cation. We also monitored the growth and orientation of the perovskite grains as the conversion progresses. Furthermore, we exploited classical molecular dynamics (MD) and density functional theory (DFT) calculations to understand the diffusion of AX into PbX2 and to estimate the hopping times along with their comparison with the experimental characteristic times.

Results and discussion

The extent of PCRs is highly dependent on the dimensions and morphology of PbX2 structures13 and the inherent complexities associated with the partial conversion of thick PbX2 films into the three-dimensional perovskite phase render understanding their kinetics and energetics quite intricate26. We carefully mitigated these issues by investigating the kinetics of PCRs using PbX2 confined within 30 nm mesopores of 500 nm thick TiO2 scaffold through in situ synchrotron x-ray scattering. The excellent infiltration of the perovskite components into the TiO2 pores is evident from the Ti, Pb, I, and C maps acquired using scanning transmission electron microscope-energy dispersive spectroscopy27 (Fig. 1a–c).

Fig. 1: Conversion reaction leading to the formation of MAPbI3 within TiO2 mesopores.
figure 1

ac Scanning transmission electron microscope-energy dispersive spectroscopy (STEM-EDS) analysis for MAPbI3 after conversion: a Ti map (showing cross-section of mesoporous TiO2 film). b Ti, Pb, and I map and c C map displaying infiltration of MAPbI3 within the mesoporous TiO2 film. d Absolute Bragg peak intensity against the time of the MAPbI3 conversion reaction: integrated intensity vs time of the consumption of PbI2 (red trace) and formation of MAPbI3 (blue trace). The intensities of the most intense Bragg reflections were integrated, normalized and plotted against time. Reciprocal maps of the PbI2 + MAI perovskite conversion reaction at e 0 s f 50 s and g 1000 s after the MAI- isopropyl alcohol solvent was introduced.

In-situ perovskite crystallization as a function of composition

The real-time grazing incidence wide-angle scattering shows the rapid formation of MAPbI3 for the reaction of PbI2 and MAI, as evident from an abrupt increase in the intensity of the Bragg peak corresponding to the perovskite phase within the first 10 seconds after the application of MAI (Fig. 1d, blue trace)16. MAPbI3 peak intensity smoothly saturates on a time scale of a few 100 seconds, mirrored by the consumption of the PbI2 phase (Fig. 1d, red trace). The consumption of preferentially oriented PbI2 (Supplementary Fig. 1) and the formation of MAPbI3 is evident from the reciprocal maps acquired at different times (Fig. 1e–g). Even after 1000 s, the slope corresponding to PbI2 did not saturate, inferring the presence of inaccessible PbI2, correlating the reciprocal map (Fig. 1g). The presence of such a weak PbI2 feature would be difficult to resolve using conventional spectroscopy or x-ray diffraction (XRD)16,28.

We also examined the conversion of PbBr2 to MAPbBr3 (Fig. 2 and Supplementary Figs. 1b and 2a). As evident from the temporal evolution of the Bragg peak intensity (Fig. 2a, pink trace), MAPbBr3 crystallizes more slowly than MAPbI3, indicating that the PbX2 structure influences the kinetics of conversion reactions. We further investigated the impact of the A-site cation on the reaction kinetics by treating PbBr2 with FABr solution (Fig. 2a, blue trace and Supplementary Fig. 2b). Interestingly, the formation of FAPbBr3 resembles more that of MAPbI3, since a larger fraction of perovskite is formed at the very beginning followed by slower growth. Also, the conversion of FAPbBr3 is initially slightly faster compared to MAPbBr3, revealing the significance of the A-site cation for the conversion reaction. However, none of the two reactions reaches saturation within 1200 s. The formation of cubic phases of MAPbBr3 and FAPbBr3 is supported by the corresponding reciprocal maps (Fig. 2b, c, Supplementary Fig. 3). By changing both lead halide and organic salts to PbCl2 and MACl, respectively, the general features as exhibited by other PCRs are observed (Supplementary Fig. 4). A more detailed interpretation of the real-time data is achieved using the (modified) Kolmogorov-Johnson-Mehl-Avrami theory of crystallization (KJMA), which models the evolution of nucleation and growth phenomena with time29,30,31,32,33. Assuming that the integrated intensity at any given time is proportional to the instantaneous volume of the perovskite, we fit the experimental data by the function: \(I(t)=({c}_{\infty }+\alpha \cdot t)\{1-{\exp }[-{(t/\tau )}^{n}]\}\), τ is the characteristic time of crystallization, n is the KJMA exponent and depends on the nature of the limiting step of the process, α is the asymptotic value of the peak intensity and is an empirical term added to consider that crystallization at the surface of PbX2 grain starts before that in the deep. The fitting of the experimental data (Supplementary Fig. 5) reveals that the KJMA exponent is in the range 0.5-1 (Supplementary Table 1), which is characteristic of the diffusion-limited crystallization in low-dimensionality systems. The kinetics of the PCRs follows the order MAPbI3 > FAPbBr3 > MAPbBr3, indicating that the crystallization dynamics depends on the nature of both halide and A-site ions.

Fig. 2: Conversion reactions leading to the formation of FAPbBr3/MAPbBr3/FAPbI3 perovskites within TiO2 mesopores.
figure 2

a Absolute Bragg peak intensity against time of the measured perovskite conversion reaction: integrated intensity vs time for the formation of MAPbBr3 and FAPbBr3. Reciprocal maps of b PbBr2 + MABr and c PbBr2 + FABr perovskite reactions after 1000 s. Broad ring around 1.5 (1/Å) is attributed to the isopropyl alcohol solvent. d Absolute Bragg peak intensity against time of the PbI2 + FAI perovskite conversion reaction: integrated intensity vs time of consumption of PbI2 (solid black colour) and formation of trigonal (solid red colour) and hexagonal phases of FAPbI3 (solid blue colour). e, f Reciprocal maps of the PbI2 + FAI perovskite reaction after e 50 s and f 1000 s after the solution was added. The image at 50 s shows Bragg peaks corresponding to both trigonal (black) and hexagonal (yellow) phases of FAPbI3. After 1000 s, the peaks of the trigonal phase have almost disappeared while the peaks of the hexagonal (yellow) phase have intensified.

For efficient light-harnessing, FAPbI3 with a bandgap of 1.48 eV is considered more desired than MAPbI334, however, understanding the formation of the photoactive (trigonal perovskite phase) FAPbI3 has been quite crucial, given its lower thermodynamic stability under ambient conditions35,36. We investigated the kinetics of FAPbI3 formation by treating PbI2 with FAI solution. Evidently, the intensity of PbI2 phase drops sharply whereas the intensity of the FAPbI3 trigonal phase rises quickly within the first 10 seconds (Fig. 2d), like the MAPbI3 perovskite. After 50 seconds, the peak intensity corresponding to FAPbI3 trigonal phase starts to decrease corroborating with its unstable nature35, conversely, the hexagonal phase, which is thermodynamically more stable, grows slowly and eventually saturates (Fig. 2d–f). After 20 min, the Bragg peak of the hexagonal yellow phase has intensified, while the peaks corresponding to the trigonal phase has nearly vanished.

Domain size and orientation

We monitored the growth of perovskite grains by estimating the crystallite size from the previously described peaks, via the formula d = 2π/FWHM (Full-width half-maximum). All PCRs showed an increase in the domain size over time (Fig. 3a), except for the iodide-based system, which has an initial domain size larger than our resolution limit (25 nm)23. From the beginning, (202) planes of MAPbI3 are strongly oriented with respect to the substrate with an FWHM increasing from <5° to 15° during the experiment (Fig. 3b, c), whereas, in the case of MAPbBr3, the preferred orientation of (001) planes increases as the growth proceeds (Fig. 3d). In fact, the uniformly distributed Bragg intensity of MAPbBr3 forms a broad maximum with a width of 41° at the end of the real-time measurement. On the contrary, FAPbBr3 shows no preferential orientation as the Bragg peak intensity remains uniformly distributed during the experiment. Furthermore, the comparative analysis of real-time and post-growth results, with FWHM changing from 41° to 29° for MAPbBr3, clearly demonstrates that the dimensions and orientation of perovskite crystallites substantially change during the drying process (Supplementary Fig. 6). Therefore, the growth models employed on the data acquired from the dried (post-growth scans) perovskite samples are inadequate to propose the mechanism of these PCRs16,18.

Fig. 3: Growth and crystallographic orientation of perovskite grains.
figure 3

a Crystal domain size estimated by the radial peak width (FWHM) as a function of reaction time and the domain size growth of iodide perovskite is quite rapid and the resolution limit is reached within seconds. b Table summarizing preferred orientation and angular distribution, and preferred orientation of c MAPbI3 and d MAPbBr3 grains with respect to the plane of the substrate. The preferred orientation of perovskite crystallites during the real-time experiment was determined by investigating the angular intensity distribution for the respective Bragg reflections.

Classical molecular dynamics simulations and density functional calculations

To gain further insight into the mechanism of PCRs, we used classical MD simulations and DFT calculations. The transformation from PbX2 to the corresponding perovskite can be categorized into three stages. The conversion reactions involve (i) X- and A+ ions, which from the solution are absorbed in the slab-like structure of the PbX2 (Fig. 4a–d, e, k), (ii) the ions aggregate and form an intermediate AX-PbX2 complex (Fig. 4f–h, l–o), and (iii) finally the AX-PbX2 complex transforms into the corresponding perovskite structure, involving the reorganization step (Fig. 4i, p–q)18,28.

Fig. 4: Classical molecular dynamics and density functional theory calculations.
figure 4

a–d Selected configurations of ions in isopropyl solution a MA+, b FA+, c I- and d Br-. The yellow shadow is added to help identify the ions in the solution. Initial, intermediate, and final structures along with the CRs bringing to ei MAPbI3, k and lp MAPbBr3 and k and nq FAPbBr3. The first block of panels ei and kq shows the lateral view of the precursor PbI2 and PbBr2 structures, putting in evidence the (quasi)-layered structure where intercalation of A+ and X- takes place. The second block shows A+ and X- ions intercalated in the precursor. The third block highlights the MAI-PbI2 and MABr-PbBr2 intermediate phases. Finally, the fourth block shows the final products, the perovskite structures. j Energy diagram of the stable and metastable phases formed along the conversion reaction PbX2+A+sol+X-sol → APbX3 (see also Supplementary Table 2). The energy of reactants, AXsol + PbX2, in particular the energy of solvated A+ and X- ions, is obtained from DFT calculations of configurations extracted from extensive Classical MD simulations (see the Methods).

Firstly, we focused on the structure and energetics of the intermediate compounds. In the first intermediate complex, MA+ and I- ions are intercalated in between PbI2 layers. MA+ is coordinated by four I-, three belonging to a common slab and one to the neighbouring slab (Fig. 4f) and its uptake from the solution (Fig. 4a) is energetically favourable. Intercalated I- binds to two Pb2+ ions of the neighbouring slabs but the repulsive interactions with the six nearest I- make the absorption of the iodide ion from the solution unfavourable (Fig. 4g). Overall, the uptake of a formula unit (f.u.) of MAI requires an intercalation energy of ~1.85 eV† (Fig. 4j, blue trace). Here and in the following, we report energies per AX formula unit of the relevant optimized structures. This can be seen as a crude 0K approximation to the free energy. In the Supplementary Discussion, we discuss why an extension to finite temperature free energy is presently impossible. For AX in solutions, we compute the average of DFT energies of configurations randomly extracted from classical MD simulations of the sample (Supplementary Table 2). We remark that this energy is relative to the energy of AX, here MAI, dissolved in isopropyl alcohol; hence, the energetics discussed here and below also depends on the solvation of A+ and X-. Although the endothermicity of the AX uptake step seems to be the general behaviour of all the PCRs, some fundamental differences exist. The structure of PbBr2 can also be considered as a layered structure with undulated PbBr2 planes, in which MA+ or FA+ and Br- can intercalate (Fig. 4k); however, the coordination of MA+ and Br- is relatively poor owing to the local configuration of bromide ions (Fig. 4l). Specifically, the intercalation of Br-, which lies in line with the bromide ions of PbBr2 and interacts with a single Pb2+ (Fig. 4m), requires a significant distortion of the PbBr2 lattice. Indeed, the intercalation of Br- in PbBr2 resembles more an interstitial defect. Moreover, MA+ intercalated in the undulated PbBr2 planes have poorer coordination with the halide ions than in the PbI2 case (Fig. 4l). These effects concur to increase the energy penalty to be paid to intercalate a (dispersed) MA+-Br- f.u. into PbBr2 from the (bulk) isopropyl solution (Fig. 4a, d) to 5.7 eV (Fig. 4j, green trace). In contrast, relatively poorer solvation of FA+ by the isopropyl alcohol (Fig. 4b, Supplementary Fig. 7) arising from the reduced polarity of FA+ as compared to MA+ renders the intercalation of FA+ energetically more favourable. This eventually leads to a low intercalation energy of 1.7 eV for FA+-Br- f.u. into PbBr2 (Fig. 4j dark green). (see the Methods).

Intercalated A+ and X- ions, which initially are randomly dispersed between the PbX2 slabs, interact through electrostatic forces. In the case of MAI and MABr systems, such a configuration leads to the formation of an intermediate state, i.e., a local minimum of the potential energy, consisting of AX-PbX2 compounds, in which all A+ and X- sites are occupied (Fig. 4h, o). In fact, MAI-PbI2 and MABr-PbBr2 are more stable than the reactants, i.e., AX in isopropyl alcohol and solid PbX2 by 1.1 and 2.5 ev/f.u., respectively. This provides the first driving force to the PCRs. The transformation of the intermediate state into the perovskite structure (Fig. 4i, p, q) brings an additional energy gain of ~0.2 eV/f.u. which provides the driving force to the reorganization of fully intercalated compounds into the corresponding perovskite structure resulting in an overall gain of energy with respect to AXsol+PbX2 of 1.35 and 2.65 eV/f.u. for MAPbI3 and MAPbBr3, respectively. These energy gains are consistent with the order of magnitude of Pb-I and Pb-Br bonding enthalpies available in Chemistry Handbooks37, 0.8–1.8 and 1.2–2 eV/bond, respectively, and can be mainly attributed to the extra Pb-X bond formed in the conversion reaction AX + PbX2 → APbX3. Interestingly, the case of FABr-PbBr2 is different as this intercalated compound does not form a complex intermediate state and the further transformation into FAPbBr3 is a barrierless process. The overall reaction between solvated FABr and solid PbBr2 into FAPbBr3 brings an energetic gain of ~7 eV/f.u . This energy gain is larger than that computed for the corresponding methylammonium perovskite and, consistently with the above analysis of intercalation energy of FABr in PbBr2, we attribute it to the poorer solvation of FA+ in the isopropyl alcohol with respect to MA+ (see also Supplementary Fig. 7).

We also investigated the migration of ions from site to site between the PbX2 slabs. In the case of MAI-PbI2 system, the migration can be interpreted as a 2D stepwise diffusion process with a migration barrier of 0.375 eV for MA+ (~15 kBT at room temperature, with kBT the thermal energy available to the system) and a double barrier of 0.30 (12 kBT) and 0.15 eV (6 kBT) for I- (Fig. 5a, b). These barriers correspond to hopping times, the time to move from one site to another, of ~8·10-8 and ~4·10−9 s, respectively, for MA+ and I-. The hopping time is estimated using the Arrhenius-like relation \({{{{{{\rm{t}}}}}}}_{H}=\hslash /{{{{{{\rm{k}}}}}}}_{B}{{{{{\rm{T}}}}}}\,{exp}[\Delta {{{{{\rm{E}}}}}}/{{{{{{\rm{k}}}}}}}_{B}{{{{{\rm{T}}}}}}]\), where \(\Delta {{{{{\rm{E}}}}}}\) is the migration barrier, \({\hslash }\) the Planck constant (divided by \(2{{{{{\rm{\pi }}}}}}\)) and \({{{{{{\rm{k}}}}}}}_{B}{{{{{\rm{T}}}}}}\) the thermal energy at temperature \({{{{{\rm{T}}}}}}\). We remark that this formula, which has been already successfully used to investigate ionic migration in halide perovskites38,39 approximates the more appropriate transition state theory40 in which the pre-exponential factor considers the so-called dynamical effects of the given system (recrossing of the transition state) and the exponential term depends on the free energy rather than on the energy of the transition state. Due to the undulations of the PbBr2 planes, the diffusion of MA+, FA+, and Br- in PbBr2 takes place along the [100] direction (Fig. 4l–p). The diffusion mechanism of Br- is concerted and involves three bromide ions (Fig. 5e), and is characterized by a barrier of 0.12 eV (5 kBT), which is lower than the diffusion barrier of I- in PbI2. Conversely, the migration of MA+ is hindered by the undulation of PbBr2 slabs (Fig. 5d) and is characterized by a higher barrier of 0.575 eV (~23 kBT). The estimated hopping time of MA+ and Br- in PbBr2 are ~2×10-4 and ~4×10-12 s, respectively, suggesting that the formation of the MABr-PbBr2 intermediate structure is kinetically limited by the migration of MA+. The migration barrier for FA+ in PbBr2 is 0.45 eV (~ 18 kBT) (Fig. 5g), lower than that of MA+, and the associated hopping time is ~2·10-6. In summary, the diffusion of FA+, and MA+ cations in PbBr2 framework is slower than the migration of MA+ (I-) in PbI2.

Fig. 5: Paths of the various stages of the conversion reaction.
figure 5

We use a stroboscopic representation of motion to draw the dynamics of the relevant atoms involved in the various processes: the atoms and the bonds are coloured in red at the beginning of the process and, passing by the green, become blue at the end. The barrier associated with each stage is also reported in Fig. 4. Panels a, b, d, e, and eg show the migration of A+ and X- for the MAPbI3, MAPbBr3 and FAPbBr3 system, respectively. Panels c, f represent the reorganization stage of the process in which MAI-PbI2 and MA-PbBr2 transform into MAPI3 and MAPBr3, respectively.

Once AX-PbX2 is formed, the reorganization of the structure into a 3D APbX3 perovskite structure is achieved through the sliding of the crystal planes (Fig. 5c, f). Despite the substantial structural rearrangement, the energy barrier of this transformation is only 0.14 eV (~ 5.5 kBT) and 0.2 eV (~ 8 kBT) for MAPbI3 and MAPbBr3, respectively. Probably due to the bulkier FA+ ion, the reorganization of FABr-PbBr2 into FAPbBr3 is a barrierless process. These barriers are lower than migration barriers indicating, consistently with experiments, that the perovskite formation process is diffusion-limited, with diffusion occurring in low dimensional geometries, i.e., 2D for MAI in PbI2 and 1D for MABr and FABr in PbBr2. Given the layered structure of PbI2, the process of FAPbI3 formation begins with the intercalation and formation of FAI-PbI2 complex. The formation of the hexagonal FAPbI3 phase requires a substantial structural reorganization- involving the making and breaking of several Pb-I bonds and migration of FA+ into the PbI3 framework. In contrast, as seen for the other APbX3 cases, probably the transformation from the intercalated FAI-PbI2 structure into the perovskite phase requires overcoming a relatively small barrier. This might explain why the formation of the perovskite phase is kinetically favoured over the hexagonal phase of FAPbI3.

Conclusions

The crystallization of different representatives of metal halide perovskite semiconductors showed that the rate of formation falls in the order MAPbI> FAPbI> FAPbBr> MAPbBr3. In particular, MAPbI3 grows very rapidly and saturates quickly. FAPbBr3 exhibits faster kinetics as compared to MAPbBr3. Interestingly the formation of FAPbI3 trigonal phase, which is thermodynamically unstable at room temperature, is observed, however, after 50 seconds, the peak intensity corresponding to the trigonal phase starts to decrease whereas the hexagonal phase grows and eventually saturates. The growth of perovskites follows the modified KJMA kinetics with KJMA exponents typical of processes controlled by confined diffusion and a characteristic time in the range of 5–400 s. We modelled perovskite formation as a three-stage process: uptake of A+ and X- ions from the solution into the slab-like PbX2 precursor structure, diffusion of the ions in the precursor to form intermediate AX-PbX2 compounds and a final reorganization of the intermediate into the corresponding perovskite. Classical MD simulations and DFT calculations have shown that the kinetics of the process is diffusion-controlled, and the hopping times follow the same order as the experimental characteristic times. In summary, real-time analysis together with MD simulations and DFT calculations revealed kinetic and thermodynamic insights that add new dimensions to the conversion reactions and will immensely contribute to the advancement of perovskite-based technologies.

Methods

Conversion reactions

The organic halide, MX (MAI, MABr, FAI, FABr) salts were purchased from Greatcell Solar, PbI2 and PbBr2 from TCI. Fluorine doped tin oxide (FTO) substrates (NSG 10, Nippon sheet glass, Japan) were cleaned with a Hellmanex solution and afterwards rinsed with de-ionized water and ethanol. Then, they were treated with a UV/O3 cleaner for 15 min. A ~30 nm thick compact TiO2 layer was deposited via aerosol spray pyrolysis at 450 °C using a commercial titanium diisopropoxide bis(acetylacetonate) solution (75% in 2-propanol, Sigma-Aldrich) diluted in ethanol (Sigma-Aldrich) (1:9, volume ratio). A ~500 nm mesoporous TiO2 layer was deposited onto the TiO2 compact layer by spin-coating a solution of a diluted paste of 30 NRD (Greatcell Solar) in anhydrous ethanol (1: 3.5 weight ratio) at 5,000 r.p.m. for 20 s with a ramp-up of 2,000 r.p.m. The resulting films were annealed at 450 °C for 30 min under dry airflow41. 1.2 M lead halide, PbX2 (X: I-, Br- or Cl-) precursor solutions were prepared in N, N-dimethylformamide (DMF) (Sigma-Aldrich) by constant stirring at 100 °C for 15 min. Lead halide solutions were spin-coated onto the mesoporous TiO2 films at 6500 rpm for 30 s. Subsequently, the films were annealed at 80 °C for 15 min, after cooling to room temperature, the films were handled under inert conditions. After mounting on the stage, 200 µL of isopropanol solution of MX (50 mM) (M= MA, methylammonium (CH3NH3+) or FA for formamidinium ((NH2)2CH+) and X= I-, Br- or Cl-) was introduced onto the subsequent lead halide films using a Syringe pump.

Realtime XRD and analysis of data

X-ray scattering experiments were done at beamline ID10 of the ESRF with a photon energy of 22 keV under a nitrogen atmosphere. The beam size was 20 µm in a vertical direction and 120 µm in a horizontal direction. GIWAXS data were measured with a PILATUS 300k (487 × 619 pixels; pixel size: 0.172 mm) with a sample−detector distance of 472 mm under an angle of incidence of 0.14°. Integration times for each image were 0.2 s during the initial stages of conversion and 2s for the final stages of conversion. Before peak fitting, all images were transformed from angular space to q-space and corrected for refraction effects.

Domain size and orientation

We monitored the growth of perovskite grains by estimating the crystallite size from the previously described peaks, via the formula d = 2π/FWHM (Full-width half-maximum). Not merely the dimensions of the coherently scattering domain influence the FWHM of the measured Bragg peaks on the 2D detector, but also the q-dependent resolution limit leads to a broadening. Therefore, to account for the fact that the resolution limit depends on the q-position of the Bragg peaks, the graphs in Fig. 3a were normalized by their peak position.

Theoretical Section

Classical Molecular dynamics (MD)

Classical MD simulations have been performed to sample the configurations of A+ and X- ions in isopropyl alcohol. In fact, at variance with the case of the same ions embedded in the PbX2 precursor, ions solvated in a liquid can present many non-equivalent configurations that one must consider estimating the energy of the system. The constant number of particles, pressure, and temperature (NPT)42 simulations were performed using the LAMMPS code43, suitably combining the GAFF potential44 for isopropanol and the MYP potential for hybrid perovskite ions32,33,45. Along the MD trajectory of the ions in pure isopropanol solution with samples consisting of 32 solvent molecules and one ion (MA+, FA+, I- or Br-, respectively) we saved 500 configurations. For these configurations, we computed the density functional theory energy (DFT – see computational details below), from which we obtained the average energy of the sample that we then used to estimate the energy of intercalation (Fig. 4j).

Ab-initio calculations

Density functional theory calculations were performed taking in due consideration van der Waals interactions. In fact, while the relevance of van der Waals interactions for determining perovskite properties is debated46, they are key in stabilizing the precursor materials, PbX2, in which two partly negatively charged halide layers face each other. In fact, in the absence of van der Waals interactions, it is impossible to reproduce the lattice parameters of the (quasi-) layered PbX2 structures within an acceptable accuracy (1–2%). We obtained good agreement of structural data for precursors and perovskites using both the so-called semi-empirical Grimme method47 in combination with the Perdew-Burke-Ernzerhof (PBE)48 exchange and correlation functional as well as with the so-called vdW-DF2 functional of Lee, Murray, Kong, Lundqvist, and Langreth49.

Computational samples of the precursor, intermediate phase and perovskite consisted of 64 stoichiometric units, which guaranteed to minimize the interactions with periodic images of A+ and X- intercalated ions as well as allowed for the intrinsic disorder of A+ ions within the inorganic framework of the corresponding perovskites. We checked that with such large samples the Γ-point sampling of the Brillouin zone is sufficient to achieve well-converged forces and energies. The interaction between valence and semi-core (Pb) electrons and core electrons and nuclei is described by ultrasoft Rappe-Rabe-Kaxiras-Joannopoulos pseudopotentials50. Kohn-Sham orbitals have been expanded on a plane-wave basis set with an energy cutoff of 40 Ry. The present setup has been successfully used in a number of previous works30,51,52,53,54. Absolute energy is ill-defined in a periodic system and energy alignment is necessary. For systems containing lead, energies are shifted so as to align the energy of semi-core Pb-5d orbitals. This approach has been successfully applied by some of the authors in the previous works46,51,54 Alignment with ions in solution is obtained via the average value of valence s orbitals of C, N (of MA+ and FA+), Br, I, which has already been proven to be a reliable alignment approach55,56. For systems containing iodide ions, we double-checked the accuracy of such an alignment approach by performing an analogous procedure using semi-core 4d orbitals.

Configurations of the ions intercalated in the PbX2 precursor have been searched by an extensive exploration of the configuration space, performing cell and geometry optimizations starting from several (5 to 10) different initial positions and, in the case of MA+ and FA+, orientations. The energy of embedded ions is then obtained by averaging over the energies of the various optimized geometries weighted by the corresponding Boltzmann weights.

Transition paths of the transformations from A+/X--PbX2 to AX- PbX2 and from AX-PbX2 to APbX3 have been determined using the string method57,58. This method allows one to identify the most likely transition path, i.e. the optimal path connecting initial and final state among the many. Along this path, we determined the energetics of the process, i.e., the relative energy of the initial and final state, and the transition barrier, i.e., the barrier the system has to overcome to accomplish the process.

In the string method, one represents the reaction path as a parametric curve, \({{{{{\bf{r}}}}}}({{{{{\rm{\lambda }}}}}})\), in the space of the atomic configurations (\({{{{{\bf{r}}}}}}\) is the 3N vector of the atomic positions). λ is a parameter measuring the degree of progress of the transition: λ = 0 when the system is in the initial state, and λ = 1 when it is in the final one. It can be shown57,58 that the most probable path is the one with zero component of the atomic forces in the direction orthogonal to the path:

$${\left[-{{{{{\boldsymbol{\nabla }}}}}}V\left({{{{{\bf{r}}}}}}({{{{{\rm{\lambda }}}}}})\right)\right]}_{\perp {{{{{\bf{r}}}}}}({{{{{\rm{\lambda }}}}}})}=0$$

In the string method, the continuous path (λ) is discretized into a finite number, L, of configurations (snapshots),\(\,{\left\{{{{{{\bf{r}}}}}}({{{{{{\rm{\lambda }}}}}}}_{{{{{{\rm{i}}}}}}})\right\}}_{{{{{{\boldsymbol{i}}}}}}{{{{{\boldsymbol{=}}}}}}{{{{{\boldsymbol{1}}}}}}{{{{{\boldsymbol{,}}}}}}{{{{{\boldsymbol{L}}}}}}}\). These snapshots satisfy the additional condition to be at a constant distance from each other: | \({{{{{\bf{r}}}}}}({{{{{{\rm{\lambda }}}}}}}_{{{{{{\rm{i}}}}}}})\)\({{{{{\bf{r}}}}}}({{{{{{\rm{\lambda }}}}}}}_{{{{{{\rm{i}}}}}}+1})\)| = | \({{{{{\bf{r}}}}}}({{{{{{\rm{\lambda }}}}}}}_{{{{{{\rm{j}}}}}}})\)\({{{{{\bf{r}}}}}}({{{{{{\rm{\lambda }}}}}}}_{{{{{{\rm{j}}}}}}+1})\)|.

Starting from an initial guess, the path is evolved according to the steepest descent dynamics driven by the component of the forces perpendicular to the path: \(-{{{{{\boldsymbol{\nabla }}}}}}V\left({{{{{\bf{r}}}}}}({{{{{{\rm{\lambda }}}}}}}_{{{{{{\rm{i}}}}}}})\right)({{{{{\bf{1}}}}}}-{{{{{\rm{\alpha }}}}}}({{{{{\bf{r}}}}}}({{{{{{\rm{\lambda }}}}}}}_{{{{{{\rm{i}}}}}}}))\otimes {{{{{\rm{\alpha }}}}}}({{{{{\bf{r}}}}}}({{{{{{\rm{\lambda }}}}}}}_{{{{{{\rm{i}}}}}}})))\), whit 1 identity matrix and \({{{{{\rm{\alpha }}}}}}({{{{{\bf{r}}}}}}({{{{{{\rm{\lambda }}}}}}}_{{{{{{\rm{i}}}}}}}))\) unit vector tangent to the path at the i-th point; in practice, \(({{{{{\bf{1}}}}}}-{{{{{\rm{\alpha }}}}}}({{{{{\bf{r}}}}}}({{{{{{\rm{\lambda }}}}}}}_{{{{{{\rm{i}}}}}}}))\otimes {{{{{\rm{\alpha }}}}}}({{{{{\bf{r}}}}}}({{{{{{\rm{\lambda }}}}}}}_{{{{{{\rm{i}}}}}}})))\) is a projector on the plane orthogonal to the path at the point \({{{{{\bf{r}}}}}}({{{{{{\rm{\lambda }}}}}}}_{{{{{{\rm{i}}}}}}})\). Indeed, since the tangential component of the force has only the effect of changing the distance between successive snapshots, a more efficient algorithm consists in i) evolving the path according to the entire force and ii) imposing the equidistance condition by moving the snapshots along the polygonal joining the configurations \(\,{\left\{{{{{{\bf{r}}}}}}({{{{{{\rm{\lambda }}}}}}}_{{{{{{\rm{i}}}}}}})\right\}}_{{{{{{\boldsymbol{i}}}}}}{{{{{\boldsymbol{=}}}}}}{{{{{\boldsymbol{1}}}}}}{{{{{\boldsymbol{,}}}}}}{{{{{\boldsymbol{L}}}}}}}\) obtained in i). This two-step process is repeated until the maximum component of the atomistic force orthogonal to the path is below 10−3 Hartree/Bohr (atomic units), the same convergence criterion that is typically used in cell optimizations. On the converged string we apply the “climbing algorithm”, which moves the higher in energy snapshot upward, toward the maximum of the energy along the path. This allows us to accurately determine the transition barrier. Ab initio calculations were performed using the pw.x (cell optimization and energy calculations) and neb.x (string calculations) modules of the Quantum Espresso package59.