amep.thermo.kintemp#

amep.thermo.kintemp(v: ndarray, m: float | None | ndarray = None, d: int = 2) ndarray#

Calculates the kinetic temperature per particle based on the 2nd moment of the velocity distribution as described in Ref. [1].

Notes

The kinetic temperature is defined as the kinetic energy. In the overdamped regime (i.e. mass=0), it is simply \(\langle v^2\rangle\) (see Ref. [2]).

References

Parameters:
  • v (np.ndarray) – Velocity array of shape (N,3).

  • m (float or np.ndarray or None, optional) – Particle mass(es). The default is None.

  • d (int, optional) – Spatial dimension. The default is 2.

Returns:

temp – Kinetic temperature of each particle. Same length as v.

Return type:

np.ndarray

Examples

>>> import amep
>>> traj = amep.load.traj("../examples/data/lammps.h5amep")
>>> frame = traj[-1]
>>> tkin = amep.thermo.kintemp(
...     frame.velocities(), m=frame.mass()
... )
>>> fig, axs = amep.plot.new(figsize=(3.6,3))
>>> mp = amep.plot.particles(
...     axs, frame.coords(), frame.box, frame.radius(),
...     values=tkin, cscale="log"
... )
>>> axs.set_xlabel(r'$x$')
>>> axs.set_ylabel(r'$y$')
>>> cax = amep.plot.add_colorbar(
...     fig, axs, mp, label=r"$T_{\rm kin}$"
... )
>>> fig.savefig('./figures/thermo/thermo-kintemp.png')
>>>
../_images/thermo-kintemp.png