git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@13971 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
47
src/comm.cpp
47
src/comm.cpp
@ -56,6 +56,7 @@ Comm::Comm(LAMMPS *lmp) : Pointers(lmp)
|
||||
mode = 0;
|
||||
bordergroup = 0;
|
||||
cutghostuser = 0.0;
|
||||
cutusermulti = NULL;
|
||||
ghost_velocity = 0;
|
||||
|
||||
user_procgrid[0] = user_procgrid[1] = user_procgrid[2] = 0;
|
||||
@ -114,6 +115,7 @@ Comm::~Comm()
|
||||
memory->destroy(xsplit);
|
||||
memory->destroy(ysplit);
|
||||
memory->destroy(zsplit);
|
||||
memory->destroy(cutusermulti);
|
||||
delete [] customfile;
|
||||
delete [] outfile;
|
||||
}
|
||||
@ -141,6 +143,11 @@ void Comm::copy_arrays(Comm *oldcomm)
|
||||
memcpy(zsplit,oldcomm->zsplit,(procgrid[2]+1)*sizeof(double));
|
||||
}
|
||||
|
||||
if (oldcomm->cutusermulti) {
|
||||
memory->create(cutusermulti,atom->ntypes+1,"comm:cutusermulti");
|
||||
memcpy(cutusermulti,oldcomm->cutusermulti,atom->ntypes+1);
|
||||
}
|
||||
|
||||
if (customfile) {
|
||||
int n = strlen(oldcomm->customfile) + 1;
|
||||
customfile = new char[n];
|
||||
@ -234,9 +241,17 @@ void Comm::modify_params(int narg, char **arg)
|
||||
while (iarg < narg) {
|
||||
if (strcmp(arg[iarg],"mode") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal comm_modify command");
|
||||
if (strcmp(arg[iarg+1],"single") == 0) mode = SINGLE;
|
||||
else if (strcmp(arg[iarg+1],"multi") == 0) mode = MULTI;
|
||||
else error->all(FLERR,"Illegal comm_modify command");
|
||||
if (strcmp(arg[iarg+1],"single") == 0) {
|
||||
// need to reset cutghostuser when switching comm mode
|
||||
if (mode == MULTI) cutghostuser = 0.0;
|
||||
memory->destroy(cutusermulti);
|
||||
cutusermulti = NULL;
|
||||
mode = SINGLE;
|
||||
} else if (strcmp(arg[iarg+1],"multi") == 0) {
|
||||
// need to reset cutghostuser when switching comm mode
|
||||
if (mode == SINGLE) cutghostuser = 0.0;
|
||||
mode = MULTI;
|
||||
} else error->all(FLERR,"Illegal comm_modify command");
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"group") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal comm_modify command");
|
||||
@ -249,10 +264,36 @@ void Comm::modify_params(int narg, char **arg)
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"cutoff") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal comm_modify command");
|
||||
if (mode == MULTI)
|
||||
error->all(FLERR,"Use cutoff/multi flag to set cutoff in multi mode");
|
||||
cutghostuser = force->numeric(FLERR,arg[iarg+1]);
|
||||
if (cutghostuser < 0.0)
|
||||
error->all(FLERR,"Invalid cutoff in comm_modify command");
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"cutoff/multi") == 0) {
|
||||
int i,nlo,nhi;
|
||||
double cut;
|
||||
if (mode == SINGLE)
|
||||
error->all(FLERR,"Use cutoff flag to set cutoff in single mode");
|
||||
if (domain->box_exist == 0)
|
||||
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");
|
||||
if (cutusermulti == NULL) {
|
||||
memory->create(cutusermulti,ntypes+1,"comm:cutusermulti");
|
||||
for (i=0; i < ntypes+1; ++i)
|
||||
cutusermulti[i] = -1.0;
|
||||
}
|
||||
force->bounds(arg[iarg+1],ntypes,nlo,nhi,1);
|
||||
cut = force->numeric(FLERR,arg[iarg+2]);
|
||||
cutghostuser = MAX(cutghostuser,cut);
|
||||
if (cut < 0.0)
|
||||
error->all(FLERR,"Invalid cutoff in comm_modify command");
|
||||
for (i=nlo; i<=nhi; ++i)
|
||||
cutusermulti[i] = cut;
|
||||
iarg += 3;
|
||||
} else if (strcmp(arg[iarg],"vel") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal comm_modify command");
|
||||
if (strcmp(arg[iarg+1],"yes") == 0) ghost_velocity = 1;
|
||||
|
||||
Reference in New Issue
Block a user