[gmx-developers] possible bug in gmx_clustsize.c

Alan Chen alan.robot at gmail.com
Mon Sep 14 23:20:14 CEST 2009

Hi all:

I've been banging my head against some non-expected output from
g_clustsize until I finally looked at the code and think there is a
bug in the generation of cluster histogram distribution.
in gmx_clustsize.c line 333 the histogram is accumulated using:

nelem += cs_dist[i][j];

This is probably intended to have been summing over unweighted, raw
cluster counts seeing as line 335 keeps track of the total number of
atoms involved in clusters via:

nhisto += (int)((j+1)*nelem/n_x);

However, just previously, cs_dist is already size-weighted in line 317:

cs_dist[i][j] *= (j+1);

Therefore, the histogram is in fact a size-weighted cluster histogram,
not a histogram of raw cluster counts, and the reported "total number
of atoms in clusters" is not a meaningful number
because it is actually weighted by the square of the cluster-size.

The line numbers all refer to the source released with gromacs 4.0.5

On a slightly unrelated note, the online documentation page for
g_clustsize is missing, and although I tried to submit via to bugzilla
 the registration mechanism doesn't seem to be working either, hence
the list-serve email.


Alan Chen

postdoctoral research associate
Garcia Group
Rensselaer Polytechnic Institute
chena7 at rpi.edu

More information about the gromacs.org_gmx-developers mailing list