Fix CG with multiple domains
authorMark Abraham <mark.j.abraham@gmail.com>
Wed, 18 Jul 2018 14:50:13 +0000 (16:50 +0200)
committerMark Abraham <mark.j.abraham@gmail.com>
Mon, 30 Jul 2018 15:49:53 +0000 (17:49 +0200)
The global state can only be accessed on master rank, so we should set
the flags there and then permit the DD code to propagate the setup of
the cg_p vector.

Fixes #2554

Change-Id: If294bf000eb0266125ecc6c6bf937aac0390e2b8

docs/release-notes/2018/2018.3.rst
src/gromacs/mdlib/minimize.cpp

index 4f13f68ea82424b1c23407f9dbce86b9143d77e9..251ca127fc335aae3954c91a5b271cdc4807cca3 100644 (file)
@@ -8,6 +8,9 @@ earlier, which you can find described in the :ref:`release-notes`.
 
 Fixes where mdrun could behave incorrectly
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Multi-domain Conjugate Gradient minimimization no longer segfaults.
+
+:issue:`2554`
 
 Fixes for ``gmx`` tools
 ^^^^^^^^^^^^^^^^^^^^^^^
index 961d95e27f53751a3167cdf83fe81788a0961182..cbf10a7c7fe9ba6addd0440c3495a6b885419f04 100644 (file)
@@ -1043,8 +1043,11 @@ double do_cg(FILE *fplog, t_commrec *cr, const gmx::MDLogger gmx_unused &mdlog,
 
     step = 0;
 
-    // Ensure the extra per-atom state array gets allocated
-    state_global->flags |= (1<<estCGP);
+    if (MASTER(cr))
+    {
+        // Ensure the extra per-atom state array gets allocated
+        state_global->flags |= (1<<estCGP);
+    }
 
     /* Create 4 states on the stack and extract pointers that we will swap */
     em_state_t  s0 {}, s1 {}, s2 {}, s3 {};