rdkit: Segfault when parsing InChI for Pubchem compound

Configuration:

  • RDKit Version: ‘2020.03.2’ or ‘2020.03.1’
  • Operating system: Linux
  • Python version (if relevant): 3.7.6
  • Are you using conda? Yes
  • If you are using conda, which channel did you install the rdkit from? conda-forge
  • If you are not using conda: how did you install the RDKit?

Description:

I got Segmentation fault output when I run the code below

from rdkit import Chem
Chem.MolFromInchi('InChI=1S/C5H14O3SSi/c1-5-9(10,6-2,7-3)8-4/h5H2,1-4H3')

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 1
  • Comments: 16 (12 by maintainers)

Most upvoted comments

The problem here is that S=[Si] is a radical (as is the original molecule) and InChI doesn’t handle radicals correctly. The warning is telling you this (as usual, it’s often not a good idea to ignore warnings).

Here’s a simple demonstration of this:

In [13]: Chem.MolToInchi(Chem.MolFromSmiles('[C]-[C]'))
[15:23:21] WARNING: Accepted unusual valence(s): C(1)

Out[13]: 'InChI=1S/C2/c1-2'

In [14]: Chem.MolToInchi(Chem.MolFromSmiles('[C]=[C]'))
[15:23:25] WARNING: Accepted unusual valence(s): C(2)

Out[14]: 'InChI=1S/C2/c1-2'

In [15]: Chem.MolToInchi(Chem.MolFromSmiles('[C]#[C]'))
[15:23:30] WARNING: Accepted unusual valence(s): C(3)

Out[15]: 'InChI=1S/C2/c1-2'

The RDKit should probably still not fail with the S=[Si] InChI, but it’s not going to produce anything correct