openbabel icon indicating copy to clipboard operation
openbabel copied to clipboard

Open Babel Error in Do 3D coordinate generation failed

Open nakatamaho opened this issue 3 years ago • 24 comments

  • [x] I believe this to be a bug with Open Babel

Environment Information

Open Babel version: 3.1.1 Operating system and version: macOS big sure and Red Hat Enterprise Linux Server release 7.3 (Maipo)

Expected Behavior

/opt/openbabel2.4.1/bin/obabel -:"C[C@H]([C@@H](C(=O)O)N)O" --add-h --gen3d -oxyz 17

C 1.19286 0.04506 0.20032 C 2.70616 0.08144 0.01491 H 3.17336 0.23795 0.99466 C 3.14803 1.17558 -0.97994 H 2.76452 2.15338 -0.66944 C 4.67921 1.29148 -0.99423 O 5.41785 1.10263 -0.04358 O 5.12473 1.65063 -2.22820 N 2.70335 0.91478 -2.38659 O 3.10573 -1.20711 -0.46921 H 0.68027 -0.25654 -0.71973 H 0.80572 1.01652 0.52100 H 0.92501 -0.70084 0.95647 H 4.32700 1.66400 -2.81379 H 1.67851 0.94547 -2.39707 H 2.89564 -0.08367 -2.55682 H 4.01094 -1.36282 -0.13549 1 molecule converted`

Actual Behavior

/opt/openbabel3.1.1/bin/obabel -:"C[C@H]([C@@H](C(=O)O)N)O" --add-h --gen3d -oxyz

*** Open Babel Error in Do 3D coordinate generation failed 8

C 0.00000 0.00000 0.00000 C 0.00000 0.00000 0.00000 C 0.00000 0.00000 0.00000 C 0.00000 0.00000 0.00000 O 0.00000 0.00000 0.00000 O 0.00000 0.00000 0.00000 N 0.00000 0.00000 0.00000 O 0.00000 0.00000 0.00000 1 molecule converted 1

Steps to Reproduce

described above. Using 2.4.1, the conversion is done successfully however, using 3.1.1, the conversion fails.

nakatamaho avatar Jan 03 '21 03:01 nakatamaho

Following commands also fails for 3.1.1 and not for 2.4.1. obabel '-:C\1=C/C=C\C=C\C=C/C=C/C=C\C=C\C=C1' --gen3d --add-h -oxyz obabel '-:C[C@]12CC[C@H]3[C@H]([C@@H]1C[C@H]([C@@H]2O)O)CCC4=C3C=CC(=C4)O' --gen3d --add-h -oxyz obabel '-:C[C@@H]1[C@H](C[C@@H]([C@H](O1)OC2[C@@H]([C@H](C([C@@H]([C@@H]2O)O)O)O)O)N)N=C(C(=O)O)N' --gen3d --add-h -oxyz obabel '-:C([C@H]([C@@H]([C@@H]([C@H](CO)O)O)O)O)O' --gen3d --add-h -oxyz obabel '-:C([C@H]([C@H]([C@@H]([C@H](C(=O)O)O)O)O)O)O' --gen3d --add-h -oxyz obabel '-:C1=CC(=CC=C1[C@H]([C@@H](CO)NC(=O)C(Cl)Cl)O)[N+](=O)[O-]' --gen3d --add-h -oxyz obabel '-:C1(=N)OC(=N)OC(=N)O1' --gen3d --add-h -oxyz obabel -:C1CCC/C=C/CCC1 --gen3d --add-h -oxyz obabel '-:C[C@H]1C[C@@H](C(=O)[C@@H](C1)[C@@H](CC2CC(=O)NC(=O)C2)O)C' --gen3d --add-h -oxyz obabel '-:[C@@H]([C@@H](C(=O)O)Br)(C(=O)O)Br' --gen3d --add-h -oxyz obabel '-:[C@@H]([C@@H](C(=O)O)Br)(C(=O)O)Br' --gen3d --add-h -oxyz obabel '-:C1CCC/C=C\CCCCCCCC(=O)CCC1' --gen3d --add-h -oxyz obabel '-:C[C@H]([C@@H](C)C(=O)O)C(=O)O' --gen3d --add-h -oxyz obabel '-:[C@@H]([C@H](C(=O)O)O)(C(=O)O)O' --gen3d --add-h -oxyz obabel '-:[C@@H]([C@@H](C(=O)O)O)(C(=O)O)O.O' --gen3d --add-h -oxyz obabel '-:[C@@H]([C@H](C(=O)[O-])O)(C(=O)[O-])O.[C@@H]([C@H](C(=O)[O-])O)(C(=O)[O-])O.O.[K+].[K+].[K+].[K+]' --gen3d --add-h -oxyz obabel '-:[C@@H]([C@H](C(=O)[O-])O)(C(=O)O)O.O.[Na+]' --gen3d --add-h -oxyz obabel '-:C=C[C@H]1CN2CC[C@H]1C[C@H]2[C@@H](C3=CC=NC4=CC=CC=C34)O' --gen3d --add-h -oxyz obabel '-:C=C[C@H]1CN2CC[C@H]1C[C@@H]2[C@H](C3=CC=NC4=CC=CC=C34)O' --gen3d --add-h -oxyz obabel '-:C[C@H]([C@@H](C(=O)O)N)O' --gen3d --add-h -oxyz obabel '-:C([C@H]([C@H]([C@@H]([C@H](CO)O)O)O)O)O' --gen3d --add-h -oxyz obabel '-:[C@@H]([C@H](C(=O)N)O)(C(=O)N)O' --gen3d --add-h -oxyz obabel '-:C1[C@@H](NC(=N[C@H]1O)N)[C@@H](C(=O)O)N' --gen3d --add-h -oxyz obabel '-:C1=CC(=N)C=CC1=C(C2=CC=C(C=C2)N)C3=CC=C(C=C3)N.Cl' --gen3d --add-h -oxyz obabel '-:C1=CC(=N)C=CC1=C(C2=CC=C(C=C2)N)C3=CC=C(C=C3)N' --gen3d --add-h -oxyz obabel '-:CN1CCC2=CC3=C(C=C2[C@@H]1[C@@H]4C5=C(C(=C(C=C5)OC)OC)C(=O)O4)OCO3' --gen3d --add-h -oxyz obabel '-:C[C@H]([C@@H](C)O)O' --gen3d --add-h -oxyz obabel '-:C/C/1=C\CC(/C=C/C/C(=C/CC1)/C)(C)C' --gen3d --add-h -oxyz obabel '-:CC(C)C[C@@H](C(=O)O)NC(=O)[C@H]([C@@H](CC1=CC=CC=C1)N)O' --gen3d --add-h -oxyz obabel '-:C[C@H]([C@@H](C(=O)O)N)OP(=O)(O)O' --gen3d --add-h -oxyz obabel '-:C([C@H]([C@H]([C@@H]([C@@H](CO)O)O)O)O)O' --gen3d --add-h -oxyz obabel '-:C[C@H]([C@@H](C(=O)O)N)SC[C@@H](C(=O)O)N' --gen3d --add-h -oxyz obabel '-:C1CN2CC3=CC4=C(C=C3[C@H]5[C@H]2C1=C[C@@H]([C@H]5O)O)OCO4' --gen3d --add-h -oxyz

nakatamaho avatar Jan 03 '21 04:01 nakatamaho

also this one OC[C@H]1O[C@@H](Oc2ccc(N=Nc3ccccc3)cc2)[C@H](O)[C@@H](O)[C@@H]1O[C@@H]1O[C@H](CO)[C@H](O)[C@H](O)[C@H]1O

2d gen works for the same

nicman23 avatar Mar 06 '21 13:03 nicman23

I reproduced the issue.

The error message is displayed when the stereochemistry of generated coordinate is wrong (code). This stereochemistry check is introduced by #2158.

@timvdm In my opitnion, OpGen3D::Do() should generate a coordinate even if the stereochemistry is wrong, not throwing an error and generating all zero coordinate. What do you think? (Of course, the ultimate solution is always generating correct stereochemistry, but let's consider a quick fix for now...)

n-yoshikawa avatar Mar 15 '21 07:03 n-yoshikawa

same issue here: Cc1ccc(-c2cccc([C@@H]3C[C@](C)(c4ccccc4)c4cc(C(=N)N)ccc4N3)c2)c(C(=O)O)c1

kexul avatar Apr 16 '21 11:04 kexul

Similar issue here.

When I run obabel -i smi smiles.smi -o xyz -O out.xyz -m -h --gen3d using OpenBabel 3.1.1, where smiles.smi include one line: N1(C=C[C@@H](C=C1C)[C@H]1C=CN(C(=C1)C)CCCl)CCCl

I got the following error: image

Moreover, for the following SMILES: C1=C[C@H]2C(=CN1C)[C@H]1C(=CC=CN1C)C=C2 I got image

The computed coordinates are all 0s.

When using Open Babel 3.0.0 -- May 1 2020 -- 18:25:45, the errors disappear.

My OS system is Ubuntu 18.04.6 LTS.

May I ask what is the problem and how to fix it? Thanks.

jajupmochi avatar Feb 20 '22 13:02 jajupmochi

@jajupmochi Would an update of openbabel an option for you? There are might be good reasons to use a LTS from the Ubuntu family instead their intermediate releases published twice a year, as well as against; if you stick to LTS I would recommend to update to 20.04 LTS (and in this summer, to 22.04 LTS). To provide perspective, OpenBabel repackaged by DebiChem for Linux Debian 12/bookworm (branch testing) is at version 3.1.1 by February 6th, 2022 (tracker).

If the generation 0D (the SMILES string) to 3D (the .xyz) fails, an alternative is to generate an intermediate 2D (.xyz) in first place. Sometimes, rewriting the SMILES string into a form more accessible to OpenBabel equally helps/offers additional help.

For the first SMILES string:

obabel -:"N1(C=C[C@@H](C=C1C)[C@H]1C=CN(C(=C1)C)CCCl)CCCl" -ocan | obabel -ismi -h --gen3d -oxyz

yields e.g.,

1 molecule converted
42

Cl         0.93057       -0.72235        0.11214
C          2.70908       -0.81013        0.17949
C          3.30555       -0.84380       -1.22848
N          4.78308       -0.91157       -1.16078
C          5.50030        0.27828       -1.04781
C          6.79964        0.34655       -0.72869
C          7.58978       -0.90870       -0.42149
C          6.78436       -2.16623       -0.71814
C          5.47659       -2.13574       -1.05238
C          4.75761       -3.43161       -1.33497
C          9.00781       -0.95143       -1.07678
C          9.00304       -0.87328       -2.58644
C          9.84595       -0.06092       -3.23557
N         10.75438        0.79769       -2.61330
C         10.72369        0.90150       -1.20482
C          9.92661        0.09709       -0.46849
C         11.53292        1.93288       -0.45745
C         11.76972        1.46635       -3.46203
C         13.02007        0.59878       -3.60521
Cl        14.17952        1.34836       -4.73549
H          2.97462       -1.70594        0.74913
H          3.06144        0.06210        0.73931
H          3.00196        0.05450       -1.78183
H          2.89782       -1.68767       -1.79530
H          4.92952        1.18267       -1.23133
H          7.29603        1.30611       -0.65422
H          7.74476       -0.91385        0.66839
H          7.30518       -3.11487       -0.62493
H          5.43684       -4.29123       -1.32134
H          4.29997       -3.40647       -2.32943
H          3.97906       -3.61608       -0.58816
H          9.45341       -1.92403       -0.81917
H          8.32012       -1.50882       -3.14057
H          9.85509       -0.03516       -4.32277
H          9.92024        0.18199        0.61507
H         11.99814        2.68502       -1.09382
H         12.32360        1.45087        0.12668
H         10.88323        2.48502        0.23284
H         12.03163        2.45619       -3.07851
H         11.34272        1.65757       -4.45561
H         12.77633       -0.39293       -3.99931
H         13.53045        0.46885       -2.64625
1 molecule converted

For the second SMILES, a

obabel -:"C1=C[C@H]2C(=CN1C)[C@H]1C(=CC=CN1C)C=C2" -h --gen3d -oxyz

had a bit longer to process, yet yielded

==============================
*** Open Babel Warning  in CorrectStereoAtoms
  Could not correct 1 stereocenter(s) in this molecule ()
  with Atom Ids as follows: 2
Warning: Stereochemistry is wrong, using the distance geometry method instead
32

C          2.60383        1.49083       -0.12670
C          1.43386        1.00301       -0.55160
C          0.16007        1.78818       -0.38777
C          0.39455        3.22898        0.09450
C          1.63353        3.59061        0.49530
N          2.73661        2.72869        0.48467
C          4.05307        3.17814        0.93817
C         -0.73994        4.22711       -0.20133
C         -1.37886        3.91583       -1.58459
C         -2.68725        4.07890       -1.85916
C         -3.58769        4.39478       -0.78204
C         -3.13375        4.38712        0.48110
N         -1.79593        4.21044        0.85072
C         -1.39422        4.68796        2.17553
C         -0.62779        2.94809       -2.39395
C         -0.60098        1.77317       -1.71521
H          3.52439        0.92548       -0.25711
H          1.38016        0.02410       -1.02108
H         -0.46096        1.28945        0.37433
H          1.87572        4.61011        0.77967
H          3.97269        3.69145        1.90255
H          4.73786        2.33413        1.07729
H          4.49759        3.85987        0.20543
H         -0.32155        5.24498       -0.25919
H         -3.11998        3.72406       -2.78926
H         -4.64581        4.48976       -1.00063
H         -3.81871        4.51863        1.31134
H         -1.58075        5.76585        2.25805
H         -1.97963        4.18100        2.95084
H         -0.33818        4.51109        2.39131
H          0.33645        3.37992       -2.68070
H         -1.57881        1.31717       -1.52649
1 molecule converted

with non-zero coordinates.

nbehrnd avatar Feb 21 '22 07:02 nbehrnd

Thank you @nbehrnd, I will try.

jajupmochi avatar Feb 21 '22 09:02 jajupmochi

On occasion, I sometimes embark a route like

obabel -:"c1ccncc1" -can | obabel -ismi -h --gen2d -osdf | obabel
-isdf --gen3d -osdf

for «difficult» cases. Because, the more conformational flexible (number of one may rotate) a molecule is, especially with stereogenic centres, the more computational demanding the provision of /a/ conformation by OpenBabel is. For a rigid molecule like pyridine above, this has no benefit. I do not possess a one-fits-all scale to anticipate ahead of time when this extended route is necessary.

Note, by documentation (incl. a reference to an open-access publication), --gen3d is only one out of five levels to provide you /one/ starting conformation. And though it does not aim to compete with protein folding programs, OpenBabel's --conformer flag allows you to generate conformers, too.

nbehrnd avatar Feb 21 '22 09:02 nbehrnd

Try this one: ZINC001094026363 Cc1nnc(CNC[C@@H]2CN(C(=O)[C@@]34CCCC[C@H]3C4)C[C@H]2C)n1C1CC1

Even Zinc doesn't have 3D rdkit molecule for this...

BJWiley233 avatar Nov 23 '22 07:11 BJWiley233

obabel 3.1.1 as provided by Debian 12/bookworm:

$ obabel -:"Cc1nnc(CNC[C@@H]2CN(C(=O)[C@@]34CCCC[C@H]3C4)C[C@H]2C)n1C1CC1" -h --gen3d -oxyz
==============================
*** Open Babel Warning  in CorrectStereoAtoms
  Could not correct 1 stereocenter(s) in this molecule ()
  with Atom Ids as follows: 13
Warning: Stereochemistry is wrong, using the distance geometry method instead
60

C         -0.96751       -6.04030        0.85012
C         -0.18563       -5.36963       -0.20405
N          1.05552       -5.65459       -0.55344
N          1.64211       -4.47773       -0.97450
C          0.73179       -3.52767       -0.82832
C          1.03754       -2.15138       -0.35630
N         -0.00647       -1.16768       -0.62677
C          0.36434        0.12879       -0.04808
C         -0.70183        1.16832       -0.38027
C         -0.32732        2.55799        0.11070
N         -1.60972        3.22336        0.10344
C         -1.93947        4.01607       -0.99438
O         -1.20420        4.19679       -1.95634
C         -3.28400        4.70992       -0.89954
C         -3.29091        5.79849        0.15051
C         -2.45333        6.99476       -0.39547
C         -2.28042        7.07812       -1.94291
C         -3.35420        6.37931       -2.79614
C         -4.13166        5.43396       -1.96698
C         -4.26395        3.98532       -1.87327
C         -2.57855        2.31840        0.70103
C         -2.08699        0.91709        0.28696
C         -3.05856        0.23856       -0.67549
N         -0.49989       -4.15031       -0.76765
C         -1.46180       -3.99662       -1.86437
C         -2.06598       -5.22686       -2.53580
C         -2.94709       -4.27257       -1.80539
H         -0.98234       -7.12149        0.69463
H         -0.48251       -5.85298        1.81790
H         -1.99355       -5.67149        0.92233
H          1.98585       -1.82921       -0.80748
H          1.19877       -2.22364        0.72465
H         -0.09393       -1.05871       -1.63704
H          1.32780        0.45852       -0.45523
H          0.47738        0.04083        1.04048
H         -0.82678        1.21794       -1.47098
H          0.41625        3.05512       -0.51673
H          0.03859        2.54279        1.14727
H         -2.85296        5.45082        1.09341
H         -4.30676        6.12747        0.40030
H         -2.88334        7.93042       -0.02392
H         -1.44507        6.93572        0.03427
H         -1.31169        6.63066       -2.20266
H         -2.18051        8.12576       -2.25049
H         -4.04330        7.15049       -3.16709
H         -2.92235        5.90083       -3.68024
H         -5.05075        5.94058       -1.66063
H         -3.84736        3.40889       -2.69793
H         -5.16670        3.55676       -1.46033
H         -2.50258        2.43194        1.78898
H         -3.61128        2.52186        0.40396
H         -1.98490        0.28744        1.18243
H         -2.61144       -0.63909       -1.15160
H         -3.95281       -0.09178       -0.13927
H         -3.37215        0.92427       -1.46752
H         -1.18993       -3.17436       -2.52411
H         -2.07994       -5.24422       -3.61949
H         -1.92569       -6.21057       -2.10163
H         -3.40012       -4.59021       -0.87620
H         -3.60298       -3.66116       -2.42118
1 molecule converted

Well, what is the matter with this one, why the complaint? So I run

$ obabel -:"Cc1nnc(CNC[C@@H]2CN(C(=O)[C@@]34CCCC[C@H]3C4)C[C@H]2C)n1C1CC1" -O test.png
1 molecule converted

test

So I copy-paste the SMILES string to cdkdepict for a visualization, but what should be unusual there?

cdkdepict

Though the structure representations are not implausible, I process ZINC001094026363.sdf from here (download button) (a 2D RDKit file) on on Jmol's console:

$ load "ZINC001094026363.sdf";
$ calculate hydrogens;
$ minimize;
$ minimize;
$ write "converged.sdf";

Apparently, converged.sdf still is problematic

$ obabel converged.sdf -O converged.smi
1 molecule converted
$ obabel convergerd.smi -h --gen3d -O convergerd3d.sdf
$ obabel converged.smi --gen3d -O converged3d.sdf
==============================
*** Open Babel Warning  in CorrectStereoAtoms
  Could not correct 1 stereocenter(s) in this molecule (/home/USER/Desktop/ZINC001094026363.sdf)
  with Atom Ids as follows: 13
Warning: Stereochemistry is wrong, using the distance geometry method instead
...

So, it likely is time to get in touch with the database's curators about this very entry.

nbehrnd avatar Nov 23 '22 10:11 nbehrnd

Thanks for all the work you did to check it. Ironically this works on my Mac with Open Babel 3.1.0 from conda install (OpenBabel11232220203D) but with same version on ubuntu 20.04 compiled with cmake (OpenBabel11242202202D) I get failure to generate 3D molecule.

obabel -:"Cc1nnc(CNC[C@@H]2CN(C(=O)[C@@]34CCCC[C@H]3C4)C[C@H]2C)n1C1CC1" -h --gen3d -osdf

How did you make obabel on your debian arch?

BJWiley233 avatar Nov 24 '22 02:11 BJWiley233

How do you define "failure to generate 3D molecule"? Do you get an error?

fredrikw avatar Nov 24 '22 09:11 fredrikw

@BJWiley233 In instances when obabel reported an error about stereochemistry in a SMILES string, so far, my assumption was that somewhere an @, or /, or \, was lost, or was used too often. Perhaps the cause is between the keyboard and chair. Here, the request to report (obabel's) canonical SMILES string

$ obabel -:"Cc1nnc(CNC[C@@H]2CN(C(=O)[C@@]34CCCC[C@H]3C4)C[C@H]2C)n1C1CC1" -ocan 
C[C@@H]1CN(C[C@H]1CNCc1nnc(n1C1CC1)C)C(=O)[C@]12CCCC[C@H]2C1	
1 molecule converted

doesn't help; advancing a step further

$ obabel -:"Cc1nnc(CNC[C@@H]2CN(C(=O)[C@@]34CCCC[C@H]3C4)C[C@H]2C)n1C1CC1" -ocan | obabel -ismi --gen3d -osdf
1 molecule converted
==============================
*** Open Babel Warning  in CorrectStereoAtoms
  Could not correct 1 stereocenter(s) in this molecule ()
  with Atom Ids as follows: 20
Warning: Stereochemistry is wrong, using the distance geometry method instead
^C

(intentionally stopped by Ctrl + C, hence the ^C) still displays the obstacle. So your report obabel in iOS would trade better than Debian is worth to note for those with access to both operating systems. Maybe the SMILES was derived from a .sdf already problematic?

Because I'm not aware (yet) of a checker for SMILES in regard of consistency (like for Python online, or pylint for the CLI; or checkcif for crystal structure data; or the CIP validator by Hanson et al. (2018JChemInfModel1755)), the mentioned cdk-depict sometimes serves me to spot a (potentially) problematic SMILES string: enter e.g., CC=CC and the wavy bond indicates the configuration of the double bound is not defined. With the optional display of CIP labels, there equally will be an explicit question mark; this contrasts to C\C=C\C, C\C=C/C, C/C=C\C, and C/C=C/C:

butene_variations

Regarding the second part: thankfully, obabel is equally available as a .deb package prêt-à-porter/ready to go (Debian's tracker). There might be a delta in time and functionality between the executables either compiled from the source code here (GitHub), and the one via the repositories of DebiChem. With Debian branch testing (at present, Debian 12/bookworm) one may consider more like a rolling release (comparison to Debian stable, or LTS releases in the Ubuntu family), I do not perceive the delays as problematic. After preparing a package, improvements unrelated to security stay in the purgatory of Debian's branch unstable (or sid) for about 5 days; if accepted, they then percolate into testing.

nbehrnd avatar Nov 24 '22 09:11 nbehrnd

I don't really think that there is an Error as such in the SMILES. It's just that the fragment-based builder can't find a fragment with the specified stereochemistry so it will fall back on the slower distance geometry version of 3D-generation. There are only warnings in your examples @nbehrnd.

fredrikw avatar Nov 24 '22 09:11 fredrikw

@fredrikw When running a conversion

$ obabel -:"Cc1nnc(CNC[C@@H]2CN(C(=O)[C@@]34CCCC[C@H]3C4)C[C@H]2C)n1C1CC1" -ocan | obabel -ismi --gen3d -osdf
1 molecule converted
==============================
*** Open Babel Warning  in CorrectStereoAtoms
  Could not correct 1 stereocenter(s) in this molecule ()
  with Atom Ids as follows: 20
Warning: Stereochemistry is wrong, using the distance geometry method instead

obabel eventually provides an result. Not measured with a structure of similar complexity/conformational flexibility, processing is perceived as taking a bit longer, though. (More work/different processing.) My interpretation of obabel's report «Could not correct ... stereochemistry is wrong» is the data to process by obabel (already) are problematic. Second, I don't read this obabel report as a note obabel did something wrong.

nbehrnd avatar Nov 24 '22 09:11 nbehrnd

My interpretation (and I think it is supported by the code) is that when you run gen3d, OpenBabel first try the fragment-based builder. However, this fails due to stereochemical mismatch between the fragments and the input why it falls back on the distance geometry method. So this is not an error, neither by obabel nor in the initial SMILES. However, @BJWiley233 seems to have another problem on their Ubuntu machine and THAT may be a proper error.

fredrikw avatar Nov 24 '22 10:11 fredrikw

Yes same version installed, with ubuntu I make and compile in 20.04 image like:

RUN apt-get update && apt-get install -y swig
RUN cd /opt && wget https://github.com/openbabel/openbabel/archive/refs/tags/openbabel-3-1-1.tar.gz
RUN cd /opt && tar -xvzf openbabel-3-1-1.tar.gz && cd openbabel-openbabel-3-1-1 && mkdir ob-build && cd ob-build
RUN cd /opt/openbabel-openbabel-3-1-1/ob-build && cmake -DRUN_SWIG=ON -DPYTHON_BINDINGS=OFF .. && make install -j8 

And this returns 0.000 for all XYZ coordinates but works with conda installation on my mac.

obabel -:"Cc1nnc(CNC[C@@H]2CN(C(=O)[C@@]34CCCC[C@H]3C4)C[C@H]2C)n1C1CC1" -h --gen3d -osdf

Mac results:

==============================
*** Open Babel Warning  in CorrectStereoAtoms
  Could not correct 1 stereocenter(s) in this molecule ()
  with Atom Ids as follows: 13
Warning: Stereochemistry is wrong, using the distance geometry method instead

 OpenBabel11242219173D

 60 64  0  0  1  0  0  0  0  0999 V2000
    5.7003   -1.3450    0.6202 C   0  0  0  0  0  0  0  0  0  0  0  0
    5.1653   -2.6527    0.1911 C   0  0  0  0  0  0  0  0  0  0  0  0
    4.8155   -2.9824   -1.0364 N   0  0  0  0  0  0  0  0  0  0  0  0
...

Ubuntu 20.04 results:

==============================
*** Open Babel Warning  in CorrectStereoAtoms
  Could not correct 1 stereocenter(s) in this molecule ()
  with Atom Ids as follows: 13
Warning: Stereochemistry is wrong, using the distance geometry method instead
==============================
*** Open Babel Error  in Do
  3D coordinate generation failed
==============================
*** Open Babel Warning  in WriteMolecule
  No 2D or 3D coordinates exist. Stereochemical information will be stored using an Open Babel extension. To generate 2D or 3D coordinates instead use --gen2D or --gen3D.

 OpenBabel11252201262D

 60 64  0  0  1  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 N   0  0  0  0  0  0  0  0  0  0  0  0
...

BJWiley233 avatar Nov 25 '22 01:11 BJWiley233

So there is the error:

==============================
*** Open Babel Error  in Do
  3D coordinate generation failed

Do you have Eigen on the Ubuntu machine? I think that the distance geometry method will use Eigen if available, maybe it's available on the Mac and not on the Ubuntu? The cmake run should say in its output if it found Eigen or not.

fredrikw avatar Nov 25 '22 07:11 fredrikw

@BJWiley233 Would the use of obabel from a .deb for Ubuntu (their index mentions version 3.0.0 for LTS release 20.04/focal, and 3.1.1 for 22.04/jammy)) be suitable for you? If so, are you able to generate a 2D structure, a 3D conformer, respectively?

To ease potential replication, I attach the results with obabel (Open Babel 3.1.1 -- Oct 20 2022 -- 17:31:22) as currently provided by Linux Debian 12/bookworm as a .zip archive. There might be slight numeric differences for the conformer (diff --brief will spot them) when you generate a conformer on your computer (indeed, there may be variations from run to run). Often, they are not this much important from a chemical point of view if obabel is used to provide a starting point for ongoing further work in Gaussian/MOPAC at higher level of theory, but can be quantified e.g., by a Kabsch test (an implementation in Python by Charnley et al.).

2022-11-25_comparison.zip

nbehrnd avatar Nov 25 '22 09:11 nbehrnd

I got some working with adding Eigen to Ubuntu image. There are still issues for some molecules where obabel will hang while try to run the distance geometry method. Does this algorithm run infinitely until it finds a solution or does it stop after a certain amount of iterations?

BJWiley233 avatar Nov 26 '22 10:11 BJWiley233

It should stop after trying the full process 25 times. But since the included steps can run for a long time as well that might feel infinitely...

fredrikw avatar Nov 29 '22 08:11 fredrikw

I guess since it can take a while it may be nice to log which iteration it is at to stdout.

BJWiley233 avatar Dec 01 '22 07:12 BJWiley233

Tangent note: on occasion, structure solution in X-ray crystallography is difficult because of disorder. Here, the use of (reasonable) fragments ready-for-use offers a help (e.g., Daniel Kratzerts fragmentDB for Disordered Structure Refinement (DSR)). In the subsequent structure refinement (once all atoms relevant to the model are identified), one may opt-in for a variation of angles/distances equally for these building blocks.

Question: Is there something similar possible (perhaps already implemented) with openbabel, i.e. 1) to build a library of motifs which are seen multiple times, and 2) to later indicate openbabel to join a select member of them with a fragment defined by e.g., SMILES input from the CLI? By this I do not refer to put two molecules into one model (the joining period in a SMILES string), but joining two fragments to covalently bind into one molecule in common.

nbehrnd avatar Dec 01 '22 08:12 nbehrnd

Question: Is there something similar possible (perhaps already implemented) with openbabel, i.e. 1) to build a library of motifs which are seen multiple times, and 2) to later indicate openbabel to join a select member of them with a fragment defined by e.g., SMILES input from the CLI? By this I do not refer to put two molecules into one model (the joining period in a SMILES string), but joining two fragments to covalently bind into one molecule in common.

This is how the fragment-based builder already works by default. https://jcheminf.biomedcentral.com/articles/10.1186/s13321-019-0372-5

ghutchis avatar Dec 05 '22 17:12 ghutchis