Output collsions particles-walls and particle-particle per cycle

Asked by rox212

Hi! I want to know if it is possible to access the total number of collisions of particles with:
1) walls (top and bottom walls if possible)
2) other particles
I want to access these parameters at each cycle or time step.

I am using Yade 2018b with following engines:

And I am using the following engines with integrators/laws:

O.engines = [
    HarmonicMotionEngine(A=amplitude, f=frequency , fi = initialPhase, ids = idTop, label='combEngine',dead=True),
    HarmonicMotionEngine(A=amplitude, f=frequency , fi = initialPhase, ids = idWalls, label='combEngine1',dead=True),
    HarmonicMotionEngine(A=amplitude, f=frequency , fi = initialPhase, ids = idBottom, label='combEngine2',dead=True),

Thank you for your help!

Question information

English Edit question
Yade Edit question
No assignee Edit question
Solved by:
Last query:
Last reply:
Revision history for this message
Bruno Chareyre (bruno-chareyre) said :

How do you distinguish a collision from a contact?

Revision history for this message
rox212 (rox212) said :

I do not understand the question, a collision implies a contact.
I just want to know if there is a way in yade to access total particles collisions in a specific interval of simulation time.
By "hand" is inefficient to do that since it is a double loop in the positions given a cut-off and check out if there has been a collision (like the equations used in an Event-Driven MD).

Is it possible in yade to check how many contacts/collisions had happened in a specific interval?

Revision history for this message
Jan Stránský (honzik) said :


number of interactions/contacts of one specific body (e.g. a wall) you can do
len(body.intrs()) # [1]

For more "overall" interaction statistics, you can loop over interactions [2].
E.g. to get total number of sphere-sphere (meaning of particle-particle?) interactoins:
### maybe better to put the code in a function
nSphSph = 0
for i in O.interactions:
    shape1 = O.bodies[i.id1].shape
    shape2 = O.bodies[i.id2].shape
    if type(shape1) is Sphere and type(shape2) is Sphere:
        nSphSph += 1


[1] https://yade-dem.org/doc/yade.wrapper.html#yade.wrapper.Body.intrs
[2] https://yade-dem.org/doc/yade.wrapper.html#yade.wrapper.Omega.interactions

Revision history for this message
rox212 (rox212) said :

Thank you very much! This was really helpful.