Merge pull request #1099 from jrgissing/bond/react-efficient-competing_reactions
bond/react: efficient competing reactions
This commit is contained in:
@ -961,6 +961,10 @@ void FixBondReact::superimpose_algorithm()
|
|||||||
local_num_mega = 0;
|
local_num_mega = 0;
|
||||||
ghostly_num_mega = 0;
|
ghostly_num_mega = 0;
|
||||||
|
|
||||||
|
// indicates local ghosts of other procs
|
||||||
|
int tmp;
|
||||||
|
localsendlist = (int *) comm->extract("localsendlist",tmp);
|
||||||
|
|
||||||
// quick description of important global indices you'll see floating about:
|
// quick description of important global indices you'll see floating about:
|
||||||
// 'pion' is the pioneer loop index
|
// 'pion' is the pioneer loop index
|
||||||
// 'neigh' in the first neighbor index
|
// 'neigh' in the first neighbor index
|
||||||
@ -1857,17 +1861,24 @@ if so, flag for broadcasting for perusal by all processors
|
|||||||
|
|
||||||
void FixBondReact::glove_ghostcheck()
|
void FixBondReact::glove_ghostcheck()
|
||||||
{
|
{
|
||||||
// it appears this little loop was deemed important enough for its own function!
|
|
||||||
// noteworthy: it's only relevant for parallel
|
|
||||||
|
|
||||||
// here we add glove to either local_mega_glove or ghostly_mega_glove
|
// here we add glove to either local_mega_glove or ghostly_mega_glove
|
||||||
int ghostly = 1;
|
// ghostly_mega_glove includes atoms that are ghosts, either of this proc or another
|
||||||
//for (int i = 0; i < onemol->natoms; i++) {
|
// 'ghosts of another' indication taken from comm->sendlist
|
||||||
// if (atom->map(glove[i][1]) >= atom->nlocal) {
|
|
||||||
// ghostly = 1;
|
int ghostly = 0;
|
||||||
// break;
|
if (comm->style == 0) {
|
||||||
// }
|
for (int i = 0; i < onemol->natoms; i++) {
|
||||||
//}
|
int ilocal = atom->map(glove[i][1]);
|
||||||
|
if (ilocal >= atom->nlocal || localsendlist[ilocal] == 1) {
|
||||||
|
ghostly = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
#if !defined(MPI_STUBS)
|
||||||
|
ghostly = 1;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
if (ghostly == 1) {
|
if (ghostly == 1) {
|
||||||
ghostly_mega_glove[0][ghostly_num_mega] = rxnID;
|
ghostly_mega_glove[0][ghostly_num_mega] = rxnID;
|
||||||
|
|||||||
@ -122,6 +122,7 @@ class FixBondReact : public Fix {
|
|||||||
tagint **local_mega_glove; // consolidation local of reaction instances
|
tagint **local_mega_glove; // consolidation local of reaction instances
|
||||||
tagint **ghostly_mega_glove; // consolidation nonlocal of reaction instances
|
tagint **ghostly_mega_glove; // consolidation nonlocal of reaction instances
|
||||||
tagint **global_mega_glove; // consolidation (inter-processor) of gloves containing nonlocal atoms
|
tagint **global_mega_glove; // consolidation (inter-processor) of gloves containing nonlocal atoms
|
||||||
|
int *localsendlist; // indicates ghosts of other procs
|
||||||
int local_num_mega; // num of local reaction instances
|
int local_num_mega; // num of local reaction instances
|
||||||
int ghostly_num_mega; // num of ghostly reaction instances
|
int ghostly_num_mega; // num of ghostly reaction instances
|
||||||
int global_megasize; // num of reaction instances in global_mega_glove
|
int global_megasize; // num of reaction instances in global_mega_glove
|
||||||
|
|||||||
@ -112,6 +112,9 @@ class Comm : protected Pointers {
|
|||||||
int read_lines_from_file(FILE *, int, int, char *);
|
int read_lines_from_file(FILE *, int, int, char *);
|
||||||
int read_lines_from_file_universe(FILE *, int, int, char *);
|
int read_lines_from_file_universe(FILE *, int, int, char *);
|
||||||
|
|
||||||
|
// extract data useful to other classes
|
||||||
|
virtual void *extract(const char *, int &) {return NULL;}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int bordergroup; // only communicate this group in borders
|
int bordergroup; // only communicate this group in borders
|
||||||
|
|
||||||
|
|||||||
@ -55,7 +55,8 @@ CommBrick::CommBrick(LAMMPS *lmp) :
|
|||||||
size_reverse_send(NULL), size_reverse_recv(NULL),
|
size_reverse_send(NULL), size_reverse_recv(NULL),
|
||||||
slablo(NULL), slabhi(NULL), multilo(NULL), multihi(NULL),
|
slablo(NULL), slabhi(NULL), multilo(NULL), multihi(NULL),
|
||||||
cutghostmulti(NULL), pbc_flag(NULL), pbc(NULL), firstrecv(NULL),
|
cutghostmulti(NULL), pbc_flag(NULL), pbc(NULL), firstrecv(NULL),
|
||||||
sendlist(NULL), maxsendlist(NULL), buf_send(NULL), buf_recv(NULL)
|
sendlist(NULL), localsendlist(NULL), maxsendlist(NULL),
|
||||||
|
buf_send(NULL), buf_recv(NULL)
|
||||||
{
|
{
|
||||||
style = 0;
|
style = 0;
|
||||||
layout = Comm::LAYOUT_UNIFORM;
|
layout = Comm::LAYOUT_UNIFORM;
|
||||||
@ -74,6 +75,7 @@ CommBrick::~CommBrick()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (sendlist) for (int i = 0; i < maxswap; i++) memory->destroy(sendlist[i]);
|
if (sendlist) for (int i = 0; i < maxswap; i++) memory->destroy(sendlist[i]);
|
||||||
|
if (localsendlist) memory->destroy(localsendlist);
|
||||||
memory->sfree(sendlist);
|
memory->sfree(sendlist);
|
||||||
memory->destroy(maxsendlist);
|
memory->destroy(maxsendlist);
|
||||||
|
|
||||||
@ -1469,6 +1471,33 @@ void CommBrick::free_multi()
|
|||||||
multilo = multihi = NULL;
|
multilo = multihi = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
extract data potentially useful to other classes
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void *CommBrick::extract(const char *str, int &dim)
|
||||||
|
{
|
||||||
|
if (strcmp(str,"localsendlist") == 0) {
|
||||||
|
int i, iswap, isend;
|
||||||
|
if (!localsendlist)
|
||||||
|
memory->create(localsendlist,atom->nlocal,"comm:localsendlist");
|
||||||
|
else
|
||||||
|
memory->grow(localsendlist,atom->nlocal,"comm:localsendlist");
|
||||||
|
|
||||||
|
for (i = 0; i < atom->nlocal; i++)
|
||||||
|
localsendlist[i] = 0;
|
||||||
|
|
||||||
|
for (iswap = 0; iswap < nswap; iswap++)
|
||||||
|
for (isend = 0; isend < sendnum[iswap]; isend++)
|
||||||
|
if (sendlist[iswap][isend] < atom->nlocal)
|
||||||
|
localsendlist[sendlist[iswap][isend]] = 1;
|
||||||
|
|
||||||
|
return (void *) localsendlist;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
return # of bytes of allocated memory
|
return # of bytes of allocated memory
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|||||||
@ -46,6 +46,7 @@ class CommBrick : public Comm {
|
|||||||
|
|
||||||
void forward_comm_array(int, double **); // forward comm of array
|
void forward_comm_array(int, double **); // forward comm of array
|
||||||
int exchange_variable(int, double *, double *&); // exchange on neigh stencil
|
int exchange_variable(int, double *, double *&); // exchange on neigh stencil
|
||||||
|
void *extract(const char *,int &);
|
||||||
virtual bigint memory_usage();
|
virtual bigint memory_usage();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -67,6 +68,7 @@ class CommBrick : public Comm {
|
|||||||
|
|
||||||
int *firstrecv; // where to put 1st recv atom in each swap
|
int *firstrecv; // where to put 1st recv atom in each swap
|
||||||
int **sendlist; // list of atoms to send in each swap
|
int **sendlist; // list of atoms to send in each swap
|
||||||
|
int *localsendlist; // indexed list of local sendlist atoms
|
||||||
int *maxsendlist; // max size of send list for each swap
|
int *maxsendlist; // max size of send list for each swap
|
||||||
|
|
||||||
double *buf_send; // send buffer for all comm
|
double *buf_send; // send buffer for all comm
|
||||||
|
|||||||
Reference in New Issue
Block a user