From: Matt S. <mes...@gm...> - 2010-03-11 01:24:14
|
I finally found a fix for the crash I was experiencing. I went back and read the documentation for libxml2 and found this ( http://xmlsoft.org/threads.html) "call xmlInitParser() in the "main" thread before using any of the libxml2 > API (except possibly selecting a different memory allocator)" > After making the following change to xml.cpp, everything works fine. if(_reader) return true; //do not need to make a new reader //fix crash on GC in the C# bindings xmlInitParser(); //If the inputstream is not at the start (probably arising in fastsearch), //save its position and rewind so that the reader initialization is ok. //(Getting the requested object is handled in ReadXML(), when the format is known.) _requestedpos = GetInStream()->tellg(); The root cause of the crash was that the CLI runs finalizers in a separate thread, but libxml wasn't being setup for a multithreaded environment. While I don't think that adding this call will impact the base code, I wanted to run it by more experienced C++ programmers before committing anything. -Matt |
From: Geoffrey H. <ge...@ge...> - 2010-03-11 02:35:16
|
Matt, Great catch. This will probably help other people, since you're not the only one running Open Babel in a separate thread. I suspect this is the root cause of other XML crashes -- there are a few posted to the bug tracker. Let's commit this to SVN trunk for some testing. If it works, I'll backport it, potentially for a 2.2.4 release. Thanks, -Geoff On Mar 10, 2010, at 8:24 PM, Matt Sprague wrote: > I finally found a fix for the crash I was experiencing. I went back and read the documentation for libxml2 and found this (http://xmlsoft.org/threads.html) > > "call xmlInitParser() in the "main" thread before using any of the libxml2 API (except possibly selecting a different memory allocator)" > > > After making the following change to xml.cpp, everything works fine. > > if(_reader) > return true; //do not need to make a new reader > > //fix crash on GC in the C# bindings > xmlInitParser(); > > //If the inputstream is not at the start (probably arising in fastsearch), > //save its position and rewind so that the reader initialization is ok. > //(Getting the requested object is handled in ReadXML(), when the format is known.) > _requestedpos = GetInStream()->tellg(); > > The root cause of the crash was that the CLI runs finalizers in a separate thread, but libxml wasn't being setup for a multithreaded environment. While I don't think that adding this call will impact the base code, I wanted to run it by more experienced C++ programmers before committing anything. > > -Matt > > ------------------------------------------------------------------------------ > 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 > Ope...@li... > https://lists.sourceforge.net/lists/listinfo/openbabel-scripting |
From: Matt S. <mes...@gm...> - 2010-03-11 03:42:06
|
It's done. Let me know if you have any problems. -Matt On Wed, Mar 10, 2010 at 7:35 PM, Geoffrey Hutchison < ge...@ge...> wrote: > Matt, > > Great catch. This will probably help other people, since you're not the > only one running Open Babel in a separate thread. I suspect this is the root > cause of other XML crashes -- there are a few posted to the bug tracker. > > Let's commit this to SVN trunk for some testing. If it works, I'll backport > it, potentially for a 2.2.4 release. > > Thanks, > -Geoff > > > > |
From: Jason P. <pow...@gm...> - 2010-03-11 03:59:16
|
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 |
From: Noel O'B. <bao...@gm...> - 2010-03-11 09:48:52
|
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 <pow...@gm...> 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 > Ope...@li... > https://lists.sourceforge.net/lists/listinfo/openbabel-scripting > |
From: Noel O'B. <bao...@gm...> - 2010-03-11 14:39:57
|
---------- Forwarded message ---------- From: Jason Power <pow...@gm...> Date: 11 March 2010 14:28 Subject: Re: [OpenBabel-scripting] (no subject) To: Noel O'Boyle <bao...@gm...> 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 <pow...@gm...> 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 > > Ope...@li... > > https://lists.sourceforge.net/lists/listinfo/openbabel-scripting > |
From: Noel O'B. <bao...@gm...> - 2010-03-11 14:52:35
|
(Please cc to list) How about commenting about: ##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) and replacing it with: ring3.AddBond(1, 2, 1) ring3.AddBond(2, 3, 1) ring3.AddBond(3, 1, 1) - Noel On 11 March 2010 14:28, Jason Power <pow...@gm...> wrote: > 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 <pow...@gm...> 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 >> > Ope...@li... >> > https://lists.sourceforge.net/lists/listinfo/openbabel-scripting >> > |
From: Jason P. <pow...@gm...> - 2010-03-11 15:02:02
|
Sorry about that, didn't pay attention.. With this: import openbabel ring3 = openbabel.OBMol() ra1=ring3.NewAtom() ra2=ring3.NewAtom() ra3=ring3.NewAtom() ra1.SetAtomicNum(6) ra2.SetAtomicNum(6) ra3.SetAtomicNum(6) ring3.AddBond(1, 2, 1) ring3.AddBond(2, 3, 1) ring3.AddBond(3, 1, 1) print len(ring3.GetSSSR()) builder = openbabel.OBOp.FindType("Gen3D") builder.Do(ring3) print len(ring3.GetSSSR()) ra1.SetVector(1,0,0) ra2.SetVector(0,-1,0) ra3.SetVector(0,1,0) I now get the proper behavior of GetSSSR(), but I still get a segfault when I try to move the atoms. I assume this is because the pointers are not valid anymore. Why is this? Also, why would it work when I add a bond as you described and not work when I did it the way I was doing it? Does AddBond make some connections that I wasn't doing? Thanks, I think with this I can get my code to work! Jason On Thursday 11 March 2010 09:52:27 am Noel O'Boyle wrote: > (Please cc to list) > > How about commenting about: > > ##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) > > and replacing it with: > > ring3.AddBond(1, 2, 1) > ring3.AddBond(2, 3, 1) > ring3.AddBond(3, 1, 1) > > - Noel > > On 11 March 2010 14:28, Jason Power <pow...@gm...> wrote: > > 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 <pow...@gm...> 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 > >> > Ope...@li... > >> > https://lists.sourceforge.net/lists/listinfo/openbabel-scripting > |
From: Noel O'B. <bao...@gm...> - 2010-03-11 15:18:43
|
On 11 March 2010 15:01, Jason Power <pow...@gm...> wrote: > Sorry about that, didn't pay attention.. > > With this: > import openbabel > ring3 = openbabel.OBMol() > ra1=ring3.NewAtom() > ra2=ring3.NewAtom() > ra3=ring3.NewAtom() > ra1.SetAtomicNum(6) > ra2.SetAtomicNum(6) > ra3.SetAtomicNum(6) > ring3.AddBond(1, 2, 1) > ring3.AddBond(2, 3, 1) > ring3.AddBond(3, 1, 1) > print len(ring3.GetSSSR()) > builder = openbabel.OBOp.FindType("Gen3D") > builder.Do(ring3) > print len(ring3.GetSSSR()) > ra1.SetVector(1,0,0) > ra2.SetVector(0,-1,0) > ra3.SetVector(0,1,0) > > I now get the proper behavior of GetSSSR(), but I still get a segfault when I > try to move the atoms. I assume this is because the pointers are not valid > anymore. Why is this? I'm not sure. I have a feeling it would work fine from C++, because although the builder adds new atoms (Hs), it adds them at the end of the molecule and doesn't disturb the existing atoms. The way to find out would be the write the same code in C++ and step through it. In any case, it should work fine if you get the atom again with ring3.GetAtom(1).SetVector(whatever) > Also, why would it work when I add a bond as you described and not work when I > did it the way I was doing it? Does AddBond make some connections that I > wasn't doing? No that's not it. It's a limitation of the SWIG bindings. There are no pointers in Python, so what you have is only pretending to be a pointer as well as it can. In C++ your code would work as expected. I'll add some notes to the documentation pointing people in the direction of AddBond(). Perhaps I should also remove NewBond() from the bindings. > Thanks, I think with this I can get my code to work! > Jason > > On Thursday 11 March 2010 09:52:27 am Noel O'Boyle wrote: >> (Please cc to list) >> >> How about commenting about: >> >> ##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) >> >> and replacing it with: >> >> ring3.AddBond(1, 2, 1) >> ring3.AddBond(2, 3, 1) >> ring3.AddBond(3, 1, 1) >> >> - Noel >> >> On 11 March 2010 14:28, Jason Power <pow...@gm...> wrote: >> > 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 <pow...@gm...> 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 >> >> > Ope...@li... >> >> > https://lists.sourceforge.net/lists/listinfo/openbabel-scripting >> > |
From: Geoffrey H. <ge...@ge...> - 2010-03-11 16:32:18
|
On Mar 11, 2010, at 10:18 AM, Noel O'Boyle wrote: > direction of AddBond(). Perhaps I should also remove NewBond() from > the bindings. Yes, I think that's a good idea. -Geoff |