small fixed and error checking
This commit is contained in:
@ -13,7 +13,7 @@
|
||||
|
||||
#ifdef BOND_CLASS
|
||||
|
||||
BondStyle(fene / expand, BondFENEExpand)
|
||||
BondStyle(fene/expand, BondFENEExpand)
|
||||
|
||||
#else
|
||||
|
||||
|
||||
30
src/comm.cpp
30
src/comm.cpp
@ -292,32 +292,24 @@ void Comm::modify_params(int narg, char **arg)
|
||||
// need to reset cutghostuser when switching comm mode
|
||||
if (mode == Comm::MULTI) cutghostuser = 0.0;
|
||||
if (mode == Comm::MULTIOLD) cutghostuser = 0.0;
|
||||
if (cutusermulti) {
|
||||
memory->destroy(cutusermulti);
|
||||
cutusermulti = nullptr;
|
||||
}
|
||||
if (cutusermultiold) {
|
||||
memory->destroy(cutusermultiold);
|
||||
cutusermultiold = nullptr;
|
||||
}
|
||||
mode = Comm::SINGLE;
|
||||
} else if (strcmp(arg[iarg+1],"multi") == 0) {
|
||||
if (neighbor->style != Neighbor::MULTI)
|
||||
error->all(FLERR,"Cannot use comm mode 'multi' without 'multi' style neighbor lists");
|
||||
// need to reset cutghostuser when switching comm mode
|
||||
if (mode == Comm::SINGLE) cutghostuser = 0.0;
|
||||
if (mode == Comm::MULTIOLD) cutghostuser = 0.0;
|
||||
if (cutusermultiold) {
|
||||
memory->destroy(cutusermultiold);
|
||||
cutusermultiold = nullptr;
|
||||
}
|
||||
mode = Comm::MULTI;
|
||||
} else if (strcmp(arg[iarg+1],"multi/old") == 0) {
|
||||
if (neighbor->style == Neighbor::MULTI)
|
||||
error->all(FLERR,"Cannot use comm mode 'multi/old' with 'multi' style neighbor lists");
|
||||
// need to reset cutghostuser when switching comm mode
|
||||
if (mode == Comm::SINGLE) cutghostuser = 0.0;
|
||||
if (mode == Comm::MULTI) cutghostuser = 0.0;
|
||||
if (cutusermulti) {
|
||||
memory->destroy(cutusermulti);
|
||||
cutusermulti = nullptr;
|
||||
}
|
||||
mode = Comm::MULTIOLD;
|
||||
} else error->all(FLERR,"Illegal comm_modify command");
|
||||
iarg += 2;
|
||||
@ -333,11 +325,9 @@ void Comm::modify_params(int narg, char **arg)
|
||||
} else if (strcmp(arg[iarg],"cutoff") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal comm_modify command");
|
||||
if (mode == Comm::MULTI)
|
||||
error->all(FLERR,
|
||||
"Use cutoff/multi keyword to set cutoff in multi mode");
|
||||
error->all(FLERR, "Use cutoff/multi keyword to set cutoff in multi mode");
|
||||
if (mode == Comm::MULTIOLD)
|
||||
error->all(FLERR,
|
||||
"Use cutoff/multi/old keyword to set cutoff in multi mode");
|
||||
error->all(FLERR, "Use cutoff/multi/old keyword to set cutoff in multi mode");
|
||||
cutghostuser = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (cutghostuser < 0.0)
|
||||
error->all(FLERR,"Invalid cutoff in comm_modify command");
|
||||
@ -350,14 +340,13 @@ void Comm::modify_params(int narg, char **arg)
|
||||
if (mode == Comm::MULTIOLD)
|
||||
error->all(FLERR,"Use cutoff/multi/old keyword to set cutoff in multi/old mode");
|
||||
if (domain->box_exist == 0)
|
||||
error->all(FLERR,
|
||||
"Cannot set cutoff/multi before simulation box is defined");
|
||||
error->all(FLERR, "Cannot set cutoff/multi before simulation box is defined");
|
||||
|
||||
// Check if # of collections has changed, if so erase any previously defined cutoffs
|
||||
// Neighbor will reset ncollections if collections are redefined
|
||||
if (ncollections_cutoff != neighbor->ncollections) {
|
||||
ncollections_cutoff = neighbor->ncollections;
|
||||
if (cutusermulti) memory->destroy(cutusermulti);
|
||||
memory->destroy(cutusermulti);
|
||||
memory->create(cutusermulti,ncollections_cutoff,"comm:cutusermulti");
|
||||
for (i=0; i < ncollections_cutoff; ++i)
|
||||
cutusermulti[i] = -1.0;
|
||||
@ -379,8 +368,7 @@ void Comm::modify_params(int narg, char **arg)
|
||||
if (mode == Comm::MULTI)
|
||||
error->all(FLERR,"Use cutoff/multi keyword to set cutoff in multi mode");
|
||||
if (domain->box_exist == 0)
|
||||
error->all(FLERR,
|
||||
"Cannot set cutoff/multi before simulation box is defined");
|
||||
error->all(FLERR, "Cannot set cutoff/multi before simulation box is defined");
|
||||
const int ntypes = atom->ntypes;
|
||||
if (iarg+3 > narg)
|
||||
error->all(FLERR,"Illegal comm_modify command");
|
||||
|
||||
@ -31,9 +31,9 @@ class Comm : protected Pointers {
|
||||
int me,nprocs; // proc info
|
||||
int ghost_velocity; // 1 if ghost atoms have velocity, 0 if not
|
||||
double cutghost[3]; // cutoffs used for acquiring ghost atoms
|
||||
double cutghostuser; // user-specified ghost cutoff (mode == 0)
|
||||
double *cutusermulti; // per collection user ghost cutoff (mode == 1)
|
||||
double *cutusermultiold; // per type user ghost cutoff (mode == 2)
|
||||
double cutghostuser; // user-specified ghost cutoff (mode == SINGLE)
|
||||
double *cutusermulti; // per collection user ghost cutoff (mode == MULTI)
|
||||
double *cutusermultiold; // per type user ghost cutoff (mode == MULTIOLD)
|
||||
int ncollections; // # of collections known by comm, used to test if # has changed
|
||||
int ncollections_cutoff; // # of collections stored b cutoff/multi
|
||||
int recv_from_partition; // recv proc layout from this partition
|
||||
|
||||
@ -210,7 +210,7 @@ void NStencil::copy_bin_info_multi()
|
||||
void NStencil::create_setup()
|
||||
{
|
||||
|
||||
if (neighstyle != Neighbor::MULTI){
|
||||
if (neighstyle != Neighbor::MULTI) {
|
||||
if (nb) copy_bin_info();
|
||||
last_stencil = update->ntimestep;
|
||||
|
||||
@ -218,11 +218,11 @@ void NStencil::create_setup()
|
||||
// smax = max possible size of entire 3d stencil
|
||||
// stencil will be empty if cutneighmax = 0.0
|
||||
|
||||
sx = static_cast<int> (cutneighmax*bininvx);
|
||||
sx = static_cast<int>(cutneighmax*bininvx);
|
||||
if (sx*binsizex < cutneighmax) sx++;
|
||||
sy = static_cast<int> (cutneighmax*bininvy);
|
||||
sy = static_cast<int>(cutneighmax*bininvy);
|
||||
if (sy*binsizey < cutneighmax) sy++;
|
||||
sz = static_cast<int> (cutneighmax*bininvz);
|
||||
sz = static_cast<int>(cutneighmax*bininvz);
|
||||
if (sz*binsizez < cutneighmax) sz++;
|
||||
if (dimension == 2) sz = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user