Hi,
I am working on the rheology of sticky polymers where beads are represented by stickers, and they are connected by springs. Now I aim to add an angle between the stuck stickers, which will allow me to modify the persistence length of the chains.
Now my simulation tracks the list of stuck sticker tags, which is saved as an "associations" list in the HOOMD script.
system=hoomd.init.read_snapshot(snap)
trajWriter=hoomd.dump.gsd(filename= runname + ".gsd", group=all, period=1000, overwrite=True, dynamic=['momentum'])
trajWriter.log['associations']= lambda timestep: nl_functional.cpp_nlist.getNListArray(sticker_tags)
Now, I need to add an angle between the stuck stickers printed in 'associations' array, but I am unable to read the associations array at each timestep in the HOOMD script. For example, I can print the list using the callback function:
def printassoc(timestep):
global asso
asso=nl_functional.cpp_nlist.getNListArray(sticker_tags)
print(asso)
return [asso]
hoomd.analyze.callback(callback=printassoc,period=1000)
For example, suppose I have two dumbbells: The "asso" will print the particle tags as [3,2,1,0] at each time step, where particle tag 3 is stuck to 0 and 2 is stuck with 1, etc. But now I need to instruct HOOMD to add angles between the stuck stickers (adding triplets as (0,1,2), (1,2,3) etc.), which can be done by the system.angles.add(....), but how can I instruct HOOMD to read the "asso" list at each timestep outside the function "printassoc" ? How can I access the "asso" list outside the function "printassoc" at each timestep?
For example, for each timestep, the "asso" array will be read, and the angles will be added and removed at each timestep, and this should continue until the simulation ends. It will be grateful if someone guides me on how I can modify the HOOMD script.
Thanks and Regards,
Avishek