From eea54d018709cb37261a071db80775e189337748 Mon Sep 17 00:00:00 2001 From: Berk Hess Date: Sat, 4 Jul 2015 10:18:05 +0200 Subject: [PATCH] Fix bug in GPU list balancing The function split_sci_entry could produce empty lists. This seems not to have caused incorrect results, only slight extra processing of empty workunits in the CUDA kernel. Incorrect Coulomb energies could appear for empty lists with shift=CENTRAL, but that does not seem to happen. Refs #1767. Change-Id: I0b0ff0a450734d4863f1e9636ff5741d4f1a68da --- src/mdlib/nbnxn_search.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mdlib/nbnxn_search.c b/src/mdlib/nbnxn_search.c index 9034e2e39f..1e11514713 100644 --- a/src/mdlib/nbnxn_search.c +++ b/src/mdlib/nbnxn_search.c @@ -3545,7 +3545,8 @@ static void split_sci_entry(nbnxn_pairlist_t *nbl, nsp_cj4 += (nbl->cj4[cj4].imei[0].imask >> p) & 1; } - if (nsp_cj4 > 0 && nsp + nsp_cj4 > nsp_max) + /* Check if we should split at this cj4 to get a list of size nsp */ + if (nsp > 0 && nsp + nsp_cj4 > nsp_max) { /* Split the list at cj4 */ nbl->sci[sci].cj4_ind_end = cj4; -- 2.22.0