Fix pull code bug with DD and atom sets
[alexxy/gromacs.git] / src / gromacs / domdec / partition.cpp
index b00ceec520596409c50bc96b027913a0dc0e7749..19ab95707d1503271d1f2f913c41f31b68ee14b1 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -3167,18 +3167,19 @@ void dd_partition_system(FILE*                        fplog,
                                 mdatoms->sigmaB, dd_pme_maxshift_x(dd), dd_pme_maxshift_y(dd));
     }
 
-    if (ir->bPull)
-    {
-        /* Update the local pull groups */
-        dd_make_local_pull_groups(cr, pull_work);
-    }
-
     if (dd->atomSets != nullptr)
     {
         /* Update the local atom sets */
         dd->atomSets->setIndicesInDomainDecomposition(*(dd->ga2la));
     }
 
+    // The pull group construction can need the atom sets updated above
+    if (ir->bPull)
+    {
+        /* Update the local pull groups */
+        dd_make_local_pull_groups(cr, pull_work);
+    }
+
     /* Update the local atoms to be communicated via the IMD protocol if bIMD is TRUE. */
     imdSession->dd_make_local_IMD_atoms(dd);