Calculation of energy loss