Skip to content

Commit

Permalink
Fixed bug in evaluating entropy of ThermoData objects below 300 K.
Browse files Browse the repository at this point in the history
I had previously fixed the same bug (assuming a positive dCp/dT at low
temperature, which is not always true for very small molecules) for the
enthalpy, but forgot to propagate the same fix for entropy until now.
  • Loading branch information
jwallen committed Nov 29, 2012
1 parent 0a85f81 commit b027ab4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion rmgpy/thermo/thermodata.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ cdef class ThermoData(HeatCapacityModel):
slope = (Cphigh - Cplow) / (Thigh - Tlow)
intercept = (Cplow * Thigh - Cphigh * Tlow) / (Thigh - Tlow)
T0 = (Cp0 - Tlow) / slope + Tlow
if T > T0:
if T > T0 or slope <= 0 or T0 > Tlow:
S += slope * (T - Tlow) + intercept * log(T / Tlow)
else:
S += slope * (T0 - Tlow) + intercept * log(T0 / Tlow) + Cp0 * log(T0 / T)
Expand Down

0 comments on commit b027ab4

Please sign in to comment.