-
Notifications
You must be signed in to change notification settings - Fork 875
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
uncertainty quantification in energy corrections #1558
Conversation
I think I need a longer summary to know what this is for? |
Hi, sorry I'll elaborate. The corrections in MPCompatibility.yaml were refit and now have standard error values associated with them (from imperfect fits as well as uncertainty in experimental data). I'll add the code that calculates the corrections and their errors soon. The Correction classes which previously given an entry returned a correction now also return the error on that correction. The Compatibility classes which previously processed an entry by calculating a total correction to the energy value now also include the error on that correction. |
@mkhorton @kristinpersson @shyamd I think this needs to be discussed. I do understand of course that corrections can be changed/improved. I have no problems with putting uncertainties in. But this is a rather extensive set of changes and it is possible that there are codes out there relying on the existing correction values. Some of the corrections are not small at all. We should have a proper review of all the correction values, as well as a possible strategy to have versioned corrections based on MP database versions. This cannot be done just by someone editing the code. |
Yes, agreed this cannot be done solely in code. Perhaps worth discussing in next MP dissemination meeting; it'll need to be staged with the next database release, and have accompanying docs. Agreed also we need to store the MPCompatibility version (which could be pymatgen version even) in the database, and potentially in the resulting ComputedEntries also. |
There are plans for a docs page and a paper discussing these corrections and their effects. For the most part these don't change the old values by much. The big difference is that these corrections can be reproduced in comparison to the old numbers, which I've never been able to recreate. |
The changes are large, by ~0.5 eV/atom in some cases. MP has gone from 2012 to 2019 with many generations of db changes along the way. I do not doubt that it would be difficult to reproduce the old values (some of which were done using proper AFM structures). The original values were actually documented in the pymatgen publication. The point remains this is an exercise that requires careful discussion and vetting. A doc page and publication would be good. But this will not be merged until all the pieces are in place. |
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.
We should consider Gzip'ing the two json files of entries since they are not human-readable as is, so they might as well be binary blobs.
W: -4.351 #Fit to WO2 and WO3 (BURP: -2.762) | ||
V: -1.682 #Fit to V2O3 and V2O5 (VO2 fit is way off) (BURP: -1.764) | ||
Ni: -2.164 #Based on burp version as of Feb 28 2011 | ||
V: -1.634860584846134 |
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.
We probably don't need so many sig figs. The corrections are definitely not good sub 1 meV, so let's round to that for now unless someone has a different opinion
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.
I agree with rounding to 1 meV
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.
Does this also apply to the correction errors? Rounding to 3 decimal places often results in only 1 sigfig (error = 0.00x), at most 2.
pymatgen/entries/compatibility.py
Outdated
@@ -648,3 +721,277 @@ def __init__(self, compat_type="Advanced", correct_peroxide=True, | |||
GasCorrection(fp), | |||
AnionCorrection(fp, correct_peroxide=correct_peroxide), | |||
UCorrection(fp, MPRelaxSet, compat_type), AqueousCorrection(fp)]) | |||
|
|||
|
|||
class CorrectionCalculator: |
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.
Let's move this to a new file. Compatability is getting too dense.
pymatgen/entries/compatibility.py
Outdated
species = ['oxide', 'peroxide', 'superoxide', 'F', 'Cl', 'Br', 'I', 'N', 'S', 'Se',\ | ||
'Si', 'Sb', 'Te', 'V', 'Cr', 'Mn', 'Fe', 'Co','Ni', 'Cu', 'Mo'] #species that we're fitting corrections for | ||
|
||
def __init__(self, exp_json, comp_json): |
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.
Add docstrings for all the methods. Let's also add type hints.
pymatgen/entries/compatibility.py
Outdated
return self.corrections_dict | ||
|
||
|
||
def graph_residual_error(self): |
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.
Switch to plotly plots so that we can have them interactive and annotated for more information.
pymatgen/entries/compatibility.py
Outdated
if len(self.corrections) == 0: | ||
self.compute_corrections() | ||
|
||
aqueous = OrderedDict() |
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.
Add a comment mentioning these come from the old YAML file and are not yet auto-generated by this class.
O2: -0.316731 | ||
N2: -0.295729 | ||
F2: -0.313025 | ||
sulfide: -0.6314172089245144 |
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.
I'm tempted to get rid of the Sulfide correction class and just treat it as another Anion correction since we didn't find a big difference for polysulfides.
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.
I agree. In a forthcoming commit we've consolidated OxideCorrection and SulfideCorrection into one AnionCorrections key. This will make it clearer which Class is calling the corrections as well.
Just to give an example, Fe3O4 in MP seems to be ferromagnetic. The actual ground state is ferrimagnetic. The energy diffs are not small. This is a point I have made since 2013. The original corrections are fitted to binary oxides that were properly charge-ordered and magnetized. |
I would say you could carry 1 extra digit for the uncertainty (so, round uncertainty to 0.1 meV)
Ryan Kingsbury, Ph.D., P.E.
Postdoctoral Researcher
The Material Project
C: 713-851-7231
E: [email protected]
…On Aug 30, 2019, 2:27 PM -0700, awvio ***@***.***>, wrote:
@awvio commented on this pull request.
In pymatgen/entries/MPCompatibility.yaml:
> @@ -2,55 +2,46 @@ Name: MP
Advanced:
UCorrections:
O:
- Mn: -1.68085015096 #Fit to MnO, Mn3O4 and MnO2 (BURP:-1.687)
- Fe: -2.733 #Fit to FeO and Fe2O3 (Fe3O4 probably wrong)
- Co: -1.874 #Fit to CoO, Co3O4 (BURP:-1.751)
- Cr: -2.013 #Fit to Cr2O3 (CrO3 missing) (BURP: -2.067)
- Mo: -3.531 #Fit to MoO3 and MoO2 (BURP: -2.668)
- W: -4.351 #Fit to WO2 and WO3 (BURP: -2.762)
- V: -1.682 #Fit to V2O3 and V2O5 (VO2 fit is way off) (BURP: -1.764)
- Ni: -2.164 #Based on burp version as of Feb 28 2011
+ V: -1.634860584846134
Does this also apply to the correction errors? Rounding to 3 decimal places often results in only 1 sigfig (error = 0.00x), at most 2.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
…Correction class; moved CorrectionCalculator to separate file
…nger needed files
…cording to smaller number of sigfigs for corrections
Remove polysulfide logic from sulfide_type()
I can't figure out why my last commit about polysulfide caused the Travis Build to fail. The test that's failing (ReactionDiagramTest.test_formed_formula) doesn't touch any of the code I changed as far as I can tell. |
A good start may be to modify the ReactionDiagramTest.test_formed_formula -- it doesn't look like a very good test to me because it's not clear what's changed when it fails (I appreciate you haven't modified this file/it's not your test). Currently it's:
Maybe:
I don't know who wrote that test originally. |
@mkhorton OK, I can try that. The test runs successfully on my local machine and on AppVeyor though (without modifying the assertion statement). Could it be something about the Travis environment? |
Yeah, it looks like the kind of test that might have machine-specific precision issues but I'm not sure, I suspect the test could be improved. |
…aster' of git://github.com/materialsproject/pymatgen into corrections
…aster' of git://github.com/materialsproject/pymatgen into corrections
I think it's time to merge, thank you @awvio and @rkingsbury for the very extensive work done here. To re-iterate changes, the major changes in this PR are a new For any external pymatgen users reading this, note that the specific data and specific values in this MP2020 scheme are subject to change until we reach publication status, and @rkingsbury is planning further iterative improvements. This PR contains the machinery of the corrections class, and it is this machinery which has now been finalized. The current MP correction scheme remains usable and unchanged by this PR. Happy Friday everyone! |
Summary
Added uncertainty quantification for energy corrections in compatibility module.
Additional dependencies introduced (if any)
Plotly
TODO (if any)
WIP (needs review)