How lammps calculate the mass and density for each bin

Hi lammps-users

I use
compute chunk/atom bin/1d
fix ave/chunk

commands to divide my system to different bins and calculate the density for each bin.The density is calculated by the mass/volume where the volume is the bin volume according to the mamul. My questions is how lammps calculate the mass. The final output just give the Ncount (the number of atoms in each bin) and the density,but it does not show the atom type. For example, I have water moleculers which have H and O atoms, if lammps does not know the atom type, how can it calculate the mass in each bin. If lammps does know about it? How can I output (atom type and mass) with the density?

Fan Li

Atoms or particles in LAMMPS always have a mass, else

LAMMPS cannot time integrate them with a force.

Your script either has a mass command, or the data file sets

it, or an EAM potential files sets it.


I do have atom type and mass in my data file.
I want to output the total mass of each bin then calculate the density by hand because there is divergence between lammps reported density and the initial density whic I build. I want to figure out what is wrong. To do it, I need both total number of atoms in each bin and how many atoms in each type (for example, 200 H atoms and 150 O atoms in some bin) . How can know that ?

Fan Li

The compute chunk/atom commands assigns a chunk ID

to each atom, which in your case is the bin #. You can

dump that property with the atom to a dump file, e.g. create

a dump file with only the atoms in bin #1 if you like.

Then you can post-process the dump file however you wish.

Or you could define a dynamic group that is only the atoms

with a certain chunk ID, and use a variable formula to count

the # of atoms in that group and output the value with thermo output.