*/
#include "gmxpre.h"
+#include <cmath>
+
#include "gromacs/commandline/pargs.h"
#include "gromacs/fileio/tpxio.h"
#include "gromacs/fileio/trxio.h"
rvec_add(xref, dx, xtest);
for (j = 0; (j < DIM); j++)
{
- if (fabs(xtest[j]-x[ai][j]) > tol)
+ if (std::abs(xtest[j]-x[ai][j]) > tol)
{
/* Here we have used the wrong image for contributing to the COM */
xref[j] += mass*(xtest[j]-x[ai][j]);
t_topology *top;
t_inputrec *ir;
t_atom *atom;
- char title[STRLEN];
t_trxstatus *status;
int nrefat, natoms, nf, ntot;
real t;
- rvec *xtop, *x, xref, trial, dx = {0}, dip, dir;
+ rvec *x, xref, trial, dx = {0}, dip, dir;
matrix box;
FILE *fp;
};
output_env_t oenv;
- static gmx_bool bCom = FALSE, bPBC = FALSE;
+ static gmx_bool bCom = FALSE;
static int srefat = 1;
static real rmin = 0.0, rmax = 0.32, refdip = 0, bw = 0.01;
t_pargs pa[] = {
/* initialize reading trajectory: */
natoms = read_first_x(oenv, &status, ftp2fn(efTRX, NFILE, fnm), &t, &x, box);
- rcut = 0.99*sqrt(max_cutoff2(ir->ePBC, box));
+ rcut = 0.99*std::sqrt(max_cutoff2(ir->ePBC, box));
if (rcut == 0)
{
rcut = 10*rmax;
}
rcut2 = sqr(rcut);
invbw = 1/bw;
- nbin = (int)(rcut*invbw)+2;
+ nbin = static_cast<int>(rcut*invbw)+2;
snew(hist, nbin);
rmin2 = sqr(rmin);
}
if (rdx2 < rcut2)
{
- hist[(int)(sqrt(rdx2)*invbw)+1]++;
+ hist[static_cast<int>(std::sqrt(rdx2)*invbw)+1]++;
}
if (rdx2 >= rmin2 && rdx2 < rmax2)
{
svmul(ENM2DEBYE, dip, dip);
dip2 = norm2(dip);
- sdip += sqrt(dip2);
+ sdip += std::sqrt(dip2);
sdip2 += dip2;
for (d = 0; d < DIM; d++)
{
close_trj(status);
fprintf(stderr, "Average number of molecules within %g nm is %.1f\n",
- rmax, (real)ntot/(real)nf);
+ rmax, static_cast<real>(ntot)/nf);
if (ntot > 0)
{
sdip /= ntot;
sinp /= ntot;
sdinp /= ntot;
fprintf(stderr, "Average dipole: %f (D), std.dev. %f\n",
- sdip, sqrt(sdip2-sqr(sdip)));
+ sdip, std::sqrt(sdip2-sqr(sdip)));
fprintf(stderr, "Average radial component of the dipole: %f (D)\n",
sinp);
fprintf(stderr, "Average radial component of the polarization: %f (D)\n",