X-Git-Url: http://biod.pnpi.spb.ru/gitweb/?a=blobdiff_plain;f=src%2Fgromacs%2Fgmxana%2Fgmx_polystat.cpp;fp=src%2Fgromacs%2Fgmxana%2Fgmx_polystat.c;h=48f8092ecabdd533101f6214399453a198684e45;hb=c3f2d46e4047f0c465f7234b3784a2fa6f02a065;hp=d174119ac54301394b32234d7852457921f6a5ad;hpb=0595b4a4c763a0bc574658992081abf8b0abc3fe;p=alexxy%2Fgromacs.git diff --git a/src/gromacs/gmxana/gmx_polystat.c b/src/gromacs/gmxana/gmx_polystat.cpp similarity index 95% rename from src/gromacs/gmxana/gmx_polystat.c rename to src/gromacs/gmxana/gmx_polystat.cpp index d174119ac5..48f8092eca 100644 --- a/src/gromacs/gmxana/gmx_polystat.c +++ b/src/gromacs/gmxana/gmx_polystat.cpp @@ -36,8 +36,10 @@ */ #include "gmxpre.h" -#include -#include +#include +#include + +#include #include "gromacs/commandline/pargs.h" #include "gromacs/fileio/tpxio.h" @@ -86,7 +88,7 @@ static void gyro_eigen(double **gyr, double *eig, double **eigv, int *ord) /* 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; @@ -211,8 +213,8 @@ int gmx_polystat(int argc, char *argv[]) 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", @@ -405,13 +407,13 @@ int gmx_polystat(int argc, char *argv[]) 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"); @@ -438,7 +440,7 @@ int gmx_polystat(int argc, char *argv[]) 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; } @@ -450,8 +452,8 @@ int gmx_polystat(int argc, char *argv[]) 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; @@ -479,9 +481,9 @@ int gmx_polystat(int argc, char *argv[]) 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",