Molecule formation and infrared emission in fast interstellar shocks. I Physical processes