X-Git-Url: http://biod.pnpi.spb.ru/gitweb/?a=blobdiff_plain;f=src%2Fgromacs%2Fgmxana%2Fgmx_do_dssp.cpp;fp=src%2Fgromacs%2Fgmxana%2Fgmx_do_dssp.c;h=2abed999d596c3444257341c8e80e2eb7f9d76fc;hb=c3f2d46e4047f0c465f7234b3784a2fa6f02a065;hp=cc33e1764130faae364939cabea2206a0680a2b5;hpb=0595b4a4c763a0bc574658992081abf8b0abc3fe;p=alexxy%2Fgromacs.git diff --git a/src/gromacs/gmxana/gmx_do_dssp.c b/src/gromacs/gmxana/gmx_do_dssp.cpp similarity index 94% rename from src/gromacs/gmxana/gmx_do_dssp.c rename to src/gromacs/gmxana/gmx_do_dssp.cpp index cc33e17641..2abed999d5 100644 --- a/src/gromacs/gmxana/gmx_do_dssp.c +++ b/src/gromacs/gmxana/gmx_do_dssp.cpp @@ -36,7 +36,10 @@ */ #include "gmxpre.h" -#include +#include +#include + +#include #include "gromacs/commandline/pargs.h" #include "gromacs/fileio/confio.h" @@ -45,6 +48,7 @@ #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" @@ -81,7 +85,7 @@ static int strip_dssp(char *dsspfile, int nres, { 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, @@ -170,7 +174,7 @@ static int strip_dssp(char *dsspfile, int nres, 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(0), searchcmap(mat->nmap, mat->map, c)); } frame++; mat->nx = frame; @@ -217,15 +221,15 @@ static void check_oo(t_atoms *atoms) 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; } @@ -324,12 +328,12 @@ void write_sas_mat(const char *fn, real **accr, int nframe, int nres, t_matrix * { 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(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); @@ -362,7 +366,7 @@ void analyse_ss(const char *outfile, t_matrix *mat, const char *ss_string, { fprintf(fp, "@ subtitle \"Structure = "); } - for (s = 0; s < strlen(ss_string); s++) + for (s = 0; s < std::strlen(ss_string); s++) { if (s > 0) { @@ -387,7 +391,7 @@ void analyse_ss(const char *outfile, t_matrix *mat, const char *ss_string, 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(mat->nmap); s++) { count[s] = 0; } @@ -396,16 +400,16 @@ void analyse_ss(const char *outfile, t_matrix *mat, const char *ss_string, 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(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(mat->nmap); s++) { fprintf(fp, " %5d", count[s]); } @@ -413,17 +417,17 @@ void analyse_ss(const char *outfile, t_matrix *mat, const char *ss_string, } /* 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(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(mat->nx * mat->ny)); + for (s = 0; s < static_cast(mat->nmap); s++) { - fprintf(fp, " %5.2f", total[s] / (real) (mat->nx * mat->ny)); + fprintf(fp, " %5.2f", total[s] / static_cast(mat->nx * mat->ny)); } fprintf(fp, "\n"); @@ -552,7 +556,7 @@ int gmx_do_dssp(int argc, char *argv[]) } 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) { @@ -568,7 +572,7 @@ int gmx_do_dssp(int argc, char *argv[]) fclose(tmpf); } - strcpy(tmpfile, "ddXXXXXX"); + std::strcpy(tmpfile, "ddXXXXXX"); gmx_tmpnam(tmpfile); if ((tmpf = fopen(tmpfile, "w")) == NULL) { @@ -720,7 +724,7 @@ int gmx_do_dssp(int argc, char *argv[]) for (i = 0; i < atoms->nres; i++) { - av_area[i] = (average_area[i] / (real)nframe); + av_area[i] = (average_area[i] / static_cast(nframe)); } norm_acc(atoms, nres, av_area, norm_av_area);