Temperature calculation for solids and liquids.

Hi all

Do we always use the formula
KE = 3/2*RT
to calculate temperature!? What is the rationale in using the same in the case of liquids and solids!? Since R is universal GAS constant!

I think it has to do with equipartition. Every term that appears quadratically in the Hamiltonian gets kT/2 of thermal energy, so in 3D it makes sense that the total kinetic energy, in thermal equilibrium, equals 3 * N * kT / 2. Equipartition does not really care whether your system is a gas, liquid or solid; as long as it is well equilibrated and obeys Boltzmann statistics it should hold. The fact that R is called gas constant has more to do with historical reasons I think, it really just is Boltzmann’s constant times Avogadro’s number, but it was first encountered when people studied ideal gases. Maybe others have more insightful comments on this.

I’d only add that in simulation it’s sometimes more helpful to think explicitly about the number of degrees of freedom: KE = FkT, where F is the number of degrees of freedom. F is 3N in a completely unconstrained system, and every bond or angle that you apply “fix shake” to costs you 1 degree of freedom.

Completely flexible water, for example, has 9 degrees of freedom per molecule, whereas rigid water models (no bond or angle vibration) have only 6.

Provided that you have one thermostat for the whole system (no thermostatting in regions), LAMMPS is smart enough to account for this on your behalf.