*/
#include "gmxpre.h"
-#include <math.h>
-#include <stdlib.h>
-#include <string.h>
+#include <cmath>
+#include <cstdlib>
+#include <cstring>
+
+#include <algorithm>
#include "gromacs/commandline/pargs.h"
#include "gromacs/fileio/enxio.h"
real *readtime, real *timestep, int *nremax)
{
/* Check number of energy terms and start time of all files */
- int f, i, nre, nremin = 0, nresav = 0;
+ int f, nre, nremin = 0, nresav = 0;
ener_file_t in;
real t1, t2;
char inputstring[STRLEN];
}
else
{
- nremin = min(nremin, fr->nre);
- *nremax = max(*nremax, fr->nre);
+ nremin = std::min(nremin, fr->nre);
+ *nremax = std::max(*nremax, fr->nre);
if (nre != nresav)
{
fprintf(stderr,
{
gmx_fatal(FARGS, "Error reading user input");
}
- inputstring[strlen(inputstring)-1] = 0;
+ inputstring[std::strlen(inputstring)-1] = 0;
if (inputstring[0] == 'c' || inputstring[0] == 'C')
{
fr->ener[i].eav +
dsqr(ee_sum[i].esum/nsum
- (ee_sum[i].esum + fr->ener[i].esum)/(nsum + fr->nsum))*
- nsum*(nsum + fr->nsum)/(double)fr->nsum;
+ nsum*(nsum + fr->nsum)/static_cast<double>(fr->nsum);
ee_sum[i].esum += fr->ener[i].esum;
}
}
t_enxframe *fr, *fro;
gmx_int64_t ee_sum_step = 0, ee_sum_nsteps, ee_sum_nsum;
t_energy *ee_sum;
- gmx_int64_t lastfilestep, laststep, startstep, startstep_file = 0;
+ gmx_int64_t lastfilestep, laststep, startstep_file = 0;
int noutfr;
- int nre, nremax, this_nre, nfile, f, i, j, kkk, nset, *set = NULL;
+ int nre, nremax, this_nre, nfile, f, i, kkk, nset, *set = NULL;
double last_t;
char **fnms;
- real *readtime, *settime, timestep, t1, tadjust;
- char inputstring[STRLEN], *chptr, buf[22], buf2[22], buf3[22];
- gmx_bool ok;
+ real *readtime, *settime, timestep, tadjust;
+ char buf[22], buf2[22];
int *cont_type;
gmx_bool bNewFile, bFirst, bNewOutput;
output_env_t oenv;
timestep = 0.0;
snew(fnms, argc);
lastfilestep = 0;
- laststep = startstep = 0;
+ laststep = 0;
nfile = opt2fns(&fnms, "-f", NFILE, fnm);
if (bFirst)
{
bFirst = FALSE;
- startstep = fr->step;
}
if (bWrite)
{