From: Karol M. L. <kar...@gm...> - 2009-09-07 09:16:18
|
The problem originates from NumPy dtypes, which came with the new version in numpy. If you print out type(atomno) in that code, for some reason you'll get <type 'numpy.int32'> instead of <type 'int'>. I see two solutions - python-openbabel needs to support dtypes (ouch) or convert atomno to an int just in case. I did the second in the last commit. It should work now (although remember that you probably want to pass atomcoords[0] since it is a 3D array now). Cheers, Karol On Monday 07 September 2009 10:23:29 Noel O'Boyle wrote: > I'm afraid I haven't looked at this code for a long time, and it isn't > covered by any tests. > > The OB API will not have changed, so it must be due to some internal > cclib changes. The specific problem appears to be that atomno is not a > Python integer in the code below (or so it seems to me). I will look > into this this evening.... > > - Noel > > 2009/9/5 Adam Tenderholt <a-t...@st...>: > > Hi Noel (and others), > > > > The makeopenbabel bridge function doesn't seem to be working for me. > > I'm currently using OpenBabel version 2.2.1b3 on Fedora Core 11 with > > cclib-0.8, but I was also having this problem in cclib-0.91. > > > > The error is: > > > > File "qmforge.py", line 252, in fileOpen > > self.open(str(filename)) > > File "qmforge.py", line 168, in open > > self.popWidget.setData(data) > > File "/home/adam/QMForge-2.1/src/popwidget.py", line 101, in setData > > self.glWidget.setMolecule(data.atomcoords[0],data.atomnos) > > File "/home/adam/QMForge-2.1/src/glwidget.py", line 140, in > > setMolecule > > self.obmol = makeopenbabel(coords,aonums) > > File "/usr/lib/python2.6/site-packages/cclib/bridge/ > > cclib2openbabel.py", line 28, in makeopenbabel > > obatom.SetAtomicNum(atomno) > > TypeError: in method 'OBAtom_SetAtomicNum', argument 2 of type 'int' > > > > Any thoughts? I can dig through the code, but I figured I'd write in > > case you know what needs to be changed off the top of your head(s). > > > > Thanks, > > > > Adam -- written by Karol Langner Mon Sep 7 10:54:26 CEST 2009 |