Fix reference version with half neighbor lists

Signed-off-by: Rafael Ravedutti <rafaelravedutti@gmail.com>
This commit is contained in:
Rafael Ravedutti 2022-03-23 14:31:47 +01:00
parent 8709bc2a06
commit 94521f03b3
2 changed files with 8 additions and 4 deletions

View File

@ -79,13 +79,18 @@ double computeForceLJ_ref(Parameter *param, Atom *atom, Neighbor *neighbor, Stat
MD_FLOAT fiz = 0; MD_FLOAT fiz = 0;
for(int cjj = 0; cjj < CLUSTER_N; cjj++) { for(int cjj = 0; cjj < CLUSTER_N; cjj++) {
int cond;
#if CLUSTER_M == CLUSTER_N #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 #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 #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 #endif
if(cond) {
MD_FLOAT delx = xtmp - cj_x[CL_X_OFFSET + cjj]; MD_FLOAT delx = xtmp - cj_x[CL_X_OFFSET + cjj];
MD_FLOAT dely = ytmp - cj_x[CL_Y_OFFSET + cjj]; MD_FLOAT dely = ytmp - cj_x[CL_Y_OFFSET + cjj];
MD_FLOAT delz = ztmp - cj_x[CL_Z_OFFSET + cjj]; MD_FLOAT delz = ztmp - cj_x[CL_Z_OFFSET + cjj];

View File

@ -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, a1);
simd_h_decr(m + CLUSTER_M * 2, a2); simd_h_decr(m + CLUSTER_M * 2, a2);
} }