Replies: 1 comment 6 replies
-
I don't know the reason either, with: if isinstance(obj, Element | Species | DummySpecies):
return obj I got no error too but the test coverage could be missing somewhere. As per the docstring it should be returned "as is" ( pymatgen/src/pymatgen/core/periodic_table.py Line 1628 in 31f1e1f Looks like this check was added in #3542 1918eea, @esoteric-ephemera could you please comment on this? Thanks. |
Beta Was this translation helpful? Give feedback.
6 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.
-
The
get_el_sp
function in core.periodic_table is currently (as seen here)`
@functools.lru_cache
def get_el_sp(obj: int | SpeciesLike) -> Element | Species | DummySpecies:
"""Utility function to get an Element, Species or DummySpecies from any input.
but I am unsure specifically why returning
Element(obj.name) if isinstance(obj, Element) else Species(str(obj))
is necessary for named isotopes, instead of returningobj
. All the attributes (visible to my IDE) for the output ofget_el_sp
for a named isotope appear identical when running this function with and without theif getattr(obj, "_is_named_isotope", None)
check commented out. Running all the tests on my personal machine with theif getattr(obj, "_is_named_isotope", None)
check commented out also raised no errorsBeta Was this translation helpful? Give feedback.
All reactions