JANAF¶
This module gets thermodynamic data from the JANAF database. Files are downloaded from the NIST servers as needed and then cached locally.
Zack Gainsforth
Funding by NASA
-
class
thermochem.janaf.
JanafPhase
(rawdata_text)[source]¶ Class which is created by Janafdb for a specific phase.
It reads in the JANAF data file and produces functions which interpolate the thermodynamic constants.
Tr stands for reference temperature and is 298.15 K
>>> db = Janafdb() >>> p = db.getphasedata(formula='O2Ti', name='Rutile', phase='cr') >>> p.cp([500, 550, 1800]).astype(int).tolist() [67, 68, 78] >>> print(p.S([500, 550, 1800])) # Entropy in J/mol/K [ 82.201 88.4565 176.876 ] >>> print(p.gef([500, 550, 1800])) # [G-H(Tr)]/T in J/mol/K [ 57.077 59.704 115.753] >>> print(p.hef([500, 550, 1800])) # H-H(Tr) in kJ/mol [ 12.562 15.9955 110.022 ] >>> print(p.DeltaH([500, 550, 1800])) # Standard enthalpy of formation in kJ/mol [-943.670 -943.2295 -936.679 ] >>> print(p.DeltaG([500, 550, 1800])) # Gibbs free enegy in kJ/mol [-852.157 -843.0465 -621.013 ] >>> p.logKf([500, 550, 1800]).astype(int).tolist() # Equilibrium constant of formation. [89, 80, 18] >>> print(p.cp(1000)) # Heat capacity in J/mol/K 74.852 >>> print(p.cp(50000)) # Example of erroneous extrapolation. Traceback (most recent call last): ... ValueError: A value in x_new is above the interpolation range.
-
class
thermochem.janaf.
Janafdb
[source]¶ Class that reads the NIST JANAF tables for thermodynamic data.
Data is initially read from the web servers, and then cached.
Examples
>>> rutile = Janafdb().getphasedata(name='Rutile')
To load thermodynamic constants for TiO2, rutile.
-
getphasedata
(formula=None, name=None, phase=None, filename=None, cache=True)[source]¶ Returns an element instance given the name of the element. formula, name and phase match the respective fields in the JANAF index.
Parameters: - formula (str) – Select records that match the chemical formula
- name (str) – Select records that match the chemical/mineral name
- phase (str) – Select records that match the chemical phase. Must be one of the following valid phases: cr, l, cr,l, g, ref, cd, fl, am, vit, mon, pol, sln, aq, sat
- filename (str) – Select only records that match the filename on the website, which is very unique.
- cache (bool, default True) – Whether to cache the Janaf database. Setting this to false will download the Janaf database every time it is used.
Examples
>>> db = Janafdb() >>> db.getphasedata(formula='O2Ti', phase='cr') Traceback (most recent call last): ... ValueError: There are 2 records matching this pattern: ... Please select a unique record. >>> db.getphasedata(formula='Oxyz') Traceback (most recent call last): ... ValueError: Did not find a phase with formula = Oxyz Please provide enough information to select a unique record. Also check that you didn't eliminate the record you want by choosing too many constraints where one or more constraint is incorrect. >>> db.getphasedata(formula='Oxyz', phase='l') Traceback (most recent call last): ... ValueError: Did not find a phase with formula = Oxyz, phase = l Please provide enough information to select a unique record. Also check that you didn't eliminate the record you want by choosing too many constraints where one or more constraint is incorrect. >>> FeO = db.getphasedata(formula='FeO', phase='cr,l') >>> print(FeO) <thermochem.janaf.JanafPhase object at 0x...> Iron Oxide (FeO) Fe1O1(cr,l) Cp(298.15) = 49.915 J/mol/K S(298.15) = 60.752 J/mol/K [G-H(298.15)]/298.15 = 60.752 J/mol/K H-H(298.15) = 0.000 J/mol/K Delta_fH(298.15) = -272.044 kJ/mol Delta_fG(298.15) = -251.429 kJ/mol log(Kf((298.15)) = 44.049
-
search
(searchstr)[source]¶ List all the species containing a string. Helpful for interactive use of the database.
Parameters: searchstr (str) – The search string to look for Returns: Dataframe containing valid phases Return type: pandas.DataFrame Examples
>>> db = Janafdb() >>> s = db.search('Rb-') >>> print(s) formula name phase filename 1710 Rb- Rubidium, Ion g Rb-007 >>> s = db.search('Ti') >>> print(len(s)) 88
-