# Problem applying bonds property in PFC 2D

**URL:** <https://forum.itascainternational.com/t/problem-applying-bonds-property-in-pfc-2d/1625>\
**Category:** Uncategorized\
**Created:** [August 8, 2024, 6:17am UTC](https://forum.itascainternational.com/t/problem-applying-bonds-property-in-pfc-2d/1625 "2024-08-08T06:17:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![123](https://avatars.discourse-cdn.com/v4/letter/1/7feea3/32.png) [@123](https://forum.itascainternational.com/u/123)\
**Post date:** [August 8, 2024, 6:17am UTC](https://forum.itascainternational.com/t/problem-applying-bonds-property-in-pfc-2d/1625/1 "2024-08-08T06:17:26Z")

</div>

I WANT TO SHARE SNIPPET OF MY CODE :  
fish def applybonds(pb\_kn,pb\_ks,pb\_ten,pb\_coh,pb\_rmul)  
cluster = cluster\_head  
loop while cluster # null  
loop i(1,bnumber-1)  
bp = memory(cluster+i+2)  
bp\_next=memory(cluster+i+3)  
local clist = ball.contactmap(bp)  
section  
loop foreach local con clist  
ok=0  
if contact.end1(con) = bp\_next  
ok=1  
else if contact.end2(con) = bp\_next  
ok=1  
endif  
if ok=1  
local arg = array.create(1,2)  
arg(1,1) = ‘gap’  
arg(1,2) = 0.0  
contact.method(con,“bond”,arg)  
contact.prop(con,“pb\_kn”)=pb\_kn  
contact.prop(con,“pb\_ks”)=pb\_ks  
contact.prop(con,“pb\_ten”)=pb\_ten  
contact.prop(con,“pb\_coh”)=pb\_coh  
contact.prop(con,“pb\_rmul”)=pb\_rmul  
exit section  
endif  
endloop  
endsection  
endloop  
cluster = memory(cluster)  
endloop  
end

AFTER DEFINING THE applybonds i try to assign value of bonds, for this i use this code:  
[pb\_kn=1e12]  
[pb\_ks=1e12]  
[pb\_ten=1e8]  
[pb\_coh=1e6]  
[pb\_rmul=0.8]

[applybonds(pb\_kn,pb\_ks,pb\_ten,pb\_coh,pb\_rmul)]

while running this second code i get this error massage:  
Unrecognized word. You cannot create a new symbol except as part of a direct assignment.  
Make certain the variable name is correct.  
You can use the GLOBAL statement to explicitly declare a variable if you are certain it will be assigned a value before use.

---

<div class="post-metadata">

**Author:** ![dblanksma](https://avatars.discourse-cdn.com/v4/letter/d/858c86/32.png) [@dblanksma](https://forum.itascainternational.com/u/dblanksma)\
**Post date:** [August 12, 2024, 3:02pm UTC](https://forum.itascainternational.com/t/problem-applying-bonds-property-in-pfc-2d/1625/2 "2024-08-12T15:02:05Z")

</div>

Hello @123,  
My guess is that cluster\_head has not been initialized. Check to see what value cluster\_head is before you run the function.
