[gmx-users] k-means clustering in GROMACS
David van der Spoel
spoel at xray.bmc.uu.se
Mon Jan 8 08:53:03 CET 2007
Nikos Sgourakis wrote:
> Dear GROMACS users,
>
> Here I have implemented the k-means clustering algorithm in the original
> GROMACS module, gmx_cluster.c (called by the wrapper g_cluster).
> k-means is a heuristic algorithm that finds the partition of n points
> (conformations) in k groups (clusters), such that the sum of the
> distances of each point from the centroid of its belonging cluster is
> minimized.
> To compile, re-run make after replacing the original file: `make g_cluster`
> Most of the in-line options of the original program work. However, there
> are no output structure files. Instead, `./g_cluster -method kmeans etc`
> will produce a file with the indeces of all conformations within each
> one of the k clusters (k-means.dat), and a list of all centroids
> (centroids.dat). The conformations can then be easily retrieved from
> the original trajectory file.
> Please, let me know of any difficulties in compiling/running kmeans for
> GROMACS.
>
> Nikos
>
>
Nikos,
first, thanks for contributing to gromacs. I have some questions about
your code though. Have you run this code at all, and if so on what
platform and with which compiler? The code contains this:
void kmeans(int k)
{
int distr[k];
etc.
which is not standard C as far as I know. You can replace this by:
int *dist;
snew(distr,k);
....
sfree(distr);
where snew and sfree are gromacs macros for allocating an array with
length k for arbitrary data types.
It would also be nice if you use a uniform indentation, preferable the
emacs default.
Regards,
--
David.
________________________________________________________________________
David van der Spoel, PhD, Assoc. Prof., Molecular Biophysics group,
Dept. of Cell and Molecular Biology, Uppsala University.
Husargatan 3, Box 596, 75124 Uppsala, Sweden
phone: 46 18 471 4205 fax: 46 18 511 755
spoel at xray.bmc.uu.se spoel at gromacs.org http://folding.bmc.uu.se
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
More information about the gromacs.org_gmx-users
mailing list