Controlling the motion of hydrogen molecules