*/
#include "gmxpre.h"
-#include <math.h>
+#include <cmath>
+
+#include <algorithm>
#include "gromacs/commandline/pargs.h"
#include "gromacs/fileio/matio.h"
#include "gromacs/utility/cstringutil.h"
#include "gromacs/utility/fatalerror.h"
#include "gromacs/utility/futil.h"
+#include "gromacs/utility/gmxassert.h"
#include "gromacs/utility/smalloc.h"
static void clust_size(const char *ndx, const char *trx, const char *xpm,
t_block *mols = NULL;
gmx_mtop_atomlookup_t alook;
t_atom *atom;
- int version, generation, ii, jj, nsame;
+ int version, generation, ii, jj;
real temp, tfac;
/* Cluster size distribution (matrix) */
real **cs_dist = NULL;
real tf, dx2, cut2, *t_x = NULL, *t_y, cmid, cmax, cav, ekin;
- int i, j, k, ai, aj, ak, ci, cj, nframe, nclust, n_x, n_y, max_size = 0;
+ int i, j, k, ai, aj, ci, cj, nframe, nclust, n_x, max_size = 0;
int *clust_index, *clust_size, max_clust_size, max_clust_ind, nav, nhisto;
t_rgb rlo = { 1.0, 1.0, 1.0 };
printf("Using molecules rather than atoms. Not reading index file %s\n",
ndx);
}
+ GMX_RELEASE_ASSERT(mtop != NULL, "Trying to access mtop->mols from NULL mtop pointer");
mols = &(mtop->mols);
/* Make dummy index */
/* Compute distance */
if (bMol)
{
+ GMX_RELEASE_ASSERT(mols != NULL, "Cannot access index[] from NULL mols pointer");
bSame = FALSE;
for (ii = mols->index[ai]; !bSame && (ii < mols->index[ai+1]); ii++)
{
{
nclust++;
cs_dist[n_x-1][ci-1] += 1.0;
- max_size = max(max_size, ci);
+ max_size = std::max(max_size, ci);
if (ci > 1)
{
cav += ci;
{
if (bMol)
{
+ GMX_RELEASE_ASSERT(mols != NULL, "Cannot access index[] from NULL mols pointer");
for (j = mols->index[i]; (j < mols->index[i+1]); j++)
{
fprintf(fp, "%d\n", j+1);
nelem += cs_dist[i][j];
}
fprintf(fp, "%5d %8.3f\n", j+1, nelem/n_x);
- nhisto += (int)((j+1)*nelem/n_x);
+ nhisto += static_cast<int>((j+1)*nelem/n_x);
}
fprintf(fp, "%5d %8.3f\n", j+1, 0.0);
xvgrclose(fp);
{
cmid = cs_dist[i][j];
}
- cmax = max(cs_dist[i][j], cmax);
+ cmax = std::max(cs_dist[i][j], cmax);
}
}
fprintf(stderr, "cmid: %g, cmax: %g, max_size: %d\n", cmid, cmax, max_size);
{
cmid = cs_dist[i][j];
}
- cmax = max(cs_dist[i][j], cmax);
+ cmax = std::max(cs_dist[i][j], cmax);
}
}
fprintf(stderr, "cmid: %g, cmax: %g, max_size: %d\n", cmid, cmax, max_size);
};
#define NPA asize(pa)
const char *fnNDX, *fnTPR;
- gmx_bool bSQ, bRDF;
t_rgb rgblo, rgbhi;
t_filenm fnm[] = {