#include "autocorr.h"
-#include <math.h>
#include <stdio.h>
#include <string.h>
+#include <cmath>
+
+#include <algorithm>
+
#include "gromacs/correlationfunctions/expfit.h"
#include "gromacs/correlationfunctions/integrate.h"
#include "gromacs/correlationfunctions/manyautocorrelation.h"
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;
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. */
}
if (bFour)
{
- c0 = log((double)nframes)/log(2.0);
- k = c0;
+ c0 = std::log(static_cast<double>(nframes))/std::log(2.0);
+ k = static_cast<int>(c0);
if (k < c0)
{
k++;
* 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);
}
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