From 94521f03b39f0ea6a490c593a2476db09c73abef Mon Sep 17 00:00:00 2001 From: Rafael Ravedutti Date: Wed, 23 Mar 2022 14:31:47 +0100 Subject: [PATCH] Fix reference version with half neighbor lists Signed-off-by: Rafael Ravedutti --- gromacs/force_lj.c | 11 ++++++++--- gromacs/includes/simd/avx512_float.h | 1 - 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/gromacs/force_lj.c b/gromacs/force_lj.c index 6f9071c..2ef2764 100644 --- a/gromacs/force_lj.c +++ b/gromacs/force_lj.c @@ -79,13 +79,18 @@ double computeForceLJ_ref(Parameter *param, Atom *atom, Neighbor *neighbor, Stat MD_FLOAT fiz = 0; for(int cjj = 0; cjj < CLUSTER_N; cjj++) { + int cond; #if CLUSTER_M == CLUSTER_N - if(ci_cj0 != cj || cii != cjj) { + cond = neighbor->half_neigh ? (ci_cj0 != cj || cii < cjj) : + (ci_cj0 != cj || cii != cjj); #elif CLUSTER_M < CLUSTER_N - if(ci_cj0 != cj || cii + CLUSTER_M * (ci & 0x1) != cjj) { + cond = neighbor->half_neigh ? (ci_cj0 != cj || cii + CLUSTER_M * (ci & 0x1) < cjj) : + (ci_cj0 != cj || cii + CLUSTER_M * (ci & 0x1) != cjj); #else - if((ci_cj0 != cj || cii != cjj) && (ci_cj1 != cj || cii != cjj + CLUSTER_N)) { + cond = neighbor->half_neigh ? (ci_cj0 != cj || cii < cjj) && (ci_cj1 != cj || cii < cjj + CLUSTER_N) : + (ci_cj0 != cj || cii != cjj) && (ci_cj1 != cj || cii != cjj + CLUSTER_N); #endif + if(cond) { MD_FLOAT delx = xtmp - cj_x[CL_X_OFFSET + cjj]; MD_FLOAT dely = ytmp - cj_x[CL_Y_OFFSET + cjj]; MD_FLOAT delz = ztmp - cj_x[CL_Z_OFFSET + cjj]; diff --git a/gromacs/includes/simd/avx512_float.h b/gromacs/includes/simd/avx512_float.h index 20d54f0..104ad2c 100644 --- a/gromacs/includes/simd/avx512_float.h +++ b/gromacs/includes/simd/avx512_float.h @@ -98,4 +98,3 @@ static inline void simd_h_decr3(MD_FLOAT *m, MD_SIMD_FLOAT a0, MD_SIMD_FLOAT a1, simd_h_decr(m + CLUSTER_M, a1); simd_h_decr(m + CLUSTER_M * 2, a2); } -