From 05cafb716fcbafd6e4c8417ea8ab65cd04bbfeb8 Mon Sep 17 00:00:00 2001 From: Tim Mattox Date: Wed, 18 Jan 2017 15:51:50 -0500 Subject: [PATCH 1/2] USER-DPD: cleanup initialization of splitFDT_flag in pair_dpd_fdt.cpp --- src/USER-DPD/pair_dpd_fdt.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/USER-DPD/pair_dpd_fdt.cpp b/src/USER-DPD/pair_dpd_fdt.cpp index f2c4c8f099..332804b8db 100644 --- a/src/USER-DPD/pair_dpd_fdt.cpp +++ b/src/USER-DPD/pair_dpd_fdt.cpp @@ -43,6 +43,7 @@ using namespace LAMMPS_NS; PairDPDfdt::PairDPDfdt(LAMMPS *lmp) : Pair(lmp) { random = NULL; + splitFDT_flag = false; } /* ---------------------------------------------------------------------- */ From f6cd98636b8ba24ff45029956a3ceb4226c21ba2 Mon Sep 17 00:00:00 2001 From: Tim Mattox Date: Wed, 18 Jan 2017 16:17:11 -0500 Subject: [PATCH 2/2] USER-DPD: Also apply "check if a0 is zero" optimization to pair_dpd_fdt This relates to commit 4eb08a5822 that was applied to pair_dpd_fdt_energy --- src/USER-DPD/pair_dpd_fdt.cpp | 7 ++++++- src/USER-DPD/pair_dpd_fdt.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/USER-DPD/pair_dpd_fdt.cpp b/src/USER-DPD/pair_dpd_fdt.cpp index 332804b8db..e7e9febd82 100644 --- a/src/USER-DPD/pair_dpd_fdt.cpp +++ b/src/USER-DPD/pair_dpd_fdt.cpp @@ -44,6 +44,7 @@ PairDPDfdt::PairDPDfdt(LAMMPS *lmp) : Pair(lmp) { random = NULL; splitFDT_flag = false; + a0_is_zero = false; } /* ---------------------------------------------------------------------- */ @@ -95,7 +96,7 @@ void PairDPDfdt::compute(int eflag, int vflag) // loop over neighbors of my atoms if (splitFDT_flag) { - for (ii = 0; ii < inum; ii++) { + if (!a0_is_zero) for (ii = 0; ii < inum; ii++) { i = ilist[ii]; xtmp = x[i][0]; ytmp = x[i][1]; @@ -288,6 +289,8 @@ void PairDPDfdt::coeff(int narg, char **arg) double sigma_one = force->numeric(FLERR,arg[3]); double cut_one = cut_global; + a0_is_zero = (a0_one == 0.0); // Typical use with SSA is to set a0 to zero + if (narg == 5) cut_one = force->numeric(FLERR,arg[4]); int count = 0; @@ -372,6 +375,7 @@ void PairDPDfdt::read_restart(FILE *fp) allocate(); + a0_is_zero = true; // start with assumption that a0 is zero int i,j; int me = comm->me; for (i = 1; i <= atom->ntypes; i++) @@ -387,6 +391,7 @@ void PairDPDfdt::read_restart(FILE *fp) MPI_Bcast(&a0[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world); + a0_is_zero = a0_is_zero && (a0[i][j] == 0.0); // verify the zero assumption } } } diff --git a/src/USER-DPD/pair_dpd_fdt.h b/src/USER-DPD/pair_dpd_fdt.h index b90a831cb4..5c20f2fc8f 100644 --- a/src/USER-DPD/pair_dpd_fdt.h +++ b/src/USER-DPD/pair_dpd_fdt.h @@ -50,6 +50,7 @@ class PairDPDfdt : public Pair { double cut_global; int seed; bool splitFDT_flag; + bool a0_is_zero; void allocate();