<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Theory, Applications, and Tools for Multiscale Kinetic Modeling (July 2020)
pGrAdd Demonstration
1. Introduction
<img src="images/pGrAdd_RGB_github.png" width=400>
A Python package and database, developed by the Vlachos Research Group at the University of Delaware implements the First-Principles Semi-Empirical (FPSE) Group Additivity
(GA) method for estimating thermodynamic properties of molecules. First introduced by Benson et al. for gas molecules and
was later extended by Kua et al. to species adsorbed on catalytic surfaces. GA relies on graph theory defining each molecule
as a collection of groups and their frequency of occurrence. The values of GA groups are determined from DFT-calculated
thermodynamic properties of a (training) set of molecules by linear regression to minimize the difference of thermodynamic
properties of molecules predicted by the GA from those estimated via DFT. This package implements four group additivity
schemes in six databases (See below) and will convert a molecule entered as a Simplified Molecular-Input
Line-Entry System (SMILES) providing the constituent groups, their frequency of occurrence, and estimated
thermodynamic properties for that molecule. pgradd also provides a general GA framework for implementing a custom group additivity scheme from your ab initio data and regression to groups.
2. Available databases
Benson's gas molecule group additivity (BensonGA)
Salciccioli et al. (2012) adsorbate on Pt(111) group additivity scheme (SalciccioliGA2012)
Gu et al. (2017) solvated adsorbate on Pt(111) group additivity scheme (GuSolventGA2017Aq, GuSolventGA2017Vac)
Wittreich (2018) adsorbate on Pt(111). Subset of Gu et al. including only surface species, group values regressed with OLS/GLS (Maximum Likelihood) and DFT data processed with pMuTT (GRWSurface2018)
Wittreich (2018) solvated adsorbate on Pt(111). Subset of Gu et al. including only surface species, group values regressed with OLS/GLS (Maximum Likelihood) and DFT data processed with pMuTT (GRWAqueous2018)
3. Installation
pip install pgradd
or upgrade from a previous version
pip install --upgrade pgradd
4. Demonstration
Load the pGrAdd libraries
Step1:  Find the groups in a molecule
Molecule
Step2:  Calculate thermodynamic properties of the molecule
Step3:  Find the groups in a molecule
Molecule
Step4:  Calculate thermodynamic properties of the molecule
<ASSISTANT_TASK:>
Python Code:
import pgradd
print(pgradd.__file__)
from pgradd.GroupAdd import GroupLibrary
import pgradd.ThermoChem
lib = GroupLibrary.Load('GRWSurface2018')
Explanation: Theory, Applications, and Tools for Multiscale Kinetic Modeling (July 2020)
pGrAdd Demonstration
1. Introduction
<img src="images/pGrAdd_RGB_github.png" width=400>
A Python package and database, developed by the Vlachos Research Group at the University of Delaware implements the First-Principles Semi-Empirical (FPSE) Group Additivity
(GA) method for estimating thermodynamic properties of molecules. First introduced by Benson et al. for gas molecules and
was later extended by Kua et al. to species adsorbed on catalytic surfaces. GA relies on graph theory defining each molecule
as a collection of groups and their frequency of occurrence. The values of GA groups are determined from DFT-calculated
thermodynamic properties of a (training) set of molecules by linear regression to minimize the difference of thermodynamic
properties of molecules predicted by the GA from those estimated via DFT. This package implements four group additivity
schemes in six databases (See below) and will convert a molecule entered as a Simplified Molecular-Input
Line-Entry System (SMILES) providing the constituent groups, their frequency of occurrence, and estimated
thermodynamic properties for that molecule. pgradd also provides a general GA framework for implementing a custom group additivity scheme from your ab initio data and regression to groups.
2. Available databases
Benson's gas molecule group additivity (BensonGA)
Salciccioli et al. (2012) adsorbate on Pt(111) group additivity scheme (SalciccioliGA2012)
Gu et al. (2017) solvated adsorbate on Pt(111) group additivity scheme (GuSolventGA2017Aq, GuSolventGA2017Vac)
Wittreich (2018) adsorbate on Pt(111). Subset of Gu et al. including only surface species, group values regressed with OLS/GLS (Maximum Likelihood) and DFT data processed with pMuTT (GRWSurface2018)
Wittreich (2018) solvated adsorbate on Pt(111). Subset of Gu et al. including only surface species, group values regressed with OLS/GLS (Maximum Likelihood) and DFT data processed with pMuTT (GRWAqueous2018)
3. Installation
pip install pgradd
or upgrade from a previous version
pip install --upgrade pgradd
4. Demonstration
Load the pGrAdd libraries
End of explanation
groups = lib.GetDescriptors('C(CC([Pt])([Pt])[Pt])([Pt])([Pt])[Pt]')
print('Group              Frequency')
print('-----              ---------')
for x in groups:
    print('{0:20s}  {1:g}'.format(x, groups[x]))
Explanation: Find the groups in a molecule
Molecule: CCH<sub>2</sub>C(S)
SMILES: C(CC([Pt])([Pt])[Pt])([Pt])([Pt])[Pt])
<img src="images/CCH2C(S).png" width=400>
End of explanation
thermochem = lib.Estimate(groups, 'thermochem')
S = thermochem.get_S(T=298.15, units='cal/mol/K')
H = thermochem.get_H(T=298.15, units='kcal/mol')
G = thermochem.get_G(T=298.15, units='kJ/mol')
HoRT = thermochem.get_HoRT(298.15)
print('Entropy(298 K)  = {0:5.2f} [cal/mol/K]'.format(S))
print('Enthalpy(298 K) = {0:5.2f} [kcal/mol]'.format(H))
print('Gibb''s(298 K)    = {0:5.2f} [kJ/mol]'.format(G))
print('Dimensionless Enthalpy(298 K)  = {0:5.2f}'.format(HoRT))
import numpy as np
from pmutt import plot_1D
from matplotlib import pyplot as plt
T = np.linspace(300, 1500)
fig1, ax1 = plot_1D(thermochem, x_name='T', x_values=T,
                    methods=('get_H', 'get_S', 'get_G'),
                    get_H_kwargs={'units':'kcal/mol'},
                    get_S_kwargs={'units':'cal/mol/K'},
                    get_G_kwargs={'units': 'kJ/mol'})
fig1.set_figheight(10)
ax1[0].set_ylabel('H (kcal/mol)')
ax1[1].set_ylabel('S (cal/mol/K)')
ax1[2].set_ylabel('G (kJ/mol)')
ax1[0].set_xlabel('Temperature [K]')
ax1[1].set_xlabel('Temperature [K]')
ax1[2].set_xlabel('Temperature [K]')
plt.tight_layout()
plt.show()
from pmutt.empirical.nasa import Nasa
from pmutt.io.thermdat import write_thermdat
N = []
N.append(Nasa.from_model(thermochem, name='CCH2C(S)', T_low=300, T_high=1500, phase='S', elements={'C': 3, 'H': 2}))
print(write_thermdat(N))
Explanation: Calculate thermodynamic properties of the molecule
End of explanation
groups = lib.GetDescriptors('C([Pt])(O)C')
print('Group              Frequency')
print('-----              ---------')
for x in groups:
    print('{0:20s}  {1:g}'.format(x, groups[x]))
Explanation: Find the groups in a molecule
Molecule: CH<sub>3</sub>CHOH(S)
SMILES: C([Pt])(O)C
<img src="images/CH3CHOH(S).png" width=400>
End of explanation
thermochem = lib.Estimate(groups, 'thermochem')
S = thermochem.get_S(T=298.15, units='cal/mol/K')
H = thermochem.get_H(T=298.15, units='kcal/mol')
G = thermochem.get_G(T=298.15, units='kJ/mol')
HoRT = thermochem.get_HoRT(298.15)
print('Entropy(298 K)  = {0:5.2f} [cal/mol/K]'.format(S))
print('Enthalpy(298 K) = {0:5.2f} [kcal/mol]'.format(H))
print('Gibb''s(298 K)    = {0:5.2f} [kJ/mol]'.format(G))
print('Dimensionless Enthalpy(298 K)  = {0:5.2f}'.format(HoRT))
import numpy as np
from pmutt import plot_1D
from matplotlib import pyplot as plt
T = np.linspace(300, 1500)
fig1, ax1 = plot_1D(thermochem, x_name='T', x_values=T,
                    methods=('get_H', 'get_S', 'get_G'),
                    get_H_kwargs={'units':'kcal/mol'},
                    get_S_kwargs={'units':'cal/mol/K'},
                    get_G_kwargs={'units': 'kJ/mol'})
fig1.set_figheight(10)
ax1[0].set_ylabel('H (kcal/mol)')
ax1[1].set_ylabel('S (cal/mol/K)')
ax1[2].set_ylabel('G (kJ/mol)')
ax1[0].set_xlabel('Temperature [K]')
ax1[1].set_xlabel('Temperature [K]')
ax1[2].set_xlabel('Temperature [K]')
plt.tight_layout()
plt.show()
from pmutt.empirical.nasa import Nasa
from pmutt.io.thermdat import write_thermdat
N = []
N.append(Nasa.from_model(thermochem, name='CH3CHOH(S)', T_low=300, T_high=1500, phase='S', elements={'C': 2, 'H': 5, 'O':1}))
print(write_thermdat(N))
Explanation: Calculate thermodynamic properties of the molecule
End of explanation
<END_TASK>