Removed unused variables and changed some pointers to const char.
Added some static_cast to make explicit the old casting behaviour.
Added a missing default clause in pull code
Change-Id: I14708cf15799c564b77e466d73a9e8bc4488d192
#
# This file is part of the GROMACS molecular simulation package.
#
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2014, by the GROMACS development team, led by
+# Copyright (c) 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.
# 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.
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
-file(GLOB PULLING_SOURCES *.cpp *.c)
+file(GLOB PULLING_SOURCES *.cpp)
set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${PULLING_SOURCES} PARENT_SCOPE)
if (BUILD_TESTING)
set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${PULLING_SOURCES} PARENT_SCOPE)
if (BUILD_TESTING)
#include <stdlib.h>
#include <string.h>
#include <stdlib.h>
#include <string.h>
#include "gromacs/fileio/filenm.h"
#include "gromacs/fileio/gmxfio.h"
#include "gromacs/fileio/xvgr.h"
#include "gromacs/fileio/filenm.h"
#include "gromacs/fileio/gmxfio.h"
#include "gromacs/fileio/xvgr.h"
{
if (pcrd->dim[m] != 0)
{
{
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)
{
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]];
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)
/* 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;
const t_pull_group *pgrp2, *pgrp3;
dvec vec;
int m;
pgrp2 = &pull->group[pcrd->group[2]];
pgrp3 = &pull->group[pcrd->group[3]];
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;
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;
dvec tmp, tmp3;
t_pull_group *pgrp0, *pgrp1;
t_pull_coord *pcrd;
dsvmul( lambda*rm*pgrp0->invtm, vec, dr0);
dr_tot[c] += -lambda;
break;
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);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2008, The GROMACS development team.
*
* 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.
* 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 <stdlib.h>
#include <string.h>
#include "gromacs/domdec/domdec.h"
#include "gromacs/fileio/gmxfio.h"
#include "gromacs/fileio/trnio.h"
#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"
#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)
/* 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 */
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 */
clear_rvec(*x_weighted_sum);
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++)
{
/* 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 */
{
init_rot_group we need to store
the reference slab centers */
{
int j, islab;
gmx_enfrotgrp_t erg; /* Pointer to enforced rotation group data */
int j, islab;
gmx_enfrotgrp_t erg; /* Pointer to enforced rotation group data */
/* Right-aligned output of value with standard width */
/* 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 */
{
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);
}
{
fprintf(fp, "%6s", str);
}
for (g = 0; g < rot->ngrp; g++)
{
for (g = 0; g < rot->ngrp; g++)
{
sprintf(buf, "theta_ref%d", g);
add_to_string_aligned(&LegendStr, buf);
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 */
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 */
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;
gmx_enfrotgrp_t erg; /* Pointer to enforced rotation group data */
rvec xi_xc; /* xj - xc */
rvec tmpvec, tmpvec2;
rvec ri, si;
real siri;
rvec v_xi_xc; /* v x (xj - u) */
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) ) */
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);
svmul(psiistar/psii, ri, tmpvec);
svmul(psiistar*psiistar/(psii*psii*psii) * siri, si, tmpvec2);
int *firstindex,
int *lastindex)
{
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 */
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;
/* Start with some value */
minproj = iprod(rotg->x_ref[0], rotg->vec);
maxproj = minproj;
snew(rotg->enfrotgrp, 1);
erg = rotg->enfrotgrp;
snew(rotg->enfrotgrp, 1);
erg = rotg->enfrotgrp;
- nat_max = max(nat_max, rotg->nat);
+ nat_max = std::max(nat_max, rotg->nat);
t_rot *rot;
t_rotgrp *rotg;
gmx_bool outstep_slab, outstep_rot;
t_rot *rot;
t_rotgrp *rotg;
gmx_bool outstep_slab, outstep_rot;
gmx_enfrot_t er; /* Pointer to the enforced rotation buffer variables */
gmx_enfrotgrp_t erg; /* Pointer to enforced rotation group data */
rvec transvec;
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;
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);
/* Do we use a collective (global) set of coordinates? */
bColl = ISCOLL(rotg);
rotg = &rot->grp[g];
erg = rotg->enfrotgrp;
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);
if (outstep_rot && MASTER(cr))
{
fprintf(er->out_rot, "%12.4f", erg->degangle);
n = 0;
for (g = 0; g < pull->ngroup; g++)
n = 0;
for (g = 0; g < pull->ngroup; g++)
if (pcrd->eGeom == epullgCYL)
{
if (pcrd->eGeom == epullgCYL)
{
- double wmass, wwmass, inp, dist;
+ double wmass, wwmass, dist;
pdyna = &pull->dyna[c];
pgrp = &pull->group[pcrd->group[1]];
pdyna = &pull->dyna[c];
pgrp = &pull->group[pcrd->group[1]];