← Back to team overview

yade-users team mailing list archive

Re: [Question #688885]: Finding where a bond broke

 

Question #688885 on Yade changed:
https://answers.launchpad.net/yade/+question/688885

mrhappy posted a new comment:
Here is my final solution:
#SET This stores all connections. 1 means intact and 0 means broken.
Connectivity = [[5000, 4900, 1], 
[5001, 4901, 1], 
[5002, 4902, 1], 
[5003, 4903, 1], 
[5004, 4904, 1], 
[5005, 4905, 0], 
[5006, 4906, 0], 
[5007, 4907, 1], 
[5008, 4908, 1], 
]

#This function is called every loop to check which bond has broken
def BreakingBonds():
	CurrentBonds = 0
 	for i in O.interactions: 
      		CurrentBonds+=1 
	if Bonds0 > CurrentBonds:
		global Bonds0
		Bonds0 = Bonds0 - 1
		print("BROKEN!") 
        m = 0 
        for row in Connectivity: 
                if (Connectivity[m][2] == 1):
                        if (O.interactions[Connectivity[m][1],Connectivity[m][0]].phys.isBroken == True):
                             Connectivity[m][2] = 0
                m = m + 1

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.