git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@12753 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
29
src/comm.cpp
29
src/comm.cpp
@ -162,33 +162,12 @@ void Comm::init()
|
||||
triclinic = domain->triclinic;
|
||||
map_style = atom->map_style;
|
||||
|
||||
// warn if any proc's sub-box is smaller than neigh skin
|
||||
// since may lead to lost atoms in exchange()
|
||||
// check warn if any proc's subbox is smaller than neigh skin
|
||||
// since may lead to lost atoms in exchange()
|
||||
// really should check every exchange() in case box size is shrinking
|
||||
// but seems overkill to do that
|
||||
// but seems overkill to do that (fix balance does perform this check)
|
||||
|
||||
int flag = 0;
|
||||
if (!triclinic) {
|
||||
if (domain->subhi[0] - domain->sublo[0] < neighbor->skin) flag = 1;
|
||||
if (domain->subhi[1] - domain->sublo[1] < neighbor->skin) flag = 1;
|
||||
if (domain->dimension == 3)
|
||||
if (domain->subhi[2] - domain->sublo[2] < neighbor->skin) flag = 1;
|
||||
} else {
|
||||
double delta = domain->subhi_lamda[0] - domain->sublo_lamda[0];
|
||||
if (delta*domain->prd[0] < neighbor->skin) flag = 1;
|
||||
delta = domain->subhi_lamda[1] - domain->sublo_lamda[1];
|
||||
if (delta*domain->prd[1] < neighbor->skin) flag = 1;
|
||||
if (domain->dimension == 3) {
|
||||
delta = domain->subhi_lamda[2] - domain->sublo_lamda[2];
|
||||
if (delta*domain->prd[2] < neighbor->skin) flag = 1;
|
||||
}
|
||||
}
|
||||
|
||||
int flagall;
|
||||
MPI_Allreduce(&flag,&flagall,1,MPI_INT,MPI_SUM,world);
|
||||
if (flagall && me == 0)
|
||||
error->warning(FLERR,"Proc sub-domain size < neighbor skin - "
|
||||
"could lead to lost atoms");
|
||||
domain->subbox_too_small_check(neighbor->skin);
|
||||
|
||||
// comm_only = 1 if only x,f are exchanged in forward/reverse comm
|
||||
// comm_x_only = 0 if ghost_velocity since velocities are added
|
||||
|
||||
@ -800,6 +800,36 @@ void Domain::box_too_small_check()
|
||||
"Bond/angle/dihedral extent > half of periodic box length");
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
check warn if any proc's subbox is smaller than thresh
|
||||
since may lead to lost atoms in comm->exchange()
|
||||
current callers set thresh = neighbor skin
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void Domain::subbox_too_small_check(double thresh)
|
||||
{
|
||||
int flag = 0;
|
||||
if (!triclinic) {
|
||||
if (subhi[0]-sublo[0] < thresh || subhi[1]-sublo[1] < thresh) flag = 1;
|
||||
if (dimension == 3 && subhi[2]-sublo[2] < thresh) flag = 1;
|
||||
} else {
|
||||
double delta = subhi_lamda[0] - sublo_lamda[0];
|
||||
if (delta*prd[0] < thresh) flag = 1;
|
||||
delta = subhi_lamda[1] - sublo_lamda[1];
|
||||
if (delta*prd[1] < thresh) flag = 1;
|
||||
if (dimension == 3) {
|
||||
delta = subhi_lamda[2] - sublo_lamda[2];
|
||||
if (delta*prd[2] < thresh) flag = 1;
|
||||
}
|
||||
}
|
||||
|
||||
int flagall;
|
||||
MPI_Allreduce(&flag,&flagall,1,MPI_INT,MPI_SUM,world);
|
||||
if (flagall && comm->me == 0)
|
||||
error->warning(FLERR,"Proc sub-domain size < neighbor skin, "
|
||||
"could lead to lost atoms");
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
minimum image convention
|
||||
use 1/2 of box size as test
|
||||
|
||||
@ -101,6 +101,7 @@ class Domain : protected Pointers {
|
||||
virtual void pbc();
|
||||
void image_check();
|
||||
void box_too_small_check();
|
||||
void subbox_too_small_check(double);
|
||||
void minimum_image(double &, double &, double &);
|
||||
void minimum_image(double *);
|
||||
int closest_image(int, int);
|
||||
|
||||
@ -16,9 +16,10 @@
|
||||
#include "fix_balance.h"
|
||||
#include "balance.h"
|
||||
#include "update.h"
|
||||
#include "domain.h"
|
||||
#include "atom.h"
|
||||
#include "comm.h"
|
||||
#include "domain.h"
|
||||
#include "neighbor.h"
|
||||
#include "irregular.h"
|
||||
#include "force.h"
|
||||
#include "kspace.h"
|
||||
@ -263,9 +264,12 @@ void FixBalance::rebalance()
|
||||
if (outflag) balance->dumpout(update->ntimestep,fp);
|
||||
|
||||
// reset proc sub-domains
|
||||
// check and warn if any proc's subbox is smaller than neigh skin
|
||||
// since may lead to lost atoms in exchange()
|
||||
|
||||
if (domain->triclinic) domain->set_lamda_box();
|
||||
domain->set_local_box();
|
||||
domain->subbox_too_small_check(neighbor->skin);
|
||||
|
||||
// move atoms to new processors via irregular()
|
||||
// only needed if migrate_check() says an atom moves to far
|
||||
|
||||
Reference in New Issue
Block a user