#include <stdlib.h>
#include <string.h>
+#include <algorithm>
+
#include "gromacs/fileio/filenm.h"
#include "gromacs/fileio/gmxfio.h"
#include "gromacs/fileio/xvgr.h"
{
if (pcrd->dim[m] != 0)
{
- max_d2 = min(max_d2, norm2(pbc->box[m]));
+ max_d2 = std::min(max_d2, static_cast<double>(norm2(pbc->box[m])));
}
}
dvec xg, dvec xref, double max_dist2,
dvec dr)
{
- const t_pull_group *pgrp0, *pgrp1;
+ const t_pull_group *pgrp0;
int m;
dvec xrefr, dref = {0, 0, 0};
double dr2;
pgrp0 = &pull->group[pcrd->group[0]];
- pgrp1 = &pull->group[pcrd->group[1]];
/* Only the first group can be an absolute reference, in that case nat=0 */
if (pgrp0->nat == 0)
const t_pull_group *pgrp2, *pgrp3;
dvec vec;
int m;
- double invlen;
pgrp2 = &pull->group[pcrd->group[2]];
pgrp3 = &pull->group[pcrd->group[3]];
gmx_bool bConverged_all, bConverged = FALSE;
int niter = 0, g, c, ii, j, m, max_iter = 100;
double a;
- dvec f; /* the pull force */
dvec tmp, tmp3;
t_pull_group *pgrp0, *pgrp1;
t_pull_coord *pcrd;
dsvmul( lambda*rm*pgrp0->invtm, vec, dr0);
dr_tot[c] += -lambda;
break;
+ default:
+ gmx_incons("Invalid enumeration value for eGeom");
+ /* Keep static analyzer happy */
+ clear_dvec(dr0);
+ clear_dvec(dr1);
}
/* DEBUG */
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2008, The GROMACS development team.
- * Copyright (c) 2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include <stdlib.h>
#include <string.h>
+#include <algorithm>
+
#include "gromacs/domdec/domdec.h"
#include "gromacs/fileio/gmxfio.h"
#include "gromacs/fileio/trnio.h"
#include "gromacs/utility/qsort_threadsafe.h"
#include "gromacs/utility/smalloc.h"
-static char *RotStr = {"Enforced rotation:"};
+static char const *RotStr = {"Enforced rotation:"};
/* Set the minimum weight for the determination of the slab centers */
#define WEIGHT_MIN (10*GMX_FLOAT_MIN)
real gaussian; /* A single gaussian weight */
real wgauss; /* gaussian times current mass */
real slabweight = 0.0; /* The sum of weights in the slab */
- int i, islab;
- gmx_enfrotgrp_t erg; /* Pointer to enforced rotation group data */
+ int i;
- erg = rotg->enfrotgrp;
clear_rvec(*x_weighted_sum);
- /* Slab index */
- islab = j - erg->slab_first;
-
/* Loop over all atoms in the rotation group */
for (i = 0; i < rotg->nat; i++)
{
init_rot_group we need to store
the reference slab centers */
{
+ /* Slab index */
int j, islab;
gmx_enfrotgrp_t erg; /* Pointer to enforced rotation group data */
/* Right-aligned output of value with standard width */
-static void print_aligned(FILE *fp, char *str)
+static void print_aligned(FILE *fp, char const *str)
{
fprintf(fp, "%12s", str);
}
/* Right-aligned output of value with standard short width */
-static void print_aligned_short(FILE *fp, char *str)
+static void print_aligned_short(FILE *fp, char const *str)
{
fprintf(fp, "%6s", str);
}
for (g = 0; g < rot->ngrp; g++)
{
- rotg = &rot->grp[g];
sprintf(buf, "theta_ref%d", g);
add_to_string_aligned(&LegendStr, buf);
rvec firstatom) /* First atom after sorting along the rotation vector v */
{
/* Find the first slab for the first atom */
- return ceil((iprod(firstatom, rotg->vec) - max_beta)/rotg->slab_dist);
+ return static_cast<int>(ceil(static_cast<double>((iprod(firstatom, rotg->vec) - max_beta)/rotg->slab_dist)));
}
rvec lastatom) /* Last atom along v */
{
/* Find the last slab for the last atom */
- return floor((iprod(lastatom, rotg->vec) + max_beta)/rotg->slab_dist);
+ return static_cast<int>(floor(static_cast<double>((iprod(lastatom, rotg->vec) + max_beta)/rotg->slab_dist)));
}
gmx_enfrotgrp_t erg; /* Pointer to enforced rotation group data */
rvec xi_xc; /* xj - xc */
rvec tmpvec, tmpvec2;
- real fac, fac2;
+ real fac;
rvec ri, si;
real siri;
rvec v_xi_xc; /* v x (xj - u) */
svmul(psii, v_xi_xc, si); /* si = psii * (v x (xi-xc) ) */
- fac = iprod(v_xi_xc, ri); /* fac = (v x (xi-xc)).ri */
- fac2 = fac*fac;
-
- siri = iprod(si, ri); /* siri = si.ri */
+ siri = iprod(si, ri); /* siri = si.ri */
svmul(psiistar/psii, ri, tmpvec);
svmul(psiistar*psiistar/(psii*psii*psii) * siri, si, tmpvec2);
int *firstindex,
int *lastindex)
{
- gmx_enfrotgrp_t erg; /* Pointer to enforced rotation group data */
int i;
real xcproj; /* The projection of a reference position on the
rotation vector */
- erg = rotg->enfrotgrp;
-
/* Start with some value */
minproj = iprod(rotg->x_ref[0], rotg->vec);
maxproj = minproj;
snew(rotg->enfrotgrp, 1);
erg = rotg->enfrotgrp;
- nat_max = max(nat_max, rotg->nat);
+ nat_max = std::max(nat_max, rotg->nat);
if (PAR(cr))
{
t_rot *rot;
t_rotgrp *rotg;
gmx_bool outstep_slab, outstep_rot;
- gmx_bool bFlex, bColl;
+ gmx_bool bColl;
gmx_enfrot_t er; /* Pointer to the enforced rotation buffer variables */
gmx_enfrotgrp_t erg; /* Pointer to enforced rotation group data */
rvec transvec;
rotg = &rot->grp[g];
erg = rotg->enfrotgrp;
- /* Do we have a flexible axis? */
- bFlex = ISFLEX(rotg);
/* Do we use a collective (global) set of coordinates? */
bColl = ISCOLL(rotg);
rotg = &rot->grp[g];
erg = rotg->enfrotgrp;
- bFlex = ISFLEX(rotg);
- bColl = ISCOLL(rotg);
-
if (outstep_rot && MASTER(cr))
{
fprintf(er->out_rot, "%12.4f", erg->degangle);