Beyond Born–Oppenheimer theory for spectroscopic and scattering processes