Fix LINCS triangle constraining with OpenMP
authorBerk Hess <hess@kth.se>
Thu, 13 Dec 2018 11:06:54 +0000 (12:06 +0100)
committerPaul Bauer <paul.bauer.q@gmail.com>
Fri, 14 Dec 2018 15:21:46 +0000 (16:21 +0100)
LINCS would only apply double the iterations to constraints
in triangles when the last OpenMP task contained at least one such
triangle.

Fixes #2808

Change-Id: Ia9a402f3ada87dbf73f74eda943b3fa4bfb3559b

docs/release-notes/2018/2018.5.rst
src/gromacs/mdlib/clincs.cpp

index f746fcced0775a9d9fb5d05f6be5bcc0bf184d14..b73325f74bad4f4b5bbc9b5008c442431fe4389a 100644 (file)
@@ -26,7 +26,18 @@ PME grids with size along Z larger than 511 would make mdrun exit
 with a cryptic CUDA error.
 
 :issue: `2779`
-        
+
+Fix LINCS accuracy with OpenMP when constraint triangles are present
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+
+Constraint triangles, which usually only occur when replacing hydrogens
+by virtual interaction sites in CH3 and NH3 groups, need double the number
+of iterations as normal constraints. With OpenMP this would only happen
+when the last OpenMP thread has at least one such triangle. This would
+cause a slight loss of accuracy in inhomogeneous systems.
+
+:issue: `2808`
+
 Fixes for ``gmx`` tools
 ^^^^^^^^^^^^^^^^^^^^^^^
 
index 6b272513ac7ca69b5b825667eaca202d77b47c80..60ea4f33f0672dbd17a5982acfd03bd70685c555 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017,2018, 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.
@@ -1278,7 +1278,7 @@ static void set_lincs_matrix(struct gmx_lincsdata *li, real *invmass, real lambd
         {
             set_lincs_matrix_task(li, &li->task[th], invmass,
                                   &ncc_triangle, &nCrossTaskTriangles);
-            ntriangle = li->task[th].ntriangle;
+            ntriangle += li->task[th].ntriangle;
         }
         GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR;
     }