Hi Paul, On Sun, Oct 31, 2010 at 12:09 PM, Paul Emsley <paul.ems...@bioch.ox.ac.uk> wrote: > > > I'm running into problems when I try to kekulize carbazole. > > The description I start with is that all the bonds are marked as > Bond::AROMATIC and I do setIsAromatic(true) on all the atoms (which are > all non-hydrogens). The explicitValence() for the N is 3. > > MolOps::Kekulize() fails in that case, "Can't kekulize mol". > > If I add single bonds to hydrogens (including a hydrogens on the N) then > MolOps::Kekulize() works. > > So my question is, how should I adjust the molecule description in the > first case so that MolOps::Kekulize() works without hydrogens too?
The problem is probably the lack of an explicit H on the nitrogen atom. It's easily demonstrated with pyrrole: [2]>>> m=Chem.MolFromSmiles('c1cccn1') [15:10:05] Can't kekulize mol You can fix this by letting the RDKit know that there's an H on the N atom: [3]>>> m=Chem.MolFromSmiles('c1ccc[nH]1') [4]>>> Carbazole is the same story: [4]>>> m=Chem.MolFromSmiles('c1ccc2c(c1)[nH]c1ccccc21') [5]>>> Note that in either case if you provide the structure in its Kekule form this doesn't happen, here's the illustration for pyrrole: [5]>>> m=Chem.MolFromSmiles('C1=CC=CN1') [6]>>> Chem.MolToSmiles(m) Out[6] 'c1cc[nH]c1' There's an argument to be made that the Kekulization code could be made more robust with respect to this particular edge case, but to this point the effort involved has not seem justified by the payoff: most of the time the H is present in the SMILES, so this problem doesn't occur. Best Regards, -greg ------------------------------------------------------------------------------ Nokia and AT&T present the 2010 Calling All Innovators-North America contest Create new apps & games for the Nokia N8 for consumers in U.S. and Canada $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store http://p.sf.net/sfu/nokia-dev2dev _______________________________________________ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss