a, The molecular structures of three passivators (PEA, PA and CF3-PA). PA and CF3-PA exhibit molecular structures similar to that of PEA, but without any alkyl chain between the benzene ring and ammonium group. Corresponding Gaussian calculated electrostatic potentials (φ) are shown. The right colour bar from red to blue marks the increase of electropositivity. b, Schematic diagram of the interaction between ammonium cations with the acceptor-like defects, that is, formamidinium (FA) vacancy (VFA), methylammonium (MA) vacancy (VMA), Sn vacancy (VSn), Pb vacancy (VPb), I substituted at Sn site (ISn) and I substituted at Pb site (IPb). Both the A-I and B-I terminated (001) perovskite surfaces are considered. c, Ab initio molecular dynamics snapshots and top views of the CF3-PA, PA and PEA adsorbed perovskite surfaces at a temperature of 400 K. F atoms, green; N atoms in PA and PEA cations, red. The desorbed molecules are highlighted with blue dashed circles in the top views. d, The number of adsorbed molecules for CF3-PA, PA and PEA at temperatures of 300 and 400 K. A molecule number of 16 represents complete surface coverage in the simulation unit. e, The binding energy (Eb) between passivators and various acceptor-like defects.