# a mistake in "compute reduce" in lammps?

I get two diffrent results while using “compute reduce ave and sum” in computing addforce .i think it is a bug in lammps. see my two code:
CODE 1
units lj

fix 6 all addforce 7 0 0
compute avefx all reduce ave fx
compute sumfx all reduce sum fx

thermo_style …c_avefx c_sumfx
---------------------------------------------END of code 1
The result was: avefx=7 and sumfx=7

CODE 2

units real

fix 6 all addforce 0.5 0 0
compute avefx all reduce ave fx
compute sumfx all reduce sum fx

thermo_style …c_avefx c_sumfx
-------------------------------------------END of code 2
The result was: avefx=0.5 and sumfx=50 NOTE that the total number of atoms in the group “all” was 100.

So, i think it is a bug in LAMMPS. am i wrong?

mahdi sahebi

I get two diffrent results while using "compute reduce ave and sum" in
computing addforce .i think it is a bug in lammps. see my two code:

unlikely.

CODE 1
units lj
..
fix 6 all addforce 7 0 0
compute avefx all reduce ave fx
compute sumfx all reduce sum fx
...
thermo_style ....c_avefx c_sumfx
---------------------------------------------END of code 1
The result was: avefx=7 and sumfx=7
CODE 2
units real
..
fix 6 all addforce 0.5 0 0
compute avefx all reduce ave fx
compute sumfx all reduce sum fx
...
thermo_style ....c_avefx c_sumfx
-------------------------------------------END of code 2
The result was: avefx=0.5 and sumfx=50 NOTE that the total number of atoms
in the group "all" was 100.
So, i think it is a bug in LAMMPS. am i wrong?

you are wrong.

the difference is that in case 1 you implicitly (due to using reduced
units) have

thermo_modify norm yes

and in case 2 you implicitly have

thermo_modify norm no

if you change that, you'll see that the compute reduce sum output will change.

axel.