{
gmx_domdec_master_t *ma = NULL;
int buf2[2], *ibuf, i, ncg_home = 0, *cg = NULL, nat_home = 0;
- t_block *cgs_gl;
if (state_local->ddp_count == dd->comm->master_cg_ddp_count)
{
if (state_local->ddp_count == dd->ddp_count)
{
+ /* The local state and DD are in sync, use the DD indices */
ncg_home = dd->ncg_home;
cg = dd->index_gl;
nat_home = dd->nat_home;
}
else if (state_local->ddp_count_cg_gl == state_local->ddp_count)
{
+ /* The DD is out of sync with the local state, but we have stored
+ * the cg indices with the local state, so we can use those.
+ */
+ t_block *cgs_gl;
+
cgs_gl = &dd->comm->cgs_gl;
ncg_home = state_local->ncg_gl;
gmx_incons("Attempted to collect a vector for a state for which the charge group distribution is unknown");
}
- buf2[0] = dd->ncg_home;
- buf2[1] = dd->nat_home;
+ buf2[0] = ncg_home;
+ buf2[1] = nat_home;
if (DDMASTER(dd))
{
ma = dd->ma;
/* Collect the charge group indices on the master */
dd_gatherv(dd,
- dd->ncg_home*sizeof(int), dd->index_gl,
+ ncg_home*sizeof(int), cg,
DDMASTER(dd) ? ma->ibuf : NULL,
DDMASTER(dd) ? ma->ibuf+dd->nnodes : NULL,
DDMASTER(dd) ? ma->cg : NULL);
static void print_cg_move(FILE *fplog,
gmx_domdec_t *dd,
gmx_int64_t step, int cg, int dim, int dir,
- gmx_bool bHaveLimitdAndCMOld, real limitd,
+ gmx_bool bHaveCgcmOld, real limitd,
rvec cm_old, rvec cm_new, real pos_d)
{
gmx_domdec_comm_t *comm;
comm = dd->comm;
fprintf(fplog, "\nStep %s:\n", gmx_step_str(step, buf));
- if (bHaveLimitdAndCMOld)
+ if (limitd > 0)
{
- fprintf(fplog, "The charge group starting at atom %d moved more than the distance allowed by the domain decomposition (%f) in direction %c\n",
+ fprintf(fplog, "%s %d moved more than the distance allowed by the domain decomposition (%f) in direction %c\n",
+ dd->comm->bCGs ? "The charge group starting at atom" : "Atom",
ddglatnr(dd, dd->cgindex[cg]), limitd, dim2char(dim));
}
else
{
- fprintf(fplog, "The charge group starting at atom %d moved than the distance allowed by the domain decomposition in direction %c\n",
+ /* We don't have a limiting distance available: don't print it */
+ fprintf(fplog, "%s %d moved more than the distance allowed by the domain decomposition in direction %c\n",
+ dd->comm->bCGs ? "The charge group starting at atom" : "Atom",
ddglatnr(dd, dd->cgindex[cg]), dim2char(dim));
}
fprintf(fplog, "distance out of cell %f\n",
dir == 1 ? pos_d - comm->cell_x1[dim] : pos_d - comm->cell_x0[dim]);
- if (bHaveLimitdAndCMOld)
+ if (bHaveCgcmOld)
{
fprintf(fplog, "Old coordinates: %8.3f %8.3f %8.3f\n",
cm_old[XX], cm_old[YY], cm_old[ZZ]);
static void cg_move_error(FILE *fplog,
gmx_domdec_t *dd,
gmx_int64_t step, int cg, int dim, int dir,
- gmx_bool bHaveLimitdAndCMOld, real limitd,
+ gmx_bool bHaveCgcmOld, real limitd,
rvec cm_old, rvec cm_new, real pos_d)
{
if (fplog)
{
print_cg_move(fplog, dd, step, cg, dim, dir,
- bHaveLimitdAndCMOld, limitd, cm_old, cm_new, pos_d);
+ bHaveCgcmOld, limitd, cm_old, cm_new, pos_d);
}
print_cg_move(stderr, dd, step, cg, dim, dir,
- bHaveLimitdAndCMOld, limitd, cm_old, cm_new, pos_d);
+ bHaveCgcmOld, limitd, cm_old, cm_new, pos_d);
gmx_fatal(FARGS,
- "A charge group moved too far between two domain decomposition steps\n"
- "This usually means that your system is not well equilibrated");
+ "%s moved too far between two domain decomposition steps\n"
+ "This usually means that your system is not well equilibrated",
+ dd->comm->bCGs ? "A charge group" : "An atom");
}
static void rotate_state_atom(t_state *state, int a)
{
if (pos_d >= limit1[d])
{
- cg_move_error(fplog, dd, step, cg, d, 1, TRUE, limitd[d],
+ cg_move_error(fplog, dd, step, cg, d, 1,
+ cg_cm != state->x, limitd[d],
cg_cm[cg], cm_new, pos_d);
}
dev[d] = 1;
{
if (pos_d < limit0[d])
{
- cg_move_error(fplog, dd, step, cg, d, -1, TRUE, limitd[d],
+ cg_move_error(fplog, dd, step, cg, d, -1,
+ cg_cm != state->x, limitd[d],
cg_cm[cg], cm_new, pos_d);
}
dev[d] = -1;
{
cg_move_error(fplog, dd, step, cg, dim,
(flag & DD_FLAG_FW(d)) ? 1 : 0,
- FALSE, 0,
+ fr->cutoff_scheme == ecutsGROUP, 0,
comm->vbuf.v[buf_pos],
comm->vbuf.v[buf_pos],
comm->vbuf.v[buf_pos][dim]);
comm->cellsize_limit = 0;
comm->bBondComm = FALSE;
+ /* Atoms should be able to move by up to half the list buffer size (if > 0)
+ * within nstlist steps. Since boundaries are allowed to displace by half
+ * a cell size, DD cells should be at least the size of the list buffer.
+ */
+ comm->cellsize_limit = max(comm->cellsize_limit,
+ ir->rlistlong - max(ir->rvdw, ir->rcoulomb));
+
if (comm->bInterCGBondeds)
{
if (comm_distance_min > 0)
if (vsite != NULL)
{
/* Now we have updated mdatoms, we can do the last vsite bookkeeping */
- split_vsites_over_threads(top_local->idef.il, mdatoms, FALSE, vsite);
+ split_vsites_over_threads(top_local->idef.il, top_local->idef.iparams,
+ mdatoms, FALSE, vsite);
}
if (shellfc)
if (!(cr->duty & DUTY_PME))
{
/* Send the charges and/or c6/sigmas to our PME only node */
- gmx_pme_send_parameters(cr, mdatoms->nChargePerturbed, mdatoms->nTypePerturbed,
+ gmx_pme_send_parameters(cr,
+ fr->ic,
+ mdatoms->nChargePerturbed, mdatoms->nTypePerturbed,
mdatoms->chargeA, mdatoms->chargeB,
mdatoms->sqrt_c6A, mdatoms->sqrt_c6B,
mdatoms->sigmaA, mdatoms->sigmaB,