*/
#include "gmxpre.h"
-#include <math.h>
-#include <string.h>
+#include <cmath>
+#include <cstring>
+
+#include <algorithm>
#include "gromacs/commandline/pargs.h"
#include "gromacs/fileio/tpxio.h"
/* Calculate mean square internal distances (Auhl et al., JCP 119, 12718) */
static void calc_int_dist(double *intd, rvec *x, int i0, int i1)
{
- int ii, jj;
+ int ii;
const int ml = i1 - i0 + 1; /* Number of beads in molecule. */
int bd; /* Distance between beads */
double d;
nat_max = 0;
for (mol = 0; mol < nmol; mol++)
{
- nat_min = min(nat_min, molind[mol+1]-molind[mol]);
- nat_max = max(nat_max, molind[mol+1]-molind[mol]);
+ nat_min = std::min(nat_min, molind[mol+1]-molind[mol]);
+ nat_max = std::max(nat_max, molind[mol+1]-molind[mol]);
}
fprintf(stderr, "Group %s consists of %d molecules\n", grpname, nmol);
fprintf(stderr, "Group size per molecule, min: %d atoms, max %d atoms\n",
fprintf(out, "%10.3f %8.4f %8.4f %8.4f %8.4f %8.4f",
t*output_env_get_time_factor(oenv),
- sqrt(sum_eed2), sqrt(sum_gyro),
- sqrt(eig[ord[0]]), sqrt(eig[ord[1]]), sqrt(eig[ord[2]]));
+ std::sqrt(sum_eed2), sqrt(sum_gyro),
+ std::sqrt(eig[ord[0]]), std::sqrt(eig[ord[1]]), std::sqrt(eig[ord[2]]));
if (bPC)
{
for (d = 0; d < DIM; d++)
{
- fprintf(out, " %8.4f", sqrt(sum_eig[d]/nmol));
+ fprintf(out, " %8.4f", std::sqrt(sum_eig[d]/nmol));
}
}
fprintf(out, "\n");
for (j = 0; j < nat_min/2; j += 2)
{
sum_inp[j] /= ninp[j];
- if (i == -1 && sum_inp[j] <= exp(-1.0))
+ if (i == -1 && sum_inp[j] <= std::exp(-1.0))
{
i = j;
}
else
{
/* Do linear interpolation on a log scale */
- pers = i - 2
- + 2*(log(sum_inp[i-2]) + 1)/(log(sum_inp[i-2]) - log(sum_inp[i]));
+ pers = i - 2.0
+ + 2.0*(std::log(sum_inp[i-2]) + 1.0)/(std::log(sum_inp[i-2]) - std::log(sum_inp[i]));
}
fprintf(outp, "%10.3f %8.4f\n", t*output_env_get_time_factor(oenv), pers);
sum_pers_tot += pers;
sum_gyro_tot /= frame;
sum_pers_tot /= frame;
fprintf(stdout, "\nAverage end to end distance: %.3f (nm)\n",
- sqrt(sum_eed2_tot));
+ std::sqrt(sum_eed2_tot));
fprintf(stdout, "\nAverage radius of gyration: %.3f (nm)\n",
- sqrt(sum_gyro_tot));
+ std::sqrt(sum_gyro_tot));
if (opt2bSet("-p", NFILE, fnm))
{
fprintf(stdout, "\nAverage persistence length: %.2f bonds\n",