Added log energy calculation