How to save the maximum of contact force in LIGGGHTS

Submitted by Zheng Hu on Tue, 10/10/2017 - 00:37

Dear all,

I am facing a problem about saving the maximum of contact force.
I first get the pair-force with:

compute fc all pair/gran/local force
variable fmag atom sqrt(c_fc[1]^2+c_fc[2]^2+c_fc[3]^2)
compute maxfmag all reduce max v_fmag
variable maxcm equal c_maxfmag

There seems no mistakes while operating the above code, however, when I tried to output the result using:

fix data_max all print 10000 "The maximum of contact force = ${maxcm}" file data.txt

I got ERROR: Mismatched compute in variable formula (../variable.cpp:1140)

Note: I have also tried to use: "fix cfc all store/state 1 c_fc[1] c_fc[2] c_fc[3]" after "computer fc all pair/gran/local force", but it appeared the ERROR: Fix store/state compute does not calculate per-atom values.

Could someone please help me with this problem? How can I get the maximums of contact force of particles and output them? Many thanks!!!

AnjanaKittu | Fri, 12/15/2017 - 21:10

I am trying to output contact forces using these codes
compute fc all pair/gran/local id pos force
dump cforce all local 40000 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]

in my output file there are no numbers. I cant figure out why!

arnom's picture

arnom | Tue, 02/12/2019 - 17:02

While already an older issue I just had a look at this and it's not really an issue as it's not supposed to work.

The reason why you are only seeing the error with the print command is that, if there is no print command none of the variables are actually computed (they are only computed when required).

Secondly, variable fmag atom sqrt(c_fc[1]^2+c_fc[2]^2+c_fc[3]^2) will not work as c_fc has no per-atom output as it calculates a property per contact and not per atom.

Similarly the issue of @AnjanaKittu: dump local is for dumping per-atom properties. To dump contact properties use the dump local/gran/vtk instead.

The correct way to get the max of a component is to use a compute id all reduce max c_fc[1]
The only downside here is that it's not possible to get the magnitude.

KInd regards,

DCS team member & LIGGGHTS(R) core developer