From 50fd0cd254b1dccf69b82f4be45844b06a5ae32c Mon Sep 17 00:00:00 2001 From: sjplimp Date: Tue, 22 May 2012 15:44:05 +0000 Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@8136 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/KSPACE/pppm.cpp | 20 ++++++++++---------- src/USER-CUDA/pppm_cuda.cpp | 7 +++---- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/KSPACE/pppm.cpp b/src/KSPACE/pppm.cpp index df7f7b3065..898322c1e9 100644 --- a/src/KSPACE/pppm.cpp +++ b/src/KSPACE/pppm.cpp @@ -13,7 +13,7 @@ /* ---------------------------------------------------------------------- Contributing authors: Roy Pollock (LLNL), Paul Crozier (SNL) - per-atom energy/virial, group/group energy/force added by Stan Moore (BYU) + per-atom energy/virial & group/group energy/force added by Stan Moore (BYU) ------------------------------------------------------------------------- */ #include "lmptype.h" @@ -137,9 +137,9 @@ void PPPM::init() error->all(FLERR,"Incorrect boundaries with slab PPPM"); } - if (order > MAXORDER) { + if (order < 2 || order > MAXORDER) { char str[128]; - sprintf(str,"PPPM order cannot be greater than %d",MAXORDER); + sprintf(str,"PPPM order cannot be < 2 or > than %d",MAXORDER); error->all(FLERR,str); } @@ -241,7 +241,7 @@ void PPPM::init() int iteration = 0; - while (order > 0) { + while (order > 1) { if (iteration && me == 0) error->warning(FLERR,"Reducing PPPM order b/c stencil extends " "beyond neighbor processor"); @@ -1015,12 +1015,12 @@ void PPPM::set_grid() if (!gridflag) { double err; - h_x = h_y = h_z = 1/g_ewald; - - nx_pppm = static_cast (xprd/h_x + 1); - ny_pppm = static_cast (yprd/h_y + 1); - nz_pppm = static_cast (zprd_slab/h_z + 1); + h_x = h_y = h_z = 1.0/g_ewald; + nx_pppm = static_cast (xprd/h_x) + 1; + ny_pppm = static_cast (yprd/h_y) + 1; + nz_pppm = static_cast (zprd_slab/h_z) + 1; + err = rms(h_x,xprd,natoms,q2,acons); while (err > accuracy) { err = rms(h_x,xprd,natoms,q2,acons); @@ -1064,7 +1064,7 @@ void PPPM::set_grid() f = diffpr(h_x,h_y,h_z,q2,acons); hmin = MIN(h_x,MIN(h_y,h_z)); - gew2 = 10/hmin; + gew2 = 10.0/hmin; g_ewald = gew2; fmid = diffpr(h_x,h_y,h_z,q2,acons); diff --git a/src/USER-CUDA/pppm_cuda.cpp b/src/USER-CUDA/pppm_cuda.cpp index 35195225ec..afcc1fb52c 100644 --- a/src/USER-CUDA/pppm_cuda.cpp +++ b/src/USER-CUDA/pppm_cuda.cpp @@ -221,9 +221,9 @@ void PPPMCuda::init() error->all(FLERR,"Incorrect boundaries with slab PPPMCuda"); } - if (order > MAXORDER) { + if (order < 2 || order > MAXORDER) { char str[128]; - sprintf(str,"PPPMCuda order cannot be greater than %d",MAXORDER); + sprintf(str,"PPPMCuda order cannot be smaller than 2 or greater than %d",MAXORDER); error->all(FLERR,str); } // free all arrays previously allocated @@ -302,8 +302,7 @@ void PPPMCuda::init() int iteration = 0; - while (order > 0) { - + while (order > 1) { if (iteration && me == 0) error->warning(FLERR,"Reducing PPPMCuda order b/c stencil extends " "beyond neighbor processor");