Skip to content

Commit

Permalink
fixed pyrylium cations kekule.
Browse files Browse the repository at this point in the history
  • Loading branch information
stsouko committed Feb 17, 2021
1 parent 991fa22 commit 822bd77
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
17 changes: 13 additions & 4 deletions CGRtools/algorithms/aromatics.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright 2018-2020 Ramil Nugmanov <nougmanoff@protonmail.com>
# Copyright 2018-2021 Ramil Nugmanov <nougmanoff@protonmail.com>
# This file is part of CGRtools.
#
# CGRtools is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -361,10 +361,19 @@ def __prepare_rings(self: 'MoleculeContainer'):
elif ab != 3: # not pyridine oxyde
raise InvalidAromaticRing
elif an == 8: # furan
if ab == 2 and (ac == 0 and not radicals[n] or ac == 1 and radicals[n]):
double_bonded.add(n)
if ab == 2:
if ac == 0:
if radicals[n]:
raise InvalidAromaticRing('radical oxygen')
double_bonded.add(n)
elif ac == 1:
if radicals[n]: # furan cation-radical
double_bonded.add(n)
# pyrylium
else:
raise InvalidAromaticRing('invalid oxygen charge')
else:
raise InvalidAromaticRing
raise InvalidAromaticRing('Triple-bonded oxygen')
elif an in (16, 34, 52): # thiophene
if n not in double_bonded: # not sulphoxyde or sulphone
if ab == 2:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def finalize_options(self):

setup(
name='CGRtools',
version='4.1.10',
version='4.1.11',
packages=['CGRtools', 'CGRtools.algorithms', 'CGRtools.algorithms.components', 'CGRtools.containers',
'CGRtools.files', 'CGRtools.files._mdl', 'CGRtools.periodictable', 'CGRtools.periodictable.element',
'CGRtools.utils', 'CGRtools.attributes'],
Expand Down

0 comments on commit 822bd77

Please sign in to comment.