[lammps-users] Averaging Forces on Groups of Atoms


I want to write one component of the average of the forces acting on a group of atoms every nth time step to a file. The following line of script returns an error, "Illegal fix ave/time command". 

fix aforce grp1 ave/time 1 10 100 fx file aveforce.txt 

Thanks again!

Nicholas Jabari Lee

More details:

The problem seems to be with fx. I think need to change it to c_myfx and then add a compute-reduce-ave statment that defines c_myfx before the fix.   

compute 1 all reduce ave c_myfx

I need help with the syntax. How do a specify that I want

myfx = sum (fx[i]) / N  

, where fx[i] is the x force component of atom i, i=1,...,N; N is the total number of atoms?

You can't average a per-atom quantity like fx with fix ave/time - the doc
page for it is quite clear on this. FIx ave/atom will do this, and
compute reduce
will let you collapse it into a single value. I suggest you read howto section
4.15 of the manual. It explains global vs per-atom vs local quantities and
all the various commands that take these as input and produce output of
various kinds.