---------- Forwarded message ----------
From: Jason Power <[email protected]>
Date: 11 March 2010 14:28
Subject: Re: [OpenBabel-scripting] (no subject)
To: Noel O'Boyle <[email protected]>
Here is something that causes a segfault every time:
import openbabel
ring3 = openbabel.OBMol()
ra1=ring3.NewAtom()
ra2=ring3.NewAtom()
ra3=ring3.NewAtom()
ra1.SetAtomicNum(6)
ra2.SetAtomicNum(6)
ra3.SetAtomicNum(6)
rb1=ring3.NewBond()
rb2=ring3.NewBond()
rb3=ring3.NewBond()
rb1.SetBegin(ra1)
rb1.SetEnd(ra2)
rb2.SetBegin(ra2)
rb2.SetEnd(ra3)
rb3.SetBegin(ra3)
rb3.SetEnd(ra1)
rb1.SetBO(1)
rb2.SetBO(1)
rb3.SetBO(1)
print len(ring3.GetSSSR()) # OUTPUT: 0
builder = openbabel.OBOp.FindType("Gen3D")
builder.Do(ring3)
print len(ring3.GetSSSR()) # OUTPUT: 1
ra1.SetVector(1,0,0)
ra2.SetVector(0,-1,0)
ra3.SetVector(0,1,0)
Sometimes is segfaults on ra2.SetVector(0,-1,0) and sometimes on
ra3.SetVector(0,1,0). Also, I don't understand why the first call the
GetSSSR() doesn't return the right number.
Thanks again!
Jason
On Thursday 11 March 2010 04:48:45 am you wrote:
> Where do beginAtom and endAtom come from in your code snippet.
>
> The best thing would be if you can you create a simple and short
> self-contained script that exhibits the problem.
>
> - Noel
>
> On 11 March 2010 03:59, Jason Power <[email protected]> wrote:
> > Hi all,
> >
> > I am currently developing a pure-python 2-D molecule editor for use
> > within another project I am currently working on. To begin with I decided
> > to use the OBMol object as a model, thinking it would save me time and
> > effort. However, I have run into a variety of issues that I'm not sure
> > are due to my own misunderstandings, limitations of the python bindings,
> > or bugs.
> >
> > I am building the OBMol object slowly over time as the user adds atoms
> > and bonds. So I have a numerous places where I basically call
> >
> > self.mol.BeginModify()
> > bond = self.mol.NewBond()
> > bond.SetBegin(beginAtom)
> > bond.SetEnd(endAtom)
> > self.mol.EndModify()
> >
> > and
> >
> > self.mol.BeginModify()
> > newAtom = self.mol.NewAtom()
> > newAtom.SetVector(self.translateToAtomCoords(pos))
> > newAtom.SetAtomicNum(atomicNum)
> > self.mol.EndModify()
> >
> > and similar to delete. I find that with these calls when I go on to do
> > other interesting things it fails, often as a segfault. Also, if I try to
> > make a call like self.mol.GetSSSR() even though there is a ring, (I can
> > trace the indices of the ends of the bonds myself), it returns a zero
> > length list.
> >
> > I have found that if I call self.builder.Do(self.mol) before I run
> > GetSSSR() it will return the right numbers, but I do not want to build
> > the full 3-D coords, and worse, self.builder.Do(self.mol) randomly
> > segfaults.
> >
> > Am I doing something wrong? Is there something that I am missing while
> > building the molecule?
> >
> > Thanks for you help!
> > Jason
> >
> >
> > -------------------------------------------------------------------------
> >----- Download Intel® Parallel Studio Eval
> > Try the new software tools for yourself. Speed compiling, find bugs
> > proactively, and fine-tune applications for parallel performance.
> > See why Intel Parallel Studio got high marks during beta.
> > http://p.sf.net/sfu/intel-sw-dev
> > _______________________________________________
> > OpenBabel-scripting mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/openbabel-scripting
>
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
OpenBabel-scripting mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbabel-scripting