From 9f6928fc1d01c5173ec82342e13fc67c30c3d3fb Mon Sep 17 00:00:00 2001 From: Belinda Slakman Date: Fri, 11 Jul 2014 11:29:53 -0400 Subject: [PATCH 1/2] Implement getAllSoluteData method in solvation. This returns all the possible solute descriptors for a species, which if in the library, includes the library set, and always includes the group additivity estimate. --- rmgpy/data/solvation.py | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/rmgpy/data/solvation.py b/rmgpy/data/solvation.py index 1e5e1cbce1..fb4d51a005 100644 --- a/rmgpy/data/solvation.py +++ b/rmgpy/data/solvation.py @@ -608,10 +608,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): """ From 2d40e3bc6d21854d8fb36f80dcea5a64342b8132 Mon Sep 17 00:00:00 2001 From: Belinda Slakman Date: Fri, 11 Jul 2014 11:30:35 -0400 Subject: [PATCH 2/2] Better documentation for some solvation methods. Added information about units for the solvation correction to thermo. --- rmgpy/data/solvation.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/rmgpy/data/solvation.py b/rmgpy/data/solvation.py index fb4d51a005..b11d6aa549 100644 --- a/rmgpy/data/solvation.py +++ b/rmgpy/data/solvation.py @@ -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 @@ -815,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)