[lammps-users] Problem with fix ave/spatial

Dear LAMMPS users,

The time-averaging in fix ave/spatial gives me results which I can't
understand. I want to calculate the temperature distribution in a
simulation box using fix ave/spatial with my own variable v_Tslice. To
test it, I use the fix once (fix SLICE ...) with
Nevery=1, Nrepeat=1, Nfreq=1
so that values are written out at every time-step and no time-averaging
is done. I use it a second time (fix SLICE_NOAVE ...) with
Nevery=6, Nrepeat=2, Nfreq=12,
so that at t=24 the average of the instantaneous values at t=18 and t=24
should be calculated, and at t=36 the average of the instantaneous
values at t=30 and t=36, etc.

The full input file and results are shown below this message.
Considering layer 1, SLICE gives the values 158.746 at t=18 and 226.669
at t=24, so the average is 192.7075. This differs from the value of
193.23 calculated by SLICE_NOAVE at t=24. Shouldn't they be the same? If
I've misunderstood the time-averaging, please explain where the value of
SLICE_NOAVE comes from.

Also, is there any way of changing the precision of the values written
out by this fix (like the 'format' option for thermo)?

Thanks for your help,

Philip

%%%%%% Input file %%%%%%%%%%%%%%%%%%

############## Initialize ########################################

boundary p p p
units real
atom_style atomic
lattice diamond 5.45 origin 0 0 0
region box block 0 2 0 2 0 4
create_box 1 box
create_atoms 1 box
mass 1 28.0855
timestep 1

############### Definition of potential #########################

pair_style sw
pair_coeff * * SiGe_real.sw Si

############### Definition of regions and groups ###################

region HOT_REGION block 0 2 0 2 0.5 1.49999 units lattice
region COLD_REGION block 0 2 0 2 2.5 3.49999 units lattice
group HOT_ATOMS region HOT_REGION
group COLD_ATOMS region COLD_REGION

############### Equilibration #######################################

velocity all create 500 9572 mom yes rot yes dist gaussian
fix NVT all nvt 500 500 10.0 drag 2.
run 12
unfix NVT

############### Pump energy in/out and calculate local temperature

Averages of averages can be computed in different
ways. See the optional "ave" keyword as part of
the fix ave/spatial command.

If you want the precision in the output ave file changed,
you'd have to edit the code. You can also access this
fix's values from thermo and output them with thermo,
in which case you could control precision with thermo_modify.

Steve

Steve,

Perhaps my original email wasn't clear. I don't want to calculate an average of an average (or perhaps we understand something different by this phrase)^, so the default keyword "ave one" is what I need. I want a spatially resolved temperature profile, which is time-averaged for each layer. At t=24 the fix should take the temperature in a given layer at t=18 and and at t=24, and calculate the average of the two numbers; it should repeat this for all layers. At t=36 it should take the average of the values at t=30 and t=36. When I try to implement this (see below), I get an answer that appears to be incorrect. What's the cause of the discrepancy?

Thanks,
Philip

Sorry, I meant the "norm" keyword of fix ave/spatial.
Read the doc page about it and see if it explains
what you are seeing.

Steve

Thanks, that explains the difference. When I read the doc page previously I'm afraid I focussed on Nfreq, Nrepeat and Nevery and overlookd "norm".

Cheers,
Philip