*/
#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/confio.h"
/* Check start time of all files */
int i, natoms = 0;
t_trxstatus *status;
- real t;
t_trxframe fr;
gmx_bool ok;
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')
{
{ &bCat }, "Do not discard double time frames" }
};
#define npargs asize(pa)
- int ftpin, i, frame, frame_out, step = 0, trjout = 0;
+ int ftpin, i, frame, frame_out;
t_trxstatus *status, *trxout = NULL;
- rvec *x, *v;
real t_corr;
t_trxframe fr, frout;
- char **fnms, **fnms_out, *in_file, *out_file;
+ char **fnms, **fnms_out, *out_file;
int n_append;
gmx_bool bNewFile, bIndex, bWrite;
- int earliersteps, nfile_in, nfile_out, *cont_type, last_ok_step;
+ int nfile_in, nfile_out, *cont_type;
real *readtime, *timest, *settime;
real first_time = 0, lasttime = NOTSET, last_ok_t = -1, timestep;
real last_frame_time, searchtime;
- int isize, j;
+ int isize = 0, j;
atom_id *index = NULL, imax;
char *grpname;
real **val = NULL, *t = NULL, dt_remd;
int n, nset, ftpout = -1, prevEndStep = 0, filetype;
- gmx_bool bOK;
gmx_off_t fpos;
output_env_t oenv;
t_filenm fnm[] =
imax = index[0];
for (i = 1; i < isize; i++)
{
- imax = max(imax, index[i]);
+ imax = std::max(imax, index[i]);
}
}
if (bDeMux)
snew(fnms_out, nset);
for (i = 0; (i < nset); i++)
{
- snew(fnms_out[i], strlen(buf)+32);
+ snew(fnms_out[i], std::strlen(buf)+32);
sprintf(fnms_out[i], "%d_%s", i, buf);
}
sfree(buf);
n_append = -1;
for (i = 0; ((i < nfile_in) && (n_append == -1)); i++)
{
- if (strcmp(fnms[i], out_file) == 0)
+ if (std::strcmp(fnms[i], out_file) == 0)
{
n_append = i;
}
gmx_fatal(FARGS, "Can only append to the first file which is %s (not %s)",
fnms[0], out_file);
}
- earliersteps = 0;
/* Not checking input format, could be dangerous :-) */
/* Not checking output format, equally dangerous :-) */
{
trxout = open_trx(out_file, "w");
}
- memset(&frout, 0, sizeof(frout));
+ std::memset(&frout, 0, sizeof(frout));
}
else
{
gmx_fatal(FARGS, "Error seeking to append position.");
}
read_next_frame(oenv, status, &fr);
- if (fabs(searchtime - fr.time) > timest[0]*0.5)
+ if (std::abs(searchtime - fr.time) > timest[0]*0.5)
{
gmx_fatal(FARGS, "Error seeking: attempted to seek to %f but got %f.",
searchtime, fr.time);
while (read_next_frame(oenv, status, &fr));
close_trj(status);
-
- earliersteps += step;
}
if (trxout)
{