From: Berk Hess Date: Mon, 17 Mar 2014 15:48:53 +0000 (+0100) Subject: Fixed bug in parallel v/f constraining X-Git-Url: http://biod.pnpi.spb.ru/gitweb/?a=commitdiff_plain;h=b58afa7e304477f48ce48dfc11b9e9afd2987bc3;p=alexxy%2Fgromacs.git Fixed bug in parallel v/f constraining Constraining v or f with 3 or more decomposition domains in one or more dimensions could lead to modification of communicated v and f components by the box size for inter charge-group constraints. Fixes #1462 Change-Id: Idece9d2d0d8f48e65a654d5c2892fbe1ff836ba0 --- diff --git a/include/domdec.h b/include/domdec.h index e94139b3a6..6b41839b6e 100644 --- a/include/domdec.h +++ b/include/domdec.h @@ -243,8 +243,8 @@ void dd_move_f_vsites(gmx_domdec_t *dd, rvec *f, rvec *fshift); void dd_clear_f_vsites(gmx_domdec_t *dd, rvec *f); void dd_move_x_constraints(gmx_domdec_t *dd, matrix box, - rvec *x0, rvec *x1); -/* Move x0 and also x1 if x1!=NULL */ + rvec *x0, rvec *x1, gmx_bool bX1IsCoord); +/* Move x0 and also x1 if x1!=NULL. bX1IsCoord tells if to do PBC on x1 */ void dd_move_x_vsites(gmx_domdec_t *dd, matrix box, rvec *x); diff --git a/src/mdlib/clincs.c b/src/mdlib/clincs.c index db31dea040..c1a7ba196c 100644 --- a/src/mdlib/clincs.c +++ b/src/mdlib/clincs.c @@ -631,7 +631,7 @@ static void do_lincs(rvec *x, rvec *xp, matrix box, t_pbc *pbc, /* Communicate the corrected non-local coordinates */ if (DOMAINDECOMP(cr)) { - dd_move_x_constraints(cr->dd, box, xp, NULL); + dd_move_x_constraints(cr->dd, box, xp, NULL, FALSE); } else { diff --git a/src/mdlib/constr.c b/src/mdlib/constr.c index 0e1a6ee524..a5e1754373 100644 --- a/src/mdlib/constr.c +++ b/src/mdlib/constr.c @@ -415,7 +415,7 @@ gmx_bool constrain(FILE *fplog, gmx_bool bLog, gmx_bool bEner, */ if (cr->dd) { - dd_move_x_constraints(cr->dd, box, x, xprime); + dd_move_x_constraints(cr->dd, box, x, xprime, econq == econqCoord); } else if (PARTDECOMP(cr)) { diff --git a/src/mdlib/domdec_con.c b/src/mdlib/domdec_con.c index 773c61ec66..dae0764abd 100644 --- a/src/mdlib/domdec_con.c +++ b/src/mdlib/domdec_con.c @@ -236,7 +236,9 @@ void dd_clear_f_vsites(gmx_domdec_t *dd, rvec *f) } static void dd_move_x_specat(gmx_domdec_t *dd, gmx_domdec_specat_comm_t *spac, - matrix box, rvec *x0, rvec *x1) + matrix box, + rvec *x0, + rvec *x1, gmx_bool bX1IsCoord) { gmx_specatsend_t *spas; rvec *x, *vbuf, *rbuf; @@ -245,7 +247,7 @@ static void dd_move_x_specat(gmx_domdec_t *dd, gmx_domdec_specat_comm_t *spac, rvec shift = {0, 0, 0}; nvec = 1; - if (x1) + if (x1 != NULL) { nvec++; } @@ -285,7 +287,7 @@ static void dd_move_x_specat(gmx_domdec_t *dd, gmx_domdec_specat_comm_t *spac, { x = (v == 0 ? x0 : x1); /* Copy the required coordinates to the send buffer */ - if (!bPBC) + if (!bPBC || (v == 1 && !bX1IsCoord)) { /* Only copy */ for (i = 0; i < spas->nsend; i++) @@ -414,11 +416,12 @@ static void dd_move_x_specat(gmx_domdec_t *dd, gmx_domdec_specat_comm_t *spac, } } -void dd_move_x_constraints(gmx_domdec_t *dd, matrix box, rvec *x0, rvec *x1) +void dd_move_x_constraints(gmx_domdec_t *dd, matrix box, + rvec *x0, rvec *x1, gmx_bool bX1IsCoord) { if (dd->constraint_comm) { - dd_move_x_specat(dd, dd->constraint_comm, box, x0, x1); + dd_move_x_specat(dd, dd->constraint_comm, box, x0, x1, bX1IsCoord); } } @@ -426,7 +429,7 @@ void dd_move_x_vsites(gmx_domdec_t *dd, matrix box, rvec *x) { if (dd->vsite_comm) { - dd_move_x_specat(dd, dd->vsite_comm, box, x, NULL); + dd_move_x_specat(dd, dd->vsite_comm, box, x, NULL, FALSE); } }