Hi Diogo, The easiest way to do this is to use the substructure matching code with "uniquify=False" to find all the automorphisms between a molecule and itself: In [8]: m1 = Chem.MolFromSmiles('Oc1ccccc1')
In [9]: list(m1.GetSubstructMatches(m1,uniquify=False)) Out[9]: [(0, 1, 2, 3, 4, 5, 6), (0, 1, 6, 5, 4, 3, 2)] Here's another example: In [10]: m = Chem.MolFromSmiles('Oc1ccc(c2ccc(Cl)cc2)cc1') In [11]: list(m.GetSubstructMatches(m,uniquify=False)) Out[11]: [(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13), (0, 1, 2, 3, 4, 5, 11, 10, 8, 9, 7, 6, 12, 13), (0, 1, 13, 12, 4, 5, 6, 7, 8, 9, 10, 11, 3, 2), (0, 1, 13, 12, 4, 5, 11, 10, 8, 9, 7, 6, 3, 2)] I hope this helps, -greg On Sat, Apr 16, 2022 at 1:46 AM Diogo Martins <diogo.stm...@gmail.com> wrote: > Hello, > > I'd like to enumerate all possible permutations of symmetric atoms. > Consider the following code: > > phenol = Chem.MolFromSmiles("Oc1ccccc1") > equivalencies = list(Chem.CanonicalRankAtoms(mol, breakTies=False)) > print(equivalencies) > [0, 6, 4, 2, 1, 2, 4] > > Atoms that have the same value in list "equivalencies" are symmetric. For > phenol, the equivalent atoms correspond to a 180 degree rotation of the > aromatic ring over the axis containing the carbon-oxygen bond. The possible > permutations, expressed as atom indices, are: > [0, 1, 2, 3, 4, 5, 6] > [0, 1, 6, 5, 4, 3, 2] > > By permutations, I mean that it is possible to replace the coordinates of > the atoms and produce a realistic molecule. > > A brute force approach comes to mind, where one would enumerate all > possible combinations, and exclude those that change the molecular graph. > In the example above there are four possible combinations, because there > are two groups of two symmetric atoms. An example of an "invalid" > combination is swapping the third and seventh atoms without swapping the > fourth and sixth atoms: > [0, 1, 6, 3, 4, 5, 2] > This would be excluded as it breaks the bond between the third and fourth > atoms (among other bonds). > > Is there a method in the RDKit to enumerate the valid permutations? > > Thank you, > Diogo > > _______________________________________________ > 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