Skip to content

Commit bcd515c

Browse files
committed
When checking isomorphism of Molecules, also check the initial map
This fixes the recently added failing isomorphism check. If you pass in a mapping, it is checked for validity. Note that this is not done at the Graph level or VF2, only at the Molecule level. I.e. this bug probably still exists for Graph and maybe Group objects.
1 parent 92aa1d9 commit bcd515c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

rmgpy/molecule/molecule.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1452,6 +1452,11 @@ def is_isomorphic(self, other, initial_map=None, generate_initial_map=False, sav
14521452
# check multiplicity
14531453
if self.multiplicity != other.multiplicity:
14541454
return False
1455+
1456+
# if given an initial map, ensure that it's valid.
1457+
if initial_map:
1458+
if not self.is_mapping_valid(other, initial_map, equivalent=True):
1459+
return False
14551460

14561461
if generate_initial_map:
14571462
initial_map = dict()

0 commit comments

Comments
 (0)