Hydrogen atom as a canonical ensemble A cylinder of hydrogen gas is maintained at a temperature T. I want to find the probability of a single H atom to be in a certain state of energy E using the canonical ensemble formulae. The probability of being in a state of energy E is given by $e^{-E/k/T}$. This formula gives me senseless result, since there are infinite energy levels just below $E=0$. 
The senseless result is that the probability of H atom being in any state (of energy E) is $0$. 
Is the canonical ensemble formula not applicable to this situation? If not, why?
 A: Here's the thing. The first electronic transition (from the ground-state to the first excited state) requires $\frac{3}{4}(13.6 \,\mathrm{eV}) \approx 10\,\mathrm{eV}$. 
The energy available in a collision of two atoms in a equilibrium gas is a few times the thermal energy $k_b T$. For room temperature the thermal energy is about $\frac{1}{40}\,\mathrm{eV}$. For a low temperature gas the atoms all have their electronic configuration in the ground state all the time. (For values of "all" meaning "you could find a counter example here and there if you waited long enough but it won't actually change the result of any observation you might want to make".)
The electronic levels are "frozen out", and only the translational behavior matters.
The temperature dependence of the specific heat of diatomic gases is commonly used as a classroom example of this kind of behavior. At low temperature it is $\frac{3}{2}k_b T$ because only the translational modes are accessible. At slightly higher temperatures the rotational modes start to be activated the the specific heat rises to $\frac{5}{2} k_b T$ (because there are two distinct modes) where it plateaus for a while before the vibrational modes come on-line at still higher temperature and cause the specific heat to climb again to $\frac{7}{2}k_b T$ (two more modes) where it once more becomes more or less constant.
In order to activate the electronic modes even a little you need your gas to have a thermal energy of a few electron-volts corresponding to more than 10,000 kelvin. And once you get to that level ionization becomes possible because the subsequent excitations require less energy.
A: This paper resolves my doubts to a great extent.
http://www.ifi.unicamp.br/~mtamash/f604_fisest/pra80_032113.pdf
I found this paper when I searched 'Hydrogen atom in a box'. One key idea is that the standard H atom energy spectrum results (as taught in an introductory quantum mechanics course) are not applicable to this problem because, besides the Coulomb potential of the nucleus, there is also the constraint force of the cylinder which renders the standard H-atom results wrong; hence the senseless result when you use the canonical ensemble formula. See the above paper for more details.
