*/
#include "gmxpre.h"
-#include <math.h>
-#include <string.h>
+#include <cmath>
+#include <cstring>
#include "gromacs/commandline/pargs.h"
#include "gromacs/fileio/confio.h"
#include "gromacs/topology/index.h"
#include "gromacs/utility/fatalerror.h"
#include "gromacs/utility/futil.h"
+#include "gromacs/utility/gmxassert.h"
#include "gromacs/utility/smalloc.h"
#define FACTOR 1000.0 /* Convert nm^2/ps to 10e-5 cm^2/s */
{
if ((thistime(curr) >= (curr->nlast*curr->delta_t)) && (nr == 0))
{
- memcpy(curr->x0[curr->nlast], xc, curr->ncoords*sizeof(xc[0]));
+ std::memcpy(curr->x0[curr->nlast], xc, curr->ncoords*sizeof(xc[0]));
curr->n_offs[curr->nlast] = curr->nframes;
copy_rvec(com, curr->com[curr->nlast]);
curr->nlast++;
clear_dvec(sx);
tmass = 0;
- mass = 1;
prep_data(bMol, gnx, index, xcur, xprev, box);
for (i = 0; (i < gnx); i++)
fprintf(out, "%10d %10g\n", i, D);
if (pdbinfo)
{
- sqrtD = sqrt(D);
+ sqrtD = std::sqrt(D);
if (sqrtD > sqrtD_max)
{
sqrtD_max = sqrtD;
D2av /= curr->nmol;
VarD = D2av - sqr(Dav);
printf("<D> = %.4f Std. Dev. = %.4f Error = %.4f\n",
- Dav, sqrt(VarD), sqrt(VarD/curr->nmol));
+ Dav, std::sqrt(VarD), std::sqrt(VarD/curr->nmol));
if (fn_pdb && x)
{
{
scale *= 10;
}
+ GMX_RELEASE_ASSERT(pdbinfo != NULL, "Internal error - pdbinfo not set for PDB input");
for (i = 0; i < top->atoms.nr; i++)
{
pdbinfo[i].bfac *= scale;
/* for the first frame, the previous frame is a copy of the first frame */
if (bFirst)
{
- memcpy(xa[prev], xa[cur], curr->ncoords*sizeof(xa[prev][0]));
+ std::memcpy(xa[prev], xa[cur], curr->ncoords*sizeof(xa[prev][0]));
bFirst = FALSE;
}
if (beginfit == -1)
{
- i0 = (int)(0.1*(msd->nframes - 1) + 0.5);
+ i0 = static_cast<int>(0.1*(msd->nframes - 1) + 0.5);
beginfit = msd->time[i0];
}
else
if (endfit == -1)
{
- i1 = (int)(0.9*(msd->nframes - 1) + 0.5) + 1;
+ i1 = static_cast<int>(0.9*(msd->nframes - 1) + 0.5) + 1;
endfit = msd->time[i1-1];
}
else
{
lsq_y_ax_b(N/2, &(msd->time[i0]), &(msd->data[j][i0]), &a, &b, &r, &chi2);
lsq_y_ax_b(N/2, &(msd->time[i0+N/2]), &(msd->data[j][i0+N/2]), &a2, &b, &r, &chi2);
- SigmaD[j] = fabs(a-a2);
+ SigmaD[j] = std::abs(a-a2);
}
else
{
fprintf(stderr, "Calculating diffusion coefficients for molecules.\n");
}
+ GMX_RELEASE_ASSERT(normtype[0] != 0, "Options inconsistency; normtype[0] is NULL");
+ GMX_RELEASE_ASSERT(axtitle[0] != 0, "Options inconsistency; axtitle[0] is NULL");
+
if (normtype[0][0] != 'n')
{
type = normtype[0][0] - 'x' + X; /* See defines above */