# yade-users team mailing list archive

## [Question #698392]: I calculated the kinetic energy by E=0.5mv^2+0.5Iw^2 but it is not equal to kineticEnergy() when O.cell.velGrad is set

```New question #698392 on Yade:

I am conducting a simulation where the energy results are important for the study. So I want to study how the kinetic energy is calculated in YADE. In the documentation it shows kinetic energy is calculated by E=0.5*m*v^2+0.5*I*w^2, which is definitely normal and accurate. So I have tried to calculated kinetic energy by myself, as the particle mass m, velocity v, inertia I and angular velocity w can be all obtain by using O.bodies[]state.mass, O.bodies[].state.vel, O.bodies[].state.inertia and O.bodies[].state.angVel. But when I have set the value of O.cell.velGrad, the E=0.5*m*v^2+0.5*I*w^2 calculated by myself is much larger than utils.kineticEnergy(). And when I didn't use O.cell.velGrad, the E=0.5*m*v^2+0.5*I*w^2 calculated by myself is the same with utils.kineticEnergy()

I am thinking why this happened? Why setting the value of O.cell.velGrad will make E=0.5*m*v^2+0.5*I*w^2 larger than the utils.kineticEnergy()?

My code for calculating the E=0.5*m*v^2+0.5*I*w^2  is:

kineE=0
for i in bodies_id:
m=O.bodies[i].state.mass
v2=numpy.dot(O.bodies[i].state.vel, O.bodies[i].state.vel)
I=O.bodies[i].state.inertia
w2=numpy.dot(O.bodies[i].state.angVel, O.bodies[i].state.angVel)
kineE=kineE+0.5*m*v2+0.5*I*w2

Thank you very much!!
Yuxuan

--