Example #1
0
	def testThermoRestart(self):
		"""
		Restart tests for the :class:`rmg.thermo.ThermoGAData`,
		:class:`rmg.thermo.ThermoWilhoitData`, and 
		:class:`rmg.thermo.ThermoNASAData` classes.
		"""
		import rmg.thermo as thermo
		
		# Create
		thermoGAData0 = thermo.ThermoGAData(H298=-3.08, S298=64.27, 
			Cp=[12.28, 14.34, 16.30, 18.05, 20.92, 23.08, 26.39], comment='acetyl')
		thermoWilhoitData0 = thermo.convertGAtoWilhoit(thermoGAData0, 6, 1, False)
		thermoNASAData0 = thermo.convertWilhoitToNASA(thermoWilhoitData0)
		# Pickle
		f = open('test.pkl', 'wb');
		cPickle.dump(thermoGAData0, f)
		cPickle.dump(thermoWilhoitData0, f)
		cPickle.dump(thermoNASAData0, f)
		f.close()
		# Unpickle
		f = open('test.pkl', 'rb')
		thermoGAData = cPickle.load(f)
		thermoWilhoitData = cPickle.load(f)
		thermoNASAData = cPickle.load(f)
		f.close()
		# Compare
		self.assertTrue(thermoGAData0.equals(thermoGAData))
		self.assertTrue(thermoWilhoitData0.equals(thermoWilhoitData))
		self.assertTrue(thermoNASAData0.equals(thermoNASAData))
Example #2
0
	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)
Example #3
0
	def testEnthalpy(self):
		"""Check the NASA 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)
		NASAthermoData = thermo.convertWilhoitToNASA(WilhoitData)
		
		Tlist = thermo.ThermoGAData.CpTlist # just check at defined data points
		for T in Tlist:
			ga = GAthermoData.getEnthalpy(T)
			nasa = NASAthermoData.getEnthalpy(T)
			err = abs(ga-nasa)
			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 NASA (%.1f) differ by more than %s J/mol at %dK"%(ga,nasa,limit,T))
Example #4
0
	def testEntropy(self):
		"""Check the NASA 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)
		NASAthermoData = thermo.convertWilhoitToNASA(WilhoitData)
		
		Tlist = thermo.ThermoGAData.CpTlist # just check at defined data points
		for T in Tlist:
			ga = GAthermoData.getEntropy(T)
			nasa = NASAthermoData.getEntropy(T)
			err = abs(ga-nasa)
			limit = 4.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))
Example #5
0
	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
		"""
		
		hexadiene = species.Species(SMILES='CCC')
		hexadiene.getResonanceIsomers()
		GAthermoData = hexadiene.getThermoData()
		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))
Example #6
0
	def testNASAcreated(self):
		"""Can we make NASA polynomial data"""
		cp0, cpInf, a0, a1, a2, a3, I, J = (1.0,1.0,1.0,1.0,1.0,1.0, 1.0, 1.0)
		comment = "Stupid thermo."
		WilhoitData = thermo.ThermoWilhoitData( cp0, cpInf, a0, a1, a2, a3, I, J, comment=comment)
		NASAthermoData = thermo.convertWilhoitToNASA(WilhoitData)