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

gen3D creates invalid structures for some molecules. #2146

Closed
1 task
tdudgeon opened this issue Mar 27, 2020 · 4 comments
Closed
1 task

gen3D creates invalid structures for some molecules. #2146

tdudgeon opened this issue Mar 27, 2020 · 4 comments

Comments

@tdudgeon
Copy link

tdudgeon commented Mar 27, 2020

  • [ X ] I believe this to be a bug with Open Babel
  • This is a feature request

Environment Information

Open Babel version: 3.0.0
Operating system and version: Fedora 30

Expected Behavior

Valid 3D molfile file should be created. Coordinates should be 'reasonable'.

Actual Behavior

CTAB blocks are either invalid (containing '-nan' instead of coordinates) and with all or some coordinates at 0.000, or creates structures that are unreasonable.

Steps to Reproduce

Problem 1

$ echo 'Cc1ccsc1C1(O)CCOC1' | obabel -i smi -o mol --gen3D

 OpenBabel03272011373D

 18 19  0  0  1  0  0  0  0  0999 V2000
    2.6191   -0.3198    0.0013 C   0  0  0  0  0  0  0  0  0  0  0  0
    1.2344   -0.0253    0.0380 C   0  0  0  0  0  0  0  0  0  0  0  0
    0.5696    1.2219    0.0050 C   0  0  0  0  0  0  0  0  0  0  0  0
   -0.7972    1.2233   -0.0003 C   0  0  0  0  0  0  0  0  0  0  0  0
   -1.4123   -0.3511    0.0038 S   0  0  0  0  0  0  0  0  0  0  0  0
    0.2903   -1.0407   -0.3314 C   0  0  0  0  0  0  0  0  0  0  0  0
    1.0541   -3.3907    0.0869 C   0  0  3  0  0  0  0  0  0  0  0  0
    0.5536   -2.5620   -0.2560 O   0  0  0  0  0  0  0  0  0  0  0  0
    0.1818   -2.6278   -1.5272 C   0  0  0  0  0  2  0  0  0  0  0  0
    0.5536   -2.5620   -0.2560 C   0  0  0  0  0  2  0  0  0  0  0  0
    0.5536   -2.5620   -0.2560 O   0  0  0  0  0  0  0  0  0  0  0  0
    0.5536   -2.5620   -0.2560 C   0  0  0  0  0  2  0  0  0  0  0  0
    3.1478    0.6161    0.0046 H   0  0  0  0  0  0  0  0  0  0  0  0
    2.8965   -0.8795   -0.8720 H   0  0  0  0  0  0  0  0  0  0  0  0
    2.8905   -0.8791    0.8801 H   0  0  0  0  0  0  0  0  0  0  0  0
    1.1181    2.0974    0.0068 H   0  0  0  0  0  0  0  0  0  0  0  0
   -1.3761    2.0734   -0.0078 H   0  0  0  0  0  0  0  0  0  0  0  0
   -0.9774   -2.4581    0.2308 H   0  0  0  0  0  0  0  0  0  0  0  0
  1  2  1  0  0  0  0
  1 13  1  0  0  0  0
  1 14  1  0  0  0  0
  1 15  1  0  0  0  0
  2  3  1  0  0  0  0
  2  6  2  0  0  0  0
  3  4  2  0  0  0  0
  3 16  1  0  0  0  0
  4  5  1  0  0  0  0
  4 17  1  0  0  0  0
  5  6  1  0  0  0  0
  6  7  1  0  0  0  0
  7  8  1  0  0  0  0
  7  9  1  0  0  0  0
  7 12  1  0  0  0  0
  8 18  1  0  0  0  0
  9 10  1  0  0  0  0
 10 11  1  0  0  0  0
 11 12  1  0  0  0  0
M  END
1 molecule converted

Valid CTAB is created but molecule is distorted when viewer in 3D

Problem 2

$ echo 'OC1CCOC1Cc1ccsc1' | obabel -i smi -o mol --gen3D
==============================
*** Open Babel Warning  in Build
  There exists NaN in calculated coordinates.

 OpenBabel03272011403D

 12 13  0  0  1  0  0  0  0  0999 V2000
    0.0000    0.0000    0.0000 O   0  0  0  0  0  1  0  0  0  0  0  0
    0.0000    0.0000    0.0000 C   0  0  3  0  0  3  0  0  0  0  0  0
    0.0000    0.0000    0.0000 C   0  0  0  0  0  2  0  0  0  0  0  0
    0.0000    0.0000    0.0000 C   0  0  0  0  0  2  0  0  0  0  0  0
    0.0000    0.0000    0.0000 O   0  0  0  0  0  0  0  0  0  0  0  0
    0.0000    0.0000    0.0000 C   0  0  3  0  0  3  0  0  0  0  0  0
      -nan      -nan      -nan C   0  0  0  0  0  2  0  0  0  0  0  0
      -nan      -nan      -nan C   0  0  0  0  0  0  0  0  0  0  0  0
      -nan      -nan      -nan C   0  0  0  0  0  3  0  0  0  0  0  0
      -nan      -nan      -nan C   0  0  0  0  0  3  0  0  0  0  0  0
      -nan      -nan      -nan S   0  0  0  0  0  0  0  0  0  0  0  0
      -nan      -nan      -nan C   0  0  0  0  0  3  0  0  0  0  0  0
  1  2  1  0  0  0  0
  2  3  1  0  0  0  0
  2  6  1  0  0  0  0
  3  4  1  0  0  0  0
  4  5  1  0  0  0  0
  5  6  1  0  0  0  0
  6  7  1  0  0  0  0
  7  8  1  0  0  0  0
  8  9  1  0  0  0  0
  8 12  2  0  0  0  0
  9 10  2  0  0  0  0
 10 11  1  0  0  0  0
 11 12  1  0  0  0  0
M  END
1 molecule converted

Invalid output with -nan as coordiantes and other atoms all being at 0.0000

Problem 3

echo 'OC1COC(Cc2ccsc2)C1' | obabel -i smi -o mol --gen3D
==============================
*** Open Babel Warning  in Build
  There exists NaN in calculated coordinates.

 OpenBabel03272011423D

 12 13  0  0  1  0  0  0  0  0999 V2000
    0.0000    0.0000    0.0000 O   0  0  0  0  0  1  0  0  0  0  0  0
    0.0000    0.0000    0.0000 C   0  0  3  0  0  3  0  0  0  0  0  0
    0.0000    0.0000    0.0000 C   0  0  0  0  0  2  0  0  0  0  0  0
    0.0000    0.0000    0.0000 O   0  0  0  0  0  0  0  0  0  0  0  0
    0.0000    0.0000    0.0000 C   0  0  3  0  0  3  0  0  0  0  0  0
      -nan      -nan      -nan C   0  0  0  0  0  2  0  0  0  0  0  0
      -nan      -nan      -nan C   0  0  0  0  0  0  0  0  0  0  0  0
      -nan      -nan      -nan C   0  0  0  0  0  3  0  0  0  0  0  0
      -nan      -nan      -nan C   0  0  0  0  0  3  0  0  0  0  0  0
      -nan      -nan      -nan S   0  0  0  0  0  0  0  0  0  0  0  0
      -nan      -nan      -nan C   0  0  0  0  0  3  0  0  0  0  0  0
    0.0000    0.0000    0.0000 C   0  0  0  0  0  2  0  0  0  0  0  0
  1  2  1  0  0  0  0
  2  3  1  0  0  0  0
  2 12  1  0  0  0  0
  3  4  1  0  0  0  0
  4  5  1  0  0  0  0
  5  6  1  0  0  0  0
  5 12  1  0  0  0  0
  6  7  1  0  0  0  0
  7  8  1  0  0  0  0
  7 11  2  0  0  0  0
  8  9  2  0  0  0  0
  9 10  1  0  0  0  0
 10 11  1  0  0  0  0
M  END
1 molecule converted

same problem

Problem 4

$ echo 'OC1(Cc2ccsc2)CCOC1' | obabel -i smi -o mol --gen3D
==============================
*** Open Babel Warning  in Build
  There exists NaN in calculated coordinates.

 OpenBabel03272011433D

 12 13  0  0  1  0  0  0  0  0999 V2000
    0.0000    0.0000    0.0000 O   0  0  0  0  0  1  0  0  0  0  0  0
    0.0000    0.0000    0.0000 C   0  0  3  0  0  0  0  0  0  0  0  0
      -nan      -nan      -nan C   0  0  0  0  0  2  0  0  0  0  0  0
      -nan      -nan      -nan C   0  0  0  0  0  0  0  0  0  0  0  0
      -nan      -nan      -nan C   0  0  0  0  0  3  0  0  0  0  0  0
      -nan      -nan      -nan C   0  0  0  0  0  3  0  0  0  0  0  0
      -nan      -nan      -nan S   0  0  0  0  0  0  0  0  0  0  0  0
      -nan      -nan      -nan C   0  0  0  0  0  3  0  0  0  0  0  0
    0.0000    0.0000    0.0000 C   0  0  0  0  0  2  0  0  0  0  0  0
    0.0000    0.0000    0.0000 C   0  0  0  0  0  2  0  0  0  0  0  0
    0.0000    0.0000    0.0000 O   0  0  0  0  0  0  0  0  0  0  0  0
    0.0000    0.0000    0.0000 C   0  0  0  0  0  2  0  0  0  0  0  0
  1  2  1  0  0  0  0
  2  3  1  0  0  0  0
  2  9  1  0  0  0  0
  2 12  1  0  0  0  0
  3  4  1  0  0  0  0
  4  5  1  0  0  0  0
  4  8  2  0  0  0  0
  5  6  2  0  0  0  0
  6  7  1  0  0  0  0
  7  8  1  0  0  0  0
  9 10  1  0  0  0  0
 10 11  1  0  0  0  0
 11 12  1  0  0  0  0
M  END
1 molecule converted

same problem

Problem 5

$ echo 'NC1[C@@H]2C[C@@H]2[C@H]2C[C@@H]12' | obabel -i smi -o mol --gen3D
==============================
*** Open Babel Warning  in CorrectStereoAtoms
  Could not correct 2 stereocenter(s) in this molecule ()
  with Atom Ids as follows: 2 4
Warning: Stereochemistry is wrong, using the distance geometry method instead

 OpenBabel03272011433D

 19 21  0  0  1  0  0  0  0  0999 V2000
    0.0000   -0.0000    0.0000 N   0  0  0  0  0  0  0  0  0  0  0  0
    0.0000    0.0000    0.0000 C   0  0  3  0  0  0  0  0  0  0  0  0
    0.0000    0.0000    0.0000 C   0  0  2  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  2  0  0  0  0  0  0  0  0  0
    0.0000    0.0000    0.0000 C   0  0  1  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  1  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
    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  1  0  0  0  0
  1  9  1  0  0  0  0
  1 10  1  0  0  0  0
  2  3  1  0  0  0  0
  2  8  1  0  0  0  0
  2 11  1  0  0  0  0
  3  4  1  0  0  0  0
  3  5  1  0  0  0  0
  3 12  1  1  0  0  0
  4  5  1  0  0  0  0
  4 13  1  0  0  0  0
  4 14  1  0  0  0  0
  5  6  1  0  0  0  0
  5 15  1  1  0  0  0
  6  7  1  0  0  0  0
  6  8  1  0  0  0  0
  6 16  1  1  0  0  0
  7  8  1  0  0  0  0
  7 17  1  0  0  0  0
  7 18  1  0  0  0  0
  8 19  1  1  0  0  0
M  END
1 molecule converted

Complains about the stereochemistry, and then dumps all atoms at 0.0000

@hjjvandam
Copy link

Actually, this bug seems to be a duplicate of #2141. Sometimes it seems OpenBabel will crash when it hits this problem, sometimes it outputs junk coordinates. A more detailed discussion of the underlying cause can be found at #2144.

@ghutchis
Copy link
Member

ghutchis commented Apr 3, 2020

This should now be solved by #2150 - can you please confirm by building master?

@timvdm
Copy link
Member

timvdm commented Apr 5, 2020

Regarding problem 5: The pull request below correctly handles this case.

#2158

@ghutchis
Copy link
Member

ghutchis commented May 7, 2020

This is fixed. I'm adding these SMILES to the coordinate generation unit test.

@ghutchis ghutchis closed this as completed May 7, 2020
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