Hybrid perovskites have recently emerged as outstanding materials for efficient and low-cost solar technology. Unique properties, including high absorption coefficient1, large charge-carrier diffusion length2, small exciton binding energy3 and low trap density4, pushed their performances to a record efficiency beyond 22%5. The most common perovskite arranges into APbX3, (A = CH3NH3 + (methylammonium, MA) or CH3(NH2)2 + (formamidinium, FA); X = Cl, Bror I), which crystallizes in a three-dimensional (3D) network3. Among different candidates, mixed ionic compositions of MA and FA cations6 and Br/I halides have recently led to superior performance, with efficiencies close to 21% for (FAPbI3)0.85(MAPbBr3)0.15 (ref. 7). Nevertheless, these improvements in the efficiency of perovskite materials come with stability concerns, due to decomposition to the initial precursors8, and intrinsic halide segregation9,10 with ambiguous long-term consequences.

To overcome the stability issue, a few strategies have been proposed11,12,13,14, including the exploration of alternative cations. Recent reports have shown promising results with the introduction of Cs+ and Rb+ mixtures into the hybrid (FAPbI3)0.85(MAPbBr3)0.15 structure, leading to a complex triple15 and quadruple16 composition with efficiency over 20%. Nevertheless, organic alternatives with a proper ionic radius (R), such as hydrazinium [H3N–NH2]+ or azetidinium [(CH2)3NH2]+ (ref. 17), that can fit into the inorganic Pb–I framework while maintaining an adequate Goldschmidt tolerance factor (\(t=\left({R}_{{\rm{A}}}+{R}_{{\rm{I}}}\right)/\sqrt{2}\left({R}_{{\rm{Pb}}}+{R}_{{\rm{I}}}\right)\) to ensure a cubic structure (t = 0.8–1)17,18 are not available. On the other hand, obtaining good perovskite films with alternative cations has been experimentally challenging, and no results comparable to the state-of-the-art perovskites have been reported so far.

Here we introduce a perovskite based on the organic cation guanidinium (CH6N3 +, Gua) as a more stable and efficient alternative to the state-of-the-art MAPbI3. Gua features an ionic radius of ~278 pm (ref. 17), slightly above the upper limit of the tolerance factor (t ~1.03), forming low-dimensional perovskites (LDPs) when mixed with PbI2 (refs 19,20). In this work, we demonstrate that when combined with methylammonium in a mixed MA1–x Gua x PbI3 composition (0 < x < 0.25) the Gua cation inserts in the crystal unit, forming a 3D perovskite with enhanced thermal and environmental stability. Our results widen the exploration of cations with a radius beyond the tolerance limit, while preserving a 3D structure and high photovoltaic performance. With this approach, solar cells display an average photoconversion efficiency (PCE) of 19.2 ± 0.4% at enhanced stability.

Structural characterization of MA1–x Gua x PbI3 perovskites

To gain insight into the arrangement of the Gua cations in the MA1–x Gua x PbI3 crystal structure, X-ray diffraction (XRD) measurements of the thin films were performed (see Methods for details). Figure 1a shows the diffractograms of the perovskite films containing MA/Gua mixtures, where 0 < x Gua < 1 (x Gua represents the Gua molar ratio), compared with MAPbI3. The incorporation of Gua cations yields a gradual decrease of the reflection peak intensity, but retaining the MAPbI3 tetragonal phase even for x Gua = 0.25. Larger Gua percentages significantly decrease the diffraction signal, while the appearance of new diffraction peaks at 8.54° and 11.31° indicates the formation of a 1D GuaPbI3 phase, as previously reported21. Interestingly, a closer inspection of the reflection peaks reveals a notable shift to lower angles, as shown in the zoom of Fig. 1b corresponding to the (110) and (220) lattice planes. On increasing the Gua content, a gradual shift of the peaks occurs, as reported for the FAPbI3 α-phase after sequential substitution of FA cations for Cs22 or in the recently reported MA x EA1–x PbBr3 perovskite (EA = ethylammonium) at increasing EA contents23. In our case, this phenomenon denotes a gradual expansion of the unit-cell volume, indicating the incorporation of the larger Gua cation by direct substitution of MA, forming a mixed MA1–x Gua x PbI3. The lattice parameters, a and c, calculated from the experimental XRD patterns, indicate that the c value remains constant for all percentages, 12.625 Å, while a gradually changes from 8.838 Å to 8.902 Å, remaining invariable for Gua contents larger than 25% (Fig. 1c). Thus, a distortion of the crystal prevalently affecting the a and b lattice parameters takes place for x Gua < 0.25. Due to the mismatch in size with respect to the MA cation, the incorporation of Gua entails local distortions in the crystal, which manifest as a broadening of the peaks. The crystal strains in the structure are evaluated using the Williamson–Hall method (Supplementary Fig. 1). The results demonstrate an increased number of micro-strains and distortions of the MAPbI3 lattice at larger percentages of Gua, supporting its inclusion in the crystal. However, further increments do not incorporate into the crystalline network and lead to a phase-separated 1D GuaPbI3, as suggested by the XRD. It is worth noting that these results are in contradiction to those of previous reports, where Gua has been proposed as a passivating agent that does not incorporate into the perovskite structure due to its larger size24. Nevertheless, significant variations in the preparation method could account for the different crystallization dynamics. Here, we incorporate Gua within the precursor solution, ensuring the desired stoichiometry during crystallization.

Fig. 1: XRD and XPS characterization of Gua-based perovskites.
figure 1

a, Normalized XRD data for the mixed MA/Gua perovskite films containing different percentages of Gua. b, Magnification of the XRD peaks at (220) (left) and (440) (right) on variation of the Gua content (indicated in per cent). c, Lattice parameter variation (a and c) of the MA1–x Gua x PbI3 unit cell obtained from the crystallographic analysis of the experimental XRD patterns. d, XPS spectra of N 1s for thin films of typical MA1–x Gua x PbI3 perovskite mixtures (x = 0, 12.5, 25, 30, 50, 100) (for clarity, traces are shifted vertically). e, Quantification of the percentage of Gua obtained from the XPS analysis (GuaR corresponds to the measured values; GuaT corresponds to theoretical values, initially incorporated into the precursor solution). f, Optimized simulated structure of the unit cell of Ma0.75Gua0.25PbI3 including the six H-bond distances with respect to I atoms.

The relative composition and chemical environment of the constituents in the perovskite materials have been analysed by X-ray photoelectron spectroscopy (XPS). Measurements performed for the pure MA and Gua phases and four representative mixtures (x Gua = 12.5%, 25% 30% and 50%) reveal the formation of Pb–I bonds and a relative Pb/I ratio of ~3.0, consistent with the theoretical stoichiometry present in the 3D MA1–x Gua x PbI3 and 1D GuaPbI3 structures (Supplementary Fig. 2a). In addition, the photoemission spectra of the N 1s region reveals the two peaks attributed to the NH3 + group in MA (402.3 eV) and the NH2 + group in Gua (400.3 eV), which changes gradually in intensity on increasing the Gua content (Fig. 1d). The initial experimental MA/Gua ratio is preserved within the final structure, as presented in Fig. 1e (corroborated by NMR measurements, Supplementary Fig. 2b,c), which is particularly valuable in the determination of the crystalline structure.

To analyse the role of Gua in the crystalline material and examine the stability of the MA1–x Gua x PbI3 structures, density functional theory with generalized gradient approximation (DFT–GGA) calculations using the Perdew–Burke–Ernzerhof (PBE) exchange correlation functional were conducted. An estimation of the formation enthalpies at zero temperature, ΔH f, for the pure MA and Gua phases, as well as for that containing x Gua = 0.25 was performed (Supplementary Note 1). A remarkable difference for the three perovskite structures was found, with a clear tendency when increasing the Gua content: ΔH f(MA_pure) = −0.149 eV  ΔH f(MA0.75_Gua0.25) = −1.484 eV > ΔH f(Gua_pure)  = −2.045 eV. Compared with the pure MAPbI3 phase, which exhibits a value close to zero, consistent with previous reports25,26, 1D GuaPbI3 points to enhanced stability, as expected for LDP27. However, a striking result appears for the mixed Ma0.75Gua0.25PbI3 perovskite, which also exhibits a highly negative formation enthalpy, close to that of the 1D GuaPbI3, while maintaining its 3D structure. Note that such a behaviour has important implications for the performance of the solar cell, as the substitution of Gua for ¼ of MA in the MAPbI3 structure results in a significant increase of the system stability. Besides, a phase separation of the MA0.75Gua0.25PbI3 into the pure MA and Gua systems was found to be thermodynamically less favoured (ΔH f =  −0.622 eV), and it is foreseen that it does not occur at a lower percentage of Gua. Only at additions higher than 25%, both Ma0.75Gua0.25PbI3 and GuaPbI3 crystalline phases appear, given the impossibility of the 3D octahedral [PbI6] network to accommodate additional Gua cations. Figure 1f shows the optimized unit cell for Ma0.75Gua0.25PbI3, where the main H–I interactions with the Gua cation can be identified. Note that the formation of hydrogen bonds plays a key role in the structural stabilization. Compared with the 1–2 H bonds per MA molecule28, the introduction of Gua increases the number of interactions to six H bonds while reducing the H–I distance, which seems to be the ultimate cause for the superior Ma0.75Gua0.25PbI3 stability. Importantly, our results suggest that the crystal distortions produced by the larger cation could be compensated at the expense of the neighbouring cavities where the small MA cation localizes, preserving its 3D structure.

Optical and electronic properties

The effect of the lattice expansion on the optoelectronic properties was also analysed by DFT–GGA calculations. The electronic band structures and density of states for MAPbI3 and two representative mixtures (12.5% and 25% of Gua content) show no appreciable difference, with I 5p states mainly contributing to the top valence band and Pb 6p states dominating the lowest conduction band (Supplementary Fig. 3). Nevertheless, there is a small but gradual increase in the bandgap energy with the insertion of Gua, showing values equal to 1.77 eV, 1.79 eV and 1.82 eV for MAPbI3, 12.5% and 25% of Gua, respectively. The direct character of the MAPbI3 bandgap is also conserved in the two mixtures, with the minimum bandgap occurring at the Γ symmetry point. Moreover, the three samples display a similar dispersion of the valence and conduction bands, which ensures low carrier effective masses.

Consequently, the incorporation of Gua preserves the optical properties of the material. Figure 2a shows the normalized absorption spectra for four typical Ma1–x Gua x PbI3 thin films with x Gua  < 0.5. In agreement with the theoretical calculations, no significant changes in the shape of the spectrum are observed for mixtures containing x Gua  < 0.2, except a tiny but continuous shift in the absorption band edge, as illustrated in the inset of Fig. 2a. Yet, x Gua  > 0.2 produces an appreciable lowering of the absorption capacity along with a blueshift of the band edge (~ 0.02 eV), indicative of a widening of the bandgap. This can be related to the different organic–inorganic interactions mediated by the new hydrogen bonds, which lead to local distortions at the Gua neighbouring positions, and expand the crystal unit. Results for higher Gua percentages are also reported in Supplementary Fig. 4a. A sharp band edge at ~500 nm, with a remarkable excitonic peak at 390 nm appears for pure 1D GuaPbI3 (ref. 21). This is also detected for x Gua  > 0.5, which, together with the absorption band edge of Ma0.75Gua0.25PbI3 at ~775 nm, confirms the preservation of both individual phases. Accordingly, the photoluminescence (PL) spectra shown in Fig. 2b (Supplementary Fig. 4b–d) manifest a gradual shift towards higher energy for samples with x Gua  < 0.2 (see inset to Fig. 2b), which becomes more apparent for x Gua  = 0.25, and is preserved for larger Gua amounts, consistent with the results observed in Fig. 2a. These findings provide compelling evidence that the substitution of Gua for MA efficiently stabilizes a 3D perovskite phase while retaining extended and efficient absorption similar to MAPbI3.

Fig. 2: UPS and optical characterization.
figure 2

a, Ultraviolet–visible–near-infrared absorption spectra of typical MA1–x Gua x PbI3 films containing x ≤ 0.5 shown in Fig. 1. Inset: magnification of the band edge for mixed films containing x ≤ 0.25 of Gua. b, Photoluminescence (PL) spectra of the perovskite films shown in a. c, Secondary-electron cutoffs for workfunction determination (left), and wide (centre) and narrow (right) binding energy range valence spectra of the samples with different Gua/MA ratios.

In addition, the electronic structure was also investigated by ultraviolet photoelectron spectroscopy (UPS). The results reveal a slight gradual shift of the valence band onset (by 0.04–0.09 eV) towards the Fermi level from MAPbI3 to MA1–x Gua x PbI3 samples containing up to 25% Gua, while retaining the main valence band features of MAPbI3, as depicted in Fig. 2c. Concomitantly, the ionization energy becomes slightly reduced (by up to 0.14 eV). However, larger amounts of Gua ( > 25%) result in a shift of the valence band onset away from the Fermi level. A solid change in the valence band features, increasingly resembling those corresponding to pure GuaPbI3 (binding energy region between 5.5 eV and 8.7 eV), suggests the coexistence of GuaPbI3 at the surface above 25% Gua content, which is corroborated also by scanning electron microscopy (SEM; as discussed below). As GuaPbI3 contains an increased number of Pb0-related surface states, which tend to pin the Fermi level close to the conduction band minimum29 (Supplementary Fig. 2a), the wider gap of GuaPbI3 as compared with MAPbI3 results in the shift of the valence band onset towards higher binding energy for x Gua > 0.3.

Photovoltaic performance

To demonstrate the applicability of Gua-containing perovskites, we embodied the Ma1–x Gua x PbI3 (0 < x < 0.25) into solar cells sandwiched in between the mesoporous (mp)-TiO2, used as the electron-transporting material, and 2,2′,7,7′-tetrakis(N,N′-di-p-methoxyphenylamine)-9,9′-spirobifluorene (spiro-OMeTAD), as the hole-transporting material (Fig. 3a and Supplementary Fig. 5). The average photovoltaic parameters obtained from the cells are shown in Fig. 3b and listed in Table 1, which also includes the champion cells obtained for each condition (see also Supplementary Table 1). The short-circuit current density (\({J}_{{\rm{sc}}}\)) hardly changes for Gua fractions up to 20%, but gradually lowers for increased Gua contents, with 14% of Gua outstanding among the others. This behaviour can be related to the decreased absorption detected for x Gua  > 0.2, as supported by the external quantum efficiency (EQE) spectra shown in Fig. 3c (photographs of the as-prepared MA1–x Gua x PbI3 solar cells are provided in Supplementary Fig. 6). In addition, the average open-circuit voltage (\({V}_{{\rm{oc}}}\)) increases progressively with the Gua incorporation, from 1.04 ± 0.02 V for x = 0 to 1.085 ± 0.02 V for x = 0.25 (see Table 1), as expected from the optical bandgap observations. Notably, the fill factor (FF) remains almost unaltered, with high average values over 0.75 (and maxima close to 0.80). As a result, the PCE of the prepared cells increases from 17 ± 1% for MAPbI3 to 19.2 ± 0.4% for the Gua/MA mixed system containing 14% Gua, with a champion cell efficiency of 20.15%. Moreover, even for perovskites containing 25% Gua, the photovoltaic performance remains similar to that of the MAPbI3, with an average PCE of 17.1 ± 0.8% and a record efficiency of 18.30% (Supplementary Fig. 7). The current density versus voltage (\(J-V\)) curve and EQE obtained for the champion device are presented in Fig. 4a,b, respectively. The EQE demonstrates high photon-to-current conversion over 80% throughout the entire ultraviolet–visible spectrum, leading to an integrated current density of 22.09 mA cm−2. J–V hysteresis measurements are reported in Supplementary Fig. 8. We also analysed the charge dynamics by electro-chemical impedance spectroscopy (Supplementary Figs. 9 and 10), which suggest an increased recombination resistance and longer electron lifetime with Gua incorporation, possibly related to a more efficient charge extraction and better crystal formation.

Fig. 3: Device architecture and photovoltaic performance.
figure 3

a, Device architecture of the perovskite solar cells incorporating Gua cations (glass/FTO/c-TiO2/mp-TiO2/perovskite/spiro-OMeTAD/Au). b, Statistical data for J sc, V oc, FF and PCE obtained from more than 120 cells (at least 17 cells per condition) prepared with MA1–x Gua x PbI3 as a function of x. The top bar shows the maximum value, the bottom bar shows the minimum value, the circle shows the mean value and the dashed rectangle shows the region containing 25–75% of the data, obtained for each condition. c, EQE spectra of mixed MA1–x Gua x PbI3 (x = 0.14, 0.17 and 0.25) and that incorporating 50% Gua. The result for MAPbI3 (0%) is also included as a reference.

Table 1 Photovoltaic performance
Fig. 4: Champion device and thermal stability test.
figure 4

a,b, J–V curve (a) and EQE spectrum (b) of the champion cell prepared with mixed MA/Gua perovskite containing 14% Gua. c, MPP tracking under 1 Sun AM1.5G illumination measured in air, for a typical high-efficiency cell (MA1–x GuaxPbI3 (x = 0.14)). d, Thermal stability test of MA1–x Gua x PbI3 perovskite solar cells (x = 0, 0.125, 0.15, 0.25) at 60 °C under continuous light illumination and MPP tracking in an argon atmosphere. The initial PCE for each cell was 18.77%, 18.97%, 18.11%, and 17.14%, respectively.

Device stability and phase segregation analysis

The device stability has been tested under AM1.5 G Sun illumination at maximum power point (MPP) tracking, for more than 1,000 hours, at 60 °C and under an Ar atmosphere. The results (Fig. 4d) reveal an enhanced stability for higher Gua contents, providing evidence of the beneficial effect on the material stability, as predicted by the simulations. Despite the initial decrease, recently associated with the inter-penetration of spiro-OMeTAD and gold electrode30, a gradual stabilization and recuperation of the performance is observed, which is reproducible (Supplementary Fig. 11a) and clearly correlated with the Gua content. Alternatively, we have performed an initial light stress test at 85 °C using polytriarylamine polymer, a more stable hole-transporting material, under 300 h of illumination, which further confirms the enhanced stability compared with MAPbI3, for the mixed MA/Gua perovskite (Supplementary Fig. 11b).

To gain insight into the phase stability and micro-structure of the mixed MA/Gua system, we analysed the film morphology and phase segregation using SEM and combined micro-Raman and micro-photoluminescence (micro-PL) spectroscopy. Figure 5a–d shows the SEM images obtained for four representative compositions, including the pure MAPbI3 and GuaPbI3 phases, as well as samples containing Gua below and above 25%, at which the phase segregation may occur. As presented in the figure, the MAPbI3 film has a grainy-like morphology with large crystal domains of around 1 µm diameter (see orange line). On the contrary, GuaPbI3 presents an elongated rod-like morphology with crystals of several micrometres in length, typical for the 1D aggregation. Notably, samples containing x Gua  < 0.25 do not show any similar phase, resembling the MAPbI3 but with a considerably increased size of the crystal domains, as emphasized by the orange line in the picture. A relation between the amount of Gua and the size of the crystal domains is also observed for all samples, in which the domains remain like islands of several micrometres within the capping layer (Supplementary Figs. 12 and 13). The 1D-like morphology is detected only for samples containing higher amounts of Gua ( > 25%), as also appreciated in Fig. 5, at which phase segregation occurs.

Fig. 5: Morphology and phase segregation analysis.
figure 5

ad, Top-surface SEM images of four representative samples, including pure MAPbI3 (a), mixed MA1–x Gua x PbI3 with x = 0.14 (b), with x = 0.30 (c), and pure GuaPbI3 (d). Scale bars, 1 µm. e,f, Micro-PL wavelength peak shift map (e) and micro-Raman spectra (f) of the perovskite surface obtained for Gua contents equal to 0, 15, 25 and 75%. The traces are shifted vertically for clarity.

These results are confirmed by the micro-Raman and micro-PL analysis (Fig. 5e,f). Averaged over a diffraction-limited spot size of 300 nm, this technique can provide further information about local heterogeneities within the film31. The emission of four different samples was investigated, with a particular focus on the distribution of the PL peak position. The latter is intimately linked to the material bandgap, which changes with composition9 and/or local disorder32 over microscopic areas of the samples. Fig. 5e shows the map of the PL peak position over 6 × 6 µm2 regions. In the wavelength emission range between 710 nm and 780 nm, no appreciable change in the PL peak is observed for x Gua  < 0.25, remaining around 770 nm, as for the pure MAPbI3 (Supplementary Fig. 14). On the contrary, the addition of 75% Gua leads to the appearance of a contrasted PL map with regions extending up to a few micrometres, with a remarkable PL shift down to 710 nm. This behaviour indicates a phase segregation in the material, resulting in a distribution of different bandgaps across the film. On the same areas, micro-Raman spectra were recorded (Fig. 5f). For Gua contents up to 25%, the Raman spectra closely resemble that for the pure MAPbI3. Characteristic broad peaks in the region below 200 cm−1 are observed related to the Pb–I stretching and bending modes33,34, along with a broad feature around 250 cm−1 related to the vibrations of the organic cation. Remarkably, as recently observed with FA incorporation to the MAPbI3, a gradual shift of the peak to lower wavenumber appears, suggesting a shrinking of the mode due to the incorporation of the distinct Gua cation in the unit cell. For Gua content above 25%, we could identify a position-dependent signal that changes in line with the PL variation. Some regions show a similar spectrum as for the lower Gua content, while on the regions presenting the ‘rod-like’ morphology, a redistribution of the relative peak intensity happens with a dominant peak at 120 cm−1 and an additional peak at 135 cm−1, both with a reduced broadening of the signal. This peak shift is usually attributed to isolated Pb–I planes, similarly to the case of PbI2 intercalated with large organic molecules35, which suggest the formation of a LDP as for the pure GuaPbI3 arranging into the 1D phase. As corroborated in the figure, GuaPbI3 shows apparent peaks at 120 cm−1 and 135 cm−1 as previously asserted for the 75 % sample. These results further confirm the phase homogeneity of the mixed MA1–x Gua x PbI3 for Gua < 25%, which, on the contrary, reveals a severe phase segregation into a 3D/1D mixture for larger Gua amounts, while retaining the individual features of the single constituents. No visible degradation signs are observed during the PL measurements, as shown in Supplementary Fig. 14b.


We present a perovskite composition based on a combination of Gua/MA cations that exhibits superior photovoltaic performance and material stability compared with MAPbI3. We demonstrate that the incorporation of large Gua cations unexpectedly forms a highly stable 3D crystalline structure, plausibly mediated by the increased number of H bonds within the inorganic framework. The prepared MA1–x Gua x PbI3 perovskite preserved the good optoelectronic properties associated with the organic lead halide materials, leading to a high PCE surpassing 20% for a Gua content of 14%. Our results emphasize the versatility of organic–inorganic lead halide perovskites, and invite further exploration of organic cations including those that are beyond the limit of the tolerance factor.


Solar cell fabrication

Perovskite solar cells were fabricated on F-doped SnO2 (NSG10) substrates previously cleaned by a sequential sonication treatment in a 2% Hellmanex solution, acetone and isopropanol, followed by ultraviolet–ozone treatment for 15 min. A compact blocking layer of TiO2 (bl-TiO2, 30 nm in thickness) was then deposited onto the fluorine-doped tin oxide (FTO) glass substrate by spray pyrolysis, using a titanium diisopropoxide bis(acetylacetonate) solution in ethanol (60% v/v), and then sintered at 450 °C for 30 min. A 200-nm-thick layer of mesoporous TiO2 (mp-TiO2, 30 NR-D titania paste from Dyesol) was prepared by spin-coating a diluted TiO2 dispersion in ethanol, ratio 1:8 by weight, at 2,000 r.p.m. for 15 s followed by a sintering step at 500 °C for 30 min. Afterwards, the substrates were lithium-treated by spin-coating 40 μl of tris (bis (trifluoromethylsulfonyl)imide) (Li-TFS) (14.67 mg ml–1 in acetonitrile) onto the mesoporous layer, followed by a sintering step at 500 °C for 30 min. Stoichiometric precursor solutions were prepared by mixing MAI, GuaI (Dyesol) and PbI2 (TCI) in N,N′-dimethylsulfoxide (DMSO) with MAI/GuaI gradually changing from 1:0 to 0:1, while keeping the PbI2 molarity equal to 1.25. The perovskite layers were then fabricated by using a two-step spin-coating process reported previously36 (first step 1,000 r.p.m. for 10 s; second step 4,000 r.p.m for 30 s), and 15 s before the end of the programme, 100 µl of chlorobenzene was poured onto the films, and then the substrates were annealed at 100 °C for 45 min. After this time, spiro-OMeTAD was spin-coated at 4,000 r.p.m., for 30 s from a chlorobenzene solution (28.9 mg in 400 μl, 60 mmol) containing Li-TFSI (7.0 μl from a 520 mg ml–1 stock solution in acetonitrile), TBP (11.5 μl) and Co(II)TFSI (10 mol%, 8.8 μl from a 40 mg ml–1 stock solution) as dopants. Finally, a 70 nm gold electrode was evaporated.

Thin-film characterization

The XRD patterns of the prepared films were measured using a D8 Advance diffractometer from Bruker (Bragg–Brentano geometry, with an X-ray tube Cu Kα, λ = 1.5406 Å). The absorption spectra were registered with an ultraviolet–visible–infrared spectrophotometer (PerkinElmer Instrument). Photoluminescence (PL) steady-state measurements were recorded with a spectrophotometer (Gilden Photonics). The micro-PL and micro-Raman measurements were performed on a Renishaw InVia Raman microscope with an L100× objective (spot size of about 300 nm). The PL map was recorded using 0.0005% laser intensity (corresponding to 100 µJ cm–2), using a 532 nm green laser diode. The spectra were registered in the 710–820 nm region. Raman spectra were obtained using the same excitation monitoring the 50–250 cm−1 range, particularly sensitive to the Pb–I modes. The final data were averaged over 50 accumulations to maximize the signal-to-noise ratio. To prevent sample degradation or thermal effects, the laser power intensity was kept below (excitation density of around 3 mW cm–2 (0.005%)) and the light exposure time per measurement was 0.1 s. Photoelectron spectroscopy measurements were performed in an ultrahigh-vacuum system (base pressure of 2 × 10−10 mbar) using a He-discharge ultraviolet source (Omicron) with an excitation energy of 21.2 eV for UPS and an Al Kα X-ray source (excitation energy: 1486.6 eV) for XPS. The photoelectron spectra were recorded using a Phoibos 100 (Specs) hemispherical energy analyser at a pass energy of 5 eV for the valence band and a pass energy of 20 eV for the core levels. For workfunction determination, the secondary-electron cutoff was recorded by applying a −10 V sample bias to clear the analyser workfunction. The reported valence band spectra were background subtracted. The binding energies for all of the photoemission spectra are referenced to the Fermi level. For a comparison of the XPS core-level spectra, the binding energy values were all adjusted to the C 1s carbon at lower binding energy that was here referenced to 285 eV. A mixed Gaussian/Lorentzian peak shape and a Shirley-type background were employed for XPS peak fitting with the XPS Peak 4.1 software. NMR measurements were performed for samples containing up to 30% Gua. Mixed MA1–x Gua x PbI3 perovskite films were prepared on conductive FTO substrates in the same conditions as for the photovoltaic devices. Once the perovskite layers were crystallized, the solid films were re-dissolved in deuterated DMSO (DMSO-d6) and directly analysed in liquid-state 1H-NMR 800 MHz instruments equipped with a 5 mm triple-channel 1H/13C/15N cryoprobe and a AVII console. The method used was a single pulse with 16 scans, a delay of 5 s and a pulse length of 7.8 µs.

Device characterization

The photovoltaic device performance was analysed using a VeraSol LED solar simulator (Newport) producing 1 Sun AM 1.5 (1,000 W m–2) sunlight. Current–voltage curves were measured in air with a potentiostat (Keithley 2604). The light intensity was calibrated with a NREL-certified KG5-filtered Si reference diode. The solar cells were masked with a metal aperture of 0.16 cm2 to define the active area. The cells were measured in air, at room temperature and without encapsulation, at a constant rate 10 mV s−1 for both forward and reverse bias. No special pre-conditioning protocol was used apart from 5 s of stabilization time before the measurement. No anti-reflective coating was used during the measurement. The stability test was performed in a sealed cell holder flushed with a flow of argon (30 ml min–1) and I–V curves were characterized by an electronic system using a 22-bit delta–sigma analog-to-digital converter, performed every 2 h. For I–V curve measurement, a scan rate of 25 mV s–1 with a step of 5 mV was used, maintaining the temperature of the cells at around 60 °C. Cells were maintained at the maximum power point using a MPP tracking algorithm under 100 mW cm–2. A reference Si photodiode was placed in the holder to verify the stability of the light. EQE was measured with the IQE200B (Oriel) without bias light.

Computational calculations

Geometrical structures of PbI2 (ref. 37), GuaI (ref. 38), MAI (refs 39,40), tetragonal MAPbI3Ma (ref. 41) and 1D GuaPbI3 (ref. 21), from the bibliography, were optimized, without cell optimization. For the different perovskites, MA1–x Gua x PbI3, where x = 0, 0.25 and 1, only the organic material position was optimized, restricting the Pb and I position to those obtained from the diffractogram. We proceed in this way because the MA geometric arrangement is not known in detail from the information obtained from the diffractograms42,43. Periodic DFT–GGA calculations using the PBE exchange correlation functional were performed44. Electron–ion interactions were described by ultrasoft pseudopotentials. In the case of the Pb atom, we used a scalar relativistic pseudopotential. A 4 × 4 × 4 Monkhorst—Pack grid was chosen for sampling the Brillouin zone45. Given that these compounds are essentially ionic in nature, electrostatic interactions well described by DFT–GGA are expected to represent the main contribution in the interaction. This is indirectly confirmed by the usually good agreement between experimental and calculated structural parameters for this type of material46.

Data availability

The data that support the plots within this paper and other finding of this study are available from the corresponding author upon reasonable request.