Python-openbabel code crashes definitely on program finish

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Python-openbabel code crashes definitely on program finish

comcon1
This is the part of program, which also crashes in the same way:

#!/usr/bin/python -d
import openbabel, sys, math, random
import numpy

try:
        def add(x, y): return x+y
        obC = openbabel.OBConversion()
        obC.SetInAndOutFormats("pdb", "pdb")

        mols = []
        verts = []
        probs = []

        # initializing structures
        if True:
          nmol = openbabel.OBMol()
          obC.ReadFile(nmol, "dppsnew.pdb")
          mols.append( nmol )
          nmol = openbabel.OBMol()
          obC.ReadFile( nmol, "chlnew.pdb")
          mols.append( nmol )

        # init values for grid
        numconformers = 50

# =================================================
#           crashes because of this block!!!
# =================================================
        for mol in mols:
                for i in range(0,numconformers):
                        nmol = openbabel.OBMol(mol)
                        for torl in openbabel.OBMolTorsionIter(nmol):
                                atlist = [nmol.GetAtom(torl[0]+1),
nmol.GetAtom(torl[1]+1), nmol.GetAtom(torl[2]+1),
nmol.GetAtom(torl[3]+1)]
                                if (atlist[1].IsInRing() and
atlist[2].IsInRing() ):
                                        continue
                                tor = nmol.GetTorsion(atlist[0],
atlist[1], atlist[2], atlist[3])
                                tor = random.gauss(tor, 3)*math.pi/180
                                nmol.SetTorsion(atlist[0], atlist[1],
atlist[2], atlist[3], tor)
                        mol.AddConformer(nmol.GetConformer(0))
# =================================================
#           end of block
# =================================================
finally:
        print 'Bue!'



crash message:

*** glibc detected *** /usr/bin/python2.6: double free or corruption
(out): 0x0000000000d4bd20 ***
======= Backtrace: =========
/lib/libc.so.6[0x7f5f621f14ce]
/lib/libc.so.6(cfree+0x75)[0x7f5f621f2dbb]
/usr/local/lib/libopenbabel.so.3(_ZN9OpenBabel5OBMolD0Ev+0xd0)[0x7f5f61a135e0]


Program crashes at end everywhere - in debian, gento and cygwin.
Program works absolutely normally. The only error - is the crush on
the end, while destructing. What I does wrong with conformers?

Thank you.

------------------------------------------------------------------------------
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-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Python-openbabel code crashes definitely on program finish

Noel O'Boyle
Administrator
Hello Alexey,

To make it easier for us to identify the problem, could you provide
the simplest possible program that causes the program? Could you name
a PDB file that causes the problem?

- Noel

On 22 February 2010 17:32, Alexey Nesternko <[hidden email]> wrote:

> This is the part of program, which also crashes in the same way:
>
> #!/usr/bin/python -d
> import openbabel, sys, math, random
> import numpy
>
> try:
>        def add(x, y): return x+y
>        obC = openbabel.OBConversion()
>        obC.SetInAndOutFormats("pdb", "pdb")
>
>        mols = []
>        verts = []
>        probs = []
>
>        # initializing structures
>        if True:
>          nmol = openbabel.OBMol()
>          obC.ReadFile(nmol, "dppsnew.pdb")
>          mols.append( nmol )
>          nmol = openbabel.OBMol()
>          obC.ReadFile( nmol, "chlnew.pdb")
>          mols.append( nmol )
>
>        # init values for grid
>        numconformers = 50
>
> # =================================================
> #           crashes because of this block!!!
> # =================================================
>        for mol in mols:
>                for i in range(0,numconformers):
>                        nmol = openbabel.OBMol(mol)
>                        for torl in openbabel.OBMolTorsionIter(nmol):
>                                atlist = [nmol.GetAtom(torl[0]+1),
> nmol.GetAtom(torl[1]+1), nmol.GetAtom(torl[2]+1),
> nmol.GetAtom(torl[3]+1)]
>                                if (atlist[1].IsInRing() and
> atlist[2].IsInRing() ):
>                                        continue
>                                tor = nmol.GetTorsion(atlist[0],
> atlist[1], atlist[2], atlist[3])
>                                tor = random.gauss(tor, 3)*math.pi/180
>                                nmol.SetTorsion(atlist[0], atlist[1],
> atlist[2], atlist[3], tor)
>                        mol.AddConformer(nmol.GetConformer(0))
> # =================================================
> #           end of block
> # =================================================
> finally:
>        print 'Bue!'
>
>
>
> crash message:
>
> *** glibc detected *** /usr/bin/python2.6: double free or corruption
> (out): 0x0000000000d4bd20 ***
> ======= Backtrace: =========
> /lib/libc.so.6[0x7f5f621f14ce]
> /lib/libc.so.6(cfree+0x75)[0x7f5f621f2dbb]
> /usr/local/lib/libopenbabel.so.3(_ZN9OpenBabel5OBMolD0Ev+0xd0)[0x7f5f61a135e0]
>
>
> Program crashes at end everywhere - in debian, gento and cygwin.
> Program works absolutely normally. The only error - is the crush on
> the end, while destructing. What I does wrong with conformers?
>
> Thank you.
>
> ------------------------------------------------------------------------------
> Download Intel&#174; 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-discuss mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>

------------------------------------------------------------------------------
Download Intel&#174; 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-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Python-openbabel code crashes definitely on program finish

Noel O'Boyle
Administrator
Sorry - a typo:

" To make it easier for us to identify the problem, could you provide
the simplest possible program that causes the problem? Could you name
a PDB file that causes the problem?"

On 22 February 2010 18:39, Noel O'Boyle <[hidden email]> wrote:

> Hello Alexey,
>
> To make it easier for us to identify the problem, could you provide
> the simplest possible program that causes the program? Could you name
> a PDB file that causes the problem?
>
> - Noel
>
> On 22 February 2010 17:32, Alexey Nesternko <[hidden email]> wrote:
>> This is the part of program, which also crashes in the same way:
>>
>> #!/usr/bin/python -d
>> import openbabel, sys, math, random
>> import numpy
>>
>> try:
>>        def add(x, y): return x+y
>>        obC = openbabel.OBConversion()
>>        obC.SetInAndOutFormats("pdb", "pdb")
>>
>>        mols = []
>>        verts = []
>>        probs = []
>>
>>        # initializing structures
>>        if True:
>>          nmol = openbabel.OBMol()
>>          obC.ReadFile(nmol, "dppsnew.pdb")
>>          mols.append( nmol )
>>          nmol = openbabel.OBMol()
>>          obC.ReadFile( nmol, "chlnew.pdb")
>>          mols.append( nmol )
>>
>>        # init values for grid
>>        numconformers = 50
>>
>> # =================================================
>> #           crashes because of this block!!!
>> # =================================================
>>        for mol in mols:
>>                for i in range(0,numconformers):
>>                        nmol = openbabel.OBMol(mol)
>>                        for torl in openbabel.OBMolTorsionIter(nmol):
>>                                atlist = [nmol.GetAtom(torl[0]+1),
>> nmol.GetAtom(torl[1]+1), nmol.GetAtom(torl[2]+1),
>> nmol.GetAtom(torl[3]+1)]
>>                                if (atlist[1].IsInRing() and
>> atlist[2].IsInRing() ):
>>                                        continue
>>                                tor = nmol.GetTorsion(atlist[0],
>> atlist[1], atlist[2], atlist[3])
>>                                tor = random.gauss(tor, 3)*math.pi/180
>>                                nmol.SetTorsion(atlist[0], atlist[1],
>> atlist[2], atlist[3], tor)
>>                        mol.AddConformer(nmol.GetConformer(0))
>> # =================================================
>> #           end of block
>> # =================================================
>> finally:
>>        print 'Bue!'
>>
>>
>>
>> crash message:
>>
>> *** glibc detected *** /usr/bin/python2.6: double free or corruption
>> (out): 0x0000000000d4bd20 ***
>> ======= Backtrace: =========
>> /lib/libc.so.6[0x7f5f621f14ce]
>> /lib/libc.so.6(cfree+0x75)[0x7f5f621f2dbb]
>> /usr/local/lib/libopenbabel.so.3(_ZN9OpenBabel5OBMolD0Ev+0xd0)[0x7f5f61a135e0]
>>
>>
>> Program crashes at end everywhere - in debian, gento and cygwin.
>> Program works absolutely normally. The only error - is the crush on
>> the end, while destructing. What I does wrong with conformers?
>>
>> Thank you.
>>
>> ------------------------------------------------------------------------------
>> Download Intel&#174; 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-discuss mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>>
>

------------------------------------------------------------------------------
Download Intel&#174; 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-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Python-openbabel code crashes definitely on program finish

comcon1
The code, I has written in the post in eough to reproduce a problem. Problem doesn't depends on what PDB files i use. For example, it was cholesterol. In my case it was 2 lipids, I can The problem is memory leak during destructing mols array.
Reply | Threaded
Open this post in threaded view
|

Re: Python-openbabel code crashes definitely on program finish

Noel O'Boyle
Administrator
The reason I asked for a simple test case is not to reproduce the
problem, but to fix it quickly. I don't have the time right now to
properly indent your code, figure out what it's doing, shorten it
myself and identify the problem.

- Noel

On 22 February 2010 18:58, comcon1 <[hidden email]> wrote:

> The code, I has written in the post in eough to reproduce a problem. Problem
> doesn't depends on what PDB files i use. For example, it was cholesterol. In
> my case it was 2 lipids, I can The problem is memory leak during destructing
> mols array.
> ________________________________
> View this message in context: Re: Python-openbabel code crashes definitely
> on program finish
> Sent from the openbabel-discuss mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Download Intel&#174; 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-discuss mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
>

------------------------------------------------------------------------------
Download Intel&#174; 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-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss