fix issues in FixNeighHistory and FixNeighHistoryOMP reported in https://sourceforge.net/p/lammps/mailman/message/36138319/

This supersedes and closes PR #734
This commit is contained in:
Axel Kohlmeyer
2017-11-28 11:28:15 -05:00
parent e1189381e0
commit fa6fc947f2
2 changed files with 9 additions and 9 deletions

View File

@ -35,7 +35,7 @@ enum{DEFAULT,NPARTNER,PERPARTNER}; // also set in fix neigh/history/omp
FixNeighHistory::FixNeighHistory(LAMMPS *lmp, int narg, char **arg) :
Fix(lmp, narg, arg),
npartner(NULL), partner(NULL), valuepartner(NULL), pair(NULL),
npartner(NULL), partner(NULL), valuepartner(NULL), pair(NULL),
ipage_atom(NULL), dpage_atom(NULL), ipage_neigh(NULL), dpage_neigh(NULL)
{
if (narg != 4) error->all(FLERR,"Illegal fix NEIGH_HISTORY command");
@ -295,7 +295,7 @@ void FixNeighHistory::pre_exchange_onesided()
// set maxpartner = max # of partners of any owned atom
// bump up comm->maxexchange_fix if necessary
maxpartner = 0;
for (i = 0; i < nlocal_neigh; i++) maxpartner = MAX(maxpartner,npartner[i]);
comm->maxexchange_fix = MAX(comm->maxexchange_fix,(dnum+1)*maxpartner+1);
@ -318,7 +318,7 @@ void FixNeighHistory::pre_exchange_newton()
int *allflags;
double *allvalues,*onevalues,*jvalues;
// NOTE: all operations until very end are with
// NOTE: all operations until very end are with
// nlocal_neigh <= current nlocal and nall_neigh
// b/c previous neigh list was built with nlocal_neigh & nghost_neigh
// nlocal can be larger if other fixes added atoms at this pre_exchange()
@ -424,7 +424,7 @@ void FixNeighHistory::pre_exchange_newton()
maxpartner = 0;
for (i = 0; i < nlocal_neigh; i++) maxpartner = MAX(maxpartner,npartner[i]);
comm->maxexchange_fix = MAX(comm->maxexchange_fix,4*maxpartner+1);
comm->maxexchange_fix = MAX(comm->maxexchange_fix,(dnum+1)*maxpartner+1);
// zero npartner values from previous nlocal_neigh to current nlocal
@ -526,7 +526,7 @@ void FixNeighHistory::pre_exchange_no_newton()
// set maxpartner = max # of partners of any owned atom
// bump up comm->maxexchange_fix if necessary
maxpartner = 0;
for (i = 0; i < nlocal_neigh; i++) maxpartner = MAX(maxpartner,npartner[i]);
comm->maxexchange_fix = MAX(comm->maxexchange_fix,(dnum+1)*maxpartner+1);
@ -571,9 +571,9 @@ void FixNeighHistory::post_neighbor()
memory->sfree(firstflag);
memory->sfree(firstvalue);
maxatom = nall;
firstflag = (int **)
firstflag = (int **)
memory->smalloc(maxatom*sizeof(int *),"neighbor_history:firstflag");
firstvalue = (double **)
firstvalue = (double **)
memory->smalloc(maxatom*sizeof(double *),"neighbor_history:firstvalue");
}
@ -720,7 +720,7 @@ int FixNeighHistory::pack_reverse_comm_size(int n, int first)
last = first + n;
for (i = first; i < last; i++)
m += 1 + 4*npartner[i];
m += 1 + (dnum+1)*npartner[i];
return m;
}