Good point :-)As a key note, always run your code through a build with checks turned on. It probably would have told you immediately that you are walking off the end of an array.
Sent from Mailbox for iPhoneOn Fri, Jan 10, 2014 at 4:49 AM, Davide Bał <davide.bau@gmail.com> wrote:
Yes,
it occurs inside the loop. The loop is run inside a function:def setup_angles(m, ps, particles):i = 0while (i <= particles-3):p1 = ps.get_particle(i)p2 = ps.get_particle(i+2)p3 = ps.get_particle(i+3)ar = IMP.core.AngleRestraint(IMP.core.Harmonic(0, 1), p1, p2, p3)m.add_restraint(ar)i += 3As for the stack trace, I'm not totally sure about how to do it. I've done the following:$ gdb python(gdb) run model.pyStarting program: /usr/bin/python model.py[Thread debugging using libthread_db enabled]Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".Program received signal SIGSEGV, Segmentation fault.0x00007ffff5dd5eb0 in IMP::kernel::Particle::get_index() const () from /usr/src/imp/imp-r2.1.1/lib/libimp_kernel.so(gdb)DavideOn Jan 10, 2014, at 1:12 PM, Daniel Russel wrote:Hmmm, that code looks fine. Can you get a stack trace for a core dump? When does the core dump occur, in that loop?BTW, you can pull the Harmonic out of the loop and share one harmonic between many angle restraints._______________________________________________On Fri, Jan 10, 2014 at 3:52 AM, Davide Bał <davide.bau@gmail.com> wrote:Hi,
I'm having some (random) errors with the AngleRestraint function.
I get a Segmentation fault (core dumped) error when applying an AngleRestraint restraint like:
i = 0
while (i <= particles-3):
p1 = ps.get_particle(i)
p2 = ps.get_particle(i+2)
p3 = ps.get_particle(i+3)
ar = IMP.core.AngleRestraint(IMP.core.Harmonic(0, 1), p1, p2, p3)
m.add_restraint(ar)
i += 3
The error is not persistent, meaning that if I run the code severe times, the error disappear and the code ends normally.
Is there any specify reason for such an error?
Thanks!
Davide
_______________________________________________
IMP-dev mailing list
IMP-dev@salilab.org
https://salilab.org/mailman/listinfo/imp-dev
IMP-dev mailing list
IMP-dev@salilab.org
https://salilab.org/mailman/listinfo/imp-dev
_______________________________________________
IMP-dev mailing list
IMP-dev@salilab.org
https://salilab.org/mailman/listinfo/imp-dev