*/
#include "gmxpre.h"
-#include <math.h>
-#include <string.h>
+#include <cmath>
+#include <cstring>
#include "gromacs/commandline/pargs.h"
#include "gromacs/fileio/confio.h"
};
FILE *out = NULL; /* initialization makes all compilers happy */
t_trxstatus *status;
- t_trxstatus *trjout;
t_topology top;
int ePBC;
t_atoms *atoms;
real t, tstart, tend, **mat2;
real xj, *w_rls = NULL;
real min, max, *axis;
- int ntopatoms, step;
- int natoms, nat, count, nframes0, nframes, nlevels;
+ int natoms, nat, nframes0, nframes, nlevels;
gmx_int64_t ndim, i, j, k, l;
int WriteXref;
const char *fitfile, *trxfile, *ndxfile;
const char *eigvalfile, *eigvecfile, *averfile, *logfile;
const char *asciifile, *xpmfile, *xpmafile;
- char str[STRLEN], *fitname, *ananame, *pcwd;
+ char str[STRLEN], *fitname, *ananame;
int d, dj, nfit;
atom_id *index, *ifit;
gmx_bool bDiffMass1, bDiffMass2;
{
if (bM)
{
- sqrtm[i] = sqrt(atoms->atom[index[i]].m);
+ sqrtm[i] = std::sqrt(atoms->atom[index[i]].m);
if (i)
{
bDiffMass2 = bDiffMass2 || (sqrtm[i] != sqrtm[i-1]);
if (bFit && bDiffMass1 && !bDiffMass2)
{
bDiffMass1 = natoms != nfit;
- i = 0;
for (i = 0; (i < natoms) && !bDiffMass1; i++)
{
bDiffMass1 = index[i] != ifit[i];
snew(x, natoms);
snew(xav, natoms);
ndim = natoms*DIM;
- if (sqrt(GMX_INT64_MAX) < ndim)
+ if (std::sqrt(static_cast<real>(GMX_INT64_MAX)) < static_cast<real>(ndim))
{
gmx_fatal(FARGS, "Number of degrees of freedoms to large for matrix.\n");
}
atoms, xread, NULL, epbcNONE, zerobox, natoms, index);
sfree(xread);
- fprintf(stderr, "Constructing covariance matrix (%dx%d) ...\n", (int)ndim, (int)ndim);
+ fprintf(stderr, "Constructing covariance matrix (%dx%d) ...\n", static_cast<int>(ndim), static_cast<int>(ndim));
nframes = 0;
nat = read_first_x(oenv, &status, trxfile, &t, &xread, box);
tstart = t;
snew(eigenvalues, ndim);
snew(eigenvectors, ndim*ndim);
- memcpy(eigenvectors, mat, ndim*ndim*sizeof(real));
+ std::memcpy(eigenvectors, mat, ndim*ndim*sizeof(real));
fprintf(stderr, "\nDiagonalizing ...\n");
fflush(stderr);
eigensolver(eigenvectors, ndim, 0, ndim, eigenvalues, mat);
}
fprintf(stderr, "\nSum of the eigenvalues: %g (%snm^2)\n",
sum, bM ? "u " : "");
- if (fabs(trace-sum) > 0.01*trace)
+ if (std::abs(trace-sum) > 0.01*trace)
{
fprintf(stderr, "\nWARNING: eigenvalue sum deviates from the trace of the covariance matrix\n");
}
end = nframes-1;
fprintf(stderr, "\nWARNING: there are fewer frames in your trajectory than there are\n");
fprintf(stderr, "degrees of freedom in your system. Only generating the first\n");
- fprintf(stderr, "%d out of %d eigenvectors and eigenvalues.\n", end, (int)ndim);
+ fprintf(stderr, "%d out of %d eigenvectors and eigenvalues.\n", end, static_cast<int>(ndim));
}
else
{
"Eigenvector index", str, oenv);
for (i = 0; (i < end); i++)
{
- fprintf (out, "%10d %g\n", (int)i+1, eigenvalues[ndim-1-i]);
+ fprintf (out, "%10d %g\n", static_cast<int>(i+1), eigenvalues[ndim-1-i]);
}
xvgrclose(out);
{
fprintf(out, "Fit is %smass weighted\n", bDiffMass1 ? "" : "non-");
}
- fprintf(out, "Diagonalized the %dx%d covariance matrix\n", (int)ndim, (int)ndim);
+ fprintf(out, "Diagonalized the %dx%d covariance matrix\n", static_cast<int>(ndim), static_cast<int>(ndim));
fprintf(out, "Trace of the covariance matrix before diagonalizing: %g\n",
trace);
fprintf(out, "Trace of the covariance matrix after diagonalizing: %g\n\n",
sum);
- fprintf(out, "Wrote %d eigenvalues to %s\n", (int)end, eigvalfile);
+ fprintf(out, "Wrote %d eigenvalues to %s\n", static_cast<int>(end), eigvalfile);
if (WriteXref == eWXR_YES)
{
fprintf(out, "Wrote reference structure to %s\n", eigvecfile);