3
$\begingroup$

I have a program that returns a file with SDF format molecule. Now I want to transfer it to SMILES with Open Babel. But I don't get the result I expect. I have visited different websites that show how the SDF must look like, which I think my file does. Can one find a mistake?


CheMGen 1.0

  9  3  0  0  0               999 V2000
    0.0000    0.0000    0.0000 C  0  0  0  0  0  0  0  0  0  0  0  0
    0.0000    0.0000    0.0000 C  0  0  0  0  0  0  0  0  0  0  0  0
    0.0000    0.0000    0.0000 C  0  0  0  0  0  0  0  0  0  0  0  0
    0.0000    0.0000    0.0000 H  0  0  0  0  0  0  0  0  0  0  0  0
    0.0000    0.0000    0.0000 H  0  0  0  0  0  0  0  0  0  0  0  0
    0.0000    0.0000    0.0000 H  0  0  0  0  0  0  0  0  0  0  0  0
    0.0000    0.0000    0.0000 H  0  0  0  0  0  0  0  0  0  0  0  0
    0.0000    0.0000    0.0000 H  0  0  0  0  0  0  0  0  0  0  0  0
    0.0000    0.0000    0.0000 H  0  0  0  0  0  0  0  0  0  0  0  0
  1  3  1  0  0  0  0
  2  3  2  0  0  0  0
  1  4  1  0  0  0  0
  1  5  1  0  0  0  0
  1  6  1  0  0  0  0
  2  7  1  0  0  0  0
  2  8  1  0  0  0  0
  3  9  1  0  0  0  0
M  END
$$$$

This is what I get from Open Babel: CC=C.[HH].[HH].[HH].[HH].[HH] And this I expect: CC=C. In Open Babel I have selected "Delete Hydrogens", but they are shown.

$\endgroup$
1
  • 1
    $\begingroup$ Sorry, for rolling back your edit, but what you did invalidated your own question (Q&A with corrected code is not possible) and so I decided to rollback. Thanks for understanding. Consider accepting Buttonwood's answer and upvoting since he did get the code corrected. You can accept by hitting the green check mark near the votes.. $\endgroup$ Commented Jun 27, 2021 at 14:32

1 Answer 1

4
$\begingroup$

(Chemisty.se is a bit sloppy representing the first line of code if it is an empty one. This equally applies to copy-paste of a.sdf file.)

There is a problem, because the full stop / period is used to concatenate multiple independent molecules into one SMILES string. It may be useful e.g., to describe multiple molecules in a .sdf about a co-crystal; here, it does not seem suitable. Possibly there is a problem generating the connectivty table (below the atom coodinates, regardless if these (still) are all zero) with the program (which one?) you use, how you use it, or a combination of the two.

I assume propene is the structure you target. The freely accessible sketcher of PubChem reports C(=C)C, ChemDraw's JS sample page C=CC as a SMILES string about this molecule. The later is what Openbabel converts the former as canonical SMILES when running

obabel -:'C(=C)C' -ocan

Provision of the canonical SMILES string generates a .sdf with all-zero coordinates by OpenBabel (obabel -:'C=CC' -h -osdf -O test.sdf) similar to the following (there is a leading empty line prior to OpenBabel, but no trailing empty line past $$$$):


 OpenBabel

  9  8  0  0  0  0  0  0  0  0999 V2000
    0.0000    0.0000    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
    0.0000    0.0000    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
    0.0000    0.0000    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
    0.0000    0.0000    0.0000 H   0  0  0  0  0  0  0  0  0  0  0  0
    0.0000    0.0000    0.0000 H   0  0  0  0  0  0  0  0  0  0  0  0
    0.0000    0.0000    0.0000 H   0  0  0  0  0  0  0  0  0  0  0  0
    0.0000    0.0000    0.0000 H   0  0  0  0  0  0  0  0  0  0  0  0
    0.0000    0.0000    0.0000 H   0  0  0  0  0  0  0  0  0  0  0  0
    0.0000    0.0000    0.0000 H   0  0  0  0  0  0  0  0  0  0  0  0
  1  2  2  0  0  0  0
  1  3  1  0  0  0  0
  1  4  1  0  0  0  0
  2  5  1  0  0  0  0
  2  6  1  0  0  0  0
  3  7  1  0  0  0  0
  3  8  1  0  0  0  0
  3  9  1  0  0  0  0
M  END
$$$$

If you diff both files, you recognize that the line specifying the format in further detail (V2000) as well as the connectivity table differ.

$\endgroup$
2
  • $\begingroup$ I corrected the number of atoms in my example. Thanks for the answer. It was 3 in my file, I forgot the hydrogens. $\endgroup$ Commented Jun 27, 2021 at 14:31
  • $\begingroup$ "I forgot the hydrogens" ... hopefully, you don't create .sdf files with pen and paper, but with an algorithm within a program (which one?). MDL and now Biovia/Dassault document CT, e.g. here. $\endgroup$
    – Buttonwood
    Commented Jun 27, 2021 at 16:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.