Number of collisions in pair_style gran


My question is pretty easy but I didn’t find any info how to do it. I have a simulation with atom_style sphere and pair_style gran/hertz/history, how to count the number of collisions of the particles (number of overlapping particles) at each step and put this info to the thermo or dump?

Nikita Tropin | Scientist | NTC HPC PL
Baker Hughes | Novosibirsk Technology Center
Office: +7 383 332 9443, ext. 151 | Fax: +7 383 332 1686
Cell:+7 913 903 68 14 | [email protected] | Advancing Reservoir P**erformance

The coordination number is what you are looking for, with cut-off =
radius_1+radius_2. Use the compute coord/atom command, which will
give you the coordination number on a per atom basis. You can then
use one of the fix ave commands to average the data over the whole set
of particles.


When I try to do it, I get an error "Compute coord/atom cutoff is longer than pairwise cutoff". The explanation of the error is that LAMMPS cannot compute coordination at distances longer than the pair cutoff, since those atoms are not in the neighbor list. I guess the cutoff distance for the granular pair style is equal to the radius of the particle?

Nikita Tropin | Scientist | NTC HPC PL
Baker Hughes | Novosibirsk Technology Center

If you are trying to count the number of contacts the distance should
be the sum of the two radii under consideration, or the center to
center distance, which will count particles in contact. Using the
radius as the cutoff shouldn't find any contacts, because it counts
the number of particle centers within the cutoff distance. I
typically use my own post-processing codes to extract quantities like
the coordination number. So I couldn't tell you how the compute
coord/atom work if you have a system with a large degree of

The force cutoff is the diameter (not radius) of the particles,
so for a monodisperse system, compute coord/atom should
give you contacts. For a polydisperse system, it won't, as
Eric indicates. You could either post-process it from a normal
dump file (compute distances yourself), or try using compute
pair/local and dump local, which I think will give you a file
with non-zero forces for all touching pairs of particles. A little
script that scans it and tallies the per-particle counts would
then be the contact info.

It would also not be hard to create a compute contact/atom
command similar to coord/atom that used variable radii
for granular particles.


Just added a compute contact/atom command that does this
radius dependent overlap calculation for polydisperse systems,
e.g. granular models.

Gives you a per-atom value you can dump to to dump file.

See the 13 Aug patch.