added new freeEnergy calcuation