Kinetic Energy tensor

Dear Developers,
I used “compute temp” to calculate kinetic energy tensor, and compare the result from Lammps with those produced by my own code. It’s seemly that Lammps gave double of element-values in that tensor?
I checked values of kinetic energy (scalar) produced by Lammps and by my code, they are the same.
So please reconsider value of kinetic energy tensor, and let me know whether I get wrong?

Thank you so much.

  1. Work with global scalar first:

p * V = N * k_B * T // textbook formula

E_kin = (3/2) * N * k_B * T // textbook formula


p * V

= (2/3) * E_kin

= (2/3) * (1/2) * \sum_i m_i * [vx_i^2 + vy_i^2 + vz_i^2]

= (1/3) * \sum_i m_i * [vx_i^2 + vy_i^2 + vz_i^2]

  1. Generalize to “per-atom” quantity:

p_i * V_i = (1/3) * m_i * [vx_i^2 + vy_i^2 + vz_i^2]

  1. Then generalize to tensor:

p_i * V_i = (1/3) * (pxx_i + pyy_i + pzz_i) * V_i // trace


pxx_i * V_i = m_i * vx_i * vx_i // a diagonal term

pxy_i * V_i = m_i * vx_i * vy_i // an off-diagonal term, should be zero after ensemble average

You see that there is no “1/2” any more.

Terminology: there is no “kinetic energy tensor”. It should be called the kinetic part of the “stress tensor”.


Dear Bruce Fan,

Thank you so much for your kindly reply
Please refer this link:
and discuss your “terminologies” with Lammps developers. It’s not mine
I just want to confirm a value produced by Lammps to make sure that I get right value as its description, not on how it should be called

Thank you.

OK, I see. It doesn’t batter much. That might be also an accepted terminology. I just googled “kinetic energy tensor” and got 37 100 results. Sorry for criticizing that.