From 01609f55e2b33c001539de2a6387f50d4b8554ea Mon Sep 17 00:00:00 2001
From: Tim Mattox <timothy.mattox@engilitycorp.com>
Date: Tue, 17 Jan 2017 12:47:59 -0500
Subject: [PATCH] USER-DPD: bugfix for a segfault when using MOLECULE and DPD
 together.

---
 src/USER-DPD/npair_half_bin_newton_ssa.cpp | 4 ++--
 src/USER-DPD/npair_halffull_newton_ssa.cpp | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/USER-DPD/npair_half_bin_newton_ssa.cpp b/src/USER-DPD/npair_half_bin_newton_ssa.cpp
index 25805461b5..fd67b66e9b 100644
--- a/src/USER-DPD/npair_half_bin_newton_ssa.cpp
+++ b/src/USER-DPD/npair_half_bin_newton_ssa.cpp
@@ -251,8 +251,8 @@ void NPairHalfBinNewtonSSA::build(NeighList *list)
 
 static int cmp_ssaAIR(const void *iptr, const void *jptr)
 {
-  int i = *((int *) iptr);
-  int j = *((int *) jptr);
+  int i = NEIGHMASK & *((int *) iptr);
+  int j = NEIGHMASK & *((int *) jptr);
   if (ssaAIRptr[i] < ssaAIRptr[j]) return -1;
   if (ssaAIRptr[i] > ssaAIRptr[j]) return 1;
   return 0;
diff --git a/src/USER-DPD/npair_halffull_newton_ssa.cpp b/src/USER-DPD/npair_halffull_newton_ssa.cpp
index 3cd0b71879..2c9de3e50f 100644
--- a/src/USER-DPD/npair_halffull_newton_ssa.cpp
+++ b/src/USER-DPD/npair_halffull_newton_ssa.cpp
@@ -123,8 +123,8 @@ void NPairHalffullNewtonSSA::build(NeighList *list)
 
 static int cmp_ssaAIR(const void *iptr, const void *jptr)
 {
-  int i = *((int *) iptr);
-  int j = *((int *) jptr);
+  int i = NEIGHMASK & *((int *) iptr);
+  int j = NEIGHMASK & *((int *) jptr);
   if (ssaAIRptr[i] < ssaAIRptr[j]) return -1;
   if (ssaAIRptr[i] > ssaAIRptr[j]) return 1;
   return 0;
-- 
GitLab