Correct the error in free_energy calculation

the free_energy calculation in grbm is wrong.