CalebBell / chemicals

chemicals: Chemical database of Chemical Engineering Design Library (ChEDL)
MIT License
186 stars 36 forks source link

Changed tsv files? #10

Closed yoelcortes closed 4 years ago

yoelcortes commented 4 years ago

Hi Caleb,

I was wondering if there has been any corrections to any of the tsv files in chemicals (as compared to thermo). I'm getting significantly different numbers for the following:

>>> # Expecting 495689880.0
>>> sum([abs(Hfg(i, method='TRC')) for i in TRC_gas_data.index[pd.notnull(TRC_gas_data['Hfg'])]])
494559380.0 
>>> # Expecting 300592764.0
>>> sum([abs(Hfg(i, method='ATCT_G')) for i in Hfg_ATcT_data.index])
299452426.0

Thanks!

yoelcortes commented 4 years ago

I'm hoping to update the branches once I get these tests passing

yoelcortes commented 4 years ago

I found the source of the error. The data tables are exactly the same. The problem was that I allowed the method to search through the periodic table first instead of returning the data from the selected method. When you search the periodic table, the Hf and S0 values are for the diatomic form, which is not the right value for the given CAS:

from chemicals.elements import periodic_table
from chemicals.reactions import Hfg_ATcT_data
for i in Hfg_ATcT_data.index:
    if i in periodic_table:
        print(i, periodic_table[i].Hf, Hfg_ATcT_data.at[i, 'Hfg'])
10097-32-2 0.0 111852
12385-13-6 0.0 217998
14762-94-8 0.0 79374
17778-80-2 0.0 249229
17778-88-0 0.0 472435
22537-15-1 0.0 121302
7439-90-9 0.0 0
7440-01-9 0.0 0
7440-37-1 0.0 0
7440-44-0 0.0 716873
7440-59-7 0.0 0
7440-63-3 0.0 0
7553-56-2 0.0 62417

For now I'll just make a dictionary of the elements in their diatomic form and their heat of formation and absolute entropy and use that instead of the periodic table. I'll also make sure that when a method is selected, it only looks through that method.

CalebBell commented 4 years ago

Hi Yoel, Nice find. I can confirm all the .tsv files committed are the latest versions.