I think this will do it pattern = Chem.MolFromSmarts('C1~C~C2~C~C~C~C~C~2~C~C~1')
you need to ring closure bonds to be set to any as well hope that helps Rich From: Jean-Marc Nuzillard <jm.nuzill...@univ-reims.fr> Sent: 17 January 2020 09:54 To: RDKit Discuss <rdkit-discuss@lists.sourceforge.net> Subject: [EXTERNAL] [Rdkit-discuss] SMARTS and ring closure Dear all, I would like to write a SMARTS chain that matches any compound with a decalin ring system, whatever bond multiplicity. I wrote it as 'C1~C~C2~C~C~C~C~C2~C~C1' with ~ standing for "any bond". The C1-C1 and C2-C2 bonds have the "default type", which is single or aromatic. The code m1 = Chem.MolFromSmiles('C1CCCC(=C12)CCCC2') m2 = Chem.MolFromSmiles('C1CCC=C(C12)CCCC2') pattern = Chem.MolFromSmarts('C1~C~C2~C~C~C~C~C2~C~C1') print(m1.HasSubstructMatch(pattern)) print(m2.HasSubstructMatch(pattern)) prints False for m1 and True for m2 because the double bond in m1 is located at the place of one of the ring closure bonds in pattern. My question is how to write a SMARTS chain that fits in all cases for decalin or any other ring system and is more related to SMARTS-writing than to RDKit, I admit. Best, Jean-Marc -- Dr. Jean-Marc Nuzillard Institute of Molecular Chemistry, CNRS UMR 7312 Faculté des Sciences Exactes et Naturelles, Bâtiment 18 BP 1039 51687 REIMS Cedex 2 France Tel : 33 3 26 91 82 10 Fax : 33 3 26 91 31 66 http://www.univ-reims.fr/icmr http://eos.univ-reims.fr/LSD/CSNteam.html ORCID: 0000-0002-5120-2556 http://www.univ-reims.fr/LSD/ http://www.univ-reims.fr/LSD/JmnSoft/ This email and any attachments thereto may contain private, confidential, and privileged material for the sole use of the intended recipient. Any review, copying or distribution of this email (or any attachments thereto) by others is strictly prohibited. If you are not the intended recipient, please delete the original and any copies of this email and any attachments thereto and notify the sender immediately.
_______________________________________________ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss