I was trying to compute some stat mech and thermodynamic quantities using the data in the HITRAN molecular data base and ran into a conceptual problem. The basic quantity needed for these calculations is the partition function, $Q(T)$, the usual sum over Boltzmann factors. HITRAN provides the spectral line wavenumber, $\nu_{ij}$, and the lower state energy of the transition, $E_{\text{lower},\,ij}$ for every spectral line. I naively computed
$$Q(T) = \sum_{I,j} \exp( - (\nu_{ij} + E_{\text{lower},\,ij})/kT )$$
which gives the wrong answer compared to the the HITRAN tables of precomputed Q(T) values. It turns out that the correct calculation is
$$Q(T) = \sum_{\text{unique }E_{\text{lower},\,ij}}\exp( - E_{\text{lower},\,ij}/kT )$$
With this definition I got the right answer for $Q(T)$ and the computed specific heats of H2O and CO2 matched their measured values within 1%.
What I learned from this is that there are many more spectral lines than there are values of $E_\text{lower}$ and each value of $E_\text{lower}$ has a specific set of lines associated with it. This is true for N2, O2, CO2, and H2O.
A hydrogen atom only has one $E_\text{lower} = 0$ and all its energy levels are with respect to this. Where do the $E_\text{lower}$ values come from in a molecule? Why does the partition function only depend on them and not all the spectral lines?