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

Simple composition-based featurization fails due to an upgrade in pymatgen #920

Closed
JaGeo opened this issue Feb 6, 2024 · 2 comments · Fixed by #921
Closed

Simple composition-based featurization fails due to an upgrade in pymatgen #920

JaGeo opened this issue Feb 6, 2024 · 2 comments · Fixed by #921

Comments

@JaGeo
Copy link
Contributor

JaGeo commented Feb 6, 2024

from matminer.datasets import load_dataset
from matminer.featurizers.composition import ElementProperty
from matminer.featurizers.conversions import StrToComposition

bandgaps = load_dataset('matbench_expt_gap')
bandgaps = bandgaps[bandgaps['gap expt'] > 0].reset_index(drop=True)
bandgaps.head()

str_to_comp = StrToComposition(target_col_id='composition_pmg')
bandgaps_comp = str_to_comp.featurize_dataframe(bandgaps, col_id='composition')

featurizer = ElementProperty.from_preset('magpie')
bandgaps_data_featurized = featurizer.featurize_dataframe(bandgaps_comp, col_id='composition_pmg', ignore_errors=True,
                                                          return_errors=True)
y = bandgaps_data_featurized['gap expt']
bandgaps_data_featurized.head()

fails with:

Traceback (most recent call last):
  File "/hpc-user/jgeorge/PycharmProjects/test_new/use_matminer.py", line 2, in <module>
    from matminer.featurizers.composition import ElementProperty
  File "/home/jgeorge/miniconda3/envs/test_new/lib/python3.10/site-packages/matminer/featurizers/composition/__init__.py", line 1, in <module>
    from matminer.featurizers.composition.alloy import Miedema, WenAlloys, YangSolidSolution
  File "/home/jgeorge/miniconda3/envs/test_new/lib/python3.10/site-packages/matminer/featurizers/composition/alloy.py", line 16, in <module>
    from matminer.featurizers.composition.packing import AtomicPackingEfficiency
  File "/home/jgeorge/miniconda3/envs/test_new/lib/python3.10/site-packages/matminer/featurizers/composition/packing.py", line 13, in <module>
    from matminer.featurizers.composition.element import ElementFraction
  File "/home/jgeorge/miniconda3/envs/test_new/lib/python3.10/site-packages/matminer/featurizers/composition/element.py", line 202, in <module>
    class BandCenter(BaseFeaturizer):
  File "/home/jgeorge/miniconda3/envs/test_new/lib/python3.10/site-packages/matminer/featurizers/composition/element.py", line 210, in BandCenter
    magpie_data = MagpieData()
  File "/home/jgeorge/miniconda3/envs/test_new/lib/python3.10/site-packages/matminer/utils/data.py", line 217, in __init__
    self.all_elemental_props[descriptor_name][Element.from_Z(atomic_no).symbol] = prop_value
  File "/home/jgeorge/miniconda3/envs/test_new/lib/python3.10/site-packages/pymatgen/core/periodic_table.py", line 526, in from_Z
    raise ValueError(f"Unexpected atomic number {Z=}")
ValueError: Unexpected atomic number Z=119

It works, however, fine with pymatgen version "2023.12.18". The periodic table data has been updated. Probably a side effect of: materialsproject/pymatgen#3542

@JaGeo
Copy link
Contributor Author

JaGeo commented Feb 6, 2024

I would push a fix but "pip install -e ." from the cloned matminer repo fails

@ml-evs
Copy link
Collaborator

ml-evs commented Feb 6, 2024

Same issue as #919 I think, see the discussion over there (basically no-one is available to maintain matminer anymore and its been left in a state where dep upgrades are tricky to handle).

#919 (comment)

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 a pull request may close this issue.

2 participants