diff --git a/doc/src/Errors_messages.txt b/doc/src/Errors_messages.txt index 34a458232b..7249bfddfd 100644 --- a/doc/src/Errors_messages.txt +++ b/doc/src/Errors_messages.txt @@ -7097,6 +7097,18 @@ Self-explanatory. :dd One or more GPUs must be used when Kokkos is compiled for CUDA. :dd +{Kspace_modify mesh parameter must be all zero or all positive} :dt + +Valid kspace mesh parameters are >0. The code will try to auto-detect +suitable values when all three mesh sizes are set to zero (the default). :dd + +{Kspace_modify mesh/disp parameter must be all zero or all positive} :dt + +Valid kspace mesh/disp parameters are >0. The code will try to auto-detect +suitable values when all three mesh sizes are set to zero [and] +the required accuracy via {force/disp/real} as well as +{force/disp/kspace} is set. :dd + {Kspace style does not support compute group/group} :dt Self-explanatory. :dd diff --git a/src/kspace.cpp b/src/kspace.cpp index 0144ea59a3..64a769fa51 100644 --- a/src/kspace.cpp +++ b/src/kspace.cpp @@ -443,7 +443,11 @@ void KSpace::modify_params(int narg, char **arg) nx_pppm = nx_msm_max = force->inumeric(FLERR,arg[iarg+1]); ny_pppm = ny_msm_max = force->inumeric(FLERR,arg[iarg+2]); nz_pppm = nz_msm_max = force->inumeric(FLERR,arg[iarg+3]); - if (nx_pppm == 0 && ny_pppm == 0 && nz_pppm == 0) gridflag = 0; + if (nx_pppm == 0 && ny_pppm == 0 && nz_pppm == 0) + gridflag = 0; + else if (nx_pppm <= 0 || ny_pppm <= 0 || nz_pppm <= 0) + error->all(FLERR,"Kspace_modify mesh parameters must be all " + "zero or all positive"); else gridflag = 1; iarg += 4; } else if (strcmp(arg[iarg],"mesh/disp") == 0) { @@ -451,7 +455,11 @@ void KSpace::modify_params(int narg, char **arg) nx_pppm_6 = force->inumeric(FLERR,arg[iarg+1]); ny_pppm_6 = force->inumeric(FLERR,arg[iarg+2]); nz_pppm_6 = force->inumeric(FLERR,arg[iarg+3]); - if (nx_pppm_6 == 0 || ny_pppm_6 == 0 || nz_pppm_6 == 0) gridflag_6 = 0; + if (nx_pppm_6 == 0 && ny_pppm_6 == 0 && nz_pppm_6 == 0) + gridflag_6 = 0; + else if (nx_pppm_6 <= 0 || ny_pppm_6 <= 0 || nz_pppm_6 == 0) + error->all(FLERR,"Kspace_modify mesh/disp parameters must be all " + "zero or all positive"); else gridflag_6 = 1; iarg += 4; } else if (strcmp(arg[iarg],"order") == 0) { diff --git a/src/kspace.h b/src/kspace.h index 2345cebf24..4fd260e186 100644 --- a/src/kspace.h +++ b/src/kspace.h @@ -251,6 +251,18 @@ E: Bad kspace_modify slab parameter Kspace_modify value for the slab/volume keyword must be >= 2.0. +E: Kspace_modify mesh parameter must be all zero or all positive + +Valid kspace mesh parameters are >0. The code will try to auto-detect +suitable values when all three mesh sizes are set to zero (the default). + +E: Kspace_modify mesh/disp parameter must be all zero or all positive + +Valid kspace mesh/disp parameters are >0. The code will try to auto-detect +suitable values when all three mesh sizes are set to zero [and] +the required accuracy via {force/disp/real} as well as +{force/disp/kspace} is set. + W: Kspace_modify slab param < 2.0 may cause unphysical behavior The kspace_modify slab parameter should be larger to insure periodic