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

reduced_composition not on par with doc_string #4208

Open
msiron-entalpic opened this issue Nov 29, 2024 · 0 comments
Open

reduced_composition not on par with doc_string #4208

msiron-entalpic opened this issue Nov 29, 2024 · 0 comments
Labels

Comments

@msiron-entalpic
Copy link

Python version

Python 3.11

Pymatgen version

'2024.11.13'

Operating system version

MacOSX

Current behavior

From the docstring for reduced_composition:

@property
def reduced_composition(self) -> Self:
"""The reduced composition, i.e. amounts normalized by greatest common denominator.
 E.g. "Fe4 P4 O16".reduced_composition = "Fe P O4".
 """

I would expect to do just that, but Cs4 O4 turns into Cs2 O2 rather than Cs O. Unsure if its because some single element, for example:

Composition("O").reduced_composition # O2

Expected Behavior

I would expect that Cs4 O4 turns into Cs O rather than Cs2 O2. Unsure if its because some single element, for example:

Composition("O").reduced_composition # O2

Minimal example

from pymatgen.core import Composition
comp = Composition('Cs4 O4')
print(comp.reduced_composition) # prints out Cs2 O2, should be Cs O per doc string?

Relevant files to reproduce this bug

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant