I'm trying to search for substructures with RDKit.
I would like to search for structure 1 as substructure in other structures. I don't understand why it doesn't find this structure in structures 3 and 5. I assume this is not a bug in RDKit, but more the result of my limited chemistry understanding. Something with aromaticity? Something wrong with the structures? Can someone explain to me why it doesn't find structure 1 in structures 3 and 5? How should the search structure look like that I will find all structures 2-5?
from rdkit import Chem
smiles_list = ['C12=CC=CC=C1C3=CC=CC4=C3C2=CC=C4', 'C12=CC=CC=C1C3=CC=C4C5=C(C=CC2=C35)C6=C4C=CC=C6', 'C12=CC=CC=C1C3=CC=C4C5=C(C=CC2=C35)C=C4', 'C12=CC=CC=C1C3=CC=C4C5=C(C=CC2=C35)C6=C4C=C7CCCCC7=C6', 'C12=CC=CC=C1C3=CC=C4C5=C(C=CC2=C35)C6=C4C=C7CC8=CC=CC=C8CC7=C6']
pattern = Chem.MolFromSmiles(smiles_list[0])
for idx,smiles in enumerate(smiles_list):
m = Chem.MolFromSmiles(smiles)
print("Structure {}: pattern found {}".format(idx+1,m.HasSubstructMatch(pattern)))
# Result:
# Structure 1: pattern found True
# Structure 2: pattern found True
# Structure 3: pattern found False
# Structure 4: pattern found True
# Structure 5: pattern found False