This work was funded in part by the UK Engineering and Physical Sciences Research Council (EPSRC; grants EP/M015254/2 and EP/M024881/1); the European Research Council (ERC) Starting Grant (717026); the Swedish Research Council Vetenskapsrådet (grant 330-2014-6433); the European Commission Marie Skłodowska-Curie action (grant INCA 600398); the Swedish Government Strategic Research Area in Materials Science on Functional Materials at Linköping University (faculty grant SFO-Mat-LiU 2009-00971); and the European Union’s Horizon 2020 research and innovation program under grant agreement 763977 of the PerTPV project. S. Bai is a VINNMER Fellow and Marie Curie Fellow. P.D. and Z.Y. acknowledge support from the China Scholarship Council (CSC). C.L. and S.H acknowledge financial support from the Bavarian State Ministry of Science, Research, and the Arts for the Collaborative Research Network ‘Solar Technologies go Hybrid’ and the German Research Foundation (DFG). M.K. acknowledges support from the Swiss National Science Foundation (grant cr23i2-162828). We thank H. Long, Z. Yan, C. Bao, N. Noel, B. Wenger, J. Ball and O. Inganäs for experimental assistance and discussions.

Reviewer information

Nature thanks Aditya Mohite, Shougen Yin and the other anonymous reviewer(s) for their contribution to the peer review of this work.