X-Git-Url: http://biod.pnpi.spb.ru/gitweb/?a=blobdiff_plain;f=src%2Fgromacs%2Fmdlib%2Fdomdec.c;h=27d2bcb14a76e8191b4341857b80396afae1c51e;hb=1ff3f3bf02fa4457248228557ab0d3ffbbb7cd76;hp=08a80c667231018b85667760266a525cc1a58a2b;hpb=d067ed15ef38bb3ad6cafeab03f8b14c0a1460b9;p=alexxy%2Fgromacs.git diff --git a/src/gromacs/mdlib/domdec.c b/src/gromacs/mdlib/domdec.c index 08a80c6672..27d2bcb14a 100644 --- a/src/gromacs/mdlib/domdec.c +++ b/src/gromacs/mdlib/domdec.c @@ -1324,7 +1324,6 @@ static void dd_collect_cg(gmx_domdec_t *dd, { 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) { @@ -1334,12 +1333,18 @@ static void dd_collect_cg(gmx_domdec_t *dd, 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; @@ -1355,8 +1360,8 @@ static void dd_collect_cg(gmx_domdec_t *dd, 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; @@ -1398,7 +1403,7 @@ static void dd_collect_cg(gmx_domdec_t *dd, /* 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);