*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2008, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2018, 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.
gmx_bool gmx_mtop_bondeds_free_energy(const gmx_mtop_t *mtop)
{
- const gmx_ffparams_t *ffparams;
- int i, ftype;
- int mb;
- t_atom *atom;
- t_ilist *il;
- t_iatom *ia;
- gmx_bool bPert;
-
- ffparams = &mtop->ffparams;
+ const gmx_ffparams_t *ffparams = &mtop->ffparams;
/* Loop over all the function types and compare the A/B parameters */
- bPert = FALSE;
- for (i = 0; i < ffparams->ntypes; i++)
+ gmx_bool bPert = FALSE;
+ for (int i = 0; i < ffparams->ntypes; i++)
{
- ftype = ffparams->functype[i];
+ int ftype = ffparams->functype[i];
if (interaction_function[ftype].flags & IF_BOND)
{
if (ip_pert(ftype, &ffparams->iparams[i]))
}
/* Check perturbed charges for 1-4 interactions */
- for (mb = 0; mb < mtop->nmolblock; mb++)
+ for (const gmx_molblock_t &molb : mtop->molblock)
{
- atom = mtop->moltype[mtop->molblock[mb].type].atoms.atom;
- il = &mtop->moltype[mtop->molblock[mb].type].ilist[F_LJ14];
- ia = il->iatoms;
- for (i = 0; i < il->nr; i += 3)
+ const t_atom *atom = mtop->moltype[molb.type].atoms.atom;
+ const t_ilist &il = mtop->moltype[molb.type].ilist[F_LJ14];
+ const int *ia = il.iatoms;
+ for (int i = 0; i < il.nr; i += 3)
{
if (atom[ia[i+1]].q != atom[ia[i+1]].qB ||
atom[ia[i+2]].q != atom[ia[i+2]].qB)