[lammps-users] Question about number density computed by ave/chunk

Dear Lammps Users,

I have computed number/density in a system using (compute chunk/atom + fix ave/chunk). In the following, I attached part of my code and the lammps output for ave/chunk command. As I have noticed, the number density in each bin (4th column of ave/chunk output) can be computed by dividing the number of atoms in each bin (3th column) by bin volume (in my case: 100 [A]*100 [A]*7.75 [A]).
In order to compute the total number density in the system, I added all the numbers in the 4th column which is equal to 0.0103. I was wondering how this number is related to the total volume and the total number of atoms in the system. To compute the total volume, first of all, I subtracted and added half of the bin height from the first and last bins (which are not empty), respectively. So the total volume will be ((19.375-3.875)-(135.625+3.875))x100x100. The thing is when I divide the total number of atoms (800) by this number I get a number in the same order of magnitude as the number density in each bin, and not close to 0.0103.
I highly appreciate if someone could tell me how the results from ave/chunk are related to the total number density in the system.
Thank you in advance for your time and help.

#######-------I LAMMPS Input
region whole block 0 100 0 155 0 100 units box
create_box 2 whole

compute layers1 Ar chunk/atom bin/1d y lower 7.75 units box

fix 3 Ar ave/chunk 10000 1 10000 layers1 density/number file density_n.txt

##########-----Ave/chunk output
500000 20 800
1 3.875 0 0
2 11.625 0 0
3 19.375 167 0.00215484
4 27.125 71 0.000916129
5 34.875 54 0.000696774
6 42.625 36 0.000464516
7 50.375 44 0.000567742
8 58.125 36 0.000464516
9 65.875 24 0.000309677
10 73.625 48 0.000619355
11 81.375 50 0.000645161
12 89.125 32 0.000412903
13 96.875 28 0.00036129
14 104.625 40 0.000516129
15 112.375 34 0.00043871
16 120.125 35 0.000451613
17 127.875 55 0.000709677
18 135.625 46 0.000593548
19 143.375 0 0
20 151.125 0 0

Best regards,

Shahin Mohammadnejad

I don’t understand your reasoning.

Because you are comparing densities you are comparing an intensive property, so its value should be about the same, regardless of the “amount” that you are looking at, if you are looking at a (mostly) homogeneous system. The total density should then be a (weighted) average of the density value for each chunk.
You can get the total volume easily from the box dimensions printed in the LAMMPS output.

1 Like