git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@12023 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
@ -138,6 +138,17 @@ class Compute : protected Pointers {
|
|||||||
inline int sbmask(int j) {
|
inline int sbmask(int j) {
|
||||||
return j >> SBBITS & 3;
|
return j >> SBBITS & 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// union data struct for packing 32-bit and 64-bit ints into double bufs
|
||||||
|
// see atom_vec.h for documentation
|
||||||
|
|
||||||
|
union ubuf {
|
||||||
|
double d;
|
||||||
|
int64_t i;
|
||||||
|
ubuf(double arg) : d(arg) {}
|
||||||
|
ubuf(int64_t arg) : i(arg) {}
|
||||||
|
ubuf(int arg) : i(arg) {}
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -27,6 +27,8 @@
|
|||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
|
|
||||||
|
#include "group.h"
|
||||||
|
|
||||||
using namespace LAMMPS_NS;
|
using namespace LAMMPS_NS;
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
@ -118,6 +120,13 @@ void ComputeClusterAtom::compute_peratom()
|
|||||||
numneigh = list->numneigh;
|
numneigh = list->numneigh;
|
||||||
firstneigh = list->firstneigh;
|
firstneigh = list->firstneigh;
|
||||||
|
|
||||||
|
// if group is dynamic, insure ghost atom masks are current
|
||||||
|
|
||||||
|
if (group->dynamic[igroup]) {
|
||||||
|
commflag = 0;
|
||||||
|
comm->forward_comm_compute(this);
|
||||||
|
}
|
||||||
|
|
||||||
// every atom starts in its own cluster, with clusterID = atomID
|
// every atom starts in its own cluster, with clusterID = atomID
|
||||||
|
|
||||||
tagint *tag = atom->tag;
|
tagint *tag = atom->tag;
|
||||||
@ -136,6 +145,7 @@ void ComputeClusterAtom::compute_peratom()
|
|||||||
// iterate until no changes in my atoms
|
// iterate until no changes in my atoms
|
||||||
// then check if any proc made changes
|
// then check if any proc made changes
|
||||||
|
|
||||||
|
commflag = 1;
|
||||||
double **x = atom->x;
|
double **x = atom->x;
|
||||||
|
|
||||||
int change,done,anychange;
|
int change,done,anychange;
|
||||||
@ -191,10 +201,19 @@ int ComputeClusterAtom::pack_comm(int n, int *list, double *buf,
|
|||||||
int i,j,m;
|
int i,j,m;
|
||||||
|
|
||||||
m = 0;
|
m = 0;
|
||||||
for (i = 0; i < n; i++) {
|
if (commflag) {
|
||||||
j = list[i];
|
for (i = 0; i < n; i++) {
|
||||||
buf[m++] = clusterID[j];
|
j = list[i];
|
||||||
|
buf[m++] = clusterID[j];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
int *mask = atom->mask;
|
||||||
|
for (i = 0; i < n; i++) {
|
||||||
|
j = list[i];
|
||||||
|
buf[m++] = ubuf(mask[j]).d;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,7 +225,12 @@ void ComputeClusterAtom::unpack_comm(int n, int first, double *buf)
|
|||||||
|
|
||||||
m = 0;
|
m = 0;
|
||||||
last = first + n;
|
last = first + n;
|
||||||
for (i = first; i < last; i++) clusterID[i] = buf[m++];
|
if (commflag)
|
||||||
|
for (i = first; i < last; i++) clusterID[i] = buf[m++];
|
||||||
|
else {
|
||||||
|
int *mask = atom->mask;
|
||||||
|
for (i = first; i < last; i++) mask[i] = (int) ubuf(buf[m++]).i;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
|
|||||||
@ -36,7 +36,7 @@ class ComputeClusterAtom : public Compute {
|
|||||||
double memory_usage();
|
double memory_usage();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int nmax;
|
int nmax,commflag;
|
||||||
double cutsq;
|
double cutsq;
|
||||||
class NeighList *list;
|
class NeighList *list;
|
||||||
double *clusterID;
|
double *clusterID;
|
||||||
|
|||||||
@ -187,6 +187,8 @@ void FixGroup::set_group()
|
|||||||
|
|
||||||
// set mask for each atom
|
// set mask for each atom
|
||||||
// only in group if in parent group, in region, variable is non-zero
|
// only in group if in parent group, in region, variable is non-zero
|
||||||
|
// if compute, fix, etc needs updated masks of ghost atoms,
|
||||||
|
// it must do forward_comm() to update them
|
||||||
|
|
||||||
double **x = atom->x;
|
double **x = atom->x;
|
||||||
int *mask = atom->mask;
|
int *mask = atom->mask;
|
||||||
|
|||||||
Reference in New Issue
Block a user