Electrode-induced impurities in tin halide perovskite solar cell material CsSnBr3 from first principles

All-inorganic lead-free CsSnBr3 is attractive for applications in solar cells due to its nontoxicity and stability, but the device performance to date has been poor. Besides the intrinsic properties, impurities induced from electrodes may significantly influence the device performance. Here, we systematically studied the stability, transition energy levels, and diffusion of impurities from the most commonly used electrodes (Au, Ag, Cu, graphite, and graphene) in CsSnBr3 based on density functional theory calculations. Our results reveal that, whereas graphite and graphene electrodes exhibit negligible influence on CsSnBr3 due to the relatively high formation energies for carbon impurities in CsSnBr3, atoms from the metal electrodes can effectively diffuse into CsSnBr3 along interstice and form electrically active impurities in CsSnBr3. In this case, a significant amount of donor interstitial impurities, such as Agi+\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$Ag_i^ +$$\end{document}, Cui+\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$Cu_i^ +$$\end{document}, and Aui+\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$Au_i^ +$$\end{document}, will be formed under p-type conditions, whereas the Sn-site substitutional acceptor impurities, namely AuSn2−\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$Au_{Sn}^{2 - }$$\end{document}, AgSn2−\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$Ag_{Sn}^{2 - }$$\end{document}, and CuSn2−\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$Cu_{Sn}^{2 - }$$\end{document}, are the dominant impurities, especially under n-type conditions. In particular, except for Aui+\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$Au_i^ +$$\end{document}, all these major impurities from the metal electrodes act as nonradiative recombination centers in CsSnBr3 and significantly degrade the device performance. Our work highlights the distinct behaviors of the electrode impurities in CsSnBr3 and their influence on the related devices and provides valuable information for identifying suitable electrodes for optoelectronic applications.


INTRODUCTION
Over the past few years, hybrid organic-inorganic halide perovskites have attracted overwhelming attention for applications in solar cells, photodetectors, and phototransistors [1][2][3][4] , because of the outstanding optoelectronic properties and low cost. In particular, the power conversion efficiencies (PCE) of perovskite solar cells have reached over 25% 5,6 . However, their large-scale deployment is restricted by the toxicity of lead and poor stability. All-inorganic lead-free perovskite CsSnBr 3 is regarded as an auspicious alternative due to its similar perovskite structure to Pb-based counterparts and competitive semiconductor characteristics, including a direct bandgap 7 , suitable bandgap size 8 , favorable charge-carrier effective masses 9 , and high thermal stability 10 .
So far, there have been many experimental reports [11][12][13][14][15] on CsSnBr 3 -based solar cells. Although the long-term stability was well demonstrated, the optimal PCE only reached 3.04%, far from 28% as predicted for single-junction cells by the Shockley-Queisser model theory 16 . Recently, we showed that intrinsic defects have a great impact on CsSnBr 3 and device performance 17 . Different from other halide perovskite materials with characteristic high defect tolerance 18,19 , CsSnBr 3 is susceptible to defects. In particular, a high concentration of Sn and Cs vacancies are predicted to be electrically active and play a mixed role in affecting the optoelectronic properties. They also exhibit mobile properties, especially under illumination, and tend to accumulate at the contact near the electrode, causing an unfavorable screening-field effect for the device performance.
In turn, CsSnBr 3 may also be susceptible to impurities from electrodes, which may have an impact on the related device performance. Many optoelectronic devices, such as photodetectors, adopt an electrode-perovskite-electrode configuration, where electrodes are directly deposited on the perovskites as the back contact for the devices. In usual solar cell configurations, although a hole transport layer (HTL) or electron transport layer (ETL) separates the electrode and CsSnBr 3 , the organic HTL/ETL are particularly susceptible to the diffusion of electrode ions. Indeed, as found for the MAPbI 3 solar cell 20 , the atoms of the Au electrode can diffuse across the HTL/ETL and cause contamination to the active layer. Recently HTL-free perovskite solar cells have gained momentum due to the high cost and low stability of organic HTL 21 . As such the "direct contact" device configuration facilitates the interaction between the electrode and active layer. Although most electrodes such as Au and Ag do not directly react with CsSnBr 3 , the constituent atoms of the electrodes may migrate into CsSnBr 3 and be trapped at the interstices or intrinsic vacancies to form electrically active impurities 22 . These unintentional electrode impurities may influence device performance by introducing deep levels as non-radiative recombination centers, screening the builtin electric field, and so on. Indeed, the trihalide perovskite analog MAPbI 3 active layer has been previously demonstrated to be susceptible to electrode impurities 23,24 .
In this work, we investigated the effects of common electrode impurities on CsSnBr 3 device performance by first-principles density functional theory (DFT) calculations. We studied the most widely used electrodes of Au, Ag, Cu, and C 11,15,25-27 due to their relatively low resistivities 28 and suitable work functions for carrier extractions. For carbon electrodes 29 , we considered graphite and graphene. The Fermi energy levels (−5.10 eV for Au, −4.26 eV for Ag, −4.65 eV for Cu, and −5.00 eV for C) 30 are compatibly located above the valence band maximum (VBM) and below the conduction band minimum (CBM) of CsSnBr 3 that were measured to be −5.2 eV and −3.4 eV, respectively 31 . Such electrodes can effectively promote the extraction of photogenerated carriers from active layers and hence are the promising candidates for CsSnBr 3 devices.
Phenomenologically, the formation of electrode impurities can be regarded as that the constituent elements first decompose from the electrodes, then diffuse into the bulk of the active layers, and finally form impurities in thermal equilibrium. Correspondingly, such a behavior can be evaluated by the cohesive energy of electrodes, the thermal stabilities, and the kinetic barriers of impurities in CsSnBr 3 . To this end, we first calculated the cohesive energy for the electrodes to assess the tendency of decomposing and the impurity element provision. Then, we calculated the formation energies of all the possible electrode impurities and their diffusion barriers in CsSnBr 3 , to understand whether they can diffuse in CsSnBr 3 and cause impurity formation. Finally, we calculated the transition energy levels to assess the optoelectronic properties of these impurities. Our results demonstrate that the metal species from the electrodes can effectively diffuse and introduce electrically active impurities in the CsSnBr 3 active layer. For carbon species, it requires to overcome higher cohesive energies to escape from the electrodes and higher formation energies to cause impurities in CsSnBr 3 and thus will have less influence on the active layer. These appealing features make carbon-based electrodes stand out as promising electrodes for related optoelectronic applications.

RESULTS AND DISCUSSION Cohensive energies of electrodes
The calculated cohesive energies of the considered electrodes, Au, Ag, and Cu in equilibrium face-centered cubic geometry (FCC), and C (graphite, graphene), are shown in Table 1. Our results are in good agreement with the previous studies [32][33][34] . The metal electrodes exhibit relatively low cohesive energies of 2.93 eV, 2.41 eV, and 3.42 eV per atom for Au, Ag, and Cu, respectively. By comparison, carbon electrodes exhibit relatively high cohesive energies, while it does not significantly differ between graphite and graphene, with the values of 7.97 eV per atom and 7.96 eV per atom for graphite and graphene, respectively, indicating atomic carbon requires to overcome higher energy to escape from graphite or graphene electrodes to contaminate the active layer.
Band structure of CsSnBr 3 Before exploring the behaviors of the impurities in CsSnBr 3 , we study the band structure of bulk CsSnBr 3 , which is significantly sensitive to defective calculation, especially the transition energy levels. As shown in Fig. 1, CsSnBr 3 exhibits a direct bandgap between the CBM and VBM at the R-point in the Brillouin zone. Previous reports [35][36][37] suggest that spin-orbit coupling (SOC) is important in lead halide perovskites due to the strong relativistic effects of the heavy Pb elements, which may be relevant for Snbased perovskites. Therefore, we calculated the PBE band structures with and without SOC, as shown in Fig. 1a, b. It is interesting that, although the PBE calculation sizably underestimates the bandgap value, our PBE calculation in CsSnBr 3 without consideration of SOC predicts a value of 1.41 eV, compared with that of 0.60 eV for PBE + SOC, and the experimental one, 1.75 eV 13 . This is because the incorporation of SOC shifts the conduction band down by~0.8 eV, while the top of the valence band is almost unchanged. Similar behavior was also found in other trihalide perovskite counterparts [38][39][40] . Also, the higher level hybrid functionals, Heyd-Scuseria-Ernzerhof (HSE) was performed for bandgap correction (Fig. 1c, d). In this case, HSE overestimates the bandgap to 1.97 eV, while we obtained the bandgap of 1.83 eV when considered spin-orbit coupling. Among the results, PBE and HSE+SOC can predict a closer bandgap with respect to experimental value with a slight difference. Considering that the hybrid functionals are computationally expensive, pure PBE calculations have been widely used to study defects in perovskites [41][42][43] . In particular, the PBE results for defect formation energy 24 and diffusion barrier 23 do not significantly differ from those from HSE+SOC. Thus, in the present study, the defect formation energy and diffusion barrier were presented in the PBE values. For the energy transition levels that are sensitive to bandgap error, both PBE and HSE+SOC calculations were conducted.

Impurity Formation energies
To explore whether the electrode ions can introduce impurities to influence the properties of CsSnBr 3 , we first calculated the formation energies of the possible point impurities, including the interstitial impurities (Au i , Ag i , Cu i , and C i ) and the substitutional impurities (Au Br , Au Sn , Au Cs , Ag Br , Ag Sn , Ag Cs , Cu Br , Cu Sn , Cu Cs , C Br , C Sn , and C Cs ).
The calculated formation energies of different impurities in the neutral and charged states as a function of the Fermi level (E f ) are summarized in Fig. 2. The Fermi level depends on the electronic condition of the host material. For example, the hole-rich condition (p-type) moves the E f close to the VBM, whereas the electron-rich condition (n-type) moves the E f close to the CBM. Interestingly, as shown in Fig. 2a, we found that all the carbon electrode-induced impurities act as acceptors in CsSnBr 3 . Graphite is more stable than graphene by 0.01 eV/atom (Table 1) hence lower bulk chemical potential, consequently graphite-induced impurities exhibit slightly higher formation energy, indicating that CsSnBr 3 is more susceptible to graphene electrode than graphite electrode. They have relatively high formation energies under both Sn-rich and moderate conditions, compared with that of metal impurities, which may be attributed to the relatively weak binding of carbon atoms with CsSnBr 3 . In particular, under holerich conditions (p-type), carbon atoms are difficult to incorporate as impurities in CsSnBr 3 and will have a negligible influence on the active layer. When the host is in electron-rich (n-type) conditions, these impurities tend to be ionized by trapping the electrons and the formation energies decrease. In particular, the formation energies of the C 3À i and C 3À Br impurities are relatively low under ntype conditions, and they become the major impurities of carbon electrodes.
In stark contrast to the carbon electrode, the metal electrodes can introduce impurities with much lower formation energies and hence higher concentrations in CsSnBr 3 . As shown in Fig. 2b, the Sn-related substitutional impurities serve as acceptors with the lowest formation energies. Particularly, under electron-rich conditions (n-type), the negative formation energies indicate a considerable amount of impurities will form in negative divalent states (Au 2À Sn , Ag 2À Sn , and Cu 2À Sn ). The reasons for this are twofold. On one hand, in agreement with the recent experiment 14 , our calculations predict that CsSnBr 3 is susceptible to Sn vacancies 17 . The high concentration of Sn vacancies facilitates the accommodation of these substitutional impurities. On the other hand, the metal elements compatibly substitute at the Sn-site of CsSnBr 3 with almost no structural distortion as shown in the optimized structures. In addition to the Sn-related substitutional impurities, the interstitial impurities from the metal electrodes exhibit the second-lowest formation energies in CsSnBr 3 . In contrast, they act as donors and each metal element tends to donate an electron to the host to form monovalent impurities (Au þ i , Ag þ i , Cu þ i ), especially under hole-rich conditions (p-type). Moreover, the Br-and Cs-site substitutional impurities (Au Br , Au Cs , Ag Br , Ag Cs , Cu Br , Cu Cs ) exhibit relatively high formation energies. Only under the n-type limit, would there be any appreciable concentrations of Ag À Cs , Au À Cs , and Au Br impurities, but they are not the major impurities and will have little influence on the active layer. We noted that negative defect formation energies have been widely reported in halide perovskite systems [44][45][46][47] . While the exact reason for these seemingly unphysical values from DFT supercell method is still unknown, it could be tentatively attributed to the well-known electron correlation and self-interaction errors associated with DFT 48,49 .

Kinetic barriers
The static low formation energies of electrode impurities do not necessarily determine whether they have high concentrations in CsSnBr 3 because high kinetic barriers are likely to obstruct the migrations of the species from the electrodes into the active layer. Therefore, we next calculated the diffusion barriers to explore whether these low-formation-energy impurities can be formed and influence the bulk properties of CsSnBr 3 . As mentioned above, the acceptor impurities (Au 2À Sn , Ag 2À Sn , Cu 2À Sn ) are the dominant impurity with particularly low formation energies especially under electron-rich conditions (n-type), while the donor impurities (Au þ i , Ag þ i , Cu þ i ) are thermodynamically favorable in the active layer under hole-rich conditions (p-type). Thus, the diffusion of metal atoms from electrodes into the bulk of the active layer will have two possible mechanisms: hopping via Sn vacancies (Au 2À Sn , Ag 2À Sn , Cu 2À Sn ) and along the interstices (Au þ i , Ag þ i , Cu þ i ). These six charged defects will be considered in our diffusion calculations.
For the diffusion of the class of Sn-related substitutional impurities, it requires the assistance of the hoping of the Sn vacancies, hence, we considered three possible paths as displayed in Fig. 3a. The P1 path represents that the metal element diffuses to the Sn-site in the proximity of the impurities ([100] direction). The P2 path is along the face diagonal of the square planar structure ([110] direction), and the P3 path is along the cubic diagonal of the cubic lattice ([111] direction). For the interstitial metal impurities, one diffusion path is considered in the highly symmetric cubic phase CsSnBr 3 .
As shown in Fig. 3b, all the Sn-related substitutional metal impurities have lower diffusion barriers along the P2 path than those along the P1 and P3 paths, indicating that they prefer to diffuse along the [110] direction, which is in agreement with our previous diffusion study of Sn vacancies 17 . As expected, the barrier energies of the substitutional impurities are substantially higher than that of Sn vacancy (0.27 eV). Among them, Au 2À Sn exhibits the highest diffusion barrier, up to 2.13 eV, which may be attributed to the heavier Au atom and the larger structural distortion during the impurity diffusion. To measure the distortions, we used the sizes of the Br-Sn-Br angle α (β) in the square planar structures, as displayed in Fig. 4. In all the initial/final states, the Br-Sn-Br angles α/β are 90°, in agreement with the perfect structure. When the impurities diffuse, the structures are distorted and the values of angle α/β exhibit significant changes. In the transition states, the model of Au 2À Sn exhibits the most distortion with the Br-Sn-Br angle α/β significantly shifted to 104.3°/102.3°, compared with 103.8°/98.6°for Cu 2À Sn and 103.1°/88.5°for Ag 2À Sn . This is followed by Cu 2À Sn with a barrier of 1.48 eV, and then Ag 2À Sn also with a relatively high diffusion barrier of 1.28 eV. The low formation energies (Fig. 2b) and the high diffusion barriers indicate the metal atoms from the electrodes will be trapped at Sn vacancies near the contact and will be ionized. These impurities (Au 2À Sn , Ag 2À Sn , Cu 2À Sn ) will slowly diffuse into the bulk of CsSnBr 3 over time.
Compared to the substitutional impurities in Sn sites, our results show that the interstitial metal impurities (Au þ i , Ag þ i , Cu þ i ) have lower diffusion barriers in CsSnBr 3 . Especially for Ag þ i , its diffusion barrier is only 0.28 eV, indicating the most favorable kinetic conditions. Besides impurity Ag þ i , the impurities Cu þ i and Au þ i also exhibit low diffusion barriers of 0.42 eV and 0.67 eV, respectively. These results are close to those found in the MAPbI 3 system with the diffusion barriers of 0.27 eV, 0.42 eV, and 0.42 eV for Ag þ i , Cu þ i , and Au þ i , respectively 23 . Together with the low formation energies (Fig. 2b), such low diffusion barriers (Fig. 3b) allow the metal ions from the electrodes to efficiently diffuse into CsSnBr 3 along the interstice and form interstitial impurities in the bulk of the active layer. As shown in Fig. 5a, all the metal interstitial impurities (Au þ i , Ag þ i , Cu þ i ) prefer to locate at the interstitial site of the Sn-Br square plane and take a distorted structure, especially for Cu þ i . This may be attributed to the Coulomb attraction between the positively charged metal elements and the negatively charged bromine ions. The diffusion behaviors of the interstitial impurities (Au þ i , Ag þ i , Cu þ i ) can be described as the impurities hopping out of one Sn-Br plane and diffusing to the interstitial site on another Sn-Br plane. Interestingly, as displayed in Fig. 5b-d, the diffusion path involves a meta-stable state where the metal species is located at the middle site between the initial Sn-Br plane and final Sn-Br plane without binding with any bromine ions, resulting in multiple kinetic barriers. The highest one is regarded as the diffusion barrier for the corresponding impurities, as summarized in Fig. 3b.
The metal ions exhibit particularly mobile properties within the interstices of CsSnBr 3 . Our previous results 17 revealed that the Sn vacancy is of high concentration in CsSnBr 3 . One may envisage that the metal ions may penetrate CsSnBr 3 along the interstice, and then fill the Sn vacancies to form substitutional impurities in the bulk of the active layer. To support this hypothesis, we calculated the energy barriers for these processes, and the results  are summarized in Fig. 6. In this case, the energy barrier is the diffusion barrier for the action that an interstitial metal ion M þ i hops and fills a neighboring Sn vacancy V 2À . Indeed, as shown in Fig. 6, all these processes are exothermic and the calculated barrier energies are only 0.10, 0.23 eV, and 0.32 eV, respectively, for Ag + , Cu + , and Au + , which indicates that the metal interstitial impurities tend to fill Sn vacancies and form the Sn-site substitutional impurities. Moreover, in contrast to the relatively high diffusion barriers of hopping through Sn sites, the metal species of impurities Ag Sn , Cu Sn and Cu Sn are mainly provided by the interstitial impurities diffused from the contact.

Charge transition levels
From the aforementioned results, the metal species from the electrodes can effectively diffuse along with the interstice and form the impurities in the bulk of the active layer. In particular, the Sn-site substitutional acceptor impurities (Au 2À Sn , Ag 2À Sn , Cu 2À Sn ) are dominant, especially for n-type CsSnBr 3 , while the interstitial donor impurities (Au þ i , Ag þ i , Cu þ i ) are also expected to exist with substantial concentrations in CsSnBr 3 under hole-rich conditions (p-type). Also, impurities C i and C Br are the major impurities induced by carbon-related electrodes (graphite and graphene). To understand whether these major electrode impurities can influence the optoelectronic properties of CsSnBr 3 , we calculated the transition energy levels. For the minor impurities, due to the relatively high formation energies and less significant role in device performance, they will not be presented for a detailed discussion. It is well known that the transition energy level calculation is particularly sensitive to bandgap error. To obtain a more reliable value, we performed both PBE and HSE+SOC for this section, in which HSE+SOC calculation was based on the optimized structure of PBE level 24 . In contrast to those outside the band edges, the transition energy levels within the bandgap are important for the optoelectronic property of the host and related device performance. As shown in Fig. 7, it is noticeable that PBE exhibits a qualitatively similar result to HSE+SOC, while the level values obtained by these two methods exhibit variations, which can be attributed to the different bandgap predictions by PBE and HSE +SOC. Moreover, due to a slight underestimation (1.41 eV) of PBE and overestimation (1.83 eV) of HSE+SOC compared with the experimental result (1.75 eV), we expect that the true level to be located between the values of PBE and HSE+SOC. As shown in Fig. 7, as the major impurities induced from Ag electrodes, both results imply that Ag Sn and Ag i introduce deep energy levels inside the bandgap, which serves as nonradiative recombination centers causing energy loss and hence has a detrimental effect on the carrier transport in CsSnBr 3 . Similarly, for Cu electrodes, both Cu Sn and Cu i can trap electrons and holes at the middle of the bandgap, indicating that Cu electrode-induced impurities jeopardize the device performance as well. For the two Au-related impurities Au i and Au Sn , both PBE and HSE+SOC results show that the energy levels ℇ (1+/0) of Au i is below the VBM while ℇ (2+/1+) is above the CBM so that it will be stable only at +1 state yet harmless to CsSnBr 3 . In contrast, the deep energy level introduced by Au Sn makes the Au electrode detrimental to the active layer. Thus, it is obvious that when the host is under hole-rich conditions (p-type), the Au electrode has less influence and is preferable for devices. When under electron-rich conditions (n-type), all the metal electrodes can significantly degrade the device performance by giving rise to deep energy level impurities (Au 2À Sn , Ag 2À Sn , Cu 2À Sn ). In this case, the shift of the growth conditions for the host to Sn-rich conditions will suppress the formation of these substitutional impurities, and help mitigate device performance deficiency. Moreover, in the case of carbon-based electrodes, in spite of the difference in the formation energies, the impurities from graphite and graphene exhibit the same transition energy levels. In particular, C i and C Br are the major impurities of carbon electrodes and can induce deep energy level ℇ (1-/2-) of 0.90 eV (1.23 eV) and 0.57 eV (1.12 eV) within the bandgap based on PBE (HSE+SOC) calculation. Compared to the metal counterparts, these impurities exhibit relatively high formation energies, thus will have less influence on the active layer and related optoelectronic devices. Furthermore, the merits 27 of low-cost, high electrical conductivity, chemical stability, and modifiability enable the carbon materials as the promising electrodes for CsSnBr 3 -based optoelectronic applications.
In conclusion, based on extensive first-principles calculations, we systematically studied the behavior of the impurities from commonly used electrodes (Au, Ag, Cu, graphite, and graphene) in the bulk of the CsSnBr 3 and the possible influence they have on the optoelectronic device performance. For carbon-related electrodes, both graphite and graphene exhibit relatively high cohesive energy, and the related impurities have high formation energies. Within the system, the carbon species tend to be in the form of interstitial and substitutional impurities (C 3À i and C 3À Br ) under the n-type limit, which can introduce deep energy levels in the bandgap, yet with limited concentrations. Thus, graphene and graphite stand out as promising electrodes for related optoelectronic applications. By comparison, the decomposition of metal electrodes will provide a considerable amount of metal atoms that can efficiently diffuse into CsSnBr 3 along the interstice and form various types of impurities. Among them, the Sn-site substitutional impurities (Au 2À Sn , Ag 2À Sn , and Cu 2À Sn ) are the dominant defects, especially for n-type CsSnBr 3 , in which it serves as an acceptor. When the host is under the hole-rich conditions (p-type), a significant amount of interstitial impurities (Au þ i , Ag þ i , and Cu þ i ) also will be formed in the active layer and serve as donors. Except for I þ Au , all these major impurities can introduce deep energy levels as nonradiative recombination centers to significantly cause device performance loss. Although the Sn-rich growth condition for CsSnBr 3 will mitigate this effect, more care should be taken to prevent the metal species from contaminating the active layer in related optoelectronic devices.

First-principle calculations
Our calculations were based on density functional theory (DFT) as implemented in the Vienna ab initio simulation package (VASP) code 50 . The projector-augmented-plane-wave method was used to describe the core-valence interaction 51 . The cut-off energy for basis functions was 400 eV. The Perdew-Burke-Ernzerhof (PBE) 52 form of the generalized gradient approximation (GGA) and the higher level hybrid functional, Heyd-Scuseria-Ernzerhof (HSE) 53 were employed to describe the exchange and correlation functional theory. The HSE calculation was performed based on the optimized structure of PBE level 23,24 . The effect of spin-orbit coupling was considered. A 2 × 2 × 2 reciprocal space k-point mesh was used for the sampling of the Brillouin zone. CsSnBr 3 is in the cubic phase at room temperature 7 , so we used the cubic phase α-CsSnBr 3 for our calculations. We employed a 3 × 3 × 3 135-atom supercell for the impurity simulations. Convergence test using a 4 × 4 × 3 240-atom supercell for the two energetically favorable defects, Ag 2À Sn and Au þ i , reveals that the formation energy deviations between the 135-and 240-atom supercells are less than 0.02 eV. All the structures were fully relaxed until all the forces on the atoms are below 0.01 eV/Å. For charged defects calculations, extra electrons (holes) together with uniform compensating charges were added to the supercell.

Cohensive energies
The cohesive energy is calculated as, Here, the E cell stands for the total energy of the unit cell of electrode geometry that contains N atoms. The E atom is the spin-polarized total energy of a single isolated atom of the corresponding electrode material.

Defect formation energies
To assess the thermal stabilities of the electrode impurities in CsSnBr 3 , we calculated the formation energies. For an impurity a ionized to a charge state q, its formation energy ΔH f (a, q) is described as 54 (2) where the E(a, q) and E(host) are the total energies of the supercells with and without impurities, respectively. The n i is the difference in the number of atoms in these supercells. The E f is the energy of the Fermi level relative to the VBM, and E(VBM) is the valence band maximum energy. The correction term, ΔV, was introduced for the alignment of potentials in different impurity supercells, which will have a bulklike environment with that in the bulk. The µ i is the bulk chemical potential of atoms corresponding to the most stable elemental phase. In particular, the chemical potential of C atom will be calculated by the phases of graphite and graphene. The relative chemical potentials, Δµ i , of component atoms (Cs, Sn, and Br) should be restricted in the green region (see Supplementary Fig. 1), which has been demonstrated from our previous CsSnBr 3 defect study 17 . For the impurity atoms, Au, Ag, Cu, and C, we assumed they are in equilibrium with the "electrode-rich condition" for CsSnBr 3 near the electrodes, and thus set their relative chemical potentials Δµ i to be zero. Moreover, for reference purposes, we chose two vastly different chemical conditions for our study. They are the Sn-rich and moderate conditions corresponding to the point A (Δµ Cs = −2.66 eV, Δµ Sn = 0 eV, Δµ Br = −1.18 eV) and the point B (Δµ Cs = −3.29 eV, Δµ Sn = −1.23 eV, Δµ Br = −0.56 eV) in Supplementary Fig. 1, respectively.

Diffusion barriers
The impurity diffusion barrier was calculated using the nudged elastic band method in conjunction with the climbing image method [55][56][57] , as implemented using the VTST (VASP Transition State Tool) extension of the VASP code, which enables the determination of the minimum energy path between two energetically stable endpoints. For each pathway, we calculated six images intercalated between the relaxed initial state and final state for searching transition state. For the diffusion pathways with multiple kinetic barriers, the highest one is regarded as the diffusion barrier.

Transition energy levels
The transition energy levels ℇ(q/q′) of impurities are decided by the position of the Fermi level, where the formation energy of the impurity with the charge state q is equal to that of the charge state q′. Thus, it can be described by 54 :

DATA AVAILABILITY
All data needed to evaluate the conclusions in the paper are present in the paper and the Supplementary Materials. Additional data for this study are available from the corresponding author upon reasonable request.