Generalized opacity functions in reactive scattering: The Ar++ D2 and K + halogens reactions