-
Notifications
You must be signed in to change notification settings - Fork 871
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
Bugs in Composition().__ge__() method #4204
Comments
Admittedly the behaviour is surprising, but I believe this is expected, I had the same question in #3895 This comparison operation is not defined to really "compare" pymatgen/src/pymatgen/core/composition.py Lines 234 to 241 in 31f1e1f
Note the elements are sorted by electronegativity, in this case the comparing order is For the first comparison, the oxygen in "LiFeP" has an implied amount of zero (LiFePO0), it's therefore considered "smaller" than "LiFePO". For the second case, the amount of P is greater in "LiFePO" than "LiFeH" (effectively LiFePH0O vs LiFeP0HO0) and thus the short-circuit: pymatgen/src/pymatgen/core/composition.py Lines 245 to 249 in 31f1e1f
|
Python version
Python 3.9
Pymatgen version
2024.3.1
Operating system version
macos
Current behavior
Expected Behavior
The second one should output False.
Minimal example
Relevant files to reproduce this bug
No response
The text was updated successfully, but these errors were encountered: