[gmx-developers] possible bug in gmx_clustsize.c

David van der Spoel spoel at xray.bmc.uu.se
Tue Sep 15 08:48:00 CEST 2009

Alan Chen wrote:
> 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.

Thanks for a detailed error report. I will fix it for the next release. 
It seems that if you move the code involved in printing the cluster0size 
distribution histogram to above the bit that computes the weighted 
matrix then everything should be OK, or not?

> 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.
It is here though:

> Cheers,
> Alan Chen
> postdoctoral research associate
> Garcia Group
> Rensselaer Polytechnic Institute
> chena7 at rpi.edu
> _______________________________________________
> gmx-developers mailing list
> gmx-developers at gromacs.org
> http://lists.gromacs.org/mailman/listinfo/gmx-developers
> Please don't post (un)subscribe requests to the list. Use the 
> www interface or send it to gmx-developers-request at gromacs.org.

David van der Spoel, Ph.D., Professor of Biology
Molec. Biophys. group, Dept. of Cell & Molec. Biol., Uppsala University.
Box 596, 75124 Uppsala, Sweden. Phone:	+46184714205. Fax: +4618511755.
spoel at xray.bmc.uu.se	spoel at gromacs.org   http://folding.bmc.uu.se

More information about the gromacs.org_gmx-developers mailing list