Skip to content

Conversation

@esoteric-ephemera
Copy link
Contributor

@esoteric-ephemera esoteric-ephemera commented Oct 29, 2025

Note that the AlloySystem.get_convex_hull_and_centroid method will still fail if an alloy system doesn't have a realistic convex hull for a material:

from mp_api.client import MPRester
from pymatgen.analysis.alloys.core import AlloySystem

with MPRester() as mpr:
  a = mpr.materials.alloys.search(material_ids=["mp-19835"])

asys = AlloySystem(ids = {getattr(d.alloy_pair,k) for d in a for k in ('id_a','id_b')}, alloy_pairs = [d.alloy_pair for d in a])
print(asys.get_convex_hull_and_centroid())
>>> NotImplementedError: Sub-geometries may have coordinate sequences, but multi-part geometries do not

The reason for this being that the data going into the convex hull is the cube root of cell volume against band gap, but all of the entries in this system are metals. Thus the convex hull is a flat line at zero band gap for any input volume, and shapely can't find an appropriate boundary

Copy link
Member

@tschaume tschaume left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @esoteric-ephemera! Looks good. I updated the github actions to run tests with the latest dependencies. Would you mind seeing if you can resolve the mypy errors in the linting action? Thanks!

@esoteric-ephemera
Copy link
Contributor Author

Yep on it!

@tschaume tschaume merged commit 1713110 into materialsproject:main Oct 31, 2025
2 checks passed
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.

Missing license file Plotting issue via get_convex_hull_and_centroid for simple alloy systems

3 participants