# How compute temp/sphere calculates the temperature

Dear LAMMPS users,

I am deforming granular assemblies in June17 '13 LAMMPS, and I hoped for some clarification about the temp/sphere compute. I have copied my input script at the bottom of the message.

In the compute temp code, the temp is given by:

\sum (m v^2)

In compute temp/sphere, the temp is given by:

\sum (m v^2 + 0.4mr^2 * omega^2)

if we include all degrees of freedom, or:

\sum (0.4mr^2 * omega^2)

if we only include rotational degrees of freedom.

I would expect, therefore, that if we sum the output from the following 2 computes:

1. compute 1 all temp

2. compute 2 all temp/sphere dof rotate

we should recover the temperature calculated from this compute:

1. compute 3 all temp/sphere dof all

Instead I find that compute 3) is giving the mean of 1) and 2) rather than the total.

Post-processing the particle velocities independently, I am able to match compute 1) from the translational particle data and compute 2) from the rotational particle data, but when I add these contributions, the result is 2x the output from compute 3) (i.e. it is the sum of 1) and 2) rather than the mean).

Have I misunderstood how we should be adding the translational+rotational contributions in this case?

Many thanks,

Chris

read_restart restart.restart (atom_style = sphere, boundary = p p p, region prism)

newton off

communicate single vel yes

neighbor 0.2 bin

neigh_modify delay 0

pair_style gran/hooke/history 20000 NULL 10 NULL 0.5 1

pair_coeff * *

timestep 0.000114

velocity all zero linear

velocity all zero angular

fix 1 all nve/sphere

compute 1 all temp

compute 2 all temp/sphere dof rotate

compute 3 all temp/sphere dof all

compute 4 all temp/deform

#compute 4 all pressure 3

compute 6 all coord/atom 1.0

variable T_tot equal c_1+c_2

thermo_style custom step c_1 c_2 v_T_tot c_3 c_4

thermo 50000

thermo_modify lost ignore norm no

compute_modify thermo_temp dynamic yes

fix 2 all deform 1 xy erate 10 remap v

dump id all custom 100 a1.dump id vx vy vz omegax omegay omegaz

thermo 100

run 50000

Chris,

Temperature is averaged over all degrees of freedom. For example, in granular literature you’ll find that granular temperature (with only the translational components) is given by T=1/3<v_iv_i>. Its the same as when you look at the Maxwellian, f(v)=1/sqrt(2pi*T)^(3/2)exp(-v_i^2/(2T)), temperature is the variance for one degree of freedom.