add energy calculation