Merge pull request #728 from danicholson/cluster-fragment-aggregate-fixes
Cluster/fragment/aggregate bugfixes
This commit is contained in:
@ -52,6 +52,7 @@ ComputeAggregateAtom::ComputeAggregateAtom(LAMMPS *lmp, int narg, char **arg) :
|
||||
peratom_flag = 1;
|
||||
size_peratom_cols = 0;
|
||||
comm_forward = 1;
|
||||
comm_reverse = 1;
|
||||
|
||||
nmax = 0;
|
||||
}
|
||||
@ -120,8 +121,10 @@ void ComputeAggregateAtom::compute_peratom()
|
||||
}
|
||||
|
||||
// invoke full neighbor list (will copy or build if necessary)
|
||||
// on the first step of a run, set preflag to one in neighbor->build_one(...)
|
||||
|
||||
neighbor->build_one(list);
|
||||
if (update->firststep == update->ntimestep) neighbor->build_one(list,1);
|
||||
else neighbor->build_one(list);
|
||||
|
||||
// if group is dynamic, insure ghost atom masks are current
|
||||
|
||||
@ -164,6 +167,11 @@ void ComputeAggregateAtom::compute_peratom()
|
||||
while (1) {
|
||||
comm->forward_comm_compute(this);
|
||||
|
||||
// reverse communication when bonds are not stored on every processor
|
||||
|
||||
if (force->newton_bond)
|
||||
comm->reverse_comm_compute(this);
|
||||
|
||||
change = 0;
|
||||
while (1) {
|
||||
done = 1;
|
||||
@ -253,13 +261,50 @@ void ComputeAggregateAtom::unpack_forward_comm(int n, int first, double *buf)
|
||||
m = 0;
|
||||
last = first + n;
|
||||
if (commflag)
|
||||
for (i = first; i < last; i++) aggregateID[i] = buf[m++];
|
||||
for (i = first; i < last; i++) {
|
||||
double x = buf[m++];
|
||||
|
||||
// only overwrite ghost IDs with values lower than current ones
|
||||
|
||||
aggregateID[i] = MIN(x,aggregateID[i]);
|
||||
}
|
||||
else {
|
||||
int *mask = atom->mask;
|
||||
for (i = first; i < last; i++) mask[i] = (int) ubuf(buf[m++]).i;
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
int ComputeAggregateAtom::pack_reverse_comm(int n, int first, double *buf)
|
||||
{
|
||||
int i,m,last;
|
||||
|
||||
m = 0;
|
||||
last = first + n;
|
||||
for (i = first; i < last; i++) {
|
||||
buf[m++] = aggregateID[i];
|
||||
}
|
||||
return m;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void ComputeAggregateAtom::unpack_reverse_comm(int n, int *list, double *buf)
|
||||
{
|
||||
int i,j,m;
|
||||
|
||||
m = 0;
|
||||
for (i = 0; i < n; i++) {
|
||||
j = list[i];
|
||||
double x = buf[m++];
|
||||
|
||||
// only overwrite local IDs with values lower than current ones
|
||||
|
||||
aggregateID[j] = MIN(x,aggregateID[j]);
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
memory usage of local atom-based array
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
Reference in New Issue
Block a user