Dear OpenBabel users,

I wanted to use the AddHydrogens() method from Python, and things work
fine if I create an OBMol object by reading in a file, but it crashes
with a segmentation fault if I used it as in the example below. I
tried it on different machines:

(1) Python 2.7.9
OpenBabel git:d56a5d compiled with gcc 5.1.0
or OpenBabel 2.3.2 compiled with gcc 4.9.2
(2) Python 2.7.10
OpenBabel git:d56a5d compiled with gcc 4.8

An example interactive session:

~~~
In [1]: import openbabel as ob
In [2]: obmol = ob.OBMol()
In [3]: obatom = obmol.NewAtom()
In [4]: obatom.SetAtomicNum(6)
In [5]: obatom.SetVector(1.0, 1.0, 1.0)
In [6]: obmol.NumAtoms()
Out[6]: 1
In [7]: obmol.AddHydrogens()
Out[7]: True
In [8]: obmol.NumAtoms()
Out[8]: 5
In [9]: obatom2 = obmol.GetAtom(2)
In [10]: obatom2.GetAtomicNum()
Out[10]: 1
In [11]: obatom2.GetAtomicMass()
Out[11]: 1.00794
In [12]: obatom2.GetX()
Segmentation fault
~~~

Any suggestions why this may happen? Thanks very much in advance!

Best regards,

Peng

------------------------------------------------------------------------------
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to