# # [0]: https://vlachosgroup.github.io/pmutt/io.html#pmutt.io.thermdat.read_thermdat # ## Reactions # 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. #
# - Save the ``Reaction`` object as a ``JSON`` file # # ## Files Required # - [thermdat](thermdat) Thermdat file used to initialize ``Nasa`` species # ## Initialize Species Used For Reaction # First, we need to describe our species as pMuTT objects. For this example, we will be importing the thermdat from the [combustion database by Berkeley](http://combustion.berkeley.edu/gri_mech/version30/files30/thermo30.dat). We will store the species in a dictionary for code clarity later on. # In[1]: from pprint import pprint from pmutt.io.thermdat import read_thermdat from pmutt import pmutt_list_to_dict # The output will be a list species_list = read_thermdat(filename='thermdat') # This function converts the list to a dict for easier usage downstream species_dict = pmutt_list_to_dict(pmutt_list=species_list, key='name') # (Optional) Print the species_dict to see what's in it pprint(species_dict) # To calculate transition state properties, we will need to represent the transition state species as a pMuTT object. For this example, we will create a new ``Nasa`` object based on the H2O entry but modify the a6 parameter arbitrarily to give it a higher enthalpy. # In[2]: from copy import deepcopy # Make a copy so we don't edit the original H2O H2O_TS = deepcopy(species_dict['H2O'])
# # Below, we write a thermdat file using the species imported from the spreadsheet. # In[13]: from pmutt.io.thermdat import write_thermdat write_thermdat(filename='./output/thermdat', nasa_species=nasa_species) # Similarly, a list of ``Nasa`` objects can be read from a thermdat using [``pmutt.io.thermdat.read_thermdat``](https://vlachosgroup.github.io/pMuTT/io.html#pmutt.io.thermdat.read_thermdat). # In[14]: from pmutt.io.thermdat import read_thermdat nasa_species = read_thermdat('./output/thermdat') # <a id='section_10'></a> # # 10. Reactions # # <img src="images/reaction.png" width=800> # # ``Reaction`` objects can be created by putting together ``Nasa``, ``Shomate`` and ``StatMech`` objects. # # <img src="images/reaction_func1.png" width=800> # # # The ``from_string`` method is the easiest way to create a ``Reaction`` object. It requires the relevant species to be in a dictionary and a string to describe the reaction. # # <img src="images/reaction_string.svg" width=800>