[lammps-users] Two dimensional density profile

Hi All,

I am a new user of LAMMPS. I would like to compute a two dimensional density profile of liquid water in a 3 dimensional surface. I know there is fix ave/spatial command which can calculate density profile in 1 dimension. However, is there any other command which can calculate a 2D density profile by providing the bin size/number of bins.


there is no 2d fix ave/spatial command yet. Someone
would have to write it. You can always dump info to
a dump file and post-process it, binning it however you


The fix ave/spatial command now allows 2d or 3d
binning. See the 29Oct10 patch.


The atc package is capable of doing the averaging you want, and I have used it to compute the density of water and ions in a nanochannel (or more specifically of the oxygens, but you can figure out the rest). Here is my example code for averaging in only one direction as an example:

fix WHARDY water atc field
fix_modify WHARDY fem create mesh 1 1 40 ATC_BOX p p f
fix_modify WHARDY atom_element_map eulerian \{dumpfreq\} fix\_modify WHARDY transfer fields none fix\_modify WHARDY transfer fields add density velocity \# output fix\_modify WHARDY transfer output nanochannel\_whardyFE {dumpfreq} text binary

Jon Zimmerman is the author of this part of the atc package and has documentation through the lammps website.