*/
#include "gmxpre.h"
-#include <math.h>
-#include <stdio.h>
-#include <string.h>
+#include <cmath>
+#include <cstdio>
+#include <cstring>
+
+#include <algorithm>
#include "gromacs/commandline/pargs.h"
#include "gromacs/correlationfunctions/autocorr.h"
#define NPP asize(map)
int x, y;
-#define INDEX(ppp) ((((int) (360+ppp*RAD2DEG)) % 360)/6)
+#define INDEX(ppp) (((static_cast<int> (360+ppp*RAD2DEG)) % 360)/6)
x = INDEX(phi);
y = INDEX(psi);
#undef INDEX
- return (gmx_bool) map[x][y];
+
+ return (map[x][y] == '1') ? TRUE : FALSE;
}
atom_id *make_chi_ind(int nl, t_dlist dl[], int *ndih)
{
mult = 3;
- return (int) (chi*mult/360.0);
+ return static_cast<int>(chi*mult/360.0);
}
snew(data, nf);
if (bRAD)
{
- strcpy(ystr, "Angle (rad)");
+ std::strcpy(ystr, "Angle (rad)");
}
else
{
- strcpy(ystr, "Angle (degrees)");
+ std::strcpy(ystr, "Angle (degrees)");
}
/* Dump em all */
real *normhisto;
real **Jc, **Jcsig;
int ****his_aa_ss = NULL;
- int ***his_aa, **his_aa1, *histmp;
+ int ***his_aa, *histmp;
int i, j, k, m, n, nn, Dih, nres, hindex, angle;
gmx_bool bBfac, bOccup;
char hisfile[256], hhisfile[256], sshisfile[256], title[256], *ss_str = NULL;
}
if (bOccup && ((bfac_max <= 0) || ((bfac_max > 0) && bBfac)))
{
- hindex = ((dih[j][0]+M_PI)*nbin)/(2*M_PI);
+ hindex = static_cast<int>(((dih[j][0]+M_PI)*nbin)/(2*M_PI));
range_check(hindex, 0, nbin);
/* Assign dihedral to either of the structure determined
sprintf(title, "\\xc\\f{}\\s%d\\N Distribution for %s",
Dih-NONCHI+1, residue_name);
}
- strcpy(hhisfile, hisfile);
- strcat(hhisfile, ".xvg");
+ std::strcpy(hhisfile, hisfile);
+ std::strcat(hhisfile, ".xvg");
fp = xvgropen(hhisfile, title, "Degrees", "", oenv);
if (output_env_get_print_xvgr_codes(oenv))
{
fprintf(fp, "%10g %10g\n", phi, psi);
if (bViol)
{
- fprintf(gp, "%d\n", !bAllowed(dih[Phi][j], RAD2DEG*dih[Psi][j]));
+ fprintf(gp, "%d\n", (bAllowed(dih[Phi][j], RAD2DEG*dih[Psi][j]) == FALSE) );
}
if (bOm)
{
omega = RAD2DEG*dih[Om][j];
- mat[(int)((phi*NMAT)/360)+NMAT/2][(int)((psi*NMAT)/360)+NMAT/2]
+ mat[static_cast<int>(((phi*NMAT)/360)+NMAT/2)][static_cast<int>(((psi*NMAT)/360)+NMAT/2)]
+= omega;
}
}
for (k = 0; (k < NMAT); k++)
{
mat[j][k] /= nf;
- lo = min(mat[j][k], lo);
- hi = max(mat[j][k], hi);
+ lo = std::min(mat[j][k], lo);
+ hi = std::max(mat[j][k], hi);
}
}
/* Symmetrise */
- if (fabs(lo) > fabs(hi))
+ if (std::abs(lo) > std::abs(hi))
{
hi = -lo;
}
{
/* based on order_params below */
FILE *fp;
- int nh[edMax];
int i, Dih, Xi;
/* must correspond with enum in pp2shift.h:38 */
oenv);
xvgr_legend(fp, NONCHI+maxchi, (const char**)leg, oenv);
- for (Dih = 0; (Dih < edMax); Dih++)
- {
- nh[Dih] = 0;
- }
-
fprintf(fp, "%5s ", "#Res.");
fprintf(fp, "%10s %10s %10s ", leg[edPhi], leg[edPsi], leg[edOmega]);
for (Xi = 0; Xi < maxchi; Xi++)
x0 = y0 = z0 = 1000.0;
for (i = 0; (i < atoms->nr); i++)
{
- x0 = min(x0, x[i][XX]);
- y0 = min(y0, x[i][YY]);
- z0 = min(z0, x[i][ZZ]);
+ x0 = std::min(x0, x[i][XX]);
+ y0 = std::min(y0, x[i][YY]);
+ z0 = std::min(z0, x[i][ZZ]);
}
x0 *= 10.0; /* nm -> angstrom */
y0 *= 10.0; /* nm -> angstrom */
atom_id isize, *index;
int ndih, nactdih, nf;
real **dih, *trans_frac, *aver_angle, *time;
- int i, j, **chi_lookup, *multiplicity;
+ int i, **chi_lookup, *multiplicity;
t_filenm fnm[] = {
{ efSTX, "-s", NULL, ffREAD },
snew(multiplicity, ndih);
mk_multiplicity_lookup(multiplicity, maxchi, nlist, dlist, ndih);
- strcpy(grpname, "All residues, ");
+ std::strcpy(grpname, "All residues, ");
if (bPhi)
{
- strcat(grpname, "Phi ");
+ std::strcat(grpname, "Phi ");
}
if (bPsi)
{
- strcat(grpname, "Psi ");
+ std::strcat(grpname, "Psi ");
}
if (bOmega)
{
- strcat(grpname, "Omega ");
+ std::strcat(grpname, "Omega ");
}
if (bChi)
{
- strcat(grpname, "Chi 1-");
- sprintf(grpname + strlen(grpname), "%i", maxchi);
+ std::strcat(grpname, "Chi 1-");
+ sprintf(grpname + std::strlen(grpname), "%i", maxchi);
}