added statespecific energy calculation