*/
#include "gmxpre.h"
-#include <math.h>
+#include <cmath>
+#include <cstring>
+
+#include <algorithm>
#include "gromacs/commandline/pargs.h"
#include "gromacs/fileio/confio.h"
{
pbc_dx(&pbc, xi, x[index[j]], dx);
temp2 = norm2(dx);
- d[i][j] = sqrt(temp2);
+ d[i][j] = std::sqrt(temp2);
}
}
}
{
pbc_dx(&pbc, xi, x[index[j]], dx);
temp2 = norm2(dx);
- temp = sqrt(temp2);
+ temp = std::sqrt(temp2);
d[i][j] = temp;
dtot[i][j] += temp;
dtot2[i][j] += temp2;
{
for (j = i+1; (j < nind); j++)
{
- temp1_3 = pow(dtot1_3[i][j]/nframes, -1.0/3.0);
- temp1_6 = pow(dtot1_6[i][j]/nframes, -1.0/6.0);
+ temp1_3 = std::pow(dtot1_3[i][j]/nframes, static_cast<real>(-1.0/3.0));
+ temp1_6 = std::pow(dtot1_6[i][j]/nframes, static_cast<real>(-1.0/6.0));
if (temp1_3 > *max1_3)
{
*max1_3 = temp1_3;
for (j = 0; equiv[i][j].rnr != NOTSET && !bFound; j++)
{
bFound = ( equiv[i][j].rnr == rnr1 &&
- strcmp(equiv[i][j].rname, rname1) == 0 &&
- strcmp(equiv[i][j].aname, aname1) == 0 );
+ std::strcmp(equiv[i][j].rname, rname1) == 0 &&
+ std::strcmp(equiv[i][j].aname, aname1) == 0 );
}
if (bFound)
{
for (j = 0; equiv[i][j].rnr != NOTSET && !bFound; j++)
{
bFound = ( equiv[i][j].rnr == rnr2 &&
- strcmp(equiv[i][j].rname, rname2) == 0 &&
- strcmp(equiv[i][j].aname, aname2) == 0 );
+ std::strcmp(equiv[i][j].rname, rname2) == 0 &&
+ std::strcmp(equiv[i][j].aname, aname2) == 0 );
}
}
}
gmx_bool bSumH,
atom_id *noe_index, t_noe_gr *noe_gr)
{
- FILE *fp;
int i, j, anmil, anmjl, rnri, rnrj, gi, groupnr, neq;
char *anmi, *anmj, **nnm;
gmx_bool bMatch, bEquiv;
X are any number of letters or digits and ? goes from 1 to 3
This is supposed to cover all CH3 groups and the like */
anmi = *atoms->atomname[index[i]];
- anmil = strlen(anmi);
+ anmil = std::strlen(anmi);
bMatch = i <= isize-3 && anmi[anmil-1] == '1';
if (bMatch)
{
for (j = 1; j < 3; j++)
{
anmj = *atoms->atomname[index[i+j]];
- anmjl = strlen(anmj);
+ anmjl = std::strlen(anmj);
bMatch = bMatch && ( anmil == anmjl && anmj[anmjl-1] == Hnum[j] &&
- strncmp(anmi, anmj, anmil-1) == 0 );
+ std::strncmp(anmi, anmj, anmil-1) == 0 );
}
}
/* set index for this atom */
noe_gr[gi].aname = gmx_strdup(*atoms->atomname[index[i]]);
if (noe_index[i] == noe_index[i+1])
{
- noe_gr[gi].aname[strlen(noe_gr[gi].aname)-1] = '*';
+ noe_gr[gi].aname[std::strlen(noe_gr[gi].aname)-1] = '*';
}
}
noe_gr[gi].rnr = atoms->atom[index[i]].resind;
/* r goes from 0 to rmax
NSCALE*r/rmax goes from 0 to NSCALE
NSCALE - NSCALE*r/rmax goes from NSCALE to 0 */
- s3 = NSCALE - min(NSCALE, (int)(NSCALE*r3/rmax));
- s6 = NSCALE - min(NSCALE, (int)(NSCALE*r6/rmax));
+ s3 = NSCALE - std::min(NSCALE, static_cast<int>(NSCALE*r3/rmax));
+ s6 = NSCALE - std::min(NSCALE, static_cast<int>(NSCALE*r6/rmax));
for (i = 0; i < s3; i++)
{
{
gj = noe_index[j];
noe[gi][gj].nr++;
- noe[gi][gj].i_3 += pow(dtot1_3[i][j], -3);
- noe[gi][gj].i_6 += pow(dtot1_6[i][j], -6);
+ noe[gi][gj].i_3 += std::pow(dtot1_3[i][j], static_cast<real>(-3.0));
+ noe[gi][gj].i_6 += std::pow(dtot1_6[i][j], static_cast<real>(-6.0));
}
}
{
for (j = i+1; j < gnr; j++)
{
- noe[i][j].r_3 = pow(noe[i][j].i_3/noe[i][j].nr, -1.0/3.0);
- noe[i][j].r_6 = pow(noe[i][j].i_6/noe[i][j].nr, -1.0/6.0);
+ noe[i][j].r_3 = std::pow(noe[i][j].i_3/noe[i][j].nr, static_cast<real>(-1.0/3.0));
+ noe[i][j].r_6 = std::pow(noe[i][j].i_6/noe[i][j].nr, static_cast<real>(-1.0/6.0));
noe[j][i] = noe[i][j];
}
}
grj = noe_gr[j];
r3 = noe[i][j].r_3;
r6 = noe[i][j].r_6;
- min3 = min(r3, min3);
- min6 = min(r6, min6);
+ min3 = std::min(r3, min3);
+ min6 = std::min(r6, min6);
if (r3 < rmax || r6 < rmax)
{
if (grj.rnr == gri.rnr)
}
else
{
- strcpy(b3, "-");
+ std::strcpy(b3, "-");
}
if (r6 < rmax)
{
}
else
{
- strcpy(b6, "-");
+ std::strcpy(b6, "-");
}
fprintf(fp,
"%4d %4d %4s %4s%3d %4d %4d %4s %4s%3d %5s %5s %8d %2d %2s %s\n",
gri.ianr+1, gri.anr+1, gri.aname, gri.rname, gri.rnr+1,
grj.ianr+1, grj.anr+1, grj.aname, grj.rname, grj.rnr+1,
- b3, b6, (int)(noe[i][j].i_6+0.5), grj.rnr-gri.rnr, buf,
+ b3, b6, static_cast<int>(noe[i][j].i_6+0.5), grj.rnr-gri.rnr, buf,
noe2scale(r3, r6, rmax));
}
}
{
mean = dtot[i][j]/nframes;
mean2 = dtot2[i][j]/nframes;
- rms = sqrt(max(0, mean2-mean*mean));
+ rms = std::sqrt(std::max(static_cast<real>(0.0), mean2-mean*mean));
rmsc = rms/mean;
if (mean > *meanmax)
{
}
r2 /= (natom*(natom-1))/2;
- return sqrt(r2);
+ return std::sqrt(r2);
}
int gmx_rmsdist(int argc, char *argv[])
};
- int natom, i, j, teller, gi, gj;
+ int i, teller;
real t;
t_topology top;
}
/*do a first step*/
- natom = read_first_x(oenv, &status, ftp2fn(efTRX, NFILE, fnm), &t, &x, box);
+ read_first_x(oenv, &status, ftp2fn(efTRX, NFILE, fnm), &t, &x, box);
teller = 0;
do