From ce9b5d2f3fa3b43be4bc1b4ff9fd03ca278b1cd7 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Fri, 4 Apr 2014 16:40:30 +0000 Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@11702 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/KSPACE/msm_cg.cpp | 15 ++++++++++----- src/KSPACE/pppm_cg.cpp | 15 ++++++++++----- src/USER-OMP/msm_cg_omp.cpp | 15 ++++++++++----- 3 files changed, 30 insertions(+), 15 deletions(-) diff --git a/src/KSPACE/msm_cg.cpp b/src/KSPACE/msm_cg.cpp index 23d719ef04..8b7c3e0cda 100644 --- a/src/KSPACE/msm_cg.cpp +++ b/src/KSPACE/msm_cg.cpp @@ -27,6 +27,7 @@ #include "domain.h" #include "error.h" #include "force.h" +#include "neighbor.h" #include "memory.h" #include "msm_cg.h" @@ -155,12 +156,16 @@ void MSMCG::compute(int eflag, int vflag) } } - num_charged = 0; - for (i = 0; i < nlocal; ++i) - if (fabs(q[i]) > smallq) { - is_charged[num_charged] = i; - ++num_charged; + // only need to rebuild this list after a neighbor list update + if (neighbor->ago == 0) { + num_charged = 0; + for (i = 0; i < nlocal; ++i) { + if (fabs(q[i]) > smallq) { + is_charged[num_charged] = i; + ++num_charged; + } } + } // find grid points for all my particles // map my particle charge onto my local 3d density grid (aninterpolation) diff --git a/src/KSPACE/pppm_cg.cpp b/src/KSPACE/pppm_cg.cpp index 16b397fdc7..ca8aa2c0c3 100644 --- a/src/KSPACE/pppm_cg.cpp +++ b/src/KSPACE/pppm_cg.cpp @@ -26,6 +26,7 @@ #include "domain.h" #include "error.h" #include "force.h" +#include "neighbor.h" #include "memory.h" #include "pppm_cg.h" @@ -153,12 +154,16 @@ void PPPMCG::compute(int eflag, int vflag) } } - num_charged = 0; - for (int i = 0; i < atom->nlocal; ++i) - if (fabs(atom->q[i]) > smallq) { - is_charged[num_charged] = i; - ++num_charged; + // only need to rebuild this list after a neighbor list update + if (neighbor->ago == 0) { + num_charged = 0; + for (int i = 0; i < atom->nlocal; ++i) { + if (fabs(atom->q[i]) > smallq) { + is_charged[num_charged] = i; + ++num_charged; + } } + } // find grid points for all my particles // map my particle charge onto my local 3d density grid diff --git a/src/USER-OMP/msm_cg_omp.cpp b/src/USER-OMP/msm_cg_omp.cpp index 23f94349a0..3d91bbadfb 100644 --- a/src/USER-OMP/msm_cg_omp.cpp +++ b/src/USER-OMP/msm_cg_omp.cpp @@ -28,6 +28,7 @@ #include "domain.h" #include "error.h" #include "force.h" +#include "neighbor.h" #include "memory.h" #include "msm_cg_omp.h" @@ -156,12 +157,16 @@ void MSMCGOMP::compute(int eflag, int vflag) } } - num_charged = 0; - for (i = 0; i < nlocal; ++i) - if (fabs(q[i]) > smallq) { - is_charged[num_charged] = i; - ++num_charged; + // only need to rebuild this list after a neighbor list update + if (neighbor->ago == 0) { + num_charged = 0; + for (i = 0; i < nlocal; ++i) { + if (fabs(q[i]) > smallq) { + is_charged[num_charged] = i; + ++num_charged; + } } + } // find grid points for all my particles // map my particle charge onto my local 3d density grid (aninterpolation)