Counting the number of one group of atoms that are within a distance of the other group

Dear LAMMPS Users

I wish to count the total number of one group of atoms ( e.g. group 1 atoms) that are within certain distances (e.g. 0. 3 nm) of the other groups of atoms (e.g. group 2 atoms) every few timesteps (e.g. 1000 fs).

I know I can use compute property/local + compute pair/local + dump to extract similar information, but the processing is not ideal. Hence I wish to ask if there is a better way/combination of commands to achieve this purpose?

Many thanks for your patience.

Lunna

Hello Lunna,

I think you can use compute coord/atom for this purpose. Something like this:

group type1 type 1

compute nc type1 coord/atom cutoff 3.0 2

variable v1 atom “c_nc>0”
compute count type1 reduce sum v_v1

-David

Dear David
Thanks very much! I will implement to see how it goes.

Best wishes
Lunna