Why isotopes of hydrogen are considered when enumerating through Element
#4178
Closed
DanielYang59
started this conversation in
General
Replies: 2 comments
-
I noticed the isotopes were recently added in #3542 , perhaps we could overwrite the + class CustomEnumMeta(EnumMeta):
+ def __iter__(cls):
+ named_isotopes = {"D", "T"}
+ return (member for member in cls.__members__.values() if member.name not in named_isotopes)
- class Element(ElementBase):
+ class Element(ElementBase, metaclass=CustomEnumMeta): |
Beta Was this translation helpful? Give feedback.
0 replies
-
Sorry for duplicating the same topic, I would close this and prefer #4180 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Noticed the following behaviour:
I would expect looping through
Element
to behave similarly to looping through the periodic table, i.e. isotopes should not be considered?pymatgen/src/pymatgen/core/periodic_table.py
Lines 875 to 888 in a09e7dd
Say if I want to get all elements (for example when plotting periodic tables):
I have to do the following "hack" to skip D/T:
Or make use the fact that "symbol" of "H/D/T" are all "H" if I just need the symbols (I have to do this in
pymatviz
):@mkhorton @janosh Let's discuss here, sorry for going off-topic in the original PR.
Beta Was this translation helpful? Give feedback.
All reactions