fixed bug with DD cut-off check and PME DLB
authorBerk Hess <hess@kth.se>
Thu, 28 Feb 2013 17:10:34 +0000 (18:10 +0100)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Tue, 5 Mar 2013 19:19:37 +0000 (20:19 +0100)
During the initial stage of PME DLB, the cut-off limit check for the
DD DLB was not checked correcty. This reduced the effectiveness of
both DD and PME DLB and could lead to missing interactions during
a very limited number of steps.
Fixes #1169

Change-Id: I0b0cac22d4abbe8a9b0c16488aeb662d7d4d9bcc

src/mdlib/domdec.c

index 871b3635c06e88a1e5930615aa404ace984b4b77..56eb38d25f5b09b2337912e570ad426de2b6452a 100644 (file)
@@ -2738,10 +2738,18 @@ static real cellsize_min_dlb(gmx_domdec_comm_t *comm, int dim_ind, int dim)
 
     cellsize_min = comm->cellsize_min[dim];
 
-    if (!comm->bVacDLBNoLimit && comm->bPMELoadBalDLBLimits)
+    if (!comm->bVacDLBNoLimit)
     {
-        cellsize_min = max(cellsize_min,
-                           comm->PMELoadBal_max_cutoff/comm->cd[dim_ind].np_dlb);
+        /* The cut-off might have changed, e.g. by PME load balacning,
+         * from the value used to set comm->cellsize_min, so check it.
+         */
+        cellsize_min = max(cellsize_min, comm->cutoff/comm->cd[dim_ind].np_dlb);
+
+        if (comm->bPMELoadBalDLBLimits)
+        {
+            /* Check for the cut-off limit set by the PME load balancing */
+            cellsize_min = max(cellsize_min, comm->PMELoadBal_max_cutoff/comm->cd[dim_ind].np_dlb);
+        }
     }
 
     return cellsize_min;