The "potential energy" degree of freedom? I'm reading Schroeder's "An Introduction to Thermal Physics" and he mentions the vibrational degrees of freedom of a diatomic molecule:

A diatomic molecule can also vibrate, as if the two atoms were held together by a spring. This vibration should count as two degrees of freedom, one for the vibrational kinetic energy and one for the potential energy. (You may recall from classical mechanics that the average kinetic and potential energies of a simple harmonic oscillator are equal-a result that is consistent with the equipartition theorem.) More complicated molecules can vibrate in a variety of ways: stretching, flexing, twisting. Each "mode" of vibration counts as two degrees of freedom.

Why is there a "potential energy" degree of freedom? In classical mechanics, we treated a mass vibrating on a spring as having one degree of freedom (for example, in Lagrangian mechanics). I thought that potential energy and kinetic energy for a simple harmonic oscillator are just two sides of the same coin; the energy is transformed between the two.
Is it something different from the usual spatial degrees of freedom that I am used to?
 A: In the equipartition theorem, "degrees of freedom" mean independent ways to access energy states. It is different from "degrees of freedom" intended as Lagrangian coordinates, or position coordinates. For example, the one-dimensional free particle has 2 Lagrangian coordinates but only one way to change its kinetic energy (velocity): this is why it is the latter meaning that counts in the equipartition theorem, leading to 3 degrees of freedom being considered for each particle in an ideal gas (in 3D). It's not flat out the fact that particles in a box have one degree of freedom to move for each dimension that makes them possess 3 degrees of freedom in the context of the equipartition theorem: it's just a consequence of the fact that they can change velocity in those three directions.
For the harmonic oscillator, at fixed frequency there are two ways to change kinetic energy, position and momentum. If you are in doubt, because one depends on the other, note that an oscillation can have different amplitudes at the same frequency: so one doesn't uniquely determine the other. You might object that in this way the total energy changes too, but only global temperature is fixed in this context and not energy: the canonical ensemble is being used. So, for example, in an oscillator positions close to the center are less likely at higher temperatures; while in an ideal gas, temperature is irrelevant to average position.
The caveat is that, to be most precise, it's the quadratic terms in the Hamiltonian each that count as one degree of freedom (ultimately because they're used to calculate Gaussian integrals in the proof), so the above is just an intuitive explanation: non-quadratic terms of position and momentum in unusual Hamiltonians won't work.
