one more thing: the issue with benzene in 2020 is (i think) expected behavior and unrelated to the other issue: due to symmetry the resonance structures are identical. if instead you break the symmetry and put in o-xylene ("Cc1ccccc1C"), 2020 version (and the fix proposed above) will correctly give two discrete resonance structures:
CC1=CC=CC=C1C CC1=C(C)C=CC=C1 best wishes wim On Mon, Nov 14, 2022 at 1:13 PM Wim Dehaen <wimdeh...@gmail.com> wrote: > Hello, > I can reproduce the different behavior between a 2020.09 version and an up > to date one on my end as well. I think it is related to this issue: > https://github.com/rdkit/rdkit/issues/3973 during the kekulization some > unintended normalization seems to be happening leading to the same kekule > structures in the output > for the moment here is a dirty but functional fix (changes in bold): > > from rdkit import Chem > from rdkit.Chem import ResonanceMolSupplier, ResonanceFlags > > mol = Chem.MolFromSmiles("C1=CC2=C(C=C1)C=CC=C2") # Naphthalene > suppl = ResonanceMolSupplier(mol, Chem.KEKULE_ALL) > for m in suppl: > > * for a in m.GetAtoms(): a.SetIsAromatic(False)* > print(Chem.MolToSmiles(m, kekuleSmiles=True)) > this returns > > C1=CC2=C(C=C1)C=CC=C2 > C1=CC2=CC=CC=C2C=C1 > C1=CC=C2C=CC=CC2=C1 > > > > best wishes > wim > > On Sun, Nov 13, 2022 at 12:56 AM Eduardo Mayo <eduardomayoya...@gmail.com> > wrote: > >> Dear all, >> >> I hope you all are doing well. >> >> I've been trying to enumerate all Kekule structures, and apparently it >> should be done with ResonanceMolSupplier. In this email >> <https://sourceforge.net/p/rdkit/mailman/message/36034365/> apparently, >> this snippet works: >> >> from rdkit import Chem >>> from rdkit.Chem import ResonanceMolSupplier, ResonanceFlags >> >> >> >> mol = Chem.MolFromSmiles("c1ccccc1") >> >> >> >> suppl = ResonanceMolSupplier(mol, ResonanceFlags.KEKULE_ALL) >> >> for m in suppl: >>> print(Chem.MolToSmiles(m, kekuleSmiles=True)) >> >> [out] expected output >> >>> C1C=CC=CC=1 >> >> C1=CC=CC=C1 >> >> [out] rdkit.__version__ == '2020.03.6' >> >>> C1=CC=CC=C1 >>> >> C1=CC=CC=C1 >>> >> [out] rdkit.__version__ == '2022.03.5' >> >>> C1=CC=CC=C1 >> >> C1=CC=CC=C1 >>> >> >> But I have tried it on Win, RDKit '2022.03.5' and it doesn't work. Also, >> I tried with RDKit '2020.03.6', and it doesn't work for benzene or >> naphthalene. >> >>> from rdkit import Chem >>> from rdkit.Chem import ResonanceMolSupplier, ResonanceFlags >>> >>> mol = Chem.MolFromSmiles("C1=CC2=C(C=C1)C=CC=C2") # Naphthalene >>> >>> suppl = ResonanceMolSupplier(mol, ResonanceFlags.KEKULE_ALL) >>> for m in suppl: >>> print(Chem.MolToSmiles(m, kekuleSmiles=True)) >>> >> [out] rdkit.__version__ == '2020.03.6' >> >>> C1=CC2=C(C=C1)C=CC=C2 >>> C1=CC2=CC=CC=C2C=C1 >>> C1=CC=C2C=CC=CC2=C1 >> >> [out] rdkit.__version__ == '2022.03.5' >> >>> C1=CC2=C(C=C1)C=CC=C2 >>> C1=CC2=C(C=C1)C=CC=C2 >>> C1=CC2=C(C=C1)C=CC=C2 >> >> >> Please let me know if you have any workaround to enumerate Kekule >> structures. >> All the best, >> >> Eduardo >> _______________________________________________ >> Rdkit-discuss mailing list >> Rdkit-discuss@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss >> >
_______________________________________________ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss