*/
#include "gmxpre.h"
-#include <math.h>
-#include <stdio.h>
-#include <string.h>
+#include <cmath>
+#include <cstdio>
+#include <cstring>
+
+#include <algorithm>
#include "gromacs/fileio/confio.h"
#include "gromacs/fileio/trxio.h"
char title[256];
int i, j, k, Dih, ntrans;
int cur_bin, new_bin;
- real ttime, tt;
+ real ttime;
real *rot_occ[NROT];
int (*calc_bin)(real, int, real);
real dt;
prev = dih[i][j];
- mind = min(mind, dih[i][j]);
- maxd = max(maxd, dih[i][j]);
+ mind = std::min(mind, dih[i][j]);
+ maxd = std::max(maxd, dih[i][j]);
if ( (maxd - mind) > 2*M_PI/3) /* or 120 degrees, assuming */
{ /* multiplicity 3. Not so general.*/
tr_f[j]++;
{
for (i = 0; (i < nlist); i++)
{
- strncpy(name, dlist[i].name, 3);
+ std::strncpy(name, dlist[i].name, 3);
name[3] = '\0';
if (((Dih < edOmega) ) ||
((Dih == edOmega) && (has_dihedral(edOmega, &(dlist[i])))) ||
/* dihedrals to aromatic rings, COO, CONH2 or guanidinium are 2fold*/
if (Dih > edOmega && (dlist[i].atm.Cn[Dih-NONCHI+3] != -1))
{
- if ( ((strstr(name, "PHE") != NULL) && (Dih == edChi2)) ||
- ((strstr(name, "TYR") != NULL) && (Dih == edChi2)) ||
- ((strstr(name, "PTR") != NULL) && (Dih == edChi2)) ||
- ((strstr(name, "TRP") != NULL) && (Dih == edChi2)) ||
- ((strstr(name, "HIS") != NULL) && (Dih == edChi2)) ||
- ((strstr(name, "GLU") != NULL) && (Dih == edChi3)) ||
- ((strstr(name, "ASP") != NULL) && (Dih == edChi2)) ||
- ((strstr(name, "GLN") != NULL) && (Dih == edChi3)) ||
- ((strstr(name, "ASN") != NULL) && (Dih == edChi2)) ||
- ((strstr(name, "ARG") != NULL) && (Dih == edChi4)) )
+ if ( ((std::strstr(name, "PHE") != NULL) && (Dih == edChi2)) ||
+ ((std::strstr(name, "TYR") != NULL) && (Dih == edChi2)) ||
+ ((std::strstr(name, "PTR") != NULL) && (Dih == edChi2)) ||
+ ((std::strstr(name, "TRP") != NULL) && (Dih == edChi2)) ||
+ ((std::strstr(name, "HIS") != NULL) && (Dih == edChi2)) ||
+ ((std::strstr(name, "GLU") != NULL) && (Dih == edChi3)) ||
+ ((std::strstr(name, "ASP") != NULL) && (Dih == edChi2)) ||
+ ((std::strstr(name, "GLN") != NULL) && (Dih == edChi3)) ||
+ ((std::strstr(name, "ASN") != NULL) && (Dih == edChi2)) ||
+ ((std::strstr(name, "ARG") != NULL) && (Dih == edChi4)) )
{
multiplicity[j] = 2;
}
index = lookup[i][0]; /* index into dih of chi1 of res i */
if (index == -1)
{
- b = 0;
bRotZero = TRUE;
bHaveChi = FALSE;
}
{
d = invth*histo[j];
ang = j*fac-start;
- c1 = cos(ang);
- c2 = c1*c1;
+ c1 = std::cos(ang);
dc = d*c1;
- ds = d*sin(ang);
+ ds = d*std::sin(ang);
tdc += dc;
tds += ds;
for (i = 0; (i < nkkk); i++)
{
- c1 = cos(ang+kkk[i].offset);
+ c1 = std::cos(ang+kkk[i].offset);
c2 = c1*c1;
Jc = (kkk[i].A*c2 + kkk[i].B*c1 + kkk[i].C);
kkk[i].Jc += histo[j]*Jc;
for (i = 0; (i < nkkk); i++)
{
kkk[i].Jc /= th;
- kkk[i].Jcsig = sqrt(kkk[i].Jcsig/th-sqr(kkk[i].Jc));
+ kkk[i].Jcsig = std::sqrt(kkk[i].Jcsig/th-sqr(kkk[i].Jc));
}
*S2 = tdc*tdc+tds*tds;
}
{
int i, ix, t1, t2;
rvec r_ij, r_kj;
- real costh;
+ real costh = 0.0;
for (i = ix = 0; (ix < n3); i++, ix += 3)
{
minx = maxx = data[0];
for (i = 1; (i < ndata); i++)
{
- minx = min(minx, data[i]);
- maxx = max(maxx, data[i]);
+ minx = std::min(minx, data[i]);
+ maxx = std::max(maxx, data[i]);
}
fprintf(log, "Min data: %10g Max data: %10g\n", minx, maxx);
}
}
for (i = 0; (i < ndata); i++)
{
- ind = (data[i]-minx)*dx;
+ ind = static_cast<int>((data[i]-minx)*dx);
if ((ind >= 0) && (ind < npoints))
{
histo[ind]++;
{
struct t_pbc *pbc;
t_trxstatus *status;
- int i, angind, natoms, total, teller;
+ int i, angind, total, teller;
int nangles, n_alloc;
real t, fraction, pifac, aa, angle;
real *angles[2];
#define prev (1-cur)
snew(pbc, 1);
- natoms = read_first_x(oenv, &status, trj_fn, &t, &x, box);
+ read_first_x(oenv, &status, trj_fn, &t, &x, box);
if (bAngles)
{
for (i = 0; (i < nangles); i++)
{
real dd = angles[cur][i];
- angles[cur][i] = atan2(sin(dd), cos(dd));
+ angles[cur][i] = std::atan2(sin(dd), cos(dd));
}
}
else
}
/* Update the distribution histogram */
- angind = (int) ((angle*maxangstat)/pifac + 0.5);
+ angind = static_cast<int>((angle*maxangstat)/pifac + 0.5);
if (angind == maxangstat)
{
angind = 0;