Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
This reverts commit cae7aed.
  • Loading branch information
DanielYang59 committed May 9, 2024
1 parent 8fe65af commit 27bd8af
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions pymatgen/core/composition.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,14 +203,13 @@ def __ge__(self, other: object) -> bool:
if not isinstance(other, Composition):
return NotImplemented

try:
return all(
other[el] - self[el] < Composition.amount_tolerance for el in set(self.elements + other.elements)
)

# If any Element is in only one of the two Compositions
except IndexError:
return False
for el in sorted(set(self.elements + other.elements)):
if other[el] - self[el] >= Composition.amount_tolerance:
return False
# TODO @janosh 2024-04-29: is this a bug? why would we return True early?
if self[el] - other[el] >= Composition.amount_tolerance:
return True
return True

def __add__(self, other: object) -> Composition:
"""Add two compositions. For example, an Fe2O3 composition + an FeO
Expand Down

0 comments on commit 27bd8af

Please sign in to comment.