def testOxygenFromGA(self): """Check conversion of GA values for molecular oxygen to NASA form """ oxygen = structure.Structure(SMILES='O=O') oxygen.updateAtomTypes() GAthermoData = species.getThermoData(oxygen,thermoClass=thermo.ThermoGAData) WilhoitData = thermo.convertGAtoWilhoit(GAthermoData, atoms=2, rotors=0, linear=True) print WilhoitData NASAthermoData = thermo.convertWilhoitToNASA(WilhoitData)
def testOxygenGA(self): """Check molecular oxygen GA heat capacity values """ oxygen = structure.Structure(SMILES='O=O') oxygen.updateAtomTypes() GAthermoData = species.getThermoData(oxygen,thermoClass=thermo.ThermoGAData) #the following values come from Greg's Windows computer Cpe = [29.288, 30.208480000000002, 31.128960000000003, 32.007600000000004, 33.764880000000005, 34.936399999999999, 36.484480000000005] self.assertTrue(GAthermoData.Cp[0]==Cpe[0],"Actual (%.8f) and expected (%.8f) are different"%(GAthermoData.Cp[0],Cpe[0])) self.assertTrue(GAthermoData.Cp[1]==Cpe[1],"Actual (%.8f) and expected (%.8f) are different"%(GAthermoData.Cp[1],Cpe[1])) self.assertTrue(GAthermoData.Cp[2]==Cpe[2],"Actual (%.8f) and expected (%.8f) are different"%(GAthermoData.Cp[2],Cpe[2])) self.assertTrue(GAthermoData.Cp[3]==Cpe[3],"Actual (%.8f) and expected (%.8f) are different"%(GAthermoData.Cp[3],Cpe[3])) self.assertTrue(GAthermoData.Cp[4]==Cpe[4],"Actual (%.8f) and expected (%.8f) are different"%(GAthermoData.Cp[4],Cpe[4])) self.assertTrue(GAthermoData.Cp[5]==Cpe[5],"Actual (%.8f) and expected (%.8f) are different"%(GAthermoData.Cp[5],Cpe[5])) self.assertTrue(GAthermoData.Cp[6]==Cpe[6],"Actual (%.8f) and expected (%.8f) are different"%(GAthermoData.Cp[6],Cpe[6]))
def testEntropy(self): """Check the Wilhoit S matches the GA S for propane. Uses Propane as a test-case. atoms=11, rotors=2, linear=False """ propane = structure.Structure(SMILES='CCC') propane.updateAtomTypes() GAthermoData = species.getThermoData(propane,thermoClass=thermo.ThermoGAData) WilhoitData = thermo.convertGAtoWilhoit(GAthermoData, atoms=11, rotors=2, linear=False) Tlist = thermo.ThermoGAData.CpTlist # just check at defined data points for T in Tlist: ga = GAthermoData.getEntropy(T) wil = WilhoitData.getEntropy(T) err = abs(ga-wil) limit = 4.0 # J/mol/K self.assertTrue(err<limit,"GA (%.1f) and Wilhoit (%.1f) differ by more than %s J/mol/K at %dK"%(ga,wil,limit,T))
def testEnthalpy(self): """Check the Wilhoit H matches the GA H for propane. Uses Propane as a test-case. atoms=11, rotors=2, linear=False """ propane = structure.Structure(SMILES='CCC') propane.updateAtomTypes() GAthermoData = species.getThermoData(propane,thermoClass=thermo.ThermoGAData) WilhoitData = thermo.convertGAtoWilhoit(GAthermoData, atoms=11, rotors=2, linear=False) Tlist = thermo.ThermoGAData.CpTlist # just check at defined data points for T in Tlist: ga = GAthermoData.getEnthalpy(T) wil = WilhoitData.getEnthalpy(T) err = abs(ga-wil) limit = 2000.0 # J/mol # the wilhoit should be more accurate then trapezoid integration of GA, so wouldn't want them to be exactly the same self.assertTrue(err<limit,"GA (%.1f) and Wilhoit (%.1f) differ by more than %s J/mol at %dK"%(ga,wil,limit,T))
def testHeatCapacity(self): """Check the NASA Cp matches the GA Cp for propane. Uses Propane as a test-case. atoms=11, rotors=2, linear=False """ propane = structure.Structure(SMILES='CCC') propane.updateAtomTypes() GAthermoData = species.getThermoData(propane,thermoClass=thermo.ThermoGAData) WilhoitData = thermo.convertGAtoWilhoit(GAthermoData, atoms=11, rotors=2, linear=False) NASAthermoData = thermo.convertWilhoitToNASA(WilhoitData) Tlist = thermo.ThermoGAData.CpTlist # just check at defined data points for T in Tlist: ga = GAthermoData.getHeatCapacity(T) nasa = NASAthermoData.getHeatCapacity(T) err = abs(ga-nasa) limit = 10.0 # J/mol/K self.assertTrue(err<limit,"GA (%.1f) and NASA (%.1f) differ by more than %s J/mol/K at %dK"%(ga,nasa,limit,T))