# Coordination Number

Hi everybody.

I'm trying to evaluate the mean coordination number (mean number of contact of a bunch of particle) of a packing. I have not written down the code yet, but the idea is that, during the simulation, there will be several generations of spheres with the make cloud option. These spheres, after some steps and thanks to gravity (similarly to a pinball), will finally end in one of two different top-opened boxes. I'd like to know the coordination number of the spheres that will end in the first of the two boxes which is, i.e.:

Basically, can you suggest me how to evaluate the mean number of concact of a group of spheres contained in a specific volume?

Thank you

## Question information

Language:
English Edit question
Status:
For:
Assignee:
No assignee Edit question
Last query:
2020-03-06
2020-03-06
 Jan Stránský (honzik) said on 2020-03-02: #1

Hello,

roughly:

1) select the relevant spheres, whose center is inside a box
sphs = [b for b in O.bodies if isInsideRelevantBox(b)]

2) compute number of interactions of each sphere using b.intrs() [1]
you can also use information about shape to exclude sphere-nonsphere contact if it is not desirable

3) averaging is trivial

cheers
Jan

 Paolo (p4olo) said on 2020-03-05: #2

By the way, I can't understand how I could define the condition of being in the box I want. Moreover, which is the difference between intrs() and avgNumInteractions?
Thanks

 Jan Stránský (honzik) said on 2020-03-05: #3

> I can't understand how I could define the condition of being in the box I want.

please be more specific what you can't understand (principles, how to code it, how to use values from yade, ...).
It also pretty much depends on what "box" actually is.

> which is the difference between intrs() and avgNumInteractions?

documentation [2,3] is clear IMO. The main difference is returned type:
- b.intrs() returns a **list of interactions**
- avgNumInteractions() returns average **number** of interactions per particle

the other difference is domain considered:
- b.intrs() deals with one body
- avgNumInteractions() deals with all bodies (hence not suitable for your task)

cheers
Jan

 Paolo (p4olo) said on 2020-03-06: #4

My box is a facetbox with its top open. Let's suppose that I'd like to determine the averege coordination number of the spheres which are inside:

You suggested me to detect the relevant spheres whose center is inside the facetbox

sphs = [b for b in O.bodies if isInsideRelevantBox(b)]

I can't understande how to code the isInsideRelevantBox condition.

I think it could be something related to the x,y,z relative position between a center and the box. Basically a sphere is inside it

if -d/2<b.state.pos[0]<d/2 and -l/2<b.state.pos[1]<l/2 and -h/2<b.state.pos[2]<h/2

 Chareyre (bruno-chareyre-9) said on 2020-03-06: #5

You could put this in a function to be used in the condition.
Bruno

Le ven. 6 mars. 2020 14:17, Paolo <email address hidden> a
écrit :

> Question #689086 on Yade changed:
>
>
> Paolo is still having a problem:
> My box is a facetbox with its top open. Let's suppose that I'd like to
> determine the averege coordination number of the spheres which are
> inside:
>
>
> You suggested me to detect the relevant spheres whose center is inside
> the facetbox
>
> sphs = [b for b in O.bodies if isInsideRelevantBox(b)]
>
> I can't understande how to code the isInsideRelevantBox condition.
>
> I think it could be something related to the x,y,z relative position
> between a center and the box. Basically a sphere is inside it
>
> if -d/2<b.state.pos[0]<d/2 and -l/2<b.state.pos[1]<l/2 and
> -h/2<b.state.pos[2]<h/2
>
> --
>
> _______________________________________________
> Post to : <email address hidden>