:issue:`3946`
+Remove velocity from partially frozen atoms in md-vv
+""""""""""""""""""""""""""""""""""""""""""""""""""""
+
+md-vv would add some velocity to the frozen dimensions of partially
+frozen atoms during constraining. This did not lead to wrong
+trajectories, as the frozen dimensions of the positions are kept fixed
+during propagation. The non-zero velocities were, however, reported in
+trajectories and final configurations. They might also have lead to
+slightly wrong kinetic energies, since the reported kinetic energy is
+calculated after the velocities are constrained. All effects are
+expected to be relatively small, since they did not accumulate, as the
+velocities were regularly reset to zero once per step.
+
+:issue:`3849`
+
Fixes for ``gmx`` tools
^^^^^^^^^^^^^^^^^^^^^^^
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
* Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
- * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020,2021, 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.
}
wallcycle_stop(wcycle, ewcCONSTR);
- if (!v.empty() && cFREEZE_)
+ const bool haveVelocities = (!v.empty() || econq == ConstraintVariable::Velocities);
+ if (haveVelocities && cFREEZE_)
{
/* Set the velocities of frozen dimensions to zero */
- ArrayRef<RVec> vRef = v.unpaddedArrayRef();
+ ArrayRef<RVec> vRef;
+ if (econq == ConstraintVariable::Velocities)
+ {
+ vRef = xprime.unpaddedArrayRef();
+ }
+ else
+ {
+ vRef = v.unpaddedArrayRef();
+ }
int gmx_unused numThreads = gmx_omp_nthreads_get(emntUpdate);