# yade-users team mailing list archive

## Re: [Question #695739]: Calculation of the number of contact point in the particles

```Question #695739 on Yade changed:

Description changed to:
Hi,

I have a question about estimating the contact number of every particle
when the particles are stopped.

I am studying the effect of the porosity of the powder layer on the electrical resistance.
First, in this code, the spherical powder is replaced with some crump powder and falls into facetBox by gravitational force.
I'd like to get the number of contact points between particles after the sphere pack falling because it is one of the crucial points for the electroconductivity of the powder layer.
Moreover,  I would like to get the number of contact points of the clamp powder and that of spherical powder separately.

The code is as follows:

******************************************************************************************************************
from yade import pack, qt, plot, utils, geom, export, ymport

#Base plates properties
Baseplate=O.materials.append(FrictMat(young=190e9,poisson=.265,density=7970,frictionAngle=0.12,label="Baseplate"))

#Create base plate using facets
O.bodies.append(geom.facetBox((0,0,0), (0.21,0.21,0.21), orientation=Quaternion((1,0,0),0), wallMask=31, color=(1,0,0), material=Baseplate))    #Smkoking hole setting

#powder properties
PB=O.materials.append(FrictMat(young=220e9,poisson=.3,density=8287,frictionAngle=0,label="TiAl powder"))

#create Spherepack
sp=pack.SpherePack()

#Paricle size distribution of ball milled powder
sp.makeCloud((-0.2,-0.2,-0.2),(0.2,0.2,0.2), psdSizes=[0.021,0.023,0.025,0.027,0.03,0.033,0.036,0.040,0.044,0.048,0.053,0.058,0.063,0.070,0.076,0.084,0.092,0.101,0.111], psdCumm=[0.0021,0.0049,0.00588,0.00657,0.00907,0.01467,0.02897,0.05637,0.10027,0.16277,0.24527,0.34827,0.47627,0.61227,0.74827,0.86627,0.94987,0.99047,1], distributeMass=True)

#Make the cloud
sp.toSimulation(material=PB)

#Clump setting (by Circularity)
#0.8:
relPosList1 = [[0,0,0],[0.84,0,0]]

#0.6:
relPosList2 = [[0,0,0],[0.6,0,0]]

#0.4:
relPosList3 = [[1,0,0],[1.72,0,0],[2.32,0,0]]

#0.2:
#relPosList4 = [[1,0,0],[1.6,0,0],[2.2,0,0],[2.8,0,0],[3.4,0,0],[4.0,0,0]]

templates= []

#Clump fraction :
CP=O.bodies.replaceByClumps(templates,[0.20773,0.09662,0.00966],discretization=1)

O.engines=[
ForceResetter(),                                              #reset forces

InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()]),
#approximate collision detection

InteractionLoop(                                              # handle sphere+sphere and facet+sphere collisions
[Ig2_Sphere_Sphere_ScGeom(),Ig2_Facet_Sphere_ScGeom()],
[Ip2_FrictMat_FrictMat_MindlinPhys(
frictAngle=MatchMaker(matches=((Baseplate,PB,.451),(PB,PB,.451), )),
en=MatchMaker(matches=((Baseplate,PB,.15), (PB,PB,.45), )),
es=MatchMaker(matches=((Baseplate,PB,.10), (PB,PB,.15))))],
[Law2_ScGeom_MindlinPhys_Mindlin()]
),
NewtonIntegrator(damping=0.75, gravity=[0,0,-9.81]),
]

#PyRunner(iterPeriod=200,command='calm()',label='calmRunner')]

O.dt=.85*PWaveTimeStep()

qt.View()

qt.Controller()

O.saveTmp('yim')

#utils.voxelPorosity(resolution=200,start=(-0.8,-0.8,-0.8),end=(0.8,0.8,-0.4))
#Porocity of powderbed

#Contact number of particles
bodyList = []
for i in O.bodies:
if i.isClump:
bodyList.append(i.id)

len(O.bodies[i.id].intrs())

*********************************************************************************************************************

Thanks,

YIM

--