Correct calculate_energy

Signed-off-by: Axel Davy <axel.davy@ens.fr>