RotParticle Bingle

Asked by David Ely

I am having a problem with the Bingle scripts when I change the particle type to RotSphere and use the RotFrictionPrms() InteractionGroup. Specifically, the script which outputs the particles' positions to the screen fails when the particles collide with the following error:

Traceback (most recent call last):
  File "bingle_output.py", line 82, in <module>
    p2 = particles[1].getPosn()
IndexError: list index out of range

I don't understand why the second particle is going out of range upon collision. Any ideas?

Thanks,
David

Question information

Language:
English Edit question
Status:
Solved
For:
ESyS-Particle Edit question
Assignee:
No assignee Edit question
Solved by:
Dion Weatherley
Solved:
Last query:
Last reply:
Revision history for this message
Best Dion Weatherley (d-weatherley) said :
#1

Hi David,

I think the problem is due to a typo in the bingle_output.py code-listing in the Tutorial. When creating the two particles I have inadvertently assigned the same particle ID to both particles (id=0). Replace the particle creation lines with:

#add the first particle to the domain:
particle=NRotSphere(id=0, posn=Vec3(-5,5,-5), radius=1.0, mass=1.0)
particle.setLinearVelocity(Vec3(1.0,-1.0,1.0))
sim.createParticle(particle)

#add the second particle to the domain:
particle=NRotSphere(id=1, posn=Vec3(5,5,5), radius=1.5, mass=2.0)
particle.setLinearVelocity(Vec3(-1.0,-1.0,-1.0))
sim.createParticle(particle)

I have no idea why this bug was not picked up for non-rotational interactions. Let me know if this solves your problem.

Cheers,

Dion.

Revision history for this message
David Ely (dely-pharmacy) said :
#2

Thanks Dion Weatherley, that solved my question.