Skip to content

get_stability: no hull energy for entries the corrections drop - #1142

Open
kavanase wants to merge 2 commits into
materialsproject:mainfrom
kavanase:fix/get-stability-dropped-entries
Open

kavanase wants to merge 2 commits into
materialsproject:mainfrom
kavanase:fix/get-stability-dropped-entries

Conversation

@kavanase

@kavanase kavanase commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

get_stability returns get_e_above_hull for every input entry, including those the correction or mixing scheme dropped, whose energies it never placed on the hull's scale. The mixing scheme (default GGA_GGA+U_R2SCAN) drops entries without a structure or entry_id, and duplicates of a structure, such as a user's own calculation of a known MP material. For these, get_stability either:

  • gave a value on the wrong scale; e.g. a GGA copy of mp-13 (bcc Fe), 0.05 eV/atom above MP's GGA entry, got 5.99 eV/atom; or
  • raised for the whole call: ValueError if the entry fell below the hull, KeyError if it had no POTCAR info.

The scheme anchors the hull on one functional (r2SCAN if every GGA(+U) ground state has an r2SCAN match, else GGA(+U)) and leaves that functional's energies as its compat_1/compat_2 corrected them. So now:

  • dropped entries of the anchoring functional are corrected the same way and placed on the hull (negative if below it);
  • other dropped entries, and entries the correction rejects, get e_above_hull=None, with one MPRestWarning listing them.

Breaking: e_above_hull can now be None, but only where the old value was wrong or the call raised.

test_get_stability_dropped_entries has been updated to explicitly test this behaviour. It uses synthetic Li-O hulls anchored on each functional. User entries: GGA and r2SCAN twins of MP's Li, a plain oxide ComputedEntry, a GGA+U entry MP2020 rejects, an entry below the hull, and one without POTCAR info. Both cases raise ValueError: No valid decomposition found on main, fixed now.
For test_get_stability: Before, it compared nothing for GGA_GGA+U_R2SCAN (its entry was a bare ComputedEntry, which the scheme drops), and only one entry, of the last chemsys, for the other thermo types. Now, in every sampled chemsys plus Ni-S (a GGA(+U)-anchored mixed hull), perturbed copies of MP's compounds, 10 meV/atom higher, must sit 10 meV/atom above the copied material on MP's hull. A He-Ne test case checks the no-diagram path (only elemental entries).

Checklist

  • Google format doc strings added. Check with ruff.
  • Type annotations included. Check with mypy.
  • Tests added for new features/fixes.
  • If applicable, new classes/functions/modules have duecredit @due.dcite decorators to reference relevant papers by DOI (example)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant