Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions rmgpy/molecule/fragment.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ def equivalent(self, other, strict=True):
``False`` otherwise. If `other` is an :class:`CuttingLabel` object, then all
attributes must match exactly.
"""
if self.label != other.label:
return False

if isinstance(other, CuttingLabel):
return self.name == other.name
else:
Expand Down
8 changes: 8 additions & 0 deletions rmgpy/molecule/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,10 @@ def equivalent(self, other, strict=True):
if 'inRing' in self.props and 'inRing' in group.props:
if self.props['inRing'] != group.props['inRing']:
return False

if self.label != group.label:
return False

# Otherwise the two atom groups are equivalent
return True

Expand Down Expand Up @@ -669,6 +673,10 @@ def is_specific_case_of(self, other):
return False
elif 'inRing' not in self.props and 'inRing' in group.props:
return False

if self.label != group.label:
return False

# Otherwise self is in fact a specific case of other
return True

Expand Down
6 changes: 6 additions & 0 deletions rmgpy/molecule/molecule.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,10 @@ def equivalent(self, other, strict=True):
the element is compared and electrons are ignored.
"""
cython.declare(atom=Atom, ap=gr.GroupAtom)

if self.label != other.label:
return False

if isinstance(other, Atom):
atom = other
if strict:
Expand Down Expand Up @@ -290,6 +294,8 @@ def is_specific_case_of(self, other):
:class:`GroupAtom` object, then the atom must match or be more
specific than any of the combinations in the atom pattern.
"""
if self.label != other.label:
return False
if isinstance(other, Atom):
return self.equivalent(other)
elif isinstance(other, gr.GroupAtom):
Expand Down
Loading