[lammps-users] coordination number for polydisperse systems

Hi all.

I'd like to compute a kind of coordination number. compute_coord_atom is close to what I want, but it has a single global cutoff and doesn't do anything differently for different pair types. I could have my compute access Pair::cutsq, but I'd rather have something which looks at pair types derived from Pair which have a "sigma[itype][jtype]" variable (all the Lennard-Jones types) and base my notion of coordination on sigma[itype][jtype] rather than Pair::cutsq. Problem is that not all pair types have a natural notion of a "sigma" and it's not in the Pair interface.

Any ideas about how best to do this? One solution would be to have the compute directly take the coordination cutoffs as parameters in the input script. But it seems like this starts to get messy since I usually just want sigma[itype][jtype] (or some constant multiple). My C++ isn't so great, but I imagine there is some way to make a dynamic cast of the pair pointer to something which has a member named "sigma". Is that possible?


The pair classes have a generic request function: extract()
which will return a ptr to some array like sigma that you request.
It's up to you to insure that the pair classes you want recognize
that request and then your code (a new compute) uses that
ptr appropriately. Grep on "extract" and you'll see several classes
use this mechanism to get access to pair style parameters, including
some that request "sigma".