With domain decomposition, velocity components for communicated
atoms could be uninitialized. These components were never used, but
this could lead to valgrind warnings and floating point exceptions.
Fixes #1576.
Change-Id: Ic673680699578ddf62c2d240342138cbc16490c8
+static void clear_constraint_quantity_nonlocal(gmx_domdec_t *dd, rvec *q)
+{
+ int nonlocal_at_start, nonlocal_at_end, at;
+
+ dd_get_constraint_range(dd, &nonlocal_at_start, &nonlocal_at_end);
+
+ for (at = nonlocal_at_start; at < nonlocal_at_end; at++)
+ {
+ clear_rvec(q[at]);
+ }
+}
+
void too_many_constraint_warnings(int eConstrAlg, int warncount)
{
const char *abort = "- aborting to avoid logfile runaway.\n"
void too_many_constraint_warnings(int eConstrAlg, int warncount)
{
const char *abort = "- aborting to avoid logfile runaway.\n"
if (cr->dd)
{
dd_move_x_constraints(cr->dd, box, x, xprime, econq == econqCoord);
if (cr->dd)
{
dd_move_x_constraints(cr->dd, box, x, xprime, econq == econqCoord);
+
+ if (v != NULL)
+ {
+ /* We need to initialize the non-local components of v.
+ * We never actually use these values, but we do increment them,
+ * so we should avoid uninitialized variables and overflows.
+ */
+ clear_constraint_quantity_nonlocal(cr->dd, v);
+ }
}
if (constr->lincsd != NULL)
}
if (constr->lincsd != NULL)