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" option generates a segmentation fault when converting hydrogen isotopomers in InChI to MOL/SDF format. #1794

Closed
1 task done
hunter-moseley opened this issue Mar 17, 2018 · 4 comments
Assignees

Comments

@hunter-moseley
Copy link

  • I believe this to be a bug with Open Babel
    This bug may be related to other "--gen3D" bugs reported, but it is not obvious from the description of those issues.

Environment Information

Open Babel version: 2.4.1
Operating system and version: Fedora 27

Expected Behavior

The "--gen3D" would create a stereospecific MOL/SDF file for a stereospecific InChI.
The following command should work without generating a segmentation fault:
% obabel -iinchi alpha-d-glucopyranose_modified_H13-2H.inchi -omol -Oalpha-d-glucopyranose_modified_H13-2H.inchi.mol --gen3D

Actual Behavior

Conversion of the following InChI strings into MOL/SDF format with the "--gen3D" option generates a Segmentation Fault.

InChI=1S/C6H12O6/c7-1-2-3(8)4(9)5(10)6(11)12-2/h2-11H,1H2/t2-,3-,4+,5-,6+/m1/s1/i1D/t1-,2-,3-,4+,5-,6+
InChI=1S/C6H12O6/c7-1-2-3(8)4(9)5(10)6(11)12-2/h2-11H,1H2/t2-,3-,4+,5-,6+/m1/s1/i1D/t1-,2+,3+,4-,5+,6-/m0

Even the non-stereospecific InChI causes a seg fault with the --gen3D option:

InChI=1S/C6H12O6/c7-1-2-3(8)4(9)5(10)6(11)12-2/h2-11H,1H2/t2-,3-,4+,5-,6+/m1/s1/i1D

Steps to Reproduce

Just use the InChI provided to reproduce.

@ghutchis ghutchis added the crash label Mar 21, 2018
@ghutchis ghutchis self-assigned this Mar 21, 2018
@serval2412
Copy link
Contributor

On pc Debian x86-64 with master sources updated today, I could reproduce this.
Here's the bt:
bt.txt

@hunter-moseley
Copy link
Author

FYI. The following is the correct non-stereospecific InChI string:
InChI=1S/C6H12O6/c7-1-2-3(8)4(9)5(10)6(11)12-2/h2-11H,1H2/t2-,3-,4+,5-,6+/m1/s1/i1D/t1?,2-,3-,4+,5-,6+

timvdm added a commit to timvdm/openbabel that referenced this issue Jan 7, 2020
- data/UFF.prm: Add line for atom type 'D'.
- src/forcefields/forcefielduff.cpp: Add checks to prevent segfaults.
- test/regressiontest.cpp: Add test case.
@timvdm
Copy link
Member

timvdm commented Jan 7, 2020

The issue is that OBAtom::GetType() always returns "D" for deuterium.

  char *OBAtom::GetType()
  {
    ...
    if (_ele == 1 && _isotope == 2)
      snprintf(_type, 6, "%s", "D");

    return(_type);
  }

Adding an entry for D in UFF.prm fixes the issue.

Fix can be found here: https://github.com/timvdm/openbabel/tree/issue1794

@hunter-moseley
Copy link
Author

hunter-moseley commented Jan 8, 2020 via email

baoilleach added a commit that referenced this issue Jan 10, 2020
Fix issue #1794, UFF atom typing for deuterium
@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
Projects
None yet
Development

No branches or pull requests

5 participants