Inelastic scattering of ions at the surface