# fix ave/chunk & density

hi,everyone!
i am trying to calculate the density of water in a simulation box with a cnt. i used these commands to get the density of certain chunks and the whole volume occupied by water molecules.
“compute cc1 all chunk/atom bin/1d z 3 10.0
compute cc2 all chunk/atom bin/1d z -2 56
fix cc1 water ave/chunk 1 1000 1000 cc1 density/mass ave running file density1.profile
fix cc2 water ave/chunk 1 1000 1000 cc2 density/mass ave running file density2.profile”

but i got these results：

# Chunk Coord1 Ncount density/mass

3001000 7 984
1 -2 0 0
2 8 80.457 0.350291
3 18 285.593 1.27966
4 28 211.678 0.928524
5 38 210.353 0.938834
6 48 195.919 0.863661
7 58 0 0
&

# Chunk Coord1 Ncount density/mass

3001000 1 984
1 26 984 0.778744
3002000 1 1968
1 26 984 0.778744
3003000 1 2952
1 26 984 0.778744
3004000 1 3936
1 26 984 0.778744

u can find density in the 3rd chunk is much bigger than 1g/cm3 , i don’t konw why?
however, the density of water is rather smaller than 1 which i set before the simulation!
can u explain to me how LAMMPS calculate density in a box?
can i follow the way as i do in the macroscopic situation,namely, mass/volume?

hi,everyone!
i am trying to calculate the density of water in a simulation box with a
cnt. i used these commands to get the density of certain chunks and the
whole volume occupied by water molecules.
“compute cc1 all chunk/atom bin/1d z 3 10.0
compute cc2 all chunk/atom bin/1d z -2 56
fix cc1 water ave/chunk 1 1000 1000 cc1 density/mass ave running file
density1.profile
fix cc2 water ave/chunk 1 1000 1000 cc2 density/mass ave running file
density2.profile”

but i got these results：

# Chunk Coord1 Ncount density/mass
3001000 7 984
1 -2 0 0
2 8 80.457 0.350291
3 18 285.593 1.27966
4 28 211.678 0.928524
5 38 210.353 0.938834
6 48 195.919 0.863661
7 58 0 0
&
# Chunk Coord1 Ncount density/mass
3001000 1 984
1 26 984 0.778744
3002000 1 1968
1 26 984 0.778744
3003000 1 2952
1 26 984 0.778744
3004000 1 3936
1 26 984 0.778744

u can find density in the 3rd chunk is much bigger than 1g/cm3 , i don't
konw why?

have you visualized your trajectory? that should give you a hint.

however, the density of water is rather smaller than 1 which i set before
the simulation!

no surprise here. the volume of your chunks will span the entire box,
not only where the water molecules are.

can u explain to me how LAMMPS calculate density in a box?

sum of masses divided by volume of chunk.

can i follow the way as i do in the macroscopic situation,namely,
mass/volume?

the problem is that "volume" on the atomic level is often an ill
defined property. there are various possible ways to approximate it,
but they all have to make certain assumptions and come with different
degrees of detail and accuracy because of that.

axel.