Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 32 additions & 6 deletions rmgpy/data/solvation.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ def getSolventViscosity(self, T):
class SolvationCorrection():
"""
Stores corrections for enthalpy, entropy, and Gibbs free energy when a species is solvated.
Enthalpy and Gibbs free energy is in J/mol; entropy is in J/mol/K
"""
def __init__(self, enthalpy=None, gibbs=None, entropy=None):
self.enthalpy = enthalpy
Expand Down Expand Up @@ -608,10 +609,24 @@ def getAllSoluteData(self, species):
"""
Return all possible sets of Abraham solute descriptors for a given
:class:`Species` object `species`. The hits from the library come
first, then the group additivity estimate. This method is useful
for a generic search job.
first, then the group additivity estimate. This method is useful
for a generic search job. Right now, there should either be 1 or
2 sets of descriptors, depending on whether or not we have a
library entry.
"""
raise NotImplementedError()
soluteDataList = []

# Data from solute library
data = self.getSoluteDataFromLibrary(species, self.libraries['solute'])
if data is not None:
assert len(data) == 3, "soluteData should be a tuple (soluteData, library, entry)"
data[0].comment += "Data from solute library"
soluteDataList.append(data)
# Estimate from group additivity
# Make it a tuple
data = (self.getSoluteDataFromGroups(species), None, None)
soluteDataList.append(data)
return soluteDataList

def getSoluteDataFromLibrary(self, species, library):
"""
Expand Down Expand Up @@ -801,24 +816,35 @@ def __addGroupSoluteData(self, soluteData, database, molecule, atom):


def calcH(self, soluteData, solventData):
# Use Mintz parameters for solvents
"""
Returns the enthalpy of solvation, at 298K, in J/mol
"""
# Use Mintz parameters for solvents. Multiply by 1000 to go from kJ->J to maintain consistency
delH = 1000*((soluteData.S*solventData.s_h)+(soluteData.B*solventData.b_h)+(soluteData.E*solventData.e_h)+(soluteData.L*solventData.l_h)+(soluteData.A*solventData.a_h)+solventData.c_h)
return delH

def calcG(self, soluteData, solventData):
# Use Abraham parameters for solvents
"""
Returns the Gibbs free energy of solvation, at 298K, in J/mol
"""
# Use Abraham parameters for solvents to get log K
logK = (soluteData.S*solventData.s_g)+(soluteData.B*solventData.b_g)+(soluteData.E*solventData.e_g)+(soluteData.L*solventData.l_g)+(soluteData.A*solventData.a_g)+solventData.c_g
# Convert to delG with units of J/mol
delG = -8.314*298*2.303*logK
return delG

def calcS(self, delG, delH):
"""
Returns the entropy of solvation, at 298K, in J/mol/K
"""
delS = (delH-delG)/298
return delS

def getSolvationCorrection(self, soluteData, solventData):
"""
Given a soluteData and solventData object, calculates the enthalpy, entropy,
and Gibbs free energy of solvation at 298 K
and Gibbs free energy of solvation at 298 K. Returns a SolvationCorrection
object
"""
correction = SolvationCorrection(0.0, 0.0, 0.0)
correction.enthalpy = self.calcH(soluteData, solventData)
Expand Down