Calculation of entropy change