How to compute the kinetic energy in the reference frame of the center of mass of the molecule?

Hello LAMMPS users and developers,

I have a molecule that is moving at a very high speed, and I am using the command compute temp in order to compute its temperature. However, this command is based on the equation: 1/2 mv^2 = 3\2 k T, which results in non-realistic temperatures because the velocity of the center of mass is very high.

My question is: how can I compute the temperature based on the relative velocity of the atoms with respect to the center of mass, instead of using the velocity of the atoms in an inertial reference frame ?

Thank you,

Please check out: compute temp/com command — LAMMPS documentation

Thank you so much !