Introduction

Far-from-equilibrium, excited state processes are key to a broad range of modern applications, ranging from solar energy harvesting, to optoelectronics, quantum information processing, and medicine1,2,3,4,5,6,7. Further progress relies on ability to model the processes on the atomistic level, capturing realistic aspects of system structure associated with defects, interfaces, surfaces, etc. A methodology of choice should capture the highly non-equilibrium nature of the evolution of coupled electronic, vibrational, spin and other relevant degrees of freedom. A combination of real-time time dependent density functional theory (TDDFT) and nonadiabatic (NA) molecular dynamics (MD) provides the desired framework8,9,10,11,12,13,14,15,16,17,18,19, as it mimics nature in the most direct way, and allows one a detailed modeling of time-resolved spectroscopy measurements performed by experimentalists to elucidate excited state dynamics in a broad range of systems. NAMD/TDDFT calculations carry a high computational cost that should be reduced to make the approach applicable to new classes of systems and problems.

Metal halide perovskites (MHPs) is a modern material with complex electron-vibrational dynamics and a great potential for solar energy, optoelectronic and other applications because of their favorable optical and electronic properties20,21,22,23,24,25,26,27,28. The intrinsically strong light absorption, tunable bandgap, long charge carrier lifetimes, efficient carrier transport, and low manufacturing cost appeal highly to investigators from both academia and industry. Since the first reported MHP solar cell in 200929, the power conversion efficiency has risen rapidly from 3.8% to 26%30,31. MHPs covers a large family of compounds with the general formula ABX3, where A is either an organic cation, e.g., CH3NH3+ and CH(NH2)2+, or an inorganic cation, e.g., Cs+, B is a metal cation, such as Pb2+, Sn2+ and Ge2+, and X is a halide anion, including Cl-, Br- and I-. MHPs exhibit simultaneously features of inorganic, organic and even liquid matter: The periodic inorganic lattice ensures efficient charge transport. Similar to organic matter, MHPs undergo a variety of photochemical reactions, and analogies can be drawn between large polarons in MHPs and ion solvation in liquids32,33,34,35. MHPs are much softer than typical commercial inorganic semiconductors, such as Si, GaAs, and TiO2, as characterized by Young’s modulus. The complex composition and geometric structure of MHPs, combined with the softness, give rise to significant structural fluctuations over a variety of time scales34,36,37,38,39,40. It is important to model geometric changes and fluctuations in MHPs because they intimately couple to and have a significant impact on the electronic properties and charge carrier transport and lifetime41. While ab initio NAMD/TDDFT calculations provide essential insights into the electronic and structural dynamics of MHPs, they are computationally demanding. Further computational advances are needed for exploration of electron-vibrational dynamics of complex systems.

Machine learning (ML) has arisen as a powerful tool to provide an efficient and accurate interpolation of complex sets of data42,43,44,45,46. It is now widely used to develop force fields (FFs) based on input obtained by ab initio methods47,48,49. Providing ab initio level accuracy, MLFFs are much more computationally efficient and can be used to generate nano- and micro-second trajectories for systems composed of thousands of atoms. MLFFs are capable of tracking structural evolution of MHPs on the timescales comparable to the charge carrier lifetimes38,39,40. In addition to the proper sampling of structural evolution, NAMD simulations require calculation of electronic properties, in particular, electronic state energies and couplings between the states, including NA, Coulomb, spin-orbit, and optical transition dipole matrix elements. Evaluation of the electronic properties can be assisted by ML as well. One can develop ML models of electronic Hamiltonians19,50,51. Alternatively, one can calculate the electronic properties ab initio, along MLFF trajectories but over large timesteps, and then interpolate for the intermediate times52,53,54. The input provided by the ML models of electronic and structural properties, trained based on ab initio data, can then be used perform NAMD simulations of excited state processes in systems perturbed far from thermodynamic equilibrium.

In this work, we report a quantum dynamics simulation methodology that integrates ML, time-independent and TDDFT, and NAMD. The approach enables one to study excited state dynamics in condensed phase and nanoscale systems over nanosecond timescales, comparable to excited state lifetimes. Using this methodology, we investigate structural and optical properties and excited state dynamics in the best known MAPbI3 MHP containing four common defects: I vacancy (Iv), I interstitial (Ii), Pb interstitial (Pbi), and MA replacement with I (MAI). We show that thermal structural fluctuations result in large, up to 1 eV fluctuations in mid-gap defect levels, giving rise to sub-bandgap light absorption. The majority of the defect levels approach band edges, allowing charges to escape into bands and resulting in energy up-conversion. The Iv, Pbi and MAI defects extend the absorption spectrum into the infrared region, while the Ii defect enhances absorption near the band edge. The energy up-conversion is possible with the Iv, Ii and MAI defects. The energy level of the Pbi defect also exhibits a large fluctuation; however, it never approaches band edges, acting as an efficient charge recombination center. Therefore, Pbi defect passivation strategies are required. Fluctuations of the energy levels of the Iv defect occur on a 100 ps timescale, showcasing the value of the developed ML-based NAMD simulation methodology, allowing one to investigate long-time dynamics and rare events. The reported findings provide valuable insights for designing next-generation materials with improved light-harvesting and energy conversion properties for solar cell and optoelectronic applications.

Results

Electronic and geometric structure at 0 K

The upper panel of Fig. 1 shows the optimized structures of pristine MAPbI3 and its defective variants, with each defect highlighted for clarity, Fig. 1b–e. It is instructive to study the static (0 K) electronic structure of these systems before delving into the complex dynamics of charge trapping and recombination. The MAI and Pbi defects introduce mid-gap trap states near the conduction band minimum (CBM), approximately 0.5 eV below the CBM. In comparison, the Ii defect creates a mid-gap trap state located near the valence band maximum (VBM), around 0.1 eV above the VBM. Notably, no trap state is observed in the optimized Iv structure due to the equilibrium distance between two Pb atoms across the vacancy equal to 6.05 Å, which is sufficiently long to prevent trap state formation. The lower panels in Fig. 1 present the projected densities of states (DOS) for each configuration. The results indicate that iodine atoms predominantly contribute to the VBM, while lead atoms are the primary contributors to the CBM. The calculated energy gaps between the VBM and CBM for the pristine and defective systems are 1.79 eV, 1.82 eV, 2.01 eV, and 1.62 eV, respectively. These static calculations provide important insights into the electronic structure of MAPbI3 and its defective forms. However, the static limit at 0 K does not fully capture the dynamical behavior of defect states at ambient and operating conditions. Finite temperature analysis is critical for understanding charge carrier properties.

Fig. 1: Geometric and electronic structures of systems under investigation.
figure 1

a Optimized geometry of pristine MAPbI3. Defects are created by modifying the pristine structure. be Detailed view of the optimized geometries with MAI replacement, Pbi interstitial, Ii interstitial, and Iv vacancy defects, along with the corresponding density of states (DOS). Zero energy is set to the VBM. The MAI, Pbi, and Ii defects induce mid-gap trap states. The Ii trap state is close to the VBM. There are no mid-gap states in the optimized structure of the Iv defect, because distance between the Pb atoms across the vacancy is 6.05 Å. The distance decreases at ambient temperature, allowing p-orbitals of the Pb atoms to overlap and give rise to mid-gap trap states, Figs. 2d and 3.

Sub-bandgap charge harvesting by dynamic defects at ambient temperature

Figure 2 presents evolution of the band edges and defect levels at ambient temperature (300 K), highlighting the influence of thermal vibrations in MHPs. Due to the inherent softness of MHPs, thermal fluctuations play a critical role in determining the dynamical behavior of the defect states. The deep trap states created by the MAI and Pbi defects at 0 K, undergo significant fluctuations at 300 K, Fig. 2a,b. The fluctuations span approximately 0.9 eV for MAI and 0.5 eV for Pbi, bringing the trap states closer to the CBM. The MAI level frequently becomes quasi degenerate with the CBM, providing a favorable condition for trapped charges to escape to the CBM via thermal excitation. In contrast, the Pbi level never approaches the CBM sufficiently close to allow the thermal escape, indicating that the Pbi defect acts as a charge recombination center. The Ii defect level does not exhibit large fluctuations and remains close to the VBM, Fig. 2c. This facilitates mixing of the localized defect level wavefunction with delocalized band states, and allows thermal excitation of charges from the defect level into the band. The part of the trajectory of the Iv defect level shown in Fig. 2d is derived from a nanosecond-long MLMD simulation analyzed in more detail below. Deep trap states appear when the two Pb atoms across the Iv vacancy approach each other. The Pb-Pb dimer forms spontaneously on a 100 ps timescale38, and can be stabilized by vacancy charging during device operation55. Several mid-gap levels can form as a result of the Pb-Pb dimer formation, with the lowest level dropping by 1 eV below the CBM.

Fig. 2: Evolution of the VBM, CBM, and defect levels in MAPbI3 at ambient temperature.
figure 2

a MAI replacement, (b) Pbi interstitial, (c) Ii interstitial, and (d) Iv vacancy. Defect levels fluctuate significantly, often approaching band edges. Optical absorption of MAPbI₃ with (e) MAI, (f) Pbi, (g) Ii, and (h) Iv relative to the absorption of pristine MAPbI₃. All defects enhance absorbance at long wavelengths, either below (MAI, PbI, Iv) or at (Ii) the bandgap. il Fourier transforms of fluctuations of the VBM-CBM and VBM-trap (MAI, PbI, Iv) or trap-CBM (Ii) energy gaps, identifying the vibrational modes coupled to the electronic subsystem. Trap levels exhibit stronger electron-vibrational coupling than band levels.

Next, we compute the absorption spectra for the pristine and defective MAPbI3 systems at 300 K by calculating the transition dipole moments within the Franck-Condon approximation and averaging over several hundred structures from the MD trajectories, Fig. 2e–h. Pristine MAPbI3 exhibits strong cross-bandgap absorption at wavelengths below 750 nm, resulting in photo-induced charge carrier generation in the visible region. The spectral signal grows at shorter wavelengths, indicating efficient above-bandgap absorption. The exponential Urbach tail extending from 750 nm to 800 nm in pristine MAPbI3, just below the bandgap, is attributed to thermal phonon-induced absorption. However, sub-bandgap absorption is very limited in pristine MAPbI3, highlighting its limitations in generating photo-induced charge carriers in the sub-bandgap region and energy up-conversion. In contrast, Fig. 2e, f, h demonstrate that MAI, Pbi, and Iv defects significantly enhance sub-bandgap absorption, particularly in the region beyond 800 nm. It is important to note that the sub-bandgap absorption described here excludes multi-photon processes. We emphasize that dynamic, defect-induced photo-absorption cannot be captured by a static model of the optimized geometry at 0 K. The extended absorption beyond 800 nm in systems with the MAI, Pbi, and Iv defects arises from optical transitions between the valence band and dynamically fluctuating defect levels. This sub-bandgap absorption extends deep into the infrared region, which aligns with the amplitude of the dynamic defect level fluctuations seen in Fig. 2a, b, d, suggesting the possibility of energy up-conversion. Although the intensity at large wavelengths is relatively weak, due to the optical transition occurring between delocalized band states and the localized trap states, light absorption remains possible in the red and infrared regions of defective MAPbI₃. In comparison, longer wavelength absorption is typically achieved in the conventional semiconductors through heavy doping, where overlapping dopant wavefunctions form intermediate bands56. The Ii defect enhances the cross-bandgap absorption, as its defect level remains close to the VBM, limiting its impact on sub-bandgap absorption, Fig. 2c, g.

Figure 2i–l presents Fourier transforms (FTs) of the phonon-induced fluctuations of the energy gaps between trap and band states in the defective systems, compared to the VBM-CBM FT in pristine MAPbI₃. All systems exhibit strong signals at low frequencies below 200 cm−1. The intensities are higher for transitions involving defect levels compared with the bandgap transition, because the defect energy levels are influenced by structural motions much more strongly than band states, Fig. 2a, b, d. The Ii defect constitutes an exception, Fig. 2k. Its influence spectrum is similar to that of pristine MAPbI₃, because the Ii defect level is close to the VBM, and the Ii level and the VBM fluctuate in similar ways.

Prior work57 has demonstrated that trap states contribute bright spectral features to the optical absorption, while accelerating charge recombination only slightly, creating favorable conditions for the sub-bandgap light-harvesting. It should be noted that the behavior of point defects on surfaces, interfaces and grain boundaries can differ from that in the bulk40,58. Still, the qualitative features, such as the large amplitude defect level fluctuations, should be present in nanostructures of different dimensionalities, since structural softness and ionic character are general to MHPs.

A detailed analysis of the properties of the Iv vacancy defect system over a 200 ps timescale is presented in Fig. 3. Significant fluctuations in the electronic energy levels are observed on a 50–100 ps time scale. Several times during the 200 ps trajectory trap levels appear deep inside the bandgap, and up to 3 trap levels can form. Such fluctuations cannot be captured with short ab initio MD trajectories that are limited to about 10 ps. The inset in Fig. 3a shows а region with 3 trap levels on a finer scale and contains the clip discussed in Fig. 2d. The energies of the trap levels correlate with the distance between the two Pb atoms across the iodine vacancy. The distance oscillates by several Angstroms at room temperature. The 6.05 Å Pb-Pb distance in the optimized structure decreases to 3.42. Å in the deep trap region. As the Pb-Pb distance decreases via a spontaneous fluctuation driven by low frequency acoustic modes, the px-orbitals, pointing along the direction between the two Pb atoms, start overlapping, and the first trap state is formed. As the distance decreases further, two more trap states are formed, involving py- and pz-orbitals of the two Pb atoms. Figure 3b, c shows DOS and trap state charge densities for representative structures containing 2 and 3 trap states. The appearance of the deep mid-gap states due to thermal fluctuation of the Iv defect structure extend light absorption into the red and infrared, Fig. 2h.

Fig. 3: Electronic states in MAPbI₃ with Iv vacancy at ambient temperature.
figure 3

a Evolution of energy gaps between the VBM and the three states above it in MAPbI₃ with Iv vacancy over 200 ps. The insert exemplifies a region with deep traps. b, c Projected DOS for structures exhibiting 3 and 2 localized trap states indicated by the dashed ovals. The corresponding charge densities are shown in (df) and (gi). The distance between the two Pb atoms (highlighted in yellow) across the vacancy is 3.58 Å in part (b, df) and 3.86 Å in part (c, gi).

Charge carrier trapping, escape and recombination dynamics

Mid-gap levels extend light harvesting into sub-bandgap energy region. However, in the traditional semiconductors, high mid-gap level density is required to form an intermediate band that can facilitate charge transport56. Otherwise, charge carriers occupying mid-gap levels remain trapped and are eventually lost through nonradiative recombination. The large fluctuations of defect energy levels in MHPs create opportunities for the charges to escape into the main bands, and it is important to establish whether charges do escape or are lost through nonradiative relaxation, as they are in the traditional semiconductors.

Figure 4 depicts the photoinduced processes occurring in pristine and defective MHPs. Absorption of sunlight by the pristine system, process (1) in Fig. 4a, creates charge carriers at different energies inside the valence and conduction bands. The charges relax rapidly to the band edges, process (2). Subsequently, the charges are either extracted or recombine, process (3). In addition to these processes, a system containing defects can exhibit sub-bandgap light absorption into defect levels, process (4) in Fig. 4b. The trapped charges can recombine, process (6). However, defect levels fluctuate strongly in MHPs, and the charges generated by the sub-bandgap absorption can escape into bands, process (5), and carry out electrical or chemical work.

Fig. 4: Schematic of the photophysical processes metal halide perovskites.
figure 4

a Pristine system. b System with dynamic defects. Photoexcitation of the pristine system above the bandgap (1) results in intraband relaxation of hot carriers (2), followed by carrier recombination (3). In a system with dynamic defects, sub-bandgap excitation (4) extends light absorption to longer wavelengths, Fig. 2e–h, and allows charges to escape into bands (5). This energy up-conversion process competes with defect assisted charge recombination (6).

Figures 5 and 6d present NAMD simulation results describing competition between charge escape from the trap states into bands and electron-hole recombination. The MAI, Ii and Iv defects allow charges to escape the trap states, because the fluctuating defect levels approach the band closely, Fig. 2a, c, d. In contrast, the Pbi defect acts as a nonradiative charge recombination center, because its energy level remains far from the band edges, even though it also fluctuates by a significant amount, Fig. 2b. The charges escaped into bands can be trapped again; however, in realistic systems with relatively low defect density, charges travel away from defects and the likelihood for the charge to be trapped by the same defect again is low. This behavior contrasts sharply with that of traditional semiconductors, where trap level fluctuations are small37, preventing trapped charges from escaping into bands.

Fig. 5: Charge carrier dynamics in MAPbI3 with point defects.
figure 5

Shown are populations of the excited state (ES) with electron and hole at the band edges, and the ground state (GS), following photoexcitation of the defect states in MAPbI3 with (a) MAI, (b) Pbi and (c) Ii defects. The corresponding data for the Iv defect are shown in Fig. 6d. Sub-bandgap excitation of MAI, Ii and Iv defect levels results in energy up-conversion and charges escaping into bands, as indicated by growth of the ES population, because the defect levels fluctuate between shallow and deep regimes, Fig. 2a, c, d. In contrast, populating the Pbi defect results in charge recombination, i.e., growth of the GS population, because the Pbi defect always remains deep, Fig. 2b.

Fig. 6: Charge carrier dynamics in MAPbI3 with Iv vacancy.
figure 6

Shown are populations of the ground state (GS), the excited state (ES) with electrons and holes at the band edges, and the three trap states (TS1, TS2, TS3), Fig. 3. a Early time dynamics starting from the ES, showing charge trapping within a few picoseconds. b Nanosecond dynamics starting from the ES, demonstrating electron-hole recombination, i.e., growth of the GS population. c Comparison of electron-hole recombination simulated using the initial 10 ps, representing a typical ab initio simulation (Short 10 ps), the 7 ps including the rare event with deep traps (Rare 7 ps), insert of Fig. 3a, and the full 200 ps trajectory (Full 200 ps). The recombination accelerates when the traps are deep, and therefore, the full 200 ps data show faster recombination than the short 10 ps ab initio result. d Electron escape from the trap states. The trapped charge escapes into the band much faster than it decays to the GS. Corresponding data for the MAI, Pbi and Ii defects are shown in Fig. 5.

Figure 6 presents NAMD detailed simulation results for the Iv system. It highlights the developed capability to perform the simulations using the NAMD Hamiltonian obtained along the 200 ps trajectory, Fig. 3. Thus, we are able to investigate the influence of the rare events responsible for appearance of deep trap states on charge carrier recombination. Figure 6a demonstrates rapid, sub-ps charge trapping during the 7 ps region with the deep traps, insert in Fig. 3a. The ground state gets populated over tens of nanoseconds, Fig. 6b. Figure 6c compares charge recombination obtained using the full 200 ps NAMD Hamiltonian, the first 10 ps representing a typical ab initio simulation, and the 7 ps rare event NAMD Hamiltonian. The deep trap states appearing during the rare 7 ps event accelerate charge recombination. However, the recombination obtained with the full 200 ps trajectory is only slightly faster than the recombination for the short 10 ps trajectory, because the deep traps are formed only transiently, Fig. 2a. Thus, the argument that deep defects are detrimental to semiconductor performance does not necessarily apply to MHPs. On the contrary, as shown in Fig. 6d, obtained for the region with the deep traps, the electrons excited into the trap states can escape into the conduction band much faster than they relax to the ground state, due to the large fluctuation of the trap levels.

Many factors can lead to formation of deep defect levels in MHPs59, including charging55, grain boundary deformation39,40, point defect migration41, strain60,61, and surface effects62,63,64. In all case, significant fluctuations of defect levels should be expected, because MHPs are soft65 and undergo large scale anharmonic structural motions66.

Discussion

We have reported a quantum dynamics simulation methodology that integrates NAMD, ab initio time-independent and time-dependent DFT, and ML. The approach allows one to model excited state dynamics in nanoscale, molecular and condensed matter systems over nanosecond timescales, comparable to excited state lifetimes. Proper sampling the NAMD Hamiltonian is essential to capture rare events, which occur in such systems, and influence their structural and electronic properties, and response to external stimuli. We have demonstrated the utility of developed methodology by application to the most studied MAPbI3 MHP with the common Iv defect. In the optimized structure and in short ab initio trajectories at ambient temperature, the defect creates no mid-gap levels. However, on a 50–100 ps timescale, slow acoustic modes of MAPbI3 bring the two Pb atoms across the Iv vacancy sufficiently close to allow their p-electron orbitals to overlap and form up to three deep mid-gap trap levels. The NAMD simulations show that charge carrier recombination is accelerated significantly during these transient events. However, overall, the recombination is accelerated by 20–30% only, because the deep charge trap levels exist only for brief periods of time.

The study demonstrated two important phenomena associated with the unusual properties of intrinsic defects in MHPs, namely, sub-bandgap light absorption and energy up-conversion. The fluctuating energy levels of intrinsic point defects span a wide energy range at ambient conditions, as demonstrated with the Iv, Pbi and MAI defects in MAPbI3. This is in contrast with the traditional inorganic semiconductors, in which defect levels fluctuate much less. Thus, the commonly used classification of defects into shallow and deep does not fully apply to MHPs. Part of the time many defect levels approach band edges, and therefore, effectively, most defects in MHPs can be regarded as shallow. The large fluctuations of the energy levels of intrinsic defects in MHPs extend light absorption into low energies below the bandgap. Even excitations several tens of eV below the band edge can produce mobile charge carriers, because the charges can escape the defect levels when the levels approach the band edges. This has been shown by the NAMD simulations for the Iv, Ii and MAI defects. Energy levels of some defects, such as Pbi, never approach the band edges and act as charge recombination centers. Therefore, they should be passivated to improve MHP performance. The demonstrated mechanisms of sub-bandgap light absorption and energy up-conversion to generate mobile charge carriers can operate at both low and high defect concentration. In comparison, high defect/dopant concentrations are needed in traditional semiconductors to form intermediate bands and produce mobile charge carriers through sub-bandgap light absorption

The long-time NAMD simulation methodology reported here provides an important tool for studying excited state processes in realistic materials. The demonstrated sub-bandgap light-harvesting and energy up-conversion mediated by intrinsic defects highlight the distinct properties of MHPs and provide guidelines for designing next-generation low-cost materials with improved performance.

Methods

Electronic structure calculations

Ab initio electronic structure calculations are performed with the Perdew–Burke–Ernzerhof (PBE)67 density functional employing projected augmented pseudopotentials68, and D3 van der Waals correction69, as implemented in the Vienna Ab initio Simulation Package70. Spin-orbit coupling plays an important role in determining the electronic properties of MHPs, because they are composed of heavy elements. Fortunately, due to cancelation of errors associated with electron self-interaction and neglect of spin-orbit coupling, the bandgap and defect energy levels obtained for MAPbI3 with the PBE functional agree with those obtained at higher levels of theory. The cutoff energy of the plane wave basis is set to 450 eV. The convergence thresholds for the energy and the forces are 10−7 eV and 10−3 eV/Å, respectively. A super cell, including 4 \(\times\) 2 \(\times\) 2 unit cells, is created to model MAPbI3, Fig. 1. Defects are introduced into the pristine cell: the MAI replacement defect is modeled by substituting an MA group with an iodine atom, the Pbi interstitial defect is created by adding an extra lead atom, the Ii interstitial defect is introduced by inserting an additional iodine atom, and the Iv is modeled by removing an iodine atom. The resulting systems contain 377, 385, 385, and 383 atoms, respectively. Although the simulation cells are already rather large for the ab initio NAMD simulations, even bigger cells are desirable to achieve experimental defect concentrations. This can be achieved with ML models of electronic Hamiltonians19. Mid-gap trap states arising from point defect are localized, and their properties depend weakly on simulation cell size.

Machine learning force field and molecular dynamics

The MLFF is trained using the DeepPot-SE approach71 as implemented in DeePMD-Kit72. The training data are generated with CP2K73 using the PBE functional67 with the DFT-D3 van der Waals correction69, MOLOPT basis sets74, and GTH norm-conserving pseudopotentials75. The neighbor searching is performed with a 7 Å cutoff radius and a 2 Å smoothing distance. The embedding and fitting neural networks have 25 \(\times \,\)50 \(\times\) 100 and 240 \(\times\)240 \(\times\)240 dimensions, respectively. The network optimization is carried out using the Adam stochastic gradient descent method76 with a learning rate that decreases exponentially from the starting value of 0.001. The training data are generated via NVT simulations at temperatures ranging from 100 K to 600 K using both pristine and defective structures. The atomistic simulations are carried out using Large-scale Atomic/Molecular Massively Parallel Simulator (LAMMPS)77. The structures are visualized with the VESTA software package78.

Nonadiabatic molecular dynamics and time-domain density functional theory

To perform the NAMD/TDDFT simulations, the Iv system is heated up to 300 K, and a 3 ns microcanonical trajectory is generated with the MLFF. A randomly selected 200 ps part of the ML trajectory is analyzed ab initio and by inverse fast Fourier transform (iFFT). 3152 structures are chosen along the 200 ps trajectory every 64 fs to calculate the ab initio electronic energy levels, and 6304 structures (3152 pairs) are used to calculate the ab initio NA couplings, which are obtained as overlaps of wavefunctions at adjacent timesteps79,80. Computed every 64 fs, the ab initio energy levels and NA couplings are interpolated using the iFFT method53 to generate the NA Hamiltonian with a 1 fs timestep. The Ii, Pbi and MAI systems are studied by ab initio MD, because their structural fluctuations occur on a picosecond timescale. The systems are heated up to 300 K, and 7 ps microcanonical trajectories are generated. The last 3 ps are used for further analysis. The NAMD calculations are performed in the Kohn–Sham representation81. Excitonic effects are not included explicitly, since they require costly GW and Bethe–Salpeter calculations82, and because the exciton binding energy is much smaller83 than the defect level fluctuations. Excitations are introduced by promoting an electron from VBM to CBM, or a trap state for sub-bandgap excitation. Excitations above the bandgap relax rapidly, on a sub-picosecond timescale, by intraband relaxation through dense manifolds of states84,85. Charge trapping, de-trapping and recombination take tens of picoseconds to nanoseconds, and this timescale separation allows us to focus on the slow processes. The decoherence induced surface hopping method is used86,87, as implemented in the PYthon Extension for Ab Initio Dynamics (PYXAID) package88,89. Several thousands of DISH trajectories are generated for each modeled process to obtain converged results.