From 9026afed5cf983df3d707b6afac0a1fb8e98be3a Mon Sep 17 00:00:00 2001 From: sjplimp Date: Fri, 8 Aug 2014 14:25:15 +0000 Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@12284 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/KSPACE/msm.cpp | 3 +++ src/KSPACE/msm_cg.cpp | 3 +++ src/KSPACE/pppm.cpp | 7 ++++++- src/KSPACE/pppm_cg.cpp | 3 +++ src/KSPACE/pppm_disp.cpp | 3 +++ src/KSPACE/pppm_disp_tip4p.cpp | 3 +++ src/KSPACE/pppm_stagger.cpp | 3 +++ src/KSPACE/pppm_tip4p.cpp | 3 +++ src/USER-OMP/msm_cg_omp.cpp | 3 +++ src/USER-OMP/pppm_disp_tip4p_omp.cpp | 3 +++ src/USER-OMP/pppm_tip4p_omp.cpp | 3 +++ 11 files changed, 36 insertions(+), 1 deletion(-) diff --git a/src/KSPACE/msm.cpp b/src/KSPACE/msm.cpp index 81dbc98b47..9ba0c58191 100644 --- a/src/KSPACE/msm.cpp +++ b/src/KSPACE/msm.cpp @@ -1428,6 +1428,9 @@ void MSM::particle_map() int flag = 0; + if (!isfinite(boxlo[0]) || !isfinite(boxlo[1]) || !isfinite(boxlo[2])) + error->one(FLERR,"Non-numeric box dimensions - simulation unstable"); + for (int i = 0; i < nlocal; i++) { // (nx,ny,nz) = global coords of grid pt to "lower left" of charge diff --git a/src/KSPACE/msm_cg.cpp b/src/KSPACE/msm_cg.cpp index e1f1262c9f..5e351cfcf2 100644 --- a/src/KSPACE/msm_cg.cpp +++ b/src/KSPACE/msm_cg.cpp @@ -309,6 +309,9 @@ void MSMCG::particle_map() int flag = 0; int i; + if (!isfinite(boxlo[0]) || !isfinite(boxlo[1]) || !isfinite(boxlo[2])) + error->one(FLERR,"Non-numeric box dimensions - simulation unstable"); + for (int j = 0; j < num_charged; j++) { i = is_charged[j]; diff --git a/src/KSPACE/pppm.cpp b/src/KSPACE/pppm.cpp index a5697910c4..9e9c454389 100644 --- a/src/KSPACE/pppm.cpp +++ b/src/KSPACE/pppm.cpp @@ -1875,6 +1875,10 @@ void PPPM::particle_map() int nlocal = atom->nlocal; int flag = 0; + + if (!isfinite(boxlo[0]) || !isfinite(boxlo[1]) || !isfinite(boxlo[2])) + error->one(FLERR,"Non-numeric box dimensions - simulation unstable"); + for (int i = 0; i < nlocal; i++) { // (nx,ny,nz) = global coords of grid pt to "lower left" of charge @@ -1893,8 +1897,9 @@ void PPPM::particle_map() if (nx+nlower < nxlo_out || nx+nupper > nxhi_out || ny+nlower < nylo_out || ny+nupper > nyhi_out || - nz+nlower < nzlo_out || nz+nupper > nzhi_out) + nz+nlower < nzlo_out || nz+nupper > nzhi_out) { flag = 1; + } } if (flag) error->one(FLERR,"Out of range atoms - cannot compute PPPM"); diff --git a/src/KSPACE/pppm_cg.cpp b/src/KSPACE/pppm_cg.cpp index d071c3993a..be84a5fc0b 100644 --- a/src/KSPACE/pppm_cg.cpp +++ b/src/KSPACE/pppm_cg.cpp @@ -282,6 +282,9 @@ void PPPMCG::particle_map() double **x = atom->x; + if (!isfinite(boxlo[0]) || !isfinite(boxlo[1]) || !isfinite(boxlo[2])) + error->one(FLERR,"Non-numeric box dimensions - simulation unstable"); + int flag = 0; for (int j = 0; j < num_charged; j++) { int i = is_charged[j]; diff --git a/src/KSPACE/pppm_disp.cpp b/src/KSPACE/pppm_disp.cpp index 1dfea3bf77..37fa0b46f6 100755 --- a/src/KSPACE/pppm_disp.cpp +++ b/src/KSPACE/pppm_disp.cpp @@ -4209,6 +4209,9 @@ void PPPMDisp::particle_map(double delx, double dely, double delz, double **x = atom->x; int nlocal = atom->nlocal; + if (!isfinite(boxlo[0]) || !isfinite(boxlo[1]) || !isfinite(boxlo[2])) + error->one(FLERR,"Non-numeric box dimensions - simulation unstable"); + int flag = 0; for (int i = 0; i < nlocal; i++) { diff --git a/src/KSPACE/pppm_disp_tip4p.cpp b/src/KSPACE/pppm_disp_tip4p.cpp index 0875c881d6..c021e3dcc0 100755 --- a/src/KSPACE/pppm_disp_tip4p.cpp +++ b/src/KSPACE/pppm_disp_tip4p.cpp @@ -78,6 +78,9 @@ void PPPMDispTIP4P::particle_map_c(double delx, double dely, double delz, double **x = atom->x; int nlocal = atom->nlocal; + if (!isfinite(boxlo[0]) || !isfinite(boxlo[1]) || !isfinite(boxlo[2])) + error->one(FLERR,"Non-numeric box dimensions - simulation unstable"); + int flag = 0; for (int i = 0; i < nlocal; i++) { if (type[i] == typeO) { diff --git a/src/KSPACE/pppm_stagger.cpp b/src/KSPACE/pppm_stagger.cpp index 3863f41f89..f0ee7e10dc 100755 --- a/src/KSPACE/pppm_stagger.cpp +++ b/src/KSPACE/pppm_stagger.cpp @@ -679,6 +679,9 @@ void PPPMStagger::particle_map() double **x = atom->x; int nlocal = atom->nlocal; + if (!isfinite(boxlo[0]) || !isfinite(boxlo[1]) || !isfinite(boxlo[2])) + error->one(FLERR,"Non-numeric box dimensions - simulation unstable"); + int flag = 0; for (int i = 0; i < nlocal; i++) { diff --git a/src/KSPACE/pppm_tip4p.cpp b/src/KSPACE/pppm_tip4p.cpp index decdb1bad4..f3c6d3c9a4 100644 --- a/src/KSPACE/pppm_tip4p.cpp +++ b/src/KSPACE/pppm_tip4p.cpp @@ -73,6 +73,9 @@ void PPPMTIP4P::particle_map() double **x = atom->x; int nlocal = atom->nlocal; + if (!isfinite(boxlo[0]) || !isfinite(boxlo[1]) || !isfinite(boxlo[2])) + error->one(FLERR,"Non-numeric box dimensions - simulation unstable"); + int flag = 0; for (int i = 0; i < nlocal; i++) { if (type[i] == typeO) { diff --git a/src/USER-OMP/msm_cg_omp.cpp b/src/USER-OMP/msm_cg_omp.cpp index 07ae22d9f4..cf4128eb73 100644 --- a/src/USER-OMP/msm_cg_omp.cpp +++ b/src/USER-OMP/msm_cg_omp.cpp @@ -324,6 +324,9 @@ void MSMCGOMP::particle_map() int flag = 0; int i; + if (!isfinite(boxlo[0]) || !isfinite(boxlo[1]) || !isfinite(boxlo[2])) + error->one(FLERR,"Non-numeric box dimensions - simulation unstable"); + // XXX: O(N). is it worth to add OpenMP here? for (int j = 0; j < num_charged; j++) { i = is_charged[j]; diff --git a/src/USER-OMP/pppm_disp_tip4p_omp.cpp b/src/USER-OMP/pppm_disp_tip4p_omp.cpp index 341a6c5e76..6ee1c9fcff 100644 --- a/src/USER-OMP/pppm_disp_tip4p_omp.cpp +++ b/src/USER-OMP/pppm_disp_tip4p_omp.cpp @@ -359,6 +359,9 @@ void PPPMDispTIP4POMP::particle_map_c(double dxinv, double dyinv, const int nyhi_out = nyhi_o; const int nzhi_out = nzhi_o; + if (!isfinite(boxlo[0]) || !isfinite(boxlo[1]) || !isfinite(boxlo[2])) + error->one(FLERR,"Non-numeric box dimensions - simulation unstable"); + int i, flag = 0; #if defined(_OPENMP) #pragma omp parallel for private(i) default(none) reduction(+:flag) schedule(static) diff --git a/src/USER-OMP/pppm_tip4p_omp.cpp b/src/USER-OMP/pppm_tip4p_omp.cpp index f11d44d753..9e6efb3512 100644 --- a/src/USER-OMP/pppm_tip4p_omp.cpp +++ b/src/USER-OMP/pppm_tip4p_omp.cpp @@ -343,6 +343,9 @@ void PPPMTIP4POMP::particle_map() const double boxloz = boxlo[2]; const int nlocal = atom->nlocal; + if (!isfinite(boxlo[0]) || !isfinite(boxlo[1]) || !isfinite(boxlo[2])) + error->one(FLERR,"Non-numeric box dimensions - simulation unstable"); + int i, flag = 0; #if defined(_OPENMP) #pragma omp parallel for private(i) default(none) reduction(+:flag) schedule(static)