*/
#include "gmxpre.h"
+#include <cmath>
+
#include "gromacs/commandline/pargs.h"
#include "gromacs/fileio/confio.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]);
matrix box;
FILE *fp;
- int i, j, p, sa0, sa1, sa2, n, ntot, nf, m, *hist1, *hist2, *histn, nbin1, nbin2, nrbin;
+ int i, p, sa0, sa1, sa2, n, ntot, nf, m, *hist1, *hist2, *histn, nbin1, nbin2, nrbin;
real *histi1, *histi2, invbw, invrbw;
double sum1, sum2;
int *isize, nrefgrp, nrefat;
atom_id **index;
char **grpname;
- real inp, outp, two_pi, nav, normfac, rmin2, rmax2, rcut, rcut2, r2, r, mass, mtot;
+ real inp, outp, nav, normfac, rmin2, rmax2, rcut, rcut2, r2, r;
real c1, c2;
char str[STRLEN];
gmx_bool bTPS;
return 0;
}
- two_pi = 2/M_PI;
-
bTPS = (opt2bSet("-s", NFILE, fnm) || !opt2bSet("-n", NFILE, fnm) || bCom);
if (bTPS)
{
rmin2 = sqr(rmin);
rmax2 = sqr(rmax);
- rcut = 0.99*sqrt(max_cutoff2(guess_ePBC(box), box));
+ rcut = 0.99*std::sqrt(max_cutoff2(guess_ePBC(box), box));
if (rcut == 0)
{
rcut = 10*rmax;
rcut2 = sqr(rcut);
invbw = 1/binwidth;
- nbin1 = 1+(int)(2*invbw + 0.5);
- nbin2 = 1+(int)(invbw + 0.5);
+ nbin1 = 1+static_cast<int>(2*invbw + 0.5);
+ nbin2 = 1+static_cast<int>(invbw + 0.5);
invrbw = 1/rbinw;
snew(hist1, nbin1);
snew(hist2, nbin2);
- nrbin = 1+(int)(rcut/rbinw);
+ nrbin = 1+static_cast<int>(rcut/rbinw);
if (nrbin == 0)
{
nrbin = 1;
set_pbc(&pbc, ePBC, box);
n = 0;
inp = 0;
- outp = 0;
for (p = 0; (p < nrefgrp); p++)
{
if (bCom)
r2 = norm2(dx);
if (r2 < rcut2)
{
- r = sqrt(r2);
+ r = std::sqrt(r2);
if (!bVec23)
{
/* Determine the normal to the plain */
outp = iprod(dx, dxh2)/r;
}
{
- int ii = (int)(invrbw*r);
+ int ii = static_cast<int>(invrbw*r);
range_check(ii, 0, nrbin);
histi1[ii] += inp;
histi2[ii] += 3*sqr(outp) - 1;
}
if ((r2 >= rmin2) && (r2 < rmax2))
{
- int ii1 = (int)(invbw*(inp + 1));
- int ii2 = (int)(invbw*fabs(outp));
+ int ii1 = static_cast<int>(invbw*(inp + 1));
+ int ii2 = static_cast<int>(invbw*std::abs(outp));
range_check(ii1, 0, nbin1);
range_check(ii2, 0, nbin2);
hist1[nbin1-1] += hist1[nbin1];
hist2[nbin2-1] += hist2[nbin2];
- nav = (real)ntot/(nrefgrp*nf);
+ nav = static_cast<real>(ntot)/(nrefgrp*nf);
normfac = invbw/ntot;
fprintf(stderr, "Average nr of molecules between %g and %g nm: %.1f\n",