Exemple #1
0
    def setUp(self):
        slope = 0.5
        intercept = 10.  # kcal/mol
        del_E = -1.  # kcal/mol
        del_E_eV = del_E * c.convert_unit(initial='kcal/mol',
                                          final='eV/molecule')
        E_surf = -2.  # kcal/mol
        E_surf_eV = E_surf * c.convert_unit(initial='kcal/mol',
                                            final='eV/molecule')
        E_gas = -3.  # kcal/mol
        E_gas_eV = E_gas * c.convert_unit(initial='kcal/mol',
                                          final='eV/molecule')

        species = {
            'A(g)_shomate':
            Shomate(name='A(g)_shomate',
                    T_low=100.,
                    T_high=500.,
                    a=np.zeros(8)),
            'A(g)_statmech':
            StatMech(),
            '*':
            StatMech(),
            'A*':
            StatMech(U=del_E_eV, H=del_E_eV, **presets['constant']),
            'surf':
            StatMech(U=E_surf_eV, H=E_surf_eV, **presets['constant']),
            'gas':
            StatMech(U=E_gas_eV, H=E_gas_eV, **presets['constant'])
        }
        reaction_shomate = Reaction.from_string('A(g)_shomate + * = A*',
                                                species)
        reaction_statmech = Reaction.from_string('A(g)_statmech + * = A*',
                                                 species)

        self.lsr_const = LSR(slope=slope,
                             intercept=intercept,
                             reaction=del_E,
                             surf_species=E_surf,
                             gas_species=E_gas)
        self.lsr_shomate = LSR(slope=slope,
                               intercept=intercept,
                               reaction=reaction_shomate,
                               surf_species=species['surf'],
                               gas_species=species['gas'])
        self.lsr_statmech = LSR(slope=slope,
                                intercept=intercept,
                                reaction=reaction_statmech,
                                surf_species=species['surf'],
                                gas_species=species['gas'])
Exemple #2
0
    def from_string(cls,
                    reaction_str,
                    species,
                    species_delimiter='+',
                    reaction_delimiter='=',
                    notes=None,
                    beta=1,
                    is_adsorption=False,
                    sticking_coeff=0.5,
                    direction=None,
                    id=None):
        """Create a reaction object using the reaction string

        Parameters
        ----------
            reaction_str : str
                Reaction string.
            species : dict
                Dictionary using the names as keys. If you have a list of
                species, use pmutt.pmutt_list_to_dict to make a dict.
            species_delimiter : str, optional
                Delimiter that separate species. Leading and trailing spaces
                will be trimmed. Default is '+'
            reaction_delimiter : str, optional
                Delimiter that separate states of the reaction. Leading and
                trailing spaces will be trimmed. Default is '='
            notes : str or dict, optional
                Other notes such as the source of the reaction. Default is None
            beta : float, optional
                Power to raise the temperature in the rate expression.
                Default is 1
            is_adsorption : bool, optional
                If True, the reaction represents an adsorption. Default is False
            sticking_coeff : float, optional
                Sticking coefficient. Only relevant if ``is_adsorption`` is
                True. Default is 0.5
            gas_phase : bool
                True if the reaction has only gas-phase species. This attribute
                is determined based on the reactants and products
        Returns
        -------
            SurfaceReaction : :class:`~pmutt.omkm.SurfaceReaction` object
        """
        rxn = Reaction.from_string(reaction_str=reaction_str,
                                   species=species,
                                   species_delimiter=species_delimiter,
                                   reaction_delimiter=reaction_delimiter)
        return cls(reactants=rxn.reactants,
                   reactants_stoich=rxn.reactants_stoich,
                   products=rxn.products,
                   products_stoich=rxn.products_stoich,
                   transition_state=rxn.transition_state,
                   transition_state_stoich=rxn.transition_state_stoich,
                   notes=notes,
                   beta=beta,
                   is_adsorption=is_adsorption,
                   sticking_coeff=sticking_coeff,
                   direction=direction,
                   id=id)
Exemple #3
0
def read_reactions(filename,
                   species,
                   species_delimiter='.',
                   reaction_delimiter='>>',
                   raise_error=True,
                   raise_warning=True):
    """Reads reactions from RING output file.

    Parameters
    ----------
        filename : str
            Input filename
        species : dict
            Dictionary using the names as keys. If you have a list of
            species, use pmutt.pmutt_list_to_dict to make a dict.
        species_delimiter : str, optional
            Delimiter that separate species. Leading and trailing spaces
            will be trimmed. Default is '.'
        reaction_delimiter : str, optional
            Delimiter that separate states of the reaction. Leading and
            trailing spaces will be trimmed. Default is '>>'
        raise_error : bool, optional
            If True, raises an error if the transition state is not located in
            species. Default is True
        raise_warning : bool, optional
            Only relevant if raise_error is False. Raises a warning if the
            transition state is not located in species. Default is True
    Returns
    -------
        reactions : list of :class:`~pmutt.reaction.Reaction` objects
            Reactions
    """
    rxns = []
    with open(filename, 'r') as f_ptr:
        for line in f_ptr:
            # Skip lines that do not have a reaction
            if reaction_delimiter not in line:
                continue
            reaction_str = line.replace('\n', '')
            rxn = Reaction.from_string(reaction_str=reaction_str,
                                       species=species,
                                       species_delimiter=species_delimiter,
                                       reaction_delimiter=reaction_delimiter,
                                       raise_error=raise_error,
                                       raise_warning=raise_warning)
            rxns.append(rxn)
    return Reactions(reactions=rxns)
Exemple #4
0
    def _float_to_reaction(self, val):
        """Converts a float to a :class:`~pmutt.reaction.Reaction` object

        Parameters
        ----------
            val : float
                Value (in kcal/mol)
        Returns
        -------
            obj : :class:`~pmutt.reaction.Reaction` object
                :class:`~pmutt.reaction.Reaction` object that gives the val
                when `get_delta_E` is called
        """
        reactant = StatMech()
        product = self._float_to_specie(val=val)
        return Reaction(reactants=[reactant], reactants_stoich=[1.],
                        products=[product], products_stoich=[1.])
    def setUp(self):
        self.species_dict = {
            'H2O':
            Nasa(name='H2O',
                 T_low=200.,
                 T_mid=1000.,
                 T_high=3500.,
                 elements={
                     'H': 2,
                     'O': 1
                 },
                 a_low=[
                     4.19864056E+00, -2.03643410E-03, 6.52040211E-06,
                     -5.48797062E-09, 1.77197817E-12, -3.02937267E+04,
                     -8.49032208E-01
                 ],
                 a_high=[
                     3.03399249E+00, 2.17691804E-03, -1.64072518E-07,
                     -9.70419870E-11, 1.68200992E-14, -3.00042971E+04,
                     4.96677010E+00
                 ]),
            'H2':
            Nasa(name='H2',
                 T_low=200.,
                 T_mid=1000.,
                 T_high=3500.,
                 elements={'H': 2},
                 a_low=[
                     2.34433112E+00, 7.98052075E-03, -1.94781510E-05,
                     2.01572094E-08, -7.37611761E-12, -9.17935173E+02,
                     6.83010238E-01
                 ],
                 a_high=[
                     3.33727920E+00, -4.94024731E-05, 4.99456778E-07,
                     -1.79566394E-10, 2.00255376E-14, -9.50158922E+02,
                     -3.20502331E+00
                 ]),
            'O2':
            Nasa(name='O2',
                 T_low=200.,
                 T_mid=1000.,
                 T_high=3500.,
                 elements={'O': 2},
                 a_low=[
                     3.78245636E+00, -2.99673416E-03, 9.84730201E-06,
                     -9.68129509E-09, 3.24372837E-12, -1.06394356E+03,
                     3.65767573E+00
                 ],
                 a_high=[
                     3.28253784E+00, 1.48308754E-03, -7.57966669E-07,
                     2.09470555E-10, -2.16717794E-14, -1.08845772E+03,
                     5.45323129E+00
                 ]),
            'O':
            Nasa(name='O',
                 T_low=200.,
                 T_mid=1000.,
                 T_high=3500.,
                 elements={'O': 1},
                 a_low=[
                     3.16826710E+00, -3.27931884E-03, 6.64306396E-06,
                     -6.12806624E-09, 2.11265971E-12, 2.91222592E+04,
                     2.05193346E+00
                 ],
                 a_high=[
                     2.56942078E+00, -8.59741137E-05, 4.19484589E-08,
                     -1.00177799E-11, 1.22833691E-15, 2.92175791E+04,
                     4.78433864E+00
                 ]),
            'H':
            Nasa(name='H',
                 T_low=200.,
                 T_mid=1000.,
                 T_high=3500.,
                 elements={'H': 1},
                 a_low=[
                     2.50000000E+00, 7.05332819E-13, -1.99591964E-15,
                     2.30081632E-18, -9.27732332E-22, 2.54736599E+04,
                     -4.46682853E-01
                 ],
                 a_high=[
                     2.50000001E+00, -2.30842973E-11, 1.61561948E-14,
                     -4.73515235E-18, 4.98197357E-22, 2.54736599E+04,
                     -4.46682914E-01
                 ]),
            'OH':
            Nasa(name='OH',
                 T_low=200.,
                 T_mid=1000.,
                 T_high=3500.,
                 elements={
                     'O': 1,
                     'H': 1
                 },
                 a_high=[
                     3.09288767E+00, 5.48429716E-04, 1.26505228E-07,
                     -8.79461556E-11, 1.17412376E-14, 3.85865700E+03,
                     4.47669610E+00
                 ],
                 a_low=[
                     3.99201543E+00, -2.40131752E-03, 4.61793841E-06,
                     -3.88113333E-09, 1.36411470E-12, 3.61508056E+03,
                     -1.03925458E-01
                 ])
        }
        self.reactions = Reactions(reactions=[
            Reaction.from_string('O+2H=H2O', self.species_dict),
            Reaction.from_string('O+H2=H2O', self.species_dict),
            Reaction.from_string('OH+H=H2O', self.species_dict),
            Reaction.from_string('OH+0.5H2=H2O', self.species_dict),
            Reaction.from_string('0.5O+2H=H2O', self.species_dict),
            Reaction.from_string('0.5O2+H2=H2O', self.species_dict)
        ])

        self.reactions_dict = {
            'class':
            "<class 'pmutt.reaction.Reactions'>",
            'reactions': [{
                'class':
                "<class 'pmutt.reaction.Reaction'>",
                'products': [{
                    'T_high':
                    3500.0,
                    'T_low':
                    200.0,
                    'T_mid':
                    1000.0,
                    'a_high': [
                        3.03399249, 0.00217691804, -1.64072518e-07,
                        -9.7041987e-11, 1.68200992e-14, -30004.2971, 4.9667701
                    ],
                    'a_low': [
                        4.19864056, -0.0020364341, 6.52040211e-06,
                        -5.48797062e-09, 1.77197817e-12, -30293.7267,
                        -0.849032208
                    ],
                    'class':
                    "<class 'pmutt.empirical.nasa.Nasa'>",
                    'elements': {
                        'H': 2,
                        'O': 1
                    },
                    'name':
                    'H2O',
                    'notes':
                    None,
                    'phase':
                    None,
                    'statmech_model':
                    None,
                    'misc_models':
                    None,
                    'cat_site':
                    None,
                    'n_sites':
                    None,
                    'smiles':
                    None,
                    'type':
                    'nasa'
                }],
                'products_stoich': [1.0],
                'reactants': [{
                    'T_high':
                    3500.0,
                    'T_low':
                    200.0,
                    'T_mid':
                    1000.0,
                    'a_high': [
                        2.56942078, -8.59741137e-05, 4.19484589e-08,
                        -1.00177799e-11, 1.22833691e-15, 29217.5791, 4.78433864
                    ],
                    'a_low': [
                        3.1682671, -0.00327931884, 6.64306396e-06,
                        -6.12806624e-09, 2.11265971e-12, 29122.2592, 2.05193346
                    ],
                    'class':
                    "<class 'pmutt.empirical.nasa.Nasa'>",
                    'elements': {
                        'O': 1
                    },
                    'name':
                    'O',
                    'notes':
                    None,
                    'phase':
                    None,
                    'statmech_model':
                    None,
                    'misc_models':
                    None,
                    'cat_site':
                    None,
                    'n_sites':
                    None,
                    'smiles':
                    None,
                    'type':
                    'nasa'
                }, {
                    'T_high':
                    3500.0,
                    'T_low':
                    200.0,
                    'T_mid':
                    1000.0,
                    'a_high': [
                        2.50000001, -2.30842973e-11, 1.61561948e-14,
                        -4.73515235e-18, 4.98197357e-22, 25473.6599,
                        -0.446682914
                    ],
                    'a_low': [
                        2.5, 7.05332819e-13, -1.99591964e-15, 2.30081632e-18,
                        -9.27732332e-22, 25473.6599, -0.446682853
                    ],
                    'class':
                    "<class 'pmutt.empirical.nasa.Nasa'>",
                    'elements': {
                        'H': 1
                    },
                    'name':
                    'H',
                    'notes':
                    None,
                    'phase':
                    None,
                    'statmech_model':
                    None,
                    'misc_models':
                    None,
                    'cat_site':
                    None,
                    'n_sites':
                    None,
                    'smiles':
                    None,
                    'type':
                    'nasa'
                }],
                'reactants_stoich': [1.0, 2.0],
                'transition_state':
                None,
                'transition_state_stoich':
                None
            }, {
                'class':
                "<class 'pmutt.reaction.Reaction'>",
                'products': [{
                    'T_high':
                    3500.0,
                    'T_low':
                    200.0,
                    'T_mid':
                    1000.0,
                    'a_high': [
                        3.03399249, 0.00217691804, -1.64072518e-07,
                        -9.7041987e-11, 1.68200992e-14, -30004.2971, 4.9667701
                    ],
                    'a_low': [
                        4.19864056, -0.0020364341, 6.52040211e-06,
                        -5.48797062e-09, 1.77197817e-12, -30293.7267,
                        -0.849032208
                    ],
                    'class':
                    "<class 'pmutt.empirical.nasa.Nasa'>",
                    'elements': {
                        'H': 2,
                        'O': 1
                    },
                    'name':
                    'H2O',
                    'notes':
                    None,
                    'phase':
                    None,
                    'statmech_model':
                    None,
                    'misc_models':
                    None,
                    'cat_site':
                    None,
                    'n_sites':
                    None,
                    'smiles':
                    None,
                    'type':
                    'nasa'
                }],
                'products_stoich': [1.0],
                'reactants': [{
                    'T_high':
                    3500.0,
                    'T_low':
                    200.0,
                    'T_mid':
                    1000.0,
                    'a_high': [
                        2.56942078, -8.59741137e-05, 4.19484589e-08,
                        -1.00177799e-11, 1.22833691e-15, 29217.5791, 4.78433864
                    ],
                    'a_low': [
                        3.1682671, -0.00327931884, 6.64306396e-06,
                        -6.12806624e-09, 2.11265971e-12, 29122.2592, 2.05193346
                    ],
                    'class':
                    "<class 'pmutt.empirical.nasa.Nasa'>",
                    'elements': {
                        'O': 1
                    },
                    'name':
                    'O',
                    'notes':
                    None,
                    'phase':
                    None,
                    'statmech_model':
                    None,
                    'misc_models':
                    None,
                    'cat_site':
                    None,
                    'n_sites':
                    None,
                    'smiles':
                    None,
                    'type':
                    'nasa'
                }, {
                    'T_high':
                    3500.0,
                    'T_low':
                    200.0,
                    'T_mid':
                    1000.0,
                    'a_high': [
                        3.3372792, -4.94024731e-05, 4.99456778e-07,
                        -1.79566394e-10, 2.00255376e-14, -950.158922,
                        -3.20502331
                    ],
                    'a_low': [
                        2.34433112, 0.00798052075, -1.9478151e-05,
                        2.01572094e-08, -7.37611761e-12, -917.935173,
                        0.683010238
                    ],
                    'class':
                    "<class 'pmutt.empirical.nasa.Nasa'>",
                    'elements': {
                        'H': 2
                    },
                    'name':
                    'H2',
                    'notes':
                    None,
                    'phase':
                    None,
                    'statmech_model':
                    None,
                    'misc_models':
                    None,
                    'cat_site':
                    None,
                    'n_sites':
                    None,
                    'smiles':
                    None,
                    'type':
                    'nasa'
                }],
                'reactants_stoich': [1.0, 1.0],
                'transition_state':
                None,
                'transition_state_stoich':
                None
            }, {
                'class':
                "<class 'pmutt.reaction.Reaction'>",
                'products': [{
                    'T_high':
                    3500.0,
                    'T_low':
                    200.0,
                    'T_mid':
                    1000.0,
                    'a_high': [
                        3.03399249, 0.00217691804, -1.64072518e-07,
                        -9.7041987e-11, 1.68200992e-14, -30004.2971, 4.9667701
                    ],
                    'a_low': [
                        4.19864056, -0.0020364341, 6.52040211e-06,
                        -5.48797062e-09, 1.77197817e-12, -30293.7267,
                        -0.849032208
                    ],
                    'class':
                    "<class 'pmutt.empirical.nasa.Nasa'>",
                    'elements': {
                        'H': 2,
                        'O': 1
                    },
                    'name':
                    'H2O',
                    'notes':
                    None,
                    'phase':
                    None,
                    'statmech_model':
                    None,
                    'misc_models':
                    None,
                    'cat_site':
                    None,
                    'n_sites':
                    None,
                    'smiles':
                    None,
                    'type':
                    'nasa'
                }],
                'products_stoich': [1.0],
                'reactants': [{
                    'T_high':
                    3500.0,
                    'T_low':
                    200.0,
                    'T_mid':
                    1000.0,
                    'a_high': [
                        3.09288767, 0.000548429716, 1.26505228e-07,
                        -8.79461556e-11, 1.17412376e-14, 3858.657, 4.4766961
                    ],
                    'a_low': [
                        3.99201543, -0.00240131752, 4.61793841e-06,
                        -3.88113333e-09, 1.3641147e-12, 3615.08056,
                        -0.103925458
                    ],
                    'class':
                    "<class 'pmutt.empirical.nasa.Nasa'>",
                    'elements': {
                        'H': 1,
                        'O': 1
                    },
                    'name':
                    'OH',
                    'notes':
                    None,
                    'phase':
                    None,
                    'statmech_model':
                    None,
                    'misc_models':
                    None,
                    'cat_site':
                    None,
                    'n_sites':
                    None,
                    'smiles':
                    None,
                    'type':
                    'nasa',
                }, {
                    'T_high':
                    3500.0,
                    'T_low':
                    200.0,
                    'T_mid':
                    1000.0,
                    'a_high': [
                        2.50000001, -2.30842973e-11, 1.61561948e-14,
                        -4.73515235e-18, 4.98197357e-22, 25473.6599,
                        -0.446682914
                    ],
                    'a_low': [
                        2.5, 7.05332819e-13, -1.99591964e-15, 2.30081632e-18,
                        -9.27732332e-22, 25473.6599, -0.446682853
                    ],
                    'class':
                    "<class 'pmutt.empirical.nasa.Nasa'>",
                    'elements': {
                        'H': 1
                    },
                    'name':
                    'H',
                    'notes':
                    None,
                    'phase':
                    None,
                    'statmech_model':
                    None,
                    'misc_models':
                    None,
                    'cat_site':
                    None,
                    'n_sites':
                    None,
                    'smiles':
                    None,
                    'type':
                    'nasa',
                }],
                'reactants_stoich': [1.0, 1.0],
                'transition_state':
                None,
                'transition_state_stoich':
                None
            }, {
                'class':
                "<class 'pmutt.reaction.Reaction'>",
                'products': [{
                    'T_high':
                    3500.0,
                    'T_low':
                    200.0,
                    'T_mid':
                    1000.0,
                    'a_high': [
                        3.03399249, 0.00217691804, -1.64072518e-07,
                        -9.7041987e-11, 1.68200992e-14, -30004.2971, 4.9667701
                    ],
                    'a_low': [
                        4.19864056, -0.0020364341, 6.52040211e-06,
                        -5.48797062e-09, 1.77197817e-12, -30293.7267,
                        -0.849032208
                    ],
                    'class':
                    "<class 'pmutt.empirical.nasa.Nasa'>",
                    'elements': {
                        'H': 2,
                        'O': 1
                    },
                    'name':
                    'H2O',
                    'notes':
                    None,
                    'phase':
                    None,
                    'statmech_model':
                    None,
                    'misc_models':
                    None,
                    'cat_site':
                    None,
                    'n_sites':
                    None,
                    'smiles':
                    None,
                    'type':
                    'nasa',
                }],
                'products_stoich': [1.0],
                'reactants': [{
                    'T_high':
                    3500.0,
                    'T_low':
                    200.0,
                    'T_mid':
                    1000.0,
                    'a_high': [
                        3.09288767, 0.000548429716, 1.26505228e-07,
                        -8.79461556e-11, 1.17412376e-14, 3858.657, 4.4766961
                    ],
                    'a_low': [
                        3.99201543, -0.00240131752, 4.61793841e-06,
                        -3.88113333e-09, 1.3641147e-12, 3615.08056,
                        -0.103925458
                    ],
                    'class':
                    "<class 'pmutt.empirical.nasa.Nasa'>",
                    'elements': {
                        'H': 1,
                        'O': 1
                    },
                    'name':
                    'OH',
                    'notes':
                    None,
                    'phase':
                    None,
                    'statmech_model':
                    None,
                    'misc_models':
                    None,
                    'cat_site':
                    None,
                    'n_sites':
                    None,
                    'smiles':
                    None,
                    'type':
                    'nasa',
                }, {
                    'T_high':
                    3500.0,
                    'T_low':
                    200.0,
                    'T_mid':
                    1000.0,
                    'a_high': [
                        3.3372792, -4.94024731e-05, 4.99456778e-07,
                        -1.79566394e-10, 2.00255376e-14, -950.158922,
                        -3.20502331
                    ],
                    'a_low': [
                        2.34433112, 0.00798052075, -1.9478151e-05,
                        2.01572094e-08, -7.37611761e-12, -917.935173,
                        0.683010238
                    ],
                    'class':
                    "<class 'pmutt.empirical.nasa.Nasa'>",
                    'elements': {
                        'H': 2
                    },
                    'name':
                    'H2',
                    'notes':
                    None,
                    'phase':
                    None,
                    'statmech_model':
                    None,
                    'misc_models':
                    None,
                    'cat_site':
                    None,
                    'n_sites':
                    None,
                    'smiles':
                    None,
                    'type':
                    'nasa',
                }],
                'reactants_stoich': [1.0, 0.5],
                'transition_state':
                None,
                'transition_state_stoich':
                None
            }, {
                'class':
                "<class 'pmutt.reaction.Reaction'>",
                'products': [{
                    'T_high':
                    3500.0,
                    'T_low':
                    200.0,
                    'T_mid':
                    1000.0,
                    'a_high': [
                        3.03399249, 0.00217691804, -1.64072518e-07,
                        -9.7041987e-11, 1.68200992e-14, -30004.2971, 4.9667701
                    ],
                    'a_low': [
                        4.19864056, -0.0020364341, 6.52040211e-06,
                        -5.48797062e-09, 1.77197817e-12, -30293.7267,
                        -0.849032208
                    ],
                    'class':
                    "<class 'pmutt.empirical.nasa.Nasa'>",
                    'elements': {
                        'H': 2,
                        'O': 1
                    },
                    'name':
                    'H2O',
                    'notes':
                    None,
                    'phase':
                    None,
                    'statmech_model':
                    None,
                    'misc_models':
                    None,
                    'cat_site':
                    None,
                    'n_sites':
                    None,
                    'smiles':
                    None,
                    'type':
                    'nasa',
                }],
                'products_stoich': [1.0],
                'reactants': [{
                    'T_high':
                    3500.0,
                    'T_low':
                    200.0,
                    'T_mid':
                    1000.0,
                    'a_high': [
                        2.56942078, -8.59741137e-05, 4.19484589e-08,
                        -1.00177799e-11, 1.22833691e-15, 29217.5791, 4.78433864
                    ],
                    'a_low': [
                        3.1682671, -0.00327931884, 6.64306396e-06,
                        -6.12806624e-09, 2.11265971e-12, 29122.2592, 2.05193346
                    ],
                    'class':
                    "<class 'pmutt.empirical.nasa.Nasa'>",
                    'elements': {
                        'O': 1
                    },
                    'name':
                    'O',
                    'notes':
                    None,
                    'phase':
                    None,
                    'statmech_model':
                    None,
                    'misc_models':
                    None,
                    'cat_site':
                    None,
                    'n_sites':
                    None,
                    'smiles':
                    None,
                    'type':
                    'nasa',
                }, {
                    'T_high':
                    3500.0,
                    'T_low':
                    200.0,
                    'T_mid':
                    1000.0,
                    'a_high': [
                        2.50000001, -2.30842973e-11, 1.61561948e-14,
                        -4.73515235e-18, 4.98197357e-22, 25473.6599,
                        -0.446682914
                    ],
                    'a_low': [
                        2.5, 7.05332819e-13, -1.99591964e-15, 2.30081632e-18,
                        -9.27732332e-22, 25473.6599, -0.446682853
                    ],
                    'class':
                    "<class 'pmutt.empirical.nasa.Nasa'>",
                    'elements': {
                        'H': 1
                    },
                    'name':
                    'H',
                    'notes':
                    None,
                    'phase':
                    None,
                    'statmech_model':
                    None,
                    'misc_models':
                    None,
                    'cat_site':
                    None,
                    'n_sites':
                    None,
                    'smiles':
                    None,
                    'type':
                    'nasa',
                }],
                'reactants_stoich': [0.5, 2.0],
                'transition_state':
                None,
                'transition_state_stoich':
                None
            }, {
                'class':
                "<class 'pmutt.reaction.Reaction'>",
                'products': [{
                    'T_high':
                    3500.0,
                    'T_low':
                    200.0,
                    'T_mid':
                    1000.0,
                    'a_high': [
                        3.03399249, 0.00217691804, -1.64072518e-07,
                        -9.7041987e-11, 1.68200992e-14, -30004.2971, 4.9667701
                    ],
                    'a_low': [
                        4.19864056, -0.0020364341, 6.52040211e-06,
                        -5.48797062e-09, 1.77197817e-12, -30293.7267,
                        -0.849032208
                    ],
                    'class':
                    "<class 'pmutt.empirical.nasa.Nasa'>",
                    'elements': {
                        'H': 2,
                        'O': 1
                    },
                    'name':
                    'H2O',
                    'notes':
                    None,
                    'phase':
                    None,
                    'statmech_model':
                    None,
                    'misc_models':
                    None,
                    'cat_site':
                    None,
                    'n_sites':
                    None,
                    'smiles':
                    None,
                    'type':
                    'nasa',
                }],
                'products_stoich': [1.0],
                'reactants': [{
                    'T_high':
                    3500.0,
                    'T_low':
                    200.0,
                    'T_mid':
                    1000.0,
                    'a_high': [
                        3.28253784, 0.00148308754, -7.57966669e-07,
                        2.09470555e-10, -2.16717794e-14, -1088.45772,
                        5.45323129
                    ],
                    'a_low': [
                        3.78245636, -0.00299673416, 9.84730201e-06,
                        -9.68129509e-09, 3.24372837e-12, -1063.94356,
                        3.65767573
                    ],
                    'class':
                    "<class 'pmutt.empirical.nasa.Nasa'>",
                    'elements': {
                        'O': 2
                    },
                    'name':
                    'O2',
                    'notes':
                    None,
                    'phase':
                    None,
                    'statmech_model':
                    None,
                    'misc_models':
                    None,
                    'cat_site':
                    None,
                    'n_sites':
                    None,
                    'smiles':
                    None,
                    'type':
                    'nasa',
                }, {
                    'T_high':
                    3500.0,
                    'T_low':
                    200.0,
                    'T_mid':
                    1000.0,
                    'a_high': [
                        3.3372792, -4.94024731e-05, 4.99456778e-07,
                        -1.79566394e-10, 2.00255376e-14, -950.158922,
                        -3.20502331
                    ],
                    'a_low': [
                        2.34433112, 0.00798052075, -1.9478151e-05,
                        2.01572094e-08, -7.37611761e-12, -917.935173,
                        0.683010238
                    ],
                    'class':
                    "<class 'pmutt.empirical.nasa.Nasa'>",
                    'elements': {
                        'H': 2
                    },
                    'name':
                    'H2',
                    'notes':
                    None,
                    'phase':
                    None,
                    'statmech_model':
                    None,
                    'misc_models':
                    None,
                    'cat_site':
                    None,
                    'n_sites':
                    None,
                    'smiles':
                    None,
                    'type':
                    'nasa',
                }],
                'reactants_stoich': [0.5, 1.0],
                'transition_state':
                None,
                'transition_state_stoich':
                None
            }]
        }

        species_pathway = {
            'A': StatMech(G=1., **presets['constant']),
            'A_TS1': StatMech(G=3., **presets['constant']),
            'A_TS2': StatMech(G=2., **presets['constant']),
            'B': StatMech(G=-1., **presets['constant']),
            'C': StatMech(G=2., **presets['constant']),
            'C_TS': StatMech(G=2.5, **presets['constant']),
            'D': StatMech(G=0., **presets['constant']),
        }
        self.rxn_pathway1 = Reactions(reactions=[
            Reaction.from_string('A = A_TS1 = B', species_pathway),
            Reaction.from_string('B = C', species_pathway),
            Reaction.from_string('C = C_TS = D', species_pathway)
        ])
        self.rxn_pathway2 = Reactions(reactions=[
            Reaction.from_string('A = A_TS2 = B', species_pathway),
            Reaction.from_string('B = C', species_pathway),
            Reaction.from_string('C = C_TS = D', species_pathway)
        ])
Exemple #6
0
# Add it to the dictionary
species_dict['H2O_TS'] = H2O_TS

# (Optional) Print the new dictionary to see the new entry
pprint(species_dict)

# ## Initialize Reaction Manually
# Let us initialize the reaction manually. You will have to feed the reactants, transition states, products and their stoichiometries.

# In[3]:

from pmutt.reaction import Reaction

rxn = Reaction(reactants=[species_dict['H2'], species_dict['O2']],
               reactants_stoich=[1., 0.5],
               products=[species_dict['H2O']],
               products_stoich=[1.],
               transition_state=species_dict['H2O_TS'],
               transition_state_stoich=[1.])
# (Optional) Converting a Reaction object to a string will give its stoichiometric formula
print('Creating Reaction object manually: {}'.format(rxn))

# ## Initialize Reaction Using Strings
# Initializing manually is cumbersome and prone to error. Instead, we can use ``.from_string()`` to initialize the reaction more easily.

# In[4]:

rxn = Reaction.from_string(reaction_str='H2 + 0.5O2 = H2O_TS = H2O',
                           species=species_dict)

# See that you get the same stoichiometry as before
print('Creating Reaction object using default string notation: {}'.format(rxn))
Exemple #7
0
                 200.123762, 196.698042, 195.736534, 75.269065, 72.94012,
                 70.402739, 68.651958, 65.289743, 64.556735, 63.904694,
                 60.051442, 58.698334, 55.589005, 52.608038, 43.883525
             ],
             **presets['harmonic']),
}

# ## Create Reactions for Phase Diagram
# The reactions will be initialized and put in a list. Notice that the stoichiometric coefficient of CO changes for higher coverages. If you are unfamiliar with initializing reactions, see the Reactions example.

# In[2]:

from pmutt.reaction import Reaction

reactions = [
    Reaction.from_string('Pt = Pt', species),  # Clean surface
    Reaction.from_string('Pt + CO = CO(S) 1/16ML fcc', species),
    Reaction.from_string('Pt + CO = CO(S) 1/16ML br', species),
    Reaction.from_string('Pt + CO = CO(S) 1/16ML top', species),
    Reaction.from_string('Pt + 2CO = CO(S) 1/8ML', species),
    Reaction.from_string('Pt + 3CO = CO(S) 3/16ML', species),
    Reaction.from_string('Pt + 8CO = CO(S) 1/2ML', species)
]

# ## Create PhaseDiagram Object
# Now we have everything we need to create the ``PhaseDiagram`` object.

# In[3]:

from pmutt.reaction.phasediagram import PhaseDiagram
Exemple #8
0
# You can also evaluate reactions properties. The most straightforward way to do this is to initialize using strings.

# In[15]:


from pmutt.io.thermdat import read_thermdat
from pmutt import pmutt_list_to_dict
from pmutt.reaction import Reaction

# Get a dictionary of species
thermdat_H2O_path = os.path.join(notebook_folder, 'thermdat_H2O')
species_list = read_thermdat(thermdat_H2O_path)
species_dict = pmutt_list_to_dict(species_list)

# Initialize the reaction
rxn_H2O = Reaction.from_string('H2 + 0.5O2 = H2O', species=species_dict)

# Calculate reaction properties
H_rxn = rxn_H2O.get_delta_H(T=298., units='kJ/mol')
S_rxn = rxn_H2O.get_delta_S(T=298., units='J/mol/K')
print('H_rxn(T=298) = {:.1f} kJ/mol'.format(H_rxn))
print('S_rxn(T=298) = {:.2f} J/mol/K'.format(S_rxn))


# ## Exercise
# Write a script to calculate the Enthalpy of adsorption (in kcal/mol) of H2O on Cu(111) at T = 298 K. Some important details are given below.
# 
# ### Information Required
# #### H2O: 
# - ideal gas
# - atoms: You can use "ase.build.molecule" to generate a water molecule like we did with ethane, propane, and butane.
Exemple #9
0
             -3.3518122405333548e-09, 7.58446718337381e-13, -191086.2004520406,
             0.6858235504924011
         ]),
    'NH3':
    Shomate(name='NH3',
            T_low=300.,
            T_high=1000.,
            a=[
                18.792357134351683, 44.82725349479501, -10.05898449447048,
                0.3711633831565547, 0.2969942466370908, -1791.225746924463,
                203.9035662274934, 1784.714638346206
            ]),
}

# Define the formation of water reaction
rxn = Reaction.from_string('1.5H2 + 0.5N2 = NH3', species)

# Calculate forward change in enthalpy
H_rxn_fwd = rxn.get_delta_H(units='kcal/mol', T=300.)
print('Delta H_fwd(T = 300 K) = {:.1f} kcal/mol'.format(H_rxn_fwd))

# Calculate reverse change in enthalpy
H_rxn_rev = rxn.get_delta_H(units='kcal/mol', T=300., rev=True)
print('Delta H_rev(T = 300 K) = {:.1f} kcal/mol'.format(H_rxn_rev))

# Calculate enthalpy of reactants
H_react = rxn.get_H_state(units='kcal/mol', T=300., state='reactants')
print('H_reactants(T = 300 K) = {:.1f} kcal/mol'.format(H_react))

# <a id='section_11'></a>
Exemple #10
0
                        atoms=molecule('H2O'),
                        potentialenergy=-14.2209,
                        symmetrynumber=2,
                        spin=0,
                        references=refs,
                        vib_wavenumbers=[3825.434, 3710.264, 1582.432],
                        **presets['idealgas'])

H2O_TS_statmech = StatMech(name='H2O',
                           elements={
                               'H': 2,
                               'O': 1
                           },
                           phase='G',
                           atoms=molecule('H2O'),
                           potentialenergy=0.,
                           symmetrynumber=2,
                           spin=0,
                           references=refs,
                           vib_wavenumbers=[3825.434, 3710.264, 1582.432],
                           **presets['idealgas'])

species = {
    'H2': H2_shomate,
    'H2O': H2O_statmech,
    'O2': O2_nasa,
    'H2O_TS': H2O_TS_statmech,
}

rxn = Reaction.from_string('H2 + 0.5O2 = H2O_TS = H2O', species)
Exemple #11
0
             4.050329990684662, -0.0029677854067980108, 5.323485005316287e-06,
             -3.3518122405333548e-09, 7.58446718337381e-13, -191086.2004520406,
             0.6858235504924011
         ]),
    'NH3':
    Shomate(name='NH3',
            T_low=300.,
            T_high=1000.,
            a=[
                18.792357134351683, 44.82725349479501, -10.05898449447048,
                0.3711633831565547, 0.2969942466370908, -1791.225746924463,
                203.9035662274934, 1784.714638346206
            ]),
}

# Define the formation of ammonia reaction
rxn = Reaction.from_string('1.5H2 + 0.5N2 = NH3', species)

# Now we can calculate thermodynamic properties of the reaction.

# In[13]:
'''Forward change in enthalpy'''
H_rxn_fwd = rxn.get_delta_H(units='kcal/mol', T=300.)
print('Delta H_fwd(T = 300 K) = {:.1f} kcal/mol'.format(H_rxn_fwd))
'''Reverse change in entropy'''
S_rxn_rev = rxn.get_delta_S(units='cal/mol/K', T=300., rev=True)
print('Delta S_rev(T = 300 K) = {:.1f} cal/mol/K'.format(S_rxn_rev))
'''Gibbs energy of reactants'''
G_react = rxn.get_G_state(units='kcal/mol', T=300., state='reactants')
print('G_reactants(T = 300 K) = {:.1f} kcal/mol'.format(G_react))
Exemple #12
0
    def setUp(self):
        self.T = c.T0('K')
        # Factor to convert potential energy to dimensionless number
        dim_factor = c.R('eV/K')*self.T
        self.m = 0.5  # BEP Slope
        self.c = 20.  # BEP Intercept in kcal/mol
        species = {
            'H2': StatMech(name='H2', potentialenergy=2.*dim_factor,
                           **presets['electronic']),
            'O2': StatMech(name='O2', potentialenergy=4.*dim_factor,
                           **presets['electronic']),
            'H2O': StatMech(name='H2O', potentialenergy=3.*dim_factor,
                            **presets['electronic']),
            'BEP': BEP(slope=self.m, intercept=self.c, name='BEP')
        }
        self.rxn_delta_H = Reaction.from_string(
                reaction_str='H2 + 0.5O2 = BEP = H2O',
                species=species,
                bep_descriptor='delta_H')
        self.bep_delta_H = self.rxn_delta_H.transition_state[0]

        rxn_rev_delta_H = Reaction.from_string(
                reaction_str='H2 + 0.5O2 = BEP = H2O',
                species=species,
                bep_descriptor='rev_delta_H')
        self.bep_rev_delta_H = rxn_rev_delta_H.transition_state[0]

        rxn_reactants_H = Reaction.from_string(
                reaction_str='H2 + 0.5O2 = BEP = H2O',
                species=species,
                bep_descriptor='reactants_H')
        self.bep_reactants_H = rxn_reactants_H.transition_state[0]

        rxn_products_H = Reaction.from_string(
                reaction_str='H2 + 0.5O2 = BEP = H2O',
                species=species,
                bep_descriptor='products_H')
        self.bep_products_H = rxn_products_H.transition_state[0]

        self.rxn_delta_E = Reaction.from_string(
                reaction_str='H2 + 0.5O2 = BEP = H2O',
                species=species,
                bep_descriptor='delta_E')
        self.bep_delta_E = self.rxn_delta_E.transition_state[0]

        rxn_rev_delta_E = Reaction.from_string(
                reaction_str='H2 + 0.5O2 = BEP = H2O',
                species=species,
                bep_descriptor='rev_delta_E')
        self.bep_rev_delta_E = rxn_rev_delta_E.transition_state[0]

        rxn_reactants_E = Reaction.from_string(
                reaction_str='H2 + 0.5O2 = BEP = H2O',
                species=species,
                bep_descriptor='reactants_E')
        self.bep_reactants_E = rxn_reactants_E.transition_state[0]

        rxn_products_E = Reaction.from_string(
                reaction_str='H2 + 0.5O2 = BEP = H2O',
                species=species,
                bep_descriptor='products_E')
        self.bep_products_E = rxn_products_E.transition_state[0]
Exemple #13
0
    'O2':
    O2,
}

# (Optional) Print the species dictionary
pprint(species)

# ## Create Reactions for Phase Diagram
# The reactions will be initialized and put in a list. Notice that the stiochiometric coefficient of O2 in all reactions is 1 to ensure consistency. If you are unfamiliar with initializing reactions, see the reactions example.

# In[2]:

from pmutt.reaction import Reaction

reactions = [
    Reaction.from_string(reaction_str='2Fe+O2=2FeO', species=species),
    Reaction.from_string(reaction_str='{}Fe+O2={}Fe2O3'.format(
        4. / 3., 2. / 3.),
                         species=species),
    Reaction.from_string(reaction_str='1.5Fe+O2=0.5Fe3O4', species=species)
]

# ## Create PhaseDiagram Object
# Now we have everything we need to create the ``PhaseDiagram`` object.

# In[3]:

from pmutt.reaction.phasediagram import PhaseDiagram

phase_diagram = PhaseDiagram(reactions=reactions)
Exemple #14
0
    def from_string(cls,
                    reaction_str,
                    species,
                    species_delimiter='+',
                    reaction_delimiter='=',
                    notes=None,
                    A=None,
                    beta=1,
                    Ea=None,
                    is_adsorption=False,
                    sticking_coeff=0.5,
                    direction=None,
                    id=None,
                    use_motz_wise=False):
        """Create a reaction object using the reaction string

        Parameters
        ----------
            reaction_str : str
                Reaction string.
            species : dict
                Dictionary using the names as keys. If you have a list of
                species, use pmutt.pmutt_list_to_dict to make a dict.
            species_delimiter : str, optional
                Delimiter that separate species. Leading and trailing spaces
                will be trimmed. Default is '+'
            reaction_delimiter : str, optional
                Delimiter that separate states of the reaction. Leading and
                trailing spaces will be trimmed. Default is '='
            notes : str or dict, optional
                Other notes such as the source of the reaction. Default is None
            A : float, optional
                Pre-exponential constant. If not specified, uses reaction to
                determine value.
            beta : float, optional
                Power to raise the temperature in the rate expression. Default
                is 1 if ``is_adsorption`` is False, 0 if ``is_adsorption``
                is True.
            Ea : float, optional
                Activation energy. If not specified, uses reaction to determine
                value.
            is_adsorption : bool, optional
                If True, the reaction represents an adsorption. Default is False
            sticking_coeff : float, optional
                Sticking coefficient. Only relevant if ``is_adsorption`` is
                True. Default is 0.5
            gas_phase : bool
                True if the reaction has only gas-phase species. This attribute
                is determined based on the reactants and products
            use_motz_wise : bool, optional
                Used when generating OpenMKM YAML file. If True, uses Motz-Wise
                correction to sticking coefficient. Only applicable to
                adsorption reactions. Default is False.
        Returns
        -------
            SurfaceReaction : :class:`~pmutt.omkm.SurfaceReaction` object
        """
        rxn = Reaction.from_string(reaction_str=reaction_str,
                                   species=species,
                                   species_delimiter=species_delimiter,
                                   reaction_delimiter=reaction_delimiter)
        return cls(reactants=rxn.reactants,
                   reactants_stoich=rxn.reactants_stoich,
                   products=rxn.products,
                   products_stoich=rxn.products_stoich,
                   transition_state=rxn.transition_state,
                   transition_state_stoich=rxn.transition_state_stoich,
                   notes=notes,
                   A=A,
                   beta=beta,
                   Ea=Ea,
                   is_adsorption=is_adsorption,
                   sticking_coeff=sticking_coeff,
                   direction=direction,
                   id=id,
                   use_motz_wise=use_motz_wise)