Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chem.Kekulize(mol) error #24

Open
Nokimann opened this issue Jun 10, 2021 · 3 comments
Open

Chem.Kekulize(mol) error #24

Nokimann opened this issue Jun 10, 2021 · 3 comments

Comments

@Nokimann
Copy link

Nokimann commented Jun 10, 2021

rdkit version: 2021.03.3
(didn't check in other versions)

Doing
python get_vocab.py --ncpu 16 < aromatic.txt > vocab.txt with aromatic SMILES,
an error occurs because of Chem.Kekulize function.

In chemutils.py,

Before:

def get_mol(smiles):
    mol = Chem.MolFromSmiles(smiles)
    if mol is not None: Chem.Kekulize(mol)
    return mol

After: adding clearAromaticFlags=True

def get_mol(smiles):
    mol = Chem.MolFromSmiles(smiles)
    if mol is not None: Chem.Kekulize(mol, clearAromaticFlags=True)
    return mol

Solved.

@HarreyJia
Copy link

Thank you SO much! I have been stuck in the error for a long time.

However, I still want to know whether something different would happen in the later judgement if I changed the code.

@purplerainf
Copy link

Hi, I think I had the same issue. The error message I've got was
"rdkit.Chem.rdchem.KekulizeException: Can't kekulize mol. Unkekulized atoms: 5 6 7 8 9 10 18 26 27"

Nokimann's suggestion works for me as well, but it would be great if the author or others confirm it.

@marshallcase
Copy link

Just had the same issue as @purplerainf and @Nokimann's suggestion seemed to fix the issue. Thanks!

rl27 added a commit to rl27/hgraph2graph that referenced this issue Jun 20, 2022
bsaldivaremc2 added a commit to bsaldivaremc2/hgraph2graph that referenced this issue Jul 10, 2023
Fixing reported error: wengong-jin#24
rdkit.Chem.rdchem.KekulizeException: Can't kekulize mol.  Unkekulized atoms: 4 5 6 7 18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants