*/
#include "gmxpre.h"
-#include <ctype.h>
-#include <math.h>
-#include <stdlib.h>
-#include <string.h>
+#include <cctype>
+#include <cmath>
+#include <cstdlib>
+#include <cstring>
#include "gromacs/commandline/pargs.h"
#include "gromacs/fileio/confio.h"
#include "gromacs/fileio/pdbio.h"
#include "gromacs/fileio/xvgr.h"
#include "gromacs/gmxana/eigio.h"
+#include "gromacs/gmxana/gmx_ana.h"
#include "gromacs/legacyheaders/macros.h"
#include "gromacs/legacyheaders/readinp.h"
#include "gromacs/legacyheaders/txtdump.h"
int i, istep;
char c;
char *pos, *startpos, *step;
- int n = strlen(str);
+ int n = std::strlen(str);
/*enums to define the different lexical stati */
enum {
step = NULL;
snew(pos, n+4);
startpos = pos;
- strcpy(pos, str);
+ std::strcpy(pos, str);
pos[n] = ',';
pos[n+1] = '1';
pos[n+2] = '\0';
switch (status)
{
/* expect a number */
- case sBefore: if (isdigit(c))
+ case sBefore: if (std::isdigit(c))
{
start = pos;
status = sNumber;
{
/*store number*/
srenew(*list, nvecs+1);
- (*list)[nvecs++] = number = strtol(start, NULL, 10);
+ (*list)[nvecs++] = number = std::strtol(start, NULL, 10);
status = sBefore;
if (number == 0)
{
{
status = sMinus; break;
}
- else if (isdigit(c))
+ else if (std::isdigit(c))
{
break;
}
/* have read a '-' -> expect a number */
case sMinus:
- if (isdigit(c))
+ if (std::isdigit(c))
{
end = pos;
status = sRange; break;
} break;
case sSteppedRange:
- if (isdigit(c))
+ if (std::isdigit(c))
{
if (step)
{
if (c == ',')
{
/*store numbers*/
- end_number = strtol(end, NULL, 10);
- number = strtol(start, NULL, 10);
+ end_number = std::strtol(end, NULL, 10);
+ number = std::strtol(start, NULL, 10);
status = sBefore;
if (number == 0)
{
status = sSteppedRange;
break;
}
- else if (isdigit(c))
+ else if (std::isdigit(c))
{
break;
}
*/
int n = 0, i; rvec x;
- real sum;
while (eig_list[n++])
{
; /*count selected eigenvecs*/
/* dump coordinates of the selected eigenvectors */
while (eig_list[n])
{
- sum = 0;
for (i = 0; i < natoms; i++)
{
if (eig_list[n] > nvec)
gmx_fatal(FARGS, "Selected eigenvector %d is higher than maximum number %d of available eigenvectors", eig_list[n], nvec);
}
copy_rvec(eigvecs[eig_list[n]-1][i], x);
- sum += norm2(x);
fprintf(fp, "%8.5f %8.5f %8.5f\n", x[XX], x[YY], x[ZZ]);
}
n++;
static real *scan_vecparams(const char *str, const char * par, int nvecs)
{
char f0[256], f1[256]; /*format strings adapted every pass of the loop*/
- double d, tcap = 0;
+ double d;
int i;
real *vec_params;
f0[0] = '\0';
for (i = 0; (i < nvecs); i++)
{
- strcpy(f1, f0); /*f0 is the format string for the "to-be-ignored" numbers*/
- strcat(f1, "%lf"); /*and f1 to read the actual number in this pass of the loop*/
+ std::strcpy(f1, f0); /*f0 is the format string for the "to-be-ignored" numbers*/
+ std::strcat(f1, "%lf"); /*and f1 to read the actual number in this pass of the loop*/
if (sscanf(str, f1, &d) != 1)
{
gmx_fatal(FARGS, "Not enough elements for %s parameter (I need %d)", par, nvecs);
}
vec_params[i] = d;
- tcap += d;
- strcat(f0, "%*s");
+ std::strcat(f0, "%*s");
}
}
return vec_params;
char title[STRLEN];
matrix topbox;
rvec *xtop;
- gmx_bool bTop, bFit1;
+ gmx_bool bFit1;
t_filenm fnm[] = {
{ efTRN, "-f", "eigenvec", ffREAD },
read_eigenvectors(EigvecFile, &nav, &bFit1,
&xref1, &edi_params.fitmas, &xav1, &edi_params.pcamas, &nvec1, &eignr1, &eigvec1, &eigval1);
- bTop = read_tps_conf(ftp2fn(efTPS, NFILE, fnm),
- title, &top, &ePBC, &xtop, NULL, topbox, 0);
+ read_tps_conf(ftp2fn(efTPS, NFILE, fnm),
+ title, &top, &ePBC, &xtop, NULL, topbox, 0);
atoms = &top.atoms;