I'm trying to write a new compute script to throw in the src folder that sums up the magnitude of the contact forces in the system. I tried to basically copy compute_pair_gran_local.cpp since that file directly works with the contact forces, and in my new file I would put a compute_scalar command to output a single global value that I want. The problem I run into is that compute_pair_gran_local.cpp only allows a single simulation to have one PairGran object registered using the register_compute_pair_gran_local function. So basically it seems that if I make a script that accesses the same information in compute_pair_gran_local.cpp then I will get an error or LIGGGHTS will crash.
Is there a simple way to access an array of all the contact forces using pointers? Or is there a series of steps to take in the C++ file to ultimately get this type of array? Is it also possible to have a compute_scalar() function in compute_pair_gran_local.cpp that works simultaneously with compute_local() so that I can have the scalar I need without sacrificing the outputted array of contact force information?
Hi Estefan,
Hi Estefan,
a compute reduce on the compute pair/gran/local would give you the sum of all contact forces.
If you want the sum of the magnitudes, you could extend the compute reduce command to do this!
Christoph
Help in dumping contact forces
Hi,
I am relatively new to LIGGGHTS. In my simulation I am trying to dump contact forces. I use the following line I found from one of the forums.
compute fc all pair/gran/local id pos force
dump cforce all local 70000000 post/dump.fc.*.liggghts c_fc[1] c_fc[2] c_fc[3] c_fc[4] c_fc[5] c_fc[6] c_fc[7] c_fc[8] c_fc[9] c_fc[10] c_fc[11] c_fc[12]
Then my output dump files show no numbers whatsoever.
ITEM: TIMESTEP
680000
ITEM: NUMBER OF ENTRIES
0
ITEM: BOX BOUNDS ff ff ff
-0.09525 0.09525
-0.09525 0.09525
-0.09525 0.15875
ITEM: ENTRIES c_fc[1] c_fc[2] c_fc[3] c_fc[4] c_fc[5] c_fc[6] c_fc[7] c_fc[8] c_fc[9] c_fc[10] c_fc[11] c_fc[12]
If I am doing something wrong, Could anyone tell me what are the steps that I should follow to get the contact forces?
Thank you,
Anjana