git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@687 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
99
src/comm.cpp
99
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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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]);
|
||||
|
||||
|
||||
@ -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");
|
||||
|
||||
@ -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");
|
||||
|
||||
|
||||
@ -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");
|
||||
|
||||
|
||||
@ -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)
|
||||
|
||||
Reference in New Issue
Block a user