Problem using 'Fix ave/grid' in LAMMPS

Hello LAMMPS users,

I am trying to use the new feature of LAMMPS for calculating local density in each grid cell. I am using these commands:

compute 1 all property/grid 10 10 10 id
fix 3 all ave/grid 100 10 1000 10 10 10 c_1:grid:data[1] density/mass

These are the errors I am getting:

ERROR: Fix ave/grid compute 1 data data is not per-grid array (…/utils.cpp:924)

ERROR: Fix ave/grid cannot operate on per-atom and per-grid values (…/fix_ave_grid.cpp:186)

Kindly suggest.

Thanks

Your approach is wrong. You want to use chunks and 3d binning for your purpose.

Thanks for your reply, Dr. Kohlmeyer. I used chunks but I am getting the density of each chain whereas I wish to find the density of a grid cell (or voxel) as that would be different from the density of a single chain.

Commands for chunk-
compute chains all chunk/atom molecule
fix 3 all ave/chunk 100 5 1000 chains density/mass ave running file tmp.chainsdensity

Kindly suggest.

Thanks

Like I wrote, you need to use 3d bins for chunks, not molecule IDs.