[gmx-users] Counting particles in a particular region

Oliver Beckstein oliver at biop.ox.ac.uk
Fri Mar 26 12:00:01 CET 2004

> I am wondering if there's a function in Gromacs to count the number of
> particles in a particular region of my simulation box.  In other words,
> I'd like to specify a particular range of all three coordinates, and for
> each timestep in my trajectory, count how many particles are in that
> smaller box.  The ideal output would be the number of particles as a
> function of time.  Specifically, I am running an MD simulation on an ion
> channel embedded in a lipid bilayer, and I'd like to determine the water
> occupancy of the pore region, and how it changes through the trajectory.

I had exactly the same problem and wrote `g_count' for that purpose. It is 
fairly horrible code (my first gromacs program and the second in C... go 
figure) but it has been producing results over the last 2 years.

You specify a cylindrical region and an index group and you get the 
occupancy of this region over time. 

I can send you a tar ball with the code, just email me. It will also 
include g_flux which counts full transitions of the pore, useful when you 
want to calculate equilibrium fluxes. (You might also find `gridcount' 
useful, see the gromacs contributions page).


Oliver Beckstein * oliver at biop.ox.ac.uk

More information about the gromacs.org_gmx-users mailing list