# Calculate the number of broken bonds in Cpm mat

Asked by Akm on 2020-02-12

Hi,

I am trying to calculate the number of bonds broken at each iteration in my simulation. I am using the cpm material and tried to plot it using the concept where I check if 'iscohesive==True ' but it doesn't work. Is there any other way to get these numbers?

Many thanks,
Arun

## Question information

Language:
English Edit question
Status:
Solved
For:
Assignee:
No assignee Edit question
Solved by:
Jan Stránský
Solved:
2020-02-17
Last query:
2020-02-17
2020-02-13
 Robert Caulk (rcaulk) said on 2020-02-12: #1

>but it doesn't work

Why doesn't it work?

 Jan Stránský (honzik) said on 2020-02-12: #2

> ... tried to plot it using the concept where I check if 'iscohesive==True '

please be more specific (ideally post a MWE [1])

> Is there any other way to get these numbers?

no, because "the concept where I check if 'iscohesive==True'" is the correct one

cheers
Jan

 Akm (arunkumarmurali) said on 2020-02-12: #3

Hi Jan and Robert,

My script is pretty lengthy and has a lot of imports. So let me just stick to those commands where I calculate the bond breakage statistics.

I do not get any change in the cohesive bond numbers even when I can see particles flying after bond breakage.

###At the start of the program
global cohesive_count
cohesive_count=0
for i in O.interactions:
if hasattr(i.phys, 'isCohesive'):
if i.phys.isCohesive == True:
cohesive_count+=1

###Inside a Pyrunner:
presentcohesive_count = 0
for i in O.interactions:
if hasattr(i.phys, 'isCohesive'):
if i.phys.isCohesive == 1:
presentcohesive_count+=1
noncohesive_count= cohesive_count-presentcohesive_count
print (noncohesive_count)

 Jan Stránský (honzik) said on 2020-02-13: #5

Have a look at Law2.omegaThreshold [1]. Set it to a value < 1 to actually break any interactions (currently the interactions are not broken even if they transmit almost no forces)
cheers
Jan

 Akm (arunkumarmurali) said on 2020-02-17: #6

Thanks Jan Stránský, that solved my question.

To post a message you must log in.