*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012,2014, by the GROMACS development team, led by
+ * Copyright (c) 2012,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.
int d, n[DIM];
int i;
rvec box_size;
- int nmin, fac2, try;
+ int nmin, fac2, attempt;
rvec spacing;
real max_spacing;
/* Find the smallest grid that is >= nmin */
do
{
- try = fac2*grid_base[i];
+ attempt = fac2*grid_base[i];
/* We demand a factor of 4, avoid 140, allow 90 */
- if (((try % 4 == 0 && try != 140) || try == 90) &&
- try >= nmin)
+ if (((attempt % 4 == 0 && attempt != 140) || attempt == 90) &&
+ attempt >= nmin)
{
- n[d] = try;
+ n[d] = attempt;
}
i--;
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, 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.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, 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 <math.h>
#include <stdlib.h>
+#include <algorithm>
+
#include "gromacs/legacyheaders/copyrite.h"
#include "gromacs/legacyheaders/macros.h"
#include "gromacs/legacyheaders/main.h"
t_inputrec *ir, const t_commrec *cr,
t_fcdata *fcd, t_state *state, gmx_bool bIsREMD)
{
- int fa, nmol, i, npair, np;
- t_iparams *ip;
+ int fa, nmol, npair, np;
t_disresdata *dd;
history_t *hist;
gmx_mtop_ilistloop_t iloop;
}
dd->ETerm1 = 1.0 - dd->ETerm;
- ip = mtop->ffparams.iparams;
-
dd->nres = 0;
dd->npair = 0;
iloop = gmx_mtop_ilistloop_init(mtop);
if (fplog)
{
fprintf(fplog, "Our ensemble consists of systems:");
- for (i = 0; i < dd->nsystems; i++)
+ for (int i = 0; i < dd->nsystems; i++)
{
fprintf(fplog, " %d",
(cr->ms->sim/dd->nsystems)*dd->nsystems+i);
t_fcdata *fcd, history_t *hist)
{
atom_id ai, aj;
- int fa, res, i, pair, ki, kj, m;
+ int fa, res, pair;
int type, npair, np;
rvec dx;
real *rt, *rm3tav, *Rtl_6, *Rt_6, *Rtav_6;
real rt_1, rt_3, rt2;
- ivec it, jt, dt;
t_disresdata *dd;
real ETerm, ETerm1, cf1 = 0, cf2 = 0, invn = 0;
gmx_bool bTav;
real tav_viol_Rtav7, instant_viol_Rtav7;
real up1, up2, low;
gmx_bool bConservative, bMixed, bViolation;
- ivec it, jt, dt;
+ ivec dt;
t_disresdata *dd;
int dr_weighting;
gmx_bool dr_bMixed;
/* Correct the force for the number of restraints */
if (bConservative)
{
- f_scal = max(f_scal, fmax_scal);
+ f_scal = std::max(f_scal, fmax_scal);
if (!bMixed)
{
f_scal *= Rtav/Rtav_6[res];
else
{
f_scal /= (real)npair;
- f_scal = max(f_scal, fmax_scal);
+ f_scal = std::max(f_scal, fmax_scal);
}
/* Exert the force ... */
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, 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.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2010, The GROMACS development team.
- * Copyright (c) 2012,2014, by the GROMACS development team, led by
+ * Copyright (c) 2012,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 "gromacs/legacyheaders/inputrec.h"
+#include <algorithm>
+
#include "gromacs/legacyheaders/macros.h"
#include "gromacs/legacyheaders/typedefs.h"
#include "gromacs/utility/fatalerror.h"
{
if (ir->opts.tau_t[g] > 0)
{
- tau_min = min(tau_min, ir->opts.tau_t[g]);
+ tau_min = std::min(tau_min, ir->opts.tau_t[g]);
}
}
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012,2014, by the GROMACS development team, led by
+ * Copyright (c) 2012,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.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, 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.
void gmx_setup_nodecomm(FILE gmx_unused *fplog, t_commrec *cr)
{
gmx_nodecomm_t *nc;
- int n, rank, nodehash, ng, ni;
/* Many MPI implementations do not optimize MPI_Allreduce
* (and probably also other global communication calls)
nc->bUse = FALSE;
#ifndef GMX_THREAD_MPI
#ifdef GMX_MPI
+ int n, rank, nodehash, ng, ni;
+
MPI_Comm_size(cr->mpi_comm_mygroup, &n);
MPI_Comm_rank(cr->mpi_comm_mygroup, &rank);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, 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 <stdio.h>
#include <stdlib.h>
+#include <algorithm>
+
#include "gromacs/legacyheaders/macros.h"
#include "gromacs/legacyheaders/names.h"
#include "gromacs/legacyheaders/typedefs.h"
void pr_qm_opts(FILE *fp, int indent, const char *title, t_grpopts *opts)
{
- int i, m, j;
-
fprintf(fp, "%s:\n", title);
pr_int(fp, indent, "ngQM", opts->ngQM);
static void pr_swap(FILE *fp, int indent, t_swapcoords *swap)
{
- int i, j;
+ int j;
char str[STRLEN];
gmx_bool bMDPformat)
{
const char *infbuf = "inf";
- int i;
if (available(fp, ir, indent, title))
{
gmx_ffparams_t *ffparams,
gmx_bool bShowNumbers)
{
- int i, j;
+ int i;
indent = pr_title(fp, indent, title);
(void) pr_indent(fp, indent);
static int pr_block_title(FILE *fp, int indent, const char *title, t_block *block)
{
- int i;
-
if (available(fp, block, indent, title))
{
indent = pr_title(fp, indent, title);
static int pr_blocka_title(FILE *fp, int indent, const char *title, t_blocka *block)
{
- int i;
-
if (available(fp, block, indent, title))
{
indent = pr_title(fp, indent, title);
void pr_block(FILE *fp, int indent, const char *title, t_block *block, gmx_bool bShowNumbers)
{
- int i, j, ok, size, start, end;
+ int i, start;
if (available(fp, block, indent, title))
{
indent = pr_block_title(fp, indent, title, block);
start = 0;
- end = start;
- if ((ok = (block->index[start] == 0)) == 0)
+ if (block->index[start] != 0)
{
(void) fprintf(fp, "block->index[%d] should be 0\n", start);
}
{
for (i = 0; i < block->nr; i++)
{
- end = block->index[i+1];
- size = pr_indent(fp, indent);
+ int end = block->index[i+1];
+ pr_indent(fp, indent);
if (end <= start)
{
- size += fprintf(fp, "%s[%d]={}\n", title, i);
+ fprintf(fp, "%s[%d]={}\n", title, i);
}
else
{
- size += fprintf(fp, "%s[%d]={%d..%d}\n",
- title, bShowNumbers ? i : -1,
- bShowNumbers ? start : -1, bShowNumbers ? end-1 : -1);
+ fprintf(fp, "%s[%d]={%d..%d}\n",
+ title, bShowNumbers ? i : -1,
+ bShowNumbers ? start : -1, bShowNumbers ? end-1 : -1);
}
start = end;
}
static void pr_atom(FILE *fp, int indent, const char *title, t_atom *atom, int n)
{
- int i, j;
+ int i;
if (available(fp, atom, indent, title))
{
gmx_groups_t *groups,
gmx_bool bShowNumbers)
{
- int grpnr[egcNR];
int nat_max, i, g;
pr_grps(fp, "grp", groups->grps, groups->grpname);
for (g = 0; g < egcNR; g++)
{
printf(" %5d", groups->ngrpnr[g]);
- nat_max = max(nat_max, groups->ngrpnr[g]);
+ nat_max = std::max(nat_max, groups->ngrpnr[g]);
}
printf("\n");
void pr_header(FILE *fp, int indent, const char *title, t_tpxheader *sh)
{
- char buf[22];
-
if (available(fp, sh, indent, title))
{
indent = pr_title(fp, indent, title);
#include <string.h>
+#include <algorithm>
+
#include "gromacs/legacyheaders/macros.h"
#include "gromacs/math/vec.h"
#include "gromacs/pbcutil/pbc.h"
{
fprintf(stderr, "\nWARNING during %s:\n", warn);
fprintf(stderr, "step value ");
- fprintf(stderr, "%"GMX_PRId64, step);
+ fprintf(stderr, "%" GMX_PRId64, step);
fprintf(stderr, " does not fit in int, converted to %d\n\n", i);
}
}
else
{
- return max(cutoff1, cutoff2);
+ return std::max(cutoff1, cutoff2);
}
}
int nsteps = ir->nsteps;
int i, nxtcatoms = 0;
- int nstx, nstv, nstf, nste, nstlog, nstxtc, nfep = 0;
+ int nstx, nstv, nstf, nste, nstlog, nstxtc;
double cio;
nstx = div_nsteps(nsteps, ir->nstxout);
void add_ebin(t_ebin *eb, int index, int nener, real ener[], gmx_bool bSum)
{
int i, m;
- double e, sum, sigma, invmm, diff;
+ double e, invmm, diff;
t_energy *eg, *egs;
if ((index+nener > eb->nener) || (index < 0))
char buf[256];
const char *bufi;
t_mdebin *md;
- int i, j, ni, nj, n, nh, k, kk, ncon, nset;
- gmx_bool bBHAM, bNoseHoover, b14;
+ int i, j, ni, nj, n, k, kk, ncon, nset;
+ gmx_bool bBHAM, b14;
snew(md, 1);
gmx_bool get_native_lambda, gmx_bool get_names,
char *str)
{
- size_t nps = 0, np;
int j, k = 0;
int Nsep = 0;
{
if (fep->separate_dvdl[j])
{
- double lam;
if (!get_names)
{
if (get_native_lambda && fep->init_lambda >= 0)
{
FILE *fp;
const char *dhdl = "dH/d\\lambda", *deltag = "\\DeltaH", *lambda = "\\lambda",
- *lambdastate = "\\lambda state", *remain = "remaining";
+ *lambdastate = "\\lambda state";
char title[STRLEN], label_x[STRLEN], label_y[STRLEN];
- int i, np, nps, nsets, nsets_de, nsetsbegin;
+ int i, nps, nsets, nsets_de, nsetsbegin;
int n_lambda_terms = 0;
t_lambda *fep = ir->fepvals; /* for simplicity */
t_expanded *expand = ir->expandedvals;
}
if (write_pV)
{
- np = sprintf(buf, "pV (%s)", unit_energy);
+ sprintf(buf, "pV (%s)", unit_energy);
setname[nsetsextend-1] = gmx_strdup(buf); /* the first entry after
nsets */
}
rvec mu_tot,
gmx_constr_t constr)
{
- int i, j, k, kk, m, n, gid;
+ int i, j, k, kk, n, gid;
real crmsd[2], tmp6[6];
real bs[NTRICLBOXS], vol, dens, pv, enthalpy;
real eee[egNR];
{
/*static char **grpnms=NULL;*/
char buf[246];
- int i, j, n, ni, nj, ndr, nor, b;
+ int i, j, n, ni, nj, b;
int ndisre = 0;
real *disre_rm3tav, *disre_rt;
int id[enxNR];
real *block[enxNR];
- /* temporary arrays for the lambda values to write out */
- double enxlambda_data[2];
-
- t_enxframe fr;
+ t_enxframe fr;
switch (mode)
{
void mde_delta_h_coll_init(t_mde_delta_h_coll *dhc, const t_inputrec *ir)
{
int i, j, n;
- double lambda;
double *lambda_vec;
int ndhmax = ir->nstenergy/ir->nstcalcenergy;
t_lambda *fep = ir->fepvals;
int i;
unsigned int j;
- if (dhc && !enerhist->dht)
+ if (!dhc)
{
- gmx_incons("No delta_h histograms in energy history");
+ gmx_incons("No delta_h histograms found");
+ }
+ if (!enerhist->dht)
+ {
+ gmx_incons("No delta_h histograms found in energy history");
}
if (enerhist->dht->nndh != dhc->ndh)
{
#include "gromacs/legacyheaders/perf_est.h"
-#include <math.h>
+#include <cmath>
#include "gromacs/legacyheaders/types/commrec.h"
#include "gromacs/math/vec.h"
int mb, nmol, atnr, cg, a, a0, ncqlj, ncq, nclj;
gmx_bool bBHAM, bLJcut, bWater, bQ, bLJ;
int nw, nqlj, nq, nlj;
- float fq, fqlj, flj, fljtab, fqljw, fqw;
+ float fq, fqlj, flj, fqljw, fqw;
t_iparams *iparams;
gmx_moltype_t *molt;
gmx_bool *bChargePerturbed, gmx_bool *bTypePerturbed)
{
t_atom *atom;
- int mb, nmol, atnr, cg, a, a0, nqlj, nq, nlj;
+ int mb, nmol, atnr, a, nqlj, nq, nlj;
gmx_bool bQRF;
t_iparams *iparams;
gmx_moltype_t *molt;
molt = &mtop->moltype[mtop->molblock[mb].type];
atom = molt->atoms.atom;
nmol = mtop->molblock[mb].nmol;
- a = 0;
for (a = 0; a < molt->atoms.nr; a++)
{
if (atom[a].q != 0 || atom[a].qB != 0)
float pme_load_estimate(gmx_mtop_t *mtop, t_inputrec *ir, matrix box)
{
- t_atom *atom;
- int mb, nmol, atnr, cg, a, a0, nq_tot, nlj_tot, f;
- gmx_bool bBHAM, bLJcut, bChargePerturbed, bTypePerturbed;
- gmx_bool bWater, bQ, bLJ;
+ int nq_tot, nlj_tot, f;
+ gmx_bool bChargePerturbed, bTypePerturbed;
double cost_bond, cost_pp, cost_redist, cost_spread, cost_fft, cost_solve, cost_pme;
float ratio;
- t_iparams *iparams;
- gmx_moltype_t *molt;
/* Computational cost of bonded, non-bonded and PME calculations.
* This will be machine dependent.
* although not so much that the numbers need to be adjusted.
*/
- iparams = mtop->ffparams.iparams;
- atnr = mtop->ffparams.atnr;
-
cost_bond = C_BOND*n_bonded_dx(mtop, TRUE);
if (ir->cutoff_scheme == ecutsGROUP)
{
f = ((ir->efep != efepNO && bChargePerturbed) ? 2 : 1);
cost_redist += C_PME_REDIST*nq_tot;
- cost_spread += f*C_PME_SPREAD*nq_tot*pow(ir->pme_order, 3);
- cost_fft += f*C_PME_FFT*ir->nkx*ir->nky*ir->nkz*log(ir->nkx*ir->nky*ir->nkz);
+ cost_spread += f*C_PME_SPREAD*nq_tot*std::pow(static_cast<real>(ir->pme_order), static_cast<real>(3.0));
+ cost_fft += f*C_PME_FFT*ir->nkx*ir->nky*ir->nkz*std::log(static_cast<real>(ir->nkx*ir->nky*ir->nkz));
cost_solve += f*C_PME_SOLVE*ir->nkx*ir->nky*ir->nkz;
}
f *= 7;
}
cost_redist += C_PME_REDIST*nlj_tot;
- cost_spread += f*C_PME_SPREAD*nlj_tot*pow(ir->pme_order, 3);
- cost_fft += f*C_PME_FFT*ir->nkx*ir->nky*ir->nkz*log(ir->nkx*ir->nky*ir->nkz);
+ cost_spread += f*C_PME_SPREAD*nlj_tot*std::pow(static_cast<real>(ir->pme_order), static_cast<real>(3.0));
+ cost_fft += f*C_PME_FFT*ir->nkx*ir->nky*ir->nkz*std::log(static_cast<real>(ir->nkx*ir->nky*ir->nkz));
cost_solve += f*C_PME_SOLVE*ir->nkx*ir->nky*ir->nkz;
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, 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.
static void init_grptcstat(int ngtc, t_grp_tcstat tcstat[])
{
- int i, j;
+ int i;
for (i = 0; (i < ngtc); i++)
{
gmx_bool bEkinAveVel, gmx_bool bScaleEkin)
{
int i, j, m, ngtc;
- real T, ek;
+ real T;
t_grp_tcstat *tcstat;
real nrdf, nd, *ndf;