How to calculate the magnitude and average of contact force?

Submitted by Rachel on Thu, 01/17/2019 - 03:56

Hi colleagues,

I am facing a problem about outputing the magnitude and average of contact force, but failed.
To obtain the contact force, I use command:
compute fc all pair/gran/local pos id force (the 10-12th values are the contact forces on x,y,z directions)

Then I use:
variable avefc atom sqrt(c_fc[10]^2+c_fc[11]^2+c_fc[12]^2)
to calculate the magnitude of contact force.

To obtain the average of the contact force, I use command:
compute meanCF all reduce ave v_avefc
varaible vmeancf equal c_meanCF
fix outp all print 1000 "${vmeancf}" screen no title "vmeancf" file force.txt (to output the average of contact force)

However, it reports the Error: "mismatched compute in variable formula."

How could I get the magnitude and average of the contact force? Any clues are appreciated!

Best,
Rachel

Daniel Queteschiner | Fri, 01/18/2019 - 09:39

compute pair/gran/local is computing per-contact data, a variable of type atom is expecting per-atom data. Hence the sizes don't match.
I suggest to print the contact data to a file (e.g. using dump local) and use matlab, octave, ... to postprocess it afterwards.