Runaway electrons in the atmosphere in the presence of a magnetic field