*
* 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 <algorithm>
+#include "gromacs/legacyheaders/gmx_omp_nthreads.h"
#include "gromacs/legacyheaders/macros.h"
#include "gromacs/legacyheaders/mdrun.h"
#include "gromacs/legacyheaders/names.h"
t_nrnb *nrnb)
{
ivec *nFreeze = ir->opts.nFreeze;
- int n, d, g = 0;
+ int n, d;
+ int nthreads gmx_unused;
+
+#ifndef __clang_analyzer__
+ // cppcheck-suppress unreadVariable
+ nthreads = gmx_omp_nthreads_get(emntUpdate);
+#endif
/* Scale the positions */
+#pragma omp parallel for num_threads(nthreads) schedule(static)
for (n = start; n < start+nr_atoms; n++)
{
- if (cFREEZE)
+ int g;
+
+ if (cFREEZE == NULL)
+ {
+ g = 0;
+ }
+ else
{
g = cFREEZE[n];
}
*
* 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.
case (epcNO):
break;
case (epcBERENDSEN):
- berendsen_pscale(inputrec, pcoupl_mu, state->box, state->box_rel,
- start, homenr, state->x, md->cFREEZE, nrnb);
+ /* We should only scale after a step where the pressure (kinetic
+ * energy and virial) was calculated. This happens after the
+ * coordinate update, whereas the current routine is called before
+ * that, so we scale when step % nstpcouple = 1 instead of 0.
+ */
+ if (inputrec->nstpcouple == 1 || (step % inputrec->nstpcouple == 1))
+ {
+ berendsen_pscale(inputrec, pcoupl_mu, state->box, state->box_rel,
+ start, homenr, state->x, md->cFREEZE, nrnb);
+ }
break;
case (epcPARRINELLORAHMAN):
/* The box velocities were updated in do_pr_pcoupl in the update