def __init__( self, groundStateDegeneracy=-1, numberOfAtoms=None, stericEnergy=None, molecularMass=None, energy=0, atomicNumbers=None, rotationalConstants=None, atomCoords=None, frequencies=None, source=None, ): #: Electronic ground state degeneracy in RMG taken as number of radicals +1 self.groundStateDegeneracy = groundStateDegeneracy self.numberOfAtoms = numberOfAtoms #: Number of atoms. self.stericEnergy = Energy(stericEnergy) self.molecularMass = Mass(molecularMass) self.energy = Energy(energy) self.atomicNumbers = atomicNumbers self.rotationalConstants = Frequency(rotationalConstants) self.atomCoords = Length(atomCoords) self.frequencies = Frequency(frequencies) self.source = source self.testValid()
def testJoback(self): #values calculate from joback's estimations self.testCases = [ [ 'acetone', 'CC(=O)C', Length(5.36421, 'angstroms'), Energy(3.20446, 'kJ/mol'), "Epsilon & sigma estimated with Tc=500.53 K, Pc=47.11 bar (from Joback method)" ], [ 'cyclopenta-1,2-diene', 'C1=C=CCC1', None, None, None ], # not sure what to expect, we just want to make sure it doesn't crash ['benzene', 'c1ccccc1', None, None, None], ] for name, smiles, sigma, epsilon, comment in self.testCases: species = Species(molecule=[Molecule(SMILES=smiles)]) transportData, blank, blank2 = self.transportdb.getTransportPropertiesViaGroupEstimates( species) # check Joback worked. # If we don't know what to expect, don't check (just make sure we didn't crash) if comment: self.assertTrue(transportData.comment == comment) if sigma: self.assertAlmostEqual(transportData.sigma.value_si * 1e10, sigma.value_si * 1e10, 4) if epsilon: self.assertAlmostEqual(transportData.epsilon.value_si, epsilon.value_si, 1)
def test_joback(self): """Test transport property estimation via Joback groups.""" self.testCases = [ [ 'acetone', 'CC(=O)C', Length(5.36421, 'angstroms'), Energy(3.20446, 'kJ/mol'), "Epsilon & sigma estimated with Tc=500.53 K, Pc=47.11 bar (from Joback method)" ], [ 'cyclopenta-1,2-diene', 'C1=C=CCC1', None, None, None ], # not sure what to expect, we just want to make sure it doesn't crash ['benzene', 'c1ccccc1', None, None, None], ] # values calculate from joback's estimations for name, smiles, sigma, epsilon, comment in self.testCases: species = Species().from_smiles(smiles) transport_data, blank, blank2 = self.database.get_transport_properties_via_group_estimates( species) # check Joback worked. # If we don't know what to expect, don't check (just make sure we didn't crash) if comment: self.assertTrue(transport_data.comment == comment) if sigma: self.assertAlmostEqual(transport_data.sigma.value_si * 1e10, sigma.value_si * 1e10, 4) if epsilon: self.assertAlmostEqual(transport_data.epsilon.value_si, epsilon.value_si, 1)
def __init__(self, shapeIndex=None, epsilon=None, sigma=None, dipoleMoment=None, polarizability=None, rotrelaxcollnum=None, comment=''): self.shapeIndex = shapeIndex try: self.epsilon = Energy(epsilon) except quantity.QuantityError: self.epsilon = quantity.Temperature(epsilon) self.epsilon.value_si *= constants.R self.epsilon.units = 'kJ/mol' self.sigma = Length(sigma) self.dipoleMoment = DipoleMoment(dipoleMoment) self.polarizability = Volume(polarizability) self.rotrelaxcollnum = rotrelaxcollnum self.comment = comment
def setUp(self): """ A function run before each unit test in this class. """ self.shapeIndex = 1 self.epsilon = Energy(2.104, 'kJ/mol') self.sigma = Length(3.402, 'angstroms') self.dipoleMoment = DipoleMoment(1.000, 'C*m') self.polarizability = Volume(0.134, 'angstroms^3') self.rotrelaxcollnum = 0.000 self.comment = 'test' self.transport = TransportData( shapeIndex=self.shapeIndex, epsilon=self.epsilon, sigma=self.sigma, dipoleMoment=self.dipoleMoment, polarizability=self.polarizability, rotrelaxcollnum=self.rotrelaxcollnum, comment=self.comment, )