*/
#include "gmxpre.h"
-#include <stdlib.h>
+#include <cstdlib>
+#include <cstring>
+
+#include <algorithm>
#include "gromacs/commandline/pargs.h"
#include "gromacs/fileio/confio.h"
#include "gromacs/fileio/strdb.h"
#include "gromacs/fileio/trxio.h"
#include "gromacs/fileio/xvgr.h"
+#include "gromacs/gmxana/gmx_ana.h"
#include "gromacs/gmxana/gstat.h"
#include "gromacs/legacyheaders/macros.h"
#include "gromacs/legacyheaders/typedefs.h"
{
fgets2(buf, STRLEN, tapeout);
}
- while (strstr(buf, "KAPPA") == NULL);
+ while (std::strstr(buf, "KAPPA") == NULL);
if (bFirst)
{
/* Since we also have empty lines in the dssp output (temp) file,
for (i = 0; i < nr; i++)
{
c.c1 = ssbuf[i];
- mat->matrix[frame][i] = max(0, searchcmap(mat->nmap, mat->map, c));
+ mat->matrix[frame][i] = std::max(static_cast<t_matelmt>(0), searchcmap(mat->nmap, mat->map, c));
}
frame++;
mat->nx = frame;
for (i = 0; (i < atoms->nr); i++)
{
- if (strcmp(*(atoms->atomname[i]), "OXT") == 0)
+ if (std::strcmp(*(atoms->atomname[i]), "OXT") == 0)
{
*atoms->atomname[i] = OOO;
}
- else if (strcmp(*(atoms->atomname[i]), "O1") == 0)
+ else if (std::strcmp(*(atoms->atomname[i]), "O1") == 0)
{
*atoms->atomname[i] = OOO;
}
- else if (strcmp(*(atoms->atomname[i]), "OC1") == 0)
+ else if (std::strcmp(*(atoms->atomname[i]), "OC1") == 0)
{
*atoms->atomname[i] = OOO;
}
{
for (j = 0; j < nres; j++)
{
- lo = min(lo, accr[i][j]);
- hi = max(hi, accr[i][j]);
+ lo = std::min(lo, accr[i][j]);
+ hi = std::max(hi, accr[i][j]);
}
}
fp = gmx_ffopen(fn, "w");
- nlev = hi-lo+1;
+ nlev = static_cast<int>(hi-lo+1);
write_xpm(fp, 0, "Solvent Accessible Surface", "Surface (A^2)",
"Time", "Residue Index", nframe, nres,
mat->axis_x, mat->axis_y, accr, lo, hi, rlo, rhi, &nlev);
{
fprintf(fp, "@ subtitle \"Structure = ");
}
- for (s = 0; s < strlen(ss_string); s++)
+ for (s = 0; s < std::strlen(ss_string); s++)
{
if (s > 0)
{
for (f = 0; f < mat->nx; f++)
{
ss_count = 0;
- for (s = 0; s < (size_t)mat->nmap; s++)
+ for (s = 0; s < static_cast<size_t>(mat->nmap); s++)
{
count[s] = 0;
}
count[mat->matrix[f][r]]++;
total[mat->matrix[f][r]]++;
}
- for (s = 0; s < (size_t)mat->nmap; s++)
+ for (s = 0; s < static_cast<size_t>(mat->nmap); s++)
{
- if (strchr(ss_string, map[s].code.c1))
+ if (std::strchr(ss_string, map[s].code.c1))
{
ss_count += count[s];
total_count += count[s];
}
}
fprintf(fp, "%8g %5d", mat->axis_x[f], ss_count);
- for (s = 0; s < (size_t)mat->nmap; s++)
+ for (s = 0; s < static_cast<size_t>(mat->nmap); s++)
{
fprintf(fp, " %5d", count[s]);
}
}
/* now print column totals */
fprintf(fp, "%-8s %5d", "# Totals", total_count);
- for (s = 0; s < (size_t)mat->nmap; s++)
+ for (s = 0; s < static_cast<size_t>(mat->nmap); s++)
{
fprintf(fp, " %5d", total[s]);
}
fprintf(fp, "\n");
/* now print percentages */
- fprintf(fp, "%-8s %5.2f", "# SS %", total_count / (real) (mat->nx * mat->ny));
- for (s = 0; s < (size_t)mat->nmap; s++)
+ fprintf(fp, "%-8s %5.2f", "# SS %", total_count / static_cast<real>(mat->nx * mat->ny));
+ for (s = 0; s < static_cast<size_t>(mat->nmap); s++)
{
- fprintf(fp, " %5.2f", total[s] / (real) (mat->nx * mat->ny));
+ fprintf(fp, " %5.2f", total[s] / static_cast<real>(mat->nx * mat->ny));
}
fprintf(fp, "\n");
}
fprintf(stderr, "There are %d residues in your selected group\n", nres);
- strcpy(pdbfile, "ddXXXXXX");
+ std::strcpy(pdbfile, "ddXXXXXX");
gmx_tmpnam(pdbfile);
if ((tmpf = fopen(pdbfile, "w")) == NULL)
{
fclose(tmpf);
}
- strcpy(tmpfile, "ddXXXXXX");
+ std::strcpy(tmpfile, "ddXXXXXX");
gmx_tmpnam(tmpfile);
if ((tmpf = fopen(tmpfile, "w")) == NULL)
{
for (i = 0; i < atoms->nres; i++)
{
- av_area[i] = (average_area[i] / (real)nframe);
+ av_area[i] = (average_area[i] / static_cast<real>(nframe));
}
norm_acc(atoms, nres, av_area, norm_av_area);