There are other more subtle changes that can affect the aromaticity, e.g.
changing a bond order, the charge, or the atomic number of an atom. IMO,
the user needs to take responsibility for knowing if aromaticity might be
invalidated, and perform the appropriate actions. The alternative is for
the toolkit to take the responsibility, trigger a check on every edit and
take a performance hit in the general case. Indeed, atom deletion could be
treated specially, but slippery slope and confusion here we come! :-)

Regards,
Noel

On Tue, 27 Aug 2024 at 13:47, Ingvar Lagerstedt <ing...@nextmovesoftware.com>
wrote:

> Hello,
>
> When deleting an aromatic atom or bond, the ring information is removed,
> while any remaining atom in the broken aromatic ring is still labelled
> aromatic.  When attempting to sanitize such a molecule I get an exception: 
> "rdkit.Chem.rdchem.AtomKekulizeException:
> non-ring atom 0 marked aromatic"
>
> To recreate:
>
> >>> from rdkit import Chem
>
> >>> m = Chem.MolFromSmiles('c1ccccc1')
>
> >>> mw = Chem.RWMol(m)
>
> >>> mw.RemoveAtom(0)
>
> >>> Chem.SanitizeMol(mw)
>
> [10:40:50] non-ring atom 0 marked aromatic
>
> Traceback (most recent call last):
>
>   File "<stdin>", line 1, in <module>
>
> rdkit.Chem.rdchem.AtomKekulizeException: non-ring atom 0 marked aromatic
>
>
> The example is simplistic, but there are reactions where an aromatic
> system can be broken, such as Zincke-Koenig reaction or Djerassi-Rylander
> oxidation. The exception makes it harder to describe such reactions.
>
>
> I currently check if an atom/bond is aromatic before deleting it, and if
> so remove all aromatic flags in the molecule.
>
>
> To me it would make sense if RDKit removed the aromatic flags for any atom
> that is no longer in a ring when deleting an aromatic atom/bond.
>
> Alternatively remove the aromatic flag on any non-ring atom when
> attempting to kekulize the structure rather than throwing an exception.
>
>
> Compare with a Birch reduction where the ring stays intact, here the
> kekulization/the following aromatize step rightly fails to find an aromatic
> ring, no exception is thrown, and the atoms are marked as non-aromatic.
>
>
> Kind Regards,
>
> Ingvar
>
>
> _______________________________________________
> 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

Reply via email to