How about the reverse process? When an HI atom collides with another
HI, or with an electron and gets ionised, then the system has
converted kinetic energy into ionisation energy. When the ion
recombines, HII + e
HI, it can be that the photon
escapes from the cloud, in which case there has been a net loss of
energy for the gas. Since the particles are now moving slower, the
temperature of the gas
is lower, or the
gas has cooled down. This process is called radiative cooling
and it is very important for star formation.
So we understand now why colder gas will tend to be molecular, whereas
hotter gas is more likely to be atomic or even ionised. Now, if the
pressure between these phases is nearly the same, then the colder
gas (in which H
is favoured) will need to be denser than the hotter
gas (atomic or, at higher temperature, ionised). And so you expect to
find dense, cold clouds to be molecular, and hot, rarefied gas to be
ionised - which is indeed what we observe, except that there is one
more important process: photo-ionisation.