The excitation of molecular hydrogen by atomic hydrogen in astrophysical media