fix_ave/spatial command


Here is how I use fix ave/spatial to get the stress profile (Pxx, Pyy, Pzz) in the x-direction:

variable NTS equal 1000000 #Total number of timesteps
variable NBLK equal 1 #Total number of blocks
variable Nevery equal 50 #Number of time-steps between property samples
variable Nrepeat equal {NTS}/{Nevery}/{NBLK} variable Nfreq equal {NTS}/${NBLK}
variable NBIN equal 50 #Number of bins in the x direction

variable dx equal 1/${NBIN} #Bin size

compute atomstress all stress/atom

fix 1 all ave/spatial {Nevery} {Nrepeat} {Nfreq} x center {dx} c_atomstress[1] c_atomstress[2] c_atomstress[3] units reduced file stress.txt

Thank you for providing an example, Stan.

Here is what I'm facing now.

If I give command as the following,

The fix ave/spatial command does not compute
a vector (as the error message says). It computes
an array (see the doc page). Thus you need 2
subscripts to access an element of the array
to do thermo output of a single value.