*/
#include "gmxpre.h"
-#include <ctype.h>
-#include <math.h>
-#include <stdlib.h>
-#include <string.h>
+#include <cctype>
+#include <cmath>
+#include <cstdlib>
+#include <cstring>
#include "gromacs/commandline/pargs.h"
#include "gromacs/fileio/trxio.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"
typedef struct {
t_electron *tmp1, *tmp2;
tmp1 = (t_electron *)a; tmp2 = (t_electron *)b;
- return strcmp(tmp1->atomname, tmp2->atomname);
+ return std::strcmp(tmp1->atomname, tmp2->atomname);
}
int get_electrons(t_electron **eltab, const char *fn)
if (!*nslices)
{
- *nslices = (int)(box[axis][axis] * 10); /* default value */
+ *nslices = static_cast<int>(box[axis][axis] * 10); /* default value */
fprintf(stderr, "\nDividing the box in %d slices\n", *nslices);
}
/* determine which slice atom is in */
if (bCenter)
{
- slice = floor( (z-(boxSz/2.0)) / (*slWidth) ) + *nslices/2;
+ slice = static_cast<int>(std::floor( (z-(boxSz/2.0)) / (*slWidth) ) + *nslices/2);
}
else
{
- slice = (z / (*slWidth));
+ slice = static_cast<int>(z / (*slWidth));
}
sought.nr_el = 0;
sought.atomname = gmx_strdup(*(top->atoms.atomname[index[n][i]]));
double invvol;
int natoms; /* nr. atoms in trj */
t_trxstatus *status;
- int **slCount, /* nr. of atoms in one slice for a group */
- i, j, n, /* loop indices */
- ax1 = 0, ax2 = 0,
+ int i, n, /* loop indices */
nr_frames = 0, /* number of frames */
slice; /* current slice */
real t,
z;
real boxSz, aveBox;
- char *buf; /* for tmp. keeping atomname */
gmx_rmpbc_t gpbc = NULL;
if (axis < 0 || axis >= DIM)
if (!*nslices)
{
- *nslices = (int)(box[axis][axis] * 10); /* default value */
+ *nslices = static_cast<int>(box[axis][axis] * 10); /* default value */
fprintf(stderr, "\nDividing the box in %d slices\n", *nslices);
}
/* determine which slice atom is in */
if (bCenter)
{
- slice = floor( (z-(boxSz/2.0)) / (*slWidth) ) + *nslices/2;
+ slice = static_cast<int>(std::floor( (z-(boxSz/2.0)) / (*slWidth) ) + *nslices/2);
}
else
{
- slice = floor(z / (*slWidth));
+ slice = static_cast<int>(std::floor(z / (*slWidth)));
}
/* Slice should already be 0<=slice<nslices, but we just make
xlabel = bRelative ? "Average coordinate (nm)" : "Coordinate (nm)";
}
+ GMX_RELEASE_ASSERT(dens_opt[0] != NULL, "Option setting inconsistency; dens_opt[0] is NULL");
+
switch (dens_opt[0][0])
{
case 'm': ylabel = "Density (kg m\\S-3\\N)"; break;
}
else
{
- ncenter = 0;
+ ncenter = 0;
+ index_center = NULL;
}
fprintf(stderr, "\nSelect %d group%s to calculate density for:\n", ngrps, (ngrps > 1) ? "s" : "");