\(\renewcommand{\AA}{\text{Å}}\)

# 10.3.4. Calculate temperature

Temperature is computed as kinetic energy divided by some number of degrees of freedom (and the Boltzmann constant). Since kinetic energy is a function of particle velocity, there is often a need to distinguish between a particle’s advection velocity (due to some aggregate motion of particles) and its thermal velocity. The sum of the two is the particle’s total velocity, but the latter is often what is wanted to compute a temperature.

LAMMPS has several options for computing temperatures, any of which can be used in thermostatting and barostatting. These compute commands calculate temperature:

- compute temp

- compute temp/sphere

- compute temp/asphere

- compute temp/com

- compute temp/deform

- compute temp/partial

- compute temp/profile

- compute temp/ramp

- compute temp/region

All but the first 3 calculate velocity biases directly (e.g. advection velocities) that are removed when computing the thermal temperature. Compute temp/sphere and compute temp/asphere compute kinetic energy for finite-size particles that includes rotational degrees of freedom. They both allow for velocity biases indirectly, via an optional extra argument which is another temperature compute that subtracts a velocity bias. This allows the translational velocity of spherical or aspherical particles to be adjusted in prescribed ways.