diff --git a/src/neighbor.cpp b/src/neighbor.cpp index 4ab1c80b7b..f0013714ea 100644 --- a/src/neighbor.cpp +++ b/src/neighbor.cpp @@ -69,6 +69,7 @@ Neighbor::Neighbor(LAMMPS *lmp) : Pointers(lmp) dist_check = 1; pgsize = 100000; oneatom = 2000; + binsizeflag = 0; cutneighsq = NULL; cuttype = NULL; @@ -1088,7 +1089,8 @@ void Neighbor::setup_bins() // special case of all cutoffs = 0.0, binsize = box size double binsize_optimal; - if (style == BIN) binsize_optimal = 0.5*cutneighmax; + if (binsizeflag) binsize_optimal = binsize_user; + else if (style == BIN) binsize_optimal = 0.5*cutneighmax; else binsize_optimal = 0.5*cutneighmin; if (binsize_optimal == 0.0) binsize_optimal = bbox[0]; double binsizeinv = 1.0/binsize_optimal; @@ -1280,6 +1282,12 @@ void Neighbor::modify_params(int narg, char **arg) if (iarg+2 > narg) error->all("Illegal neigh_modify command"); oneatom = atoi(arg[iarg+1]); iarg += 2; + } else if (strcmp(arg[iarg],"binsize") == 0) { + if (iarg+2 > narg) error->all("Illegal neigh_modify command"); + binsize_user = atof(arg[iarg+1]); + if (binsize_user <= 0.0) binsizeflag = 0; + else binsizeflag = 1; + iarg += 2; } else if (strcmp(arg[iarg],"exclude") == 0) { if (iarg+2 > narg) error->all("Illegal neigh_modify command"); diff --git a/src/neighbor.h b/src/neighbor.h index e48e326352..39f5788986 100644 --- a/src/neighbor.h +++ b/src/neighbor.h @@ -102,7 +102,10 @@ class Neighbor : protected Pointers { int mbinx,mbiny,mbinz; int mbinxlo,mbinylo,mbinzlo; - double binsizex,binsizey,binsizez; // bin sizes and inverse sizes + int binsizeflag; // user-chosen bin size + double binsize_user; + + double binsizex,binsizey,binsizez; // actual bin sizes and inverse sizes double bininvx,bininvy,bininvz; int sx,sy,sz,smax; // bin stencil extents