diff --git a/src/MOLECULE/bond_fene_expand.h b/src/MOLECULE/bond_fene_expand.h index 6c79b1cfd0..49a8b8ab8e 100644 --- a/src/MOLECULE/bond_fene_expand.h +++ b/src/MOLECULE/bond_fene_expand.h @@ -13,7 +13,7 @@ #ifdef BOND_CLASS -BondStyle(fene / expand, BondFENEExpand) +BondStyle(fene/expand, BondFENEExpand) #else diff --git a/src/comm.cpp b/src/comm.cpp index e60c538ed2..513349f6eb 100644 --- a/src/comm.cpp +++ b/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; - } + memory->destroy(cutusermulti); + memory->destroy(cutusermultiold); 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; - } + memory->destroy(cutusermultiold); 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; - } + memory->destroy(cutusermulti); 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"); diff --git a/src/comm.h b/src/comm.h index 414b9414bc..df016c0b72 100644 --- a/src/comm.h +++ b/src/comm.h @@ -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 diff --git a/src/nstencil.cpp b/src/nstencil.cpp index 0648f0e3b1..c412c280ef 100644 --- a/src/nstencil.cpp +++ b/src/nstencil.cpp @@ -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 (cutneighmax*bininvx); + sx = static_cast(cutneighmax*bininvx); if (sx*binsizex < cutneighmax) sx++; - sy = static_cast (cutneighmax*bininvy); + sy = static_cast(cutneighmax*bininvy); if (sy*binsizey < cutneighmax) sy++; - sz = static_cast (cutneighmax*bininvz); + sz = static_cast(cutneighmax*bininvz); if (sz*binsizez < cutneighmax) sz++; if (dimension == 2) sz = 0;