openbabel icon indicating copy to clipboard operation
openbabel copied to clipboard

Open Babel Error in OpenBabel::OBBuilder::GetFragmentCoord Rigid fragment C1CCCNC1 in rigid-fragments.txt has all zero coordinates

Open StashOfCode opened this issue 5 years ago • 8 comments

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

Environment Information

Open Babel version: 3.1.0 Operating system and version: Windows 10

Expected Behavior

mol = pybel.readstring("smi", 'BrC/C=C/c1ccc(O[C@@H]2CCCNC2)cc1')
mol.make3D()

Actual Behavior

jupyter lab Kernel dies with this output in the cmd

Open Babel Error  in OpenBabel::OBBuilder::GetFragmentCoord
Rigid fragment C1CCCNC1 in rigid-fragments.txt has all zero coordinates

StashOfCode avatar Apr 13 '21 22:04 StashOfCode

Thanks for opening your first issue here! Be sure to follow the issue template!

welcome[bot] avatar Apr 13 '21 22:04 welcome[bot]

Try this one too. Babel hangs with it forever BrC/C=C/c1ccc(O[C@@H]2C[C@H]3CC[C@H]2NC3)cc1. "smilies to sdf" with "generate 3d coords" checked

StashOfCode avatar Apr 14 '21 00:04 StashOfCode

Open Babel 3.1.1 has the same problem when generating 3d structure (does not matter the output format) from .smi files.

HuMuK avatar Jan 20 '22 10:01 HuMuK

Is there a at least a way to catch this error without resorting to subprocesses?

try:
    mol = pybel.readstring("smi", 'BrC/C=C/c1ccc(O[C@@H]2CCCNC2)cc1')
    mol.make3D()
except:
    print("failed")

This does not work

PatReis avatar Aug 08 '22 15:08 PatReis

okay you can check if BABEL_DATADIR is correctly set (assuming you have conda install). This worked for me (setting manually).

import os
os.environ["BABEL_DATADIR"] = "C:\Users\...\anaconda3\envs\...\share\openbabel"  # Adjust for your conda path
import openbabel
import openbabel.pybel as pybel
mol = pybel.readstring("smi", 'BrC/C=C/c1ccc(O[C@@H]2CCCNC2)cc1')
mol.make3D()
print("everything is fine.")

PatReis avatar Aug 10 '22 11:08 PatReis