Exemplo n.º 1
0
    def setUp(self):
        unittest.TestCase.setUp(self)
        H2_thermo = BaseThermo(name='H2',
                               phase='G',
                               elements={'H': 2},
                               thermo_model=IdealGasThermo,
                               T_ref=c.T0('K'),
                               HoRT_ref=0.,
                               vib_energies=np.array([4306.1793]) *
                               c.c('cm/s') * c.h('eV s'),
                               potentialenergy=-6.7598,
                               geometry='linear',
                               symmetrynumber=2,
                               spin=0,
                               atoms=molecule('H2'))

        H2O_thermo = BaseThermo(
            name='H2O',
            phase='G',
            elements={
                'H': 2,
                'O': 1
            },
            thermo_model=IdealGasThermo,
            T_ref=c.T0('K'),
            HoRT_ref=-241.826 / (c.R('kJ/mol/K') * c.T0('K')),
            vib_energies=np.array([3825.434, 3710.264, 1582.432]) *
            c.c('cm/s') * c.h('eV s'),
            potentialenergy=-14.2209,
            geometry='nonlinear',
            symmetrynumber=2,
            spin=0,
            atoms=molecule('H2O'))

        O2_thermo = BaseThermo(name='H2O',
                               phase='G',
                               elements={'O': 2},
                               thermo_model=IdealGasThermo,
                               T_ref=c.T0('K'),
                               HoRT_ref=0.,
                               vib_energies=np.array([2205.]) * c.c('cm/s') *
                               c.h('eV s'),
                               potentialenergy=-9.86,
                               geometry='linear',
                               symmetrynumber=2,
                               spin=1,
                               atoms=molecule('O2'))
        self.references = References(
            references=[H2_thermo, H2O_thermo, O2_thermo])
Exemplo n.º 2
0
species_path = '{}/thermdat_input.xlsx'.format(base_path)
T_low = 200.
T_high = 1100.  #K

#Output information
thermdat_path = '{}/thermdat'.format(base_path)

#Miscellaneous options
show_plot = True
write_date = True
'''
Processing References
'''
#Import from excel
refs_input = read_excel(io=refs_path)
refs = References([BaseThermo(**ref_input) for ref_input in refs_input])
print('Reference Input:')
pprint(refs_input)
'''
Processing Input Species
'''
#Import from excel
species_data = read_excel(io=species_path)
species = [
    Nasa(references=refs,
         T_low=T_low,
         T_high=T_high,
         T_ref=c.T0('K'),
         **specie_data) for specie_data in species_data
]
print('Species Input:')
Exemplo n.º 3
0
#Input information
species_path = '{}/input_data.xlsx'.format(base_path)
T_low = 100.
T_high = 1500.  #K

#Output information
thermdat_path = '{}/thermdat'.format(base_path)

#Miscellaneous options
show_plot = True
'''
Processing References
'''
#Import from excel
refs_data = read_excel(io=refs_path)
refs = References([BaseThermo(**ref_data) for ref_data in refs_data])
'''
Processing Surfaces
'''
surfaces_data = read_excel(io=surfaces_path)
'''
Processing Input Species
'''
#Import from excel
species_data = read_excel(io=species_path)
#Adjust potential energy to subtract contribution from surface
for specie_data in species_data:
    #Find appropriate surface
    for surface_data in surfaces_data:
        if surface_data['name'] in specie_data['notes']:
            specie_data['potentialenergy'] -= surface_data['potentialenergy']
Exemplo n.º 4
0
T_low = 200.
T_high = 1100.  #K

#Output information
thermdat_path = '{}/thermdat'.format(base_path)

#Miscellaneous options
show_plot = True
write_date = True
'''
Processing References
'''
#Import from excel
refs_input = read_excel(io=refs_path)
pprint(refs_input)
refs = References([Reference(**ref_input) for ref_input in refs_input])
print('Reference Input:')
pprint(refs_input)
print('Reference Data:')
pprint(refs[0])
'''
Processing Input Species
'''
#Import from excel
species_data = read_excel(io=species_path)
# pprint([specie_data['elements'] for specie_data in species_data])
species = []
for specie_data in species_data:
    species.append(
        Nasa.from_statmech(references=refs,
                           T_low=T_low,
Exemplo n.º 5
0
#Input information
species_path = '{}/input_data.xlsx'.format(base_path)
T_low = 100.
T_high = 1500.  #K

#Output information
thermdat_path = '{}/thermdat'.format(base_path)

#Miscellaneous options
save_plot = True
'''
Processing References
'''
#Import from excel
refs_data = read_excel(io=refs_path)
refs = References([Reference(**ref_data) for ref_data in refs_data])
'''
Processing Surfaces
'''
surfaces_data = read_excel(io=surfaces_path)
'''
Processing Input Species
'''
#Import from excel
species_data = read_excel(io=species_path)
#Adjust potential energy to subtract contribution from surface
for specie_data in species_data:
    #Find appropriate surface
    for surface_data in surfaces_data:
        if surface_data['name'] in specie_data['notes']:
            specie_data['potentialenergy'] -= surface_data['potentialenergy']
    def setUp(self):
        unittest.TestCase.setUp(self)

        H2_thermo = Reference(name='H2',
                              phase='G',
                              elements={'H': 2},
                              T_ref=c.T0('K'),
                              HoRT_ref=0.,
                              statmech_model=StatMech,
                              trans_model=trans.IdealTrans,
                              n_degrees=3,
                              vib_model=vib.HarmonicVib,
                              elec_model=elec.IdealElec,
                              rot_model=rot.RigidRotor,
                              vib_wavenumbers=np.array([4306.1793]),
                              potentialenergy=-6.7598,
                              geometry='linear',
                              symmetrynumber=2,
                              spin=0,
                              atoms=molecule('H2'))

        H2O_thermo = Reference(
            name='H2O',
            phase='G',
            elements={
                'H': 2,
                'O': 1
            },
            T_ref=c.T0('K'),
            HoRT_ref=-241.826 / (c.R('kJ/mol/K') * c.T0('K')),
            statmech_model=StatMech,
            trans_model=trans.IdealTrans,
            n_degrees=3,
            vib_model=vib.HarmonicVib,
            elec_model=elec.IdealElec,
            rot_model=rot.RigidRotor,
            vib_wavenumbers=np.array([3825.434, 3710.264, 1582.432]),
            potentialenergy=-14.2209,
            geometry='nonlinear',
            symmetrynumber=2,
            spin=0,
            atoms=molecule('H2O'))

        O2_thermo = Reference(name='H2O',
                              phase='G',
                              elements={'O': 2},
                              T_ref=c.T0('K'),
                              HoRT_ref=0.,
                              statmech_model=StatMech,
                              trans_model=trans.IdealTrans,
                              n_degrees=3,
                              vib_model=vib.HarmonicVib,
                              elec_model=elec.IdealElec,
                              rot_model=rot.RigidRotor,
                              vib_wavenumbers=np.array([2205.]),
                              potentialenergy=-9.86,
                              geometry='linear',
                              symmetrynumber=2,
                              spin=1,
                              atoms=molecule('O2'))
        self.references = References(
            references=[H2_thermo, H2O_thermo, O2_thermo])
class TestReferences(unittest.TestCase):
    def setUp(self):
        unittest.TestCase.setUp(self)

        H2_thermo = Reference(name='H2',
                              phase='G',
                              elements={'H': 2},
                              T_ref=c.T0('K'),
                              HoRT_ref=0.,
                              statmech_model=StatMech,
                              trans_model=trans.IdealTrans,
                              n_degrees=3,
                              vib_model=vib.HarmonicVib,
                              elec_model=elec.IdealElec,
                              rot_model=rot.RigidRotor,
                              vib_wavenumbers=np.array([4306.1793]),
                              potentialenergy=-6.7598,
                              geometry='linear',
                              symmetrynumber=2,
                              spin=0,
                              atoms=molecule('H2'))

        H2O_thermo = Reference(
            name='H2O',
            phase='G',
            elements={
                'H': 2,
                'O': 1
            },
            T_ref=c.T0('K'),
            HoRT_ref=-241.826 / (c.R('kJ/mol/K') * c.T0('K')),
            statmech_model=StatMech,
            trans_model=trans.IdealTrans,
            n_degrees=3,
            vib_model=vib.HarmonicVib,
            elec_model=elec.IdealElec,
            rot_model=rot.RigidRotor,
            vib_wavenumbers=np.array([3825.434, 3710.264, 1582.432]),
            potentialenergy=-14.2209,
            geometry='nonlinear',
            symmetrynumber=2,
            spin=0,
            atoms=molecule('H2O'))

        O2_thermo = Reference(name='H2O',
                              phase='G',
                              elements={'O': 2},
                              T_ref=c.T0('K'),
                              HoRT_ref=0.,
                              statmech_model=StatMech,
                              trans_model=trans.IdealTrans,
                              n_degrees=3,
                              vib_model=vib.HarmonicVib,
                              elec_model=elec.IdealElec,
                              rot_model=rot.RigidRotor,
                              vib_wavenumbers=np.array([2205.]),
                              potentialenergy=-9.86,
                              geometry='linear',
                              symmetrynumber=2,
                              spin=1,
                              atoms=molecule('O2'))
        self.references = References(
            references=[H2_thermo, H2O_thermo, O2_thermo])

    def test_get_elements(self):
        self.assertEqual(self.references.get_elements(), ('H', 'O'))

    def test_get_elements_matrix(self):
        elements_matrix = np.array([[2, 0], [2, 1], [0, 2]])
        np.testing.assert_array_equal(self.references.get_elements_matrix(),
                                      elements_matrix)

    def test_calc_offset(self):
        expected_element_offset = {'H': -123.10868373, 'O': -186.72503046}
        calculated_element_offset = self.references.HoRT_element_offset

        #Assess whether the keys are the same
        self.assertSetEqual(set(expected_element_offset.keys()),
                            set(calculated_element_offset.keys()))
        #Assess whether the values assigned to the keys are the close
        for element in expected_element_offset.keys():
            self.assertAlmostEqual(expected_element_offset[element],
                                   calculated_element_offset[element])

    def test_get_specie_offset(self):
        elements = {'H': 2, 'O': 2}
        self.assertAlmostEqual(
            self.references.get_HoRT_offset(elements=elements),
            619.6674284923677)
        with self.assertWarns(RuntimeWarning):
            self.assertEqual(
                self.references.get_HoRT_offset(
                    elements={'non-referenced element': 1}), 0.)