X-Git-Url: http://biod.pnpi.spb.ru/gitweb/?a=blobdiff_plain;f=src%2Fgromacs%2Fcorrelationfunctions%2Fautocorr.cpp;fp=src%2Fgromacs%2Fcorrelationfunctions%2Fautocorr.c;h=7cdf48d57796f5b184fa53249d04a480e270e6ea;hb=3dadfbb969e79953a942885fb931908a36fcaf08;hp=72966978ce38d0a90f5fef87c4e35d1f6ffbcf61;hpb=4bd00f0d606ba94e0e61994c087369ee125297b2;p=alexxy%2Fgromacs.git diff --git a/src/gromacs/correlationfunctions/autocorr.c b/src/gromacs/correlationfunctions/autocorr.cpp similarity index 97% rename from src/gromacs/correlationfunctions/autocorr.c rename to src/gromacs/correlationfunctions/autocorr.cpp index 72966978ce..7cdf48d577 100644 --- a/src/gromacs/correlationfunctions/autocorr.c +++ b/src/gromacs/correlationfunctions/autocorr.cpp @@ -45,10 +45,13 @@ #include "autocorr.h" -#include #include #include +#include + +#include + #include "gromacs/correlationfunctions/expfit.h" #include "gromacs/correlationfunctions/integrate.h" #include "gromacs/correlationfunctions/manyautocorrelation.h" @@ -87,16 +90,12 @@ static void low_do_four_core(int nfour, int nframes, real c1[], real cfour[], int nCos) { int i = 0; - int fftcode; - real aver, *ans; - aver = 0.0; switch (nCos) { case enNorm: for (i = 0; (i < nframes); i++) { - aver += c1[i]; cfour[i] = c1[i]; } break; @@ -116,7 +115,7 @@ static void low_do_four_core(int nfour, int nframes, real c1[], real cfour[], gmx_fatal(FARGS, "nCos = %d, %s %d", nCos, __FILE__, __LINE__); } - fftcode = many_auto_correl(1, nframes, nfour, &cfour); + many_auto_correl(1, nframes, nfour, &cfour); } /*! \brief Routine to comput ACF without FFT. */ @@ -577,8 +576,8 @@ void low_do_autocorr(const char *fn, const output_env_t oenv, const char *title, } if (bFour) { - c0 = log((double)nframes)/log(2.0); - k = c0; + c0 = std::log(static_cast(nframes))/std::log(2.0); + k = static_cast(c0); if (k < c0) { k++; @@ -606,10 +605,9 @@ void low_do_autocorr(const char *fn, const output_env_t oenv, const char *title, * In this loop the actual correlation functions are computed, but without * normalizing them. */ - k = max(1, pow(10, (int)(log(nitem)/log(100)))); - for (i = 0; i < nitem; i++) + for (int i = 0; i < nitem; i++) { - if (bVerbose && ((i%k == 0 || i == nitem-1))) + if (bVerbose && (((i % 100) == 0) || (i == nitem-1))) { fprintf(stderr, "\rThingie %d", i+1); } @@ -660,10 +658,10 @@ void low_do_autocorr(const char *fn, const output_env_t oenv, const char *title, else { sum = print_and_integrate(fp, nout, dt, c1[0], NULL, 1); - if (bVerbose) - { - printf("Correlation time (integral over corrfn): %g (ps)\n", sum); - } + } + if (bVerbose) + { + printf("Correlation time (integral over corrfn): %g (ps)\n", sum); } } else