示例#1
0
 def test_get_A(self):
     exp_sm_SoR = self.H2O_TS_sm.get_SoR(T=c.T0('K')) \
                  - self.H2_sm.get_SoR(T=c.T0('K')) \
                  - self.O2_sm.get_SoR(T=c.T0('K'))*0.5
     exp_sm_A = c.kb('J/K') * c.T0('K') / c.h('J s') * np.exp(-exp_sm_SoR)
     exp_sm_SoR_rev = self.H2O_TS_sm.get_SoR(T=c.T0('K')) \
                      - self.H2O_sm.get_SoR(T=c.T0('K'))
     exp_sm_A_rev = c.kb('J/K') * c.T0('K') / c.h('J s') * np.exp(
         -exp_sm_SoR_rev)
     self.assertAlmostEqual(self.rxn_sm.get_A(T=c.T0('K')), exp_sm_A)
     self.assertAlmostEqual(self.rxn_sm.get_A(T=c.T0('K'), rev=True),
                            exp_sm_A_rev)
示例#2
0
 def __init__(self,
              A_st=None,
              atoms=None,
              symmetrynumber=None,
              inertia=None,
              geometry=None,
              vib_energies=None,
              potentialenergy=None,
              **kwargs):
     super().__init__(atoms=atoms,
                      symmetrynumber=symmetrynumber,
                      geometry=geometry,
                      vib_energies=vib_energies,
                      potentialenergy=potentialenergy,
                      **kwargs)
     self.A_st = A_st
     self.atoms = atoms
     self.geometry = geometry
     self.symmetrynumber = symmetrynumber
     self.inertia = inertia
     self.etotal = potentialenergy
     self.vib_energies = vib_energies
     self.theta = np.array(vib_energies) / c.kb('eV/K')
     self.zpe = sum(np.array(vib_energies)/2.) *\
         c.convert_unit(from_='eV', to='kcal')*c.Na
     if np.sum(vib_energies) != 0:
         self.q_vib = np.product(
             np.divide(1, (1 - np.exp(-self.theta / c.T0('K')))))
     if self.phase == 'G':
         if self.inertia is not None:
             self.I3 = self.inertia
         else:
             self.I3 = atoms.get_moments_of_inertia() *\
                     c.convert_unit(from_='A2', to='m2') *\
                     c.convert_unit(from_='amu', to='kg')
         self.T_I = c.h('J s')**2 / (8 * np.pi**2 * c.kb('J/K'))
     if self.phase == 'G':
         Irot = np.max(self.I3)
         if self.geometry == 'nonlinear':
             self.q_rot = np.sqrt(np.pi*Irot)/self.symmetrynumber *\
                                 (c.T0('K')/self.T_I)**(3./2.)
         else:
             self.q_rot = (c.T0('K') * Irot /
                           self.symmetrynumber) / self.T_I
     else:
         self.q_rot = 0.
     if self.A_st is not None:
         self.MW = mw(self.elements) * c.convert_unit(from_='g',
                                                      to='kg') / c.Na
         self.q_trans2D = self.A_st * (2 * np.pi * self.MW * c.kb('J/K') *
                                       c.T0('K')) / c.h('J s')**2
示例#3
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])
示例#4
0
文件: trans.py 项目: jtfrey/PyMuTT
    def get_SoR(self, T, P=c.P0('bar')):
        """Calculates the dimensionless entropy

        :math:`\\frac{S^{trans}}{R}=1+\\frac{n_{degrees}}{2}+\\log\\bigg(\\big(
        \\frac{2\\pi mk_bT}{h^2})^\\frac{n_{degrees}}{2}\\frac{RT}{PN_a}\\bigg)`

        Parameters
        ----------
            T : float
                Temperature in K
            P : float, optional
                Pressure (bar) or pressure-like quantity.
                Default is atmospheric pressure

        Returns
        -------
            SoR_trans : float
                Translational dimensionless entropy
        """
        V = self.get_V(T=T, P=P)
        unit_mass = self.molecular_weight *\
            c.convert_unit(from_='g', to='kg')/c.Na
        return 1. + float(self.n_degrees)/2. \
            + np.log((2.*np.pi*unit_mass*c.kb('J/K')*T/c.h('J s')**2)
                     ** (float(self.n_degrees)/2.)*V/c.Na)
示例#5
0
    def _get_SoR_RRHO(self, T, vib_inertia):
        """Calculates the dimensionless RRHO contribution to entropy

        Parameters
        ----------
            T : float
                Temperature in K
            vib_inertia : float
                Vibrational inertia in kg m2
        Returns
        -------
            SoR_RHHO : float
                Dimensionless entropy of Rigid Rotor Harmonic Oscillator
        """
        return 0.5 + np.log(
            (8. * np.pi**3 * vib_inertia * c.kb('J/K') * T / c.h('J s')**2)**
            0.5)
示例#6
0
文件: reaction.py 项目: jtfrey/PyMuTT
    def get_A(self, T=c.T0('K'), rev=False, **kwargs):
        """Gets pre-exponential factor between reactants (or products) and 
        transition state in 1/s

        Parameters
        ----------
            rev : bool, optional
                Reverse direction. If True, uses products as initial state 
                instead of reactants. Default is False
            T : float, optional
                Temperature in K. Default is standard temperature.
            kwargs : keyword arguments
                Parameters required to calculate pre-exponential factor
        Returns
        -------
            A : float
                Pre-exponential factor  
        """
        return c.kb('J/K')*T/c.h('J s')\
               *np.exp(-self.get_SoR_act(rev=rev, T=c.T0('K'), **kwargs))
示例#7
0
文件: excel.py 项目: mbkumar/PyMuTT
def set_vib_wavenumber(value, output_structure):
    """Parses element header and assigns to output_structure['vib_energies']
	
	Parameters
	----------
		value : float
			Vibrational frequency in 1/cm
		output_structure : dict
			Structure to assign value. Will assign to output_structure['elements'][element]
	Returns
	-------
		output_structure: dict
			output_structure with new vibration added
	"""
    vib_energy = value * c.c('cm/s') * c.h('eV s')
    try:
        output_structure['vib_energies'].append(vib_energy)
    except (NameError, KeyError):
        output_structure['vib_energies'] = [vib_energy]
    return output_structure
示例#8
0
文件: trans.py 项目: jtfrey/PyMuTT
    def get_q(self, T, P=c.P0('bar')):
        """Calculates the partition function

        :math:`q_{trans} = \\bigg(\\frac{2\\pi \\sum_{i}^{atoms}m_ikT}{h^2}
        \\bigg)^\\frac {n_{degrees}} {2}V`

        Parameters
        ----------
            T : float
                Temperature in K
            P : float, optional
                Pressure (bar) or pressure-like quantity.
                Default is atmospheric pressure
        Returns
        -------
            q_trans : float
                Translational partition function
        """
        V = self.get_V(T=T, P=P)
        unit_mass = self.molecular_weight *\
            c.convert_unit(from_='g', to='kg')/c.Na
        return V*(2*np.pi*c.kb('J/K')*T*unit_mass/c.h('J s')**2) \
            ** (float(self.n_degrees)/2.)
示例#9
0
 def test_h(self):
     self.assertEqual(c.h('J s', bar=False), 6.626070040e-34)
     self.assertEqual(c.h('J s', bar=True), 6.626070040e-34 / (2. * np.pi))
     with self.assertRaises(KeyError):
         c.h('arbitrary unit')