fix check_assign_interactions_atom()
authorGilles Gouaillardet <gilles@rist.or.jp>
Thu, 10 Sep 2020 16:48:33 +0000 (16:48 +0000)
committerArtem Zhmurov <zhmurov@gmail.com>
Thu, 10 Sep 2020 16:48:33 +0000 (16:48 +0000)
fix a bug introduced in gromacs/gromacs@c507ae4d3f4b0d516e53896dac35a52911a8a44b

Thanks Berk Hess for the guidance to the right fix

Refs. gromacs/gromacs#3635

(cherry picked from commit 7d83d16072e7521bcf8fc43ceda7bf29803466e1)

docs/release-notes/2020/2020.4.rst
src/gromacs/domdec/domdec_topology.cpp

index f2a07c3629d43e38e3871aea51c17417c2fa6cb3..94d570e1c3b749b2ecbf4b6e8d830d50e76667fa 100644 (file)
@@ -25,6 +25,14 @@ This can happen, e.g. when big molecule enters the domain, previously
 occupied by smaller molecules. The bug does not affect the single
 domain case.
 
+Fix index handling of N-body virtual sites with domain decomposition
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+
+Incorrect indexing would be used to handle N-body virtual sites in
+the domain decomposition code. This would usually lead to crashes
+due to illegal or incorrect memory usage.
+
+:issue:`3635`
 
 Fixes for ``gmx`` tools
 ^^^^^^^^^^^^^^^^^^^^^^^
index 5ae42b90272a408d432c1c3f61def9fe4eb70896..f2f85df0a341bb0b52f20ea505e2f4aa933ac622 100644 (file)
@@ -1153,7 +1153,6 @@ static inline void check_assign_interactions_atom(int                       i,
             {
                 add_vsite(*dd->ga2la, index, rtil, ftype, nral, TRUE, i, i_gl, i_mol, iatoms.data(), idef);
             }
-            j += 1 + nral + 2;
         }
         else
         {
@@ -1313,8 +1312,8 @@ static inline void check_assign_interactions_atom(int                       i,
                     (*nbonded_local)++;
                 }
             }
-            j += 1 + nral;
         }
+        j += 1 + nral_rt(ftype);
     }
 }