Formation of molecular hydrogen in interstellar space