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
FIX: MQMQA: Handle species that have mole numbers that are higher than 1 #496
base: develop
Are you sure you want to change the base?
FIX: MQMQA: Handle species that have mole numbers that are higher than 1 #496
Conversation
…el can handle species that have mole numbers that are higher than 1 (ie. dimers,trimers). In order to handle this correctly the _n_i function, ideal mixing function and some energy tests had to be adjusted. Additionally, two new tests were introduced which make sure the species with multiple moles and vacancies in the MQMQA model are correctly described.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #496 +/- ##
===========================================
+ Coverage 90.46% 90.61% +0.14%
===========================================
Files 50 50
Lines 7868 7894 +26
===========================================
+ Hits 7118 7153 +35
+ Misses 750 741 -9 ☔ View full report in Codecov by Sentry. |
@jorgepazsoldanpalma is the change from I tried to change just The key question I have is: do FactSage and Thermochemica work with both versions (both |
Hi @bocklund ! The changes I made to the species were due to the fact that when the .dat file reads the species as Fe2+ it believes that the species should have a constituent of 2 rather than 1. That was the main reason I changed it. As you correctly pointed out, the lines below the specie labeling do in fact give information regarding the respective charge of the species. |
Is The test gives the Thermochimica value, which implies that |
@bocklund The originaly reason I changed the lines, if I remember correctly, was because the energies were not matching due to the fact that the parser was interpreting the Fe2+ as being a species with charge 2 and a constituent of 2 rather than 1. Perhaps this bug in the parser has been addressed? |
@@ -67,7 +67,7 @@ | |||
2.00000 3.00000 0.000000 0.000000 0.000000 | |||
1.65300 | |||
3 2 | |||
Fe2+ Fe3+ Sb3+ | |||
Fe+2 Fe+3 Sb+3 | |||
O S | |||
2.00000 3.00000 3.00000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jorgepazsoldanpalma You added some new tests for databases containing Be2
or Al2
, which is good. The fact that you needed to change this database to be Fe+2
when Thermochimica/FactSage can use the Fe2+
version means that something about the implementation of this feature for mole numbers ≠ 1 is wrong.
Both the new Be2
/Al2
tests that were added should pass and the existing tests that use the Fe2+
-style should work (and should agree with the output of using Fe2+
-style database in Thermochimica/FactSage)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you change the database base to Fe2+
then PyCalphad raises and exception in the tests that use this database, but it should still compute the same values that the other software give.
@bocklund, just to make sure I am understanding your comments. You are saying that when you change the species from Fe+2 to Fe2+ PyCalphad just raises and exception but still correctly calculates the energies. If that is what you are saying then that is not the case at all for me. I obtain an error in which the energies are not the same with the values from Thermochimica. Now this is my understanding the of the error so far on my end and in the branch I am proposing. @select_database("Shishin_Fe-Sb-O-S_slag.dat")
This is wrong since what this is implying is the Fe2 is in fact a dimer (2 atoms/moles of Fe) of charge 2 rather than 1 mole of Fe that has a charge of 2. Now the reason this test was not raising issues in the past was in fact the error addressed in this branch. The code assummed all species had a constituent of 1 no matter was assigned to the species itself. This is why in the LiF-BeF2 system is was incorrectly normalizing the Gibbs energy of the quadruplets with Be dimers in it. In this current implemetation I make the code read the species constituent so that it can correctly differentiate dimers and monomers, and hence the test from Shishin fails now. The reason why I changed the configuration of the species is because I know the code interprets a number next to a species to be the constituent number and instead of fixing the fundamental problem (which seems to be how the .dat file address how mass is attributed to species ) I was lazy and quickly changed the expressions of the species in the database. I hope that now my actions are more clear. |
Yeah, I think this is what I'm getting at. To merge this pull request we need to ensure that we:
Right now we are violating (1) at the expense of (2), but I we should merge the implementation that satisfies both (1) and (2). Let me know if I'm understanding correctly and whether that makes sense. If it's helpful at all, I did the work to revert the Shishin database and tests and pushed the changes up to your branch here. We can successfully merge this pull request when the implementation (of the DAT/XML parsers and the |
Roger. I'll get to that implementation asap! Thanks! |
In the following commit, changes have been made so that the MQMQA model can handle species that have mole numbers that are higher than 1 (ie. dimers,trimers). In order to handle this correctly the _n_i function, ideal mixing function and some energy tests had to be adjusted. Additionally, two new tests were introduced which make sure the species with multiple moles and vacancies in the MQMQA model are correctly described.