# Regarding per atom temperature dumping

Hello all,

I want to visualize per atom temp. in visualization software.

So I am using following commands to calculate and dump the per atom temperature .

variable kB equal 1.3806504e-23 ###Boltzmann’s const.
compute keperatom all ke/atom
variable tempatom atom c_keperatom*(2/3)/( kB)
dump 2 all custom 100 temp.*.dump id type x y z v_tempatom

Is it the right way?

I think

variable kB equal 1.3806504e-23 * (1/ 1.602e-19 ) ### eV for metal units

please note that "temperature" is not a well defined concept for small
numbers of atoms, let alone individual atoms. you can apply "the
formula", but that will ultimately be some kind of scaling factor for
the kinetic energy. "temperature" as a concept only makes sense over a
large group of atoms.

as for computation, see ehe documentation of compute/temp:

The temperature is calculated by the formula KE = dim/2 N k T, where
KE = total kinetic energy of the group of atoms (sum of 1/2 m v^2),
dim = 2 or 3 = dimensionality of the simulation, N = number of atoms
in the group, k = Boltzmann constant, and T = temperature.

and:

This compute subtracts out degrees-of-freedom due to fixes that
constrain molecular motion, such as fix shake and fix rigid.

typical conventions are to subtract out degrees of freedom due to
constraints by evenly distributing them across the participating
atoms. an atom in a (shake) constrained bond loses 1/2 DOF, in an
angle 1/3 DOF. rigid objects have either 3 DOF (in 2d = 2x translate
and 1x rotate) or 6 DOF (in 3d = 3x translate and 1x rotate). if you
want the sum over all atoms to match the total system temperature,
you'll also have to consider that globally 2 DOF (for 2d) or 3 DOF
(for 3d) are subtracted due to the simulation being translationally
invariant.

axel.