We've recently adapted fix ave/spatial to use concentric spherical shell
bins. It's proved useful for calculating things like radial temperature
profiles in spherical geometries (systems with nanoparticles, etc.).
There was a similar fix posted on the list a few years ago
(http://lammps.sandia.gov/threads/msg18209.html), but since that was
posted a couple of changes have been made which prevent it from
compiling. I mentioned this a little while ago, and have since had a few
questions, so I've attached the source and some documentation.
A few caveats:
- the origin of the sphere can be given by a variable, or by a compute.
For example, you can "attach" the sphere to the centre of mass of a
group using compute com. If the origin moves outside of the box, and
PBCs are active, the origin will be wrapped back into the box whenever
- if reduced units are used, and the box is not cubic, the shells are
ellipsoidal rather than spherical. The calculated bin volumes are always
in box units, and reflect this.
- every time the fix is invoked, there needs to a be a sqrt() for every
particle which is located in the sphere. This can start to get a bit
sluggish if lots of particles fall in this region, or if you apply
several different instances of this fix simultaneously.
- if scaled units are used and the box size changes, the bin volumes are
automatically adjusted. Densities are calculated at every invocation,
using the current volumes, so the density remains correct.
- no checks are made about the sanity of the choice of sphere. If r_max
is chosen to be three times the box length, that's what the fix will try
Hope this helps those who have been looking for spherical bins,
fix_ave_spatial_spherical.txt (15.2 KB)
fix_ave_spatial_spherical.cpp (36.2 KB)
fix_ave_spatial_spherical.h (6.17 KB)
fix_ave_spatial_spherical.html (16.5 KB)