diff --git a/src/comm.cpp b/src/comm.cpp index efb58bb87d..ac3376ad41 100644 --- a/src/comm.cpp +++ b/src/comm.cpp @@ -103,60 +103,12 @@ Comm::~Comm() memory->sfree(buf_recv); } -/* ---------------------------------------------------------------------- */ - -void Comm::init() -{ - map_style = atom->map_style; - - // comm_only = 1 if only x,f are exchanged in forward/reverse comm - - comm_x_only = atom->avec->comm_x_only; - comm_f_only = atom->avec->comm_f_only; - - // maxforward = # of datums in largest forward communication - // maxreverse = # of datums in largest reverse communication - // query pair,fix,compute for their requirements - - maxforward = MAX(atom->avec->size_comm,atom->avec->size_border); - maxreverse = atom->avec->size_reverse; - - if (force->pair) maxforward = MAX(maxforward,force->pair->comm_forward); - if (force->pair) maxreverse = MAX(maxreverse,force->pair->comm_reverse); - - for (int i = 0; i < modify->nfix; i++) { - maxforward = MAX(maxforward,modify->fix[i]->comm_forward); - maxreverse = MAX(maxreverse,modify->fix[i]->comm_reverse); - } - - for (int i = 0; i < modify->ncompute; i++) { - maxforward = MAX(maxforward,modify->compute[i]->comm_forward); - maxreverse = MAX(maxreverse,modify->compute[i]->comm_reverse); - } - - if (force->newton == 0) maxreverse = 0; - - // memory for multi-style communication - - if (style == MULTI && multilo == NULL) { - allocate_multi(maxswap); - cutghostmulti = - memory->create_2d_double_array(atom->ntypes+1,3,"comm:cutghostmulti"); - } - if (style == SINGLE && multilo) { - free_multi(); - memory->destroy_2d_double_array(cutghostmulti); - } -} - /* ---------------------------------------------------------------------- setup 3d grid of procs based on box size ------------------------------------------------------------------------- */ void Comm::set_procs() { - triclinic = domain->triclinic; - if (user_procgrid[0] == 0) procs2box(); else { procgrid[0] = user_procgrid[0]; @@ -201,7 +153,7 @@ void Comm::set_procs() // set lamda box params after procs are assigned - if (triclinic) domain->set_lamda_box(); + if (domain->triclinic) domain->set_lamda_box(); if (me == 0) { if (screen) fprintf(screen," %d by %d by %d processor grid\n", @@ -211,6 +163,53 @@ void Comm::set_procs() } } +/* ---------------------------------------------------------------------- */ + +void Comm::init() +{ + triclinic = domain->triclinic; + map_style = atom->map_style; + + // comm_only = 1 if only x,f are exchanged in forward/reverse comm + + comm_x_only = atom->avec->comm_x_only; + comm_f_only = atom->avec->comm_f_only; + + // maxforward = # of datums in largest forward communication + // maxreverse = # of datums in largest reverse communication + // query pair,fix,compute for their requirements + + maxforward = MAX(atom->avec->size_comm,atom->avec->size_border); + maxreverse = atom->avec->size_reverse; + + if (force->pair) maxforward = MAX(maxforward,force->pair->comm_forward); + if (force->pair) maxreverse = MAX(maxreverse,force->pair->comm_reverse); + + for (int i = 0; i < modify->nfix; i++) { + maxforward = MAX(maxforward,modify->fix[i]->comm_forward); + maxreverse = MAX(maxreverse,modify->fix[i]->comm_reverse); + } + + for (int i = 0; i < modify->ncompute; i++) { + maxforward = MAX(maxforward,modify->compute[i]->comm_forward); + maxreverse = MAX(maxreverse,modify->compute[i]->comm_reverse); + } + + if (force->newton == 0) maxreverse = 0; + + // memory for multi-style communication + + if (style == MULTI && multilo == NULL) { + allocate_multi(maxswap); + cutghostmulti = + memory->create_2d_double_array(atom->ntypes+1,3,"comm:cutghostmulti"); + } + if (style == SINGLE && multilo) { + free_multi(); + memory->destroy_2d_double_array(cutghostmulti); + } +} + /* ---------------------------------------------------------------------- setup spatial-decomposition communication patterns function of neighbor cutoff(s) and current box size @@ -1268,7 +1267,7 @@ void Comm::procs2box() { double area[3]; - if (triclinic == 0) { + if (domain->triclinic == 0) { area[0] = domain->xprd * domain->yprd; area[1] = domain->xprd * domain->zprd; area[2] = domain->yprd * domain->zprd; diff --git a/src/create_box.cpp b/src/create_box.cpp index d3778be6a5..7d4b9f7cb8 100644 --- a/src/create_box.cpp +++ b/src/create_box.cpp @@ -57,6 +57,7 @@ void CreateBox::command(int narg, char **arg) // set simulation domain params from prism params if (strcmp(domain->regions[iregion]->style,"prism") != 0) { + domain->triclinic = 0; domain->boxlo[0] = domain->regions[iregion]->extent_xlo; domain->boxhi[0] = domain->regions[iregion]->extent_xhi; domain->boxlo[1] = domain->regions[iregion]->extent_ylo; diff --git a/src/displace_box.cpp b/src/displace_box.cpp index 4b451173f4..fb746c567e 100644 --- a/src/displace_box.cpp +++ b/src/displace_box.cpp @@ -41,7 +41,7 @@ void DisplaceBox::command(int narg, char **arg) if (domain->box_exist == 0) error->all("Displace_box command before simulation box is defined"); - if (narg < 2) error->all("Illegal displace_atoms command"); + if (narg < 2) error->all("Illegal displace_box command"); // init entire system since comm->irregular is done // comm::init needs neighbor::init needs pair::init needs kspace::init, etc @@ -391,7 +391,7 @@ void DisplaceBox::command(int narg, char **arg) } /* ---------------------------------------------------------------------- - parse optional parameters at end of displace_atoms input line + parse optional parameters at end of displace_box input line ------------------------------------------------------------------------- */ void DisplaceBox::options(int narg, char **arg) diff --git a/src/fix.cpp b/src/fix.cpp index a844a8c818..4d05902476 100644 --- a/src/fix.cpp +++ b/src/fix.cpp @@ -41,6 +41,7 @@ Fix::Fix(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) pressure_every = 0; rigid_flag = 0; virial_flag = 0; + no_convert_box = 0; comm_forward = comm_reverse = 0; neigh_half_once = neigh_half_every = 0; diff --git a/src/fix.h b/src/fix.h index a83c34b9ea..475b79afe4 100644 --- a/src/fix.h +++ b/src/fix.h @@ -33,6 +33,7 @@ class Fix : protected Pointers { int pressure_every; // how often fix needs virial computed int rigid_flag; // 1 if Fix integrates rigid bodies, 0 if not int virial_flag; // 1 if Fix contributes to virial, 0 if not + int no_convert_box; // 1 if cannot swap ortho <-> triclinic int comm_forward; // size of forward communication (0 if none) int comm_reverse; // size of reverse communication (0 if none) diff --git a/src/fix_ave_spatial.cpp b/src/fix_ave_spatial.cpp index c527621f32..d3eeeca4ee 100644 --- a/src/fix_ave_spatial.cpp +++ b/src/fix_ave_spatial.cpp @@ -42,6 +42,8 @@ FixAveSpatial::FixAveSpatial(LAMMPS *lmp, int narg, char **arg) : { if (narg < 11) error->all("Illegal fix ave/spatial command"); + no_convert_box = 1; + nevery = atoi(arg[3]); nfreq = atoi(arg[4]); diff --git a/src/fix_deform.cpp b/src/fix_deform.cpp index 15f496a797..0b41f1b0c1 100644 --- a/src/fix_deform.cpp +++ b/src/fix_deform.cpp @@ -45,6 +45,7 @@ FixDeform::FixDeform(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) if (narg < 4) error->all("Illegal fix deform command"); box_change = 1; + no_convert_box = 1; nevery = atoi(arg[3]); if (nevery <= 0) error->all("Illegal fix deform command"); diff --git a/src/fix_nph.cpp b/src/fix_nph.cpp index 0b38c5037b..a63238eb29 100644 --- a/src/fix_nph.cpp +++ b/src/fix_nph.cpp @@ -122,7 +122,6 @@ FixNPH::FixNPH(LAMMPS *lmp, int narg, char **arg) : // error checks - if (domain->triclinic) error->all("Cannot use fix nph with triclinic box"); if (p_flag[0] && domain->xperiodic == 0) error->all("Cannot use fix nph on a non-periodic dimension"); if (p_flag[1] && domain->yperiodic == 0) @@ -217,6 +216,7 @@ int FixNPH::setmask() void FixNPH::init() { + if (domain->triclinic) error->all("Cannot use fix nph with triclinic box"); if (atom->mass == NULL) error->all("Cannot use fix nph without per-type mass defined"); diff --git a/src/fix_npt.cpp b/src/fix_npt.cpp index 532c668e20..9f7cb1b5ef 100644 --- a/src/fix_npt.cpp +++ b/src/fix_npt.cpp @@ -129,7 +129,6 @@ FixNPT::FixNPT(LAMMPS *lmp, int narg, char **arg) : // error checks - if (domain->triclinic) error->all("Cannot use fix npt with triclinic box"); if (p_flag[0] && domain->xperiodic == 0) error->all("Cannot use fix npt on a non-periodic dimension"); if (p_flag[1] && domain->yperiodic == 0) @@ -227,6 +226,7 @@ int FixNPT::setmask() void FixNPT::init() { + if (domain->triclinic) error->all("Cannot use fix npt with triclinic box"); if (atom->mass == NULL) error->all("Cannot use fix npt without per-type mass defined"); diff --git a/src/style.h b/src/style.h index ec2cd56c01..c751146496 100644 --- a/src/style.h +++ b/src/style.h @@ -36,6 +36,7 @@ AtomStyle(hybrid,AtomVecHybrid) #endif #ifdef CommandInclude +#include "convert_box.h" #include "create_atoms.h" #include "create_box.h" #include "delete_atoms.h" @@ -55,6 +56,7 @@ AtomStyle(hybrid,AtomVecHybrid) #endif #ifdef CommandClass +CommandStyle(convert_box,ConvertBox) CommandStyle(create_atoms,CreateAtoms) CommandStyle(create_box,CreateBox) CommandStyle(delete_atoms,DeleteAtoms)