I am doing some homework on statistical mechanics, and I'm facing something I can't seem to understand/find what I'm doing wrong.
Suppose we have a diatomic molecule, both atoms have mass $m$. Suppose the molecule isn't moving, and it is in thermal equilibrium with a heat bath at a temperature $T$. The chemical bond can be modelled as a simple harmonic oscillator, such that the Hamiltonian is given by $$ H = K (x_1 - x_2)^2, $$ where $x_1$ and $x_2$ are the positions of atom $1$ and $2$. We now apply the equipartition theorem: $$ \left\langle x_1 \frac{\partial H}{\partial x_1} \right\rangle = \langle 2K x_1 (x_1 - x_2 ) \rangle = k_BT $$ $$ \left\langle x_2 \frac{\partial H}{\partial x_2} \right\rangle = \langle -2K x_2 (x_1 - x_2 ) \rangle = k_BT $$ When we take the sum of both, we get $$ \langle 2K (x_1 - x_2)(x_1 - x_2) \rangle = 2 \langle K (x_1 - x_2)^2 \rangle = 2 \langle H\rangle = 2k_BT \implies \langle H\rangle = k_{B}T.$$ This result isn't in agreement with the energy calculated via the canonical partition function, or just the energy of an harmonic oscillator in one-dimension: which gives $$ \langle H\rangle = \frac{k_{B}T}{2}.$$ If someone can point out what I'm doing wrong, I would greatly appreciate it! Thanks.