Fix bug in (long) neighborlist SIMD padding when adding to previous list
authorErik Lindahl <erik@kth.se>
Tue, 24 Sep 2013 22:28:29 +0000 (00:28 +0200)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Wed, 25 Sep 2013 17:40:11 +0000 (19:40 +0200)
Gromacs-4.6 introduced SIMD padding in the neighborlists, which works
fine for normal simulations. However, when the neighborlist gets long
and we end up adding a second batch of particles we need to remove the
previous padding, which was not done until now. This will typically only
occur when the list per node is large, e.g. when using long cutoffs
(>2nm) with only a single core. Normal simulations should not have been
affected by it (which is also why we did not find it until now).

Fixes #1341.

Change-Id: Ie64ab6c0313a8dc0d3545a5e7d610f24adae4438

src/mdlib/ns.c

index 1f137b363efcf545f149a9c5995328a498b38b53..6aa89cee38ec196df0f03ae1e64141e4cff356a4 100644 (file)
@@ -404,6 +404,17 @@ static inline void new_i_nblist(t_nblist *nlist,
         nlist->gid[nri]      = gid;
         nlist->shift[nri]    = shift;
     }
+    else
+    {
+        /* Adding to previous list. First remove possible previous padding */
+        if(nlist->simd_padding_width>1)
+        {
+            while(nlist->nrj>0 && nlist->jjnr[nlist->nrj-1]<0)
+            {
+                nlist->nrj--;
+            }
+        }
+    }
 }
 
 static inline void close_i_nblist(t_nblist *nlist)