Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thermodynamic data missing for Fe2O3 chemical #5

Open
AlexSilverSword opened this issue Apr 9, 2017 · 8 comments
Open

Thermodynamic data missing for Fe2O3 chemical #5

AlexSilverSword opened this issue Apr 9, 2017 · 8 comments
Assignees
Labels

Comments

@AlexSilverSword
Copy link

AlexSilverSword commented Apr 9, 2017

I am trying to use Fe2O3 in some of my thermodynamic calculations using 'thermo.chemical', but was unable to call it from the chemical database. I have used both methods shown below:

from thermo.chemical import Chemical
Fe2O3 = Chemical("Fe2O3") # Using chemical formula name
# OR
Fe2O3 = Chemical("1317-60-8") # Using the CAS ID from PubChem

Method 1 returned the following error:

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-12-872c9ccce381> in <module>()
----> 1 Fe2O3 = Chemical("Fe2O3")

C:\ProgramData\Anaconda3\lib\site-packages\thermo\chemical.py in __init__(self, ID, T, P)
    392             self.calculate(T, P)
    393         else:
--> 394             self.PubChem = PubChem(self.CAS)
    395             self.MW = MW(self.CAS)
    396             self.formula = formula(self.CAS)

C:\ProgramData\Anaconda3\lib\site-packages\thermo\identifiers.py in PubChem(CASRN)
    239 
    240     '''
--> 241     pubchem = pubchem_dict[CASRN]['Pubchem ID']
    242     return pubchem
    243 

KeyError: None

Method 2 returned a "none" for every property I tried.
Please, will you help me?

@CalebBell
Copy link
Owner

Hello Alex,

Thank you for finding this bug. For a chemical instance to be created, the structure and a valid CAS number need to have been recorded in PubChem in April 2014, when the database was created by obtaining all chemicals with valid CAS numbers associated. PubChem does include Fe2O3, but a CAS number was not available as a synonym, nor is it today. https://pubchem.ncbi.nlm.nih.gov/compound/518696

This is a frustrating and persistent problem with using CAS numbers as chemical identifiers. CAS does not publicly associate CAS numbers with chemical structures, and what they do have, CommonChemistry.org, only has pictures of structures.

I have been working on a next-generation database for some time, which will draw chemical metadata from Wikipedia, CommonChemistry, PubChem, CHEBL, and NIST's wekbook. Fe2O3 is currently included in the new database, but there are too many instances where lookups will get worse right now for me to deploy it. I have been working on it for two months so far. Perhaps more importantly, the new database will support an override file, where I can make changes to the database manually whenever errors are spotted!

Sincerely,
Caleb

@CalebBell CalebBell self-assigned this Apr 9, 2017
@CalebBell CalebBell added the bug label Apr 9, 2017
@AlexSilverSword
Copy link
Author

Hello Caleb

Thank you for your help. I am enjoying it a lot work with 'thermo' for its wide range of chemical compounds and amount of functions it provides for each chemical compound. Now that you meant you are working on the next-generation database, which includes NIST's webbook, a database that I used before. This makes me so excited to what the future of 'thermo' will behold.

I don't what to sound like I am rushing to finish the new database, but when will 'thermo' be updated to the new database, because I am using Fe2O3 a lot in my calculations. If you are uncertain at this point, it is completely understandable, because it sounds like an insane lot of work to create the new database.

Sincerely yours
Alex

@CalebBell
Copy link
Owner

Hello Alex,

I am glad you are finding useful pieces in and among the library.

I intend to do a much more thorough job with the chemical metadata database this time, and for that reason it could be a while.

In the mean time, one idea I've been thinking about would be to allow the user to specify some details about a chemical, according to the following syntax:

hematite = {'CASRN': '1309-37-1', 'name': 'hematite', 'MW': 159.688, 'formula': 'Fe2O3'}
Fe2O3 = Chemical(hematite, T=320)
Fe2O3.Cpm
103.9

This syntax could be added pretty quickly. There are two properties the library has already, even if the chemical isn't in the database: melting point and constant solid heat capacity.

The metadata project I'm talking about will be separate from a project which incorporates, say, Solid Phase Heat Capacity from NIST's webbook. That project will actually be easier.

What are your thoughts? What properties are you using, and how?

Sincerely,
Caleb

@AlexSilverSword
Copy link
Author

AlexSilverSword commented Apr 18, 2017

Hello Caleb

I like the idea of a seperated project to process the metadata of chemicals in to a new database.

The syntax you mentioned to allow users to add data as they require. Until the final mega database are released the syntax will get very handy, thank you for providing it.

Okay, I am using most of time the thermodynamics properties of chemical like gibbs free energy, delta enthalpy to calculate energy required for my reactor vessel and water heat capacity of evaporation function, what a brilliant function I must say.

I am currently using the calc_H(T, P) to calculate the enthalpy of chemical compounds, but recently realised that it a method used in other functions, which probably means I am using it incorrectly. If so will you please provide a small example of doing enthalpy calculations using thermo.

Another thing that was kind of strange to me was that I couldn't find the gibbs free energy calculations function in thermo or am I looking for it in the wrong places.

Thanks you for thermo it's a real joy to use.

Sincerely your
Alex

@CalebBell
Copy link
Owner

CalebBell commented Apr 25, 2017

Hello Alex,

The new syntax is available in the new version released to pypi, although it is not documented yet. I need to redo the introduction documenting Chemical.

calc_H is indeed an internal function. The method which sets thermodynamic properties for a chemical is set_thermo. The method I'm advertising to obtain enthalpy/internal energy/entropy/Gibbs energy are as follows:

Chemical('water', T=300).G # J/kg
-23.943214574245758
Chemical('water', T=300).Gm # J/mol
-0.4313437146551564
Chemical('water', T=300).H # J/kg
7733.0986834123505
etc.

Different fields use different reference states for thermodynamic properties though. It's the same for phase equilibria. I tried to make it Chemical really flexible supporting different reference states, but in the end I'm going to have to introduce the concept of "property package" so people interested in metallurgy don't get enthalpies from equations of state. The same methods as are available now will still be supported but the calculation may be different.

One thing that's not going to change is the following syntax (molar values returned):

Chemical('iron', T=300).HeatCapacitySolid.T_dependent_property_integral(300, 320)
502.0
Chemical('iron', T=300).HeatCapacitySolid.T_dependent_property_integral_over_T(300, 320)
1.6199168805530348

Those are what are used to do the calculation plus a bunch of equation of state stuff but I don't think you need that. You can use those methods to computer your own enthalpies and entropies and Gibbs energies.
For ideal conditions, enthalpy is just the result of T_dependent_property_integral, and entropy that of T_dependent_property_integral_over_T. Gibbs energy = H - TS. I didn't notice your response until now because it was an edit and I just got the open/close issue emails not the response. I'm leaving the bug open since, well, it's still a bug.

@CalebBell CalebBell reopened this Apr 25, 2017
@AlexSilverSword
Copy link
Author

AlexSilverSword commented Apr 27, 2017

Hello Caleb

Thank you for incorporating the new syntax into thermo it works like a bomb and it will help a lot while you are working on the new database. Thank you for explaining how to obtain enthalpy/internal energy/entropy/Gibbs energy with in 'thermo`. I was a bit uncertain on how to obtain that properties by it now all sorted out, thank you for your help.

I am over exited that you are going to introduce the concept of "property package", because as you maybe notice I am a metallurgical engineering student and adding "property package" functionality will make thermo even more brilliant python packages.

Apologies for closing the issue, I think that also broke our communication stream. I will then keep this issue open until you close it.

Sincerely yours
Alex

bjodah pushed a commit to bjodah/thermo that referenced this issue Sep 18, 2018
@marcocaggioni
Copy link

Hi,
I saw in this issue how you can define a chemical that is not present in the database.
By defining with the syntax

hematite = {'CASRN': '1309-37-1', 'name': 'hematite', 'MW': 159.688, 'formula': 'Fe2O3'}
Fe2O3 = Chemical(hematite, T=320)
Fe2O3.Cpm
103.9

and assuming is a liquid would it be possible to make a mixture using it? the mixture class does not seem to have a way to pass the chemical object so it only has access to the object in the database.

I'm interested in getting the viscosity of the mixture so my question is also what property should the chemical have to enable the mixture viscosity estimation?

thanks for this very useful library
Marco

@CalebBell
Copy link
Owner

Hi Marco,

It sounds like it would be simpler to use the methods in thermo.viscosity directly without the mixture interface. If you know the pure component viscosities, I recommend Brokaw method for gases, and simply use logarithmic mixing function mixing_logarithmic for liquids.

If you do not know the pure component viscosities, I believe the liquid methods for estimating them are too poor to recommend for industrial use; for gases, the Gharagheizi_gas_viscosity method should be appropriate.

Cheers,
Caleb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants