# [gmx-users] Distribution of z-coordinates for a particular index group

Justin Lemkul jalemkul at vt.edu
Mon Oct 8 03:01:04 CEST 2012

```
On 10/7/12 12:13 PM, Andrew DeYoung wrote:
> Hi,
>
> My system is in the slab geometry; I have applied periodic boundary
> conditions along x and y, but none along z.
>
> I frequently use the handy tool g_potential (using the -oc switch) to
> compute the (average) charge density (i.e., charge distribution or a
> "histogram of charges") along z for a particular group specified by an index
> file entry.  Since the partial charges are discretely assigned to individual
> atoms, this means that the -oc switch of g_potential effectively gives me a
> sort of distribution of the atoms along z, although the units are charge
> density, of course.
>
> My question is, what if I have atoms with zero partial charge?  Of course,
> such atoms do not contribute to the charge density.  But what if I would
> still like to compute some sort of distribution of these atoms along z?
>
> One idea is to use g_traj to print all of the z-coordinates of a particular
> group over time to an .xvg file. Then, using a scripting language, I could
> "bin" the z-coordinates and then average over time.  But is there already a
> Gromacs utility that does this?
>
> It seems that g_density, with the "-dens number" switch, may accomplish
> this.  Is it true that the "-dens number" switch will lead to computation of
> the number density of _each_ atom which is specified in the index file
> entry?
>

Seems about as good of an approach as any.  You can certainly come up with a
test case and use g_density to see if it meets expectations.

-Justin

--
========================================

Justin A. Lemkul, Ph.D.
Research Scientist
Department of Biochemistry
Virginia Tech
Blacksburg, VA
jalemkul[at]vt.edu | (540) 231-9080
http://www.bevanlab.biochem.vt.edu/Pages/Personal/justin

========================================

```