git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@11699 f3b2605a-c512-4ea7-a41b-209d697bcdaa

This commit is contained in:
sjplimp 2014-04-04 16:32:26 +00:00
parent 0aae09bf79
commit 3e9c22df24
4 changed files with 66 additions and 26 deletions

View File

@ -32,8 +32,8 @@ using namespace LAMMPS_NS;
using namespace FixConst;
/* ----------------------------------------------------------------------
copy shear partner info from neighbor lists to atom arrays
so can be exchanged with atoms
copy shear partner info from neighbor lists to per-atom arrays
so it can be exchanged with those atoms
------------------------------------------------------------------------- */
void FixShearHistoryOMP::pre_exchange()
@ -56,22 +56,11 @@ void FixShearHistoryOMP::pre_exchange()
const int tid = 0;
#endif
// each thread works on a fixed chunk of local and ghost atoms.
const int ldelta = 1 + nlocal/nthreads;
const int lfrom = tid*ldelta;
const int lmax = lfrom +ldelta;
const int lto = (lmax > nlocal) ? nlocal : lmax;
int i,j,ii,jj,m,n,inum,jnum;
int *ilist,*jlist,*numneigh,**firstneigh;
int *touch,**firsttouch;
double *shear,*allshear,**firstshear;
// zero npartners for all current atoms and
// clear page data structures for this thread
for (i = lfrom; i < lto; i++) npartner[i] = 0;
MyPage <tagint> &ipg = ipage[tid];
MyPage <double[3]> &dpg = dpage[tid];
ipg.reset();
@ -90,6 +79,21 @@ void FixShearHistoryOMP::pre_exchange()
firsttouch = list->listgranhistory->firstneigh;
firstshear = list->listgranhistory->firstdouble;
int nlocal_neigh = 0;
if (inum) nlocal_neigh = ilist[inum-1] + 1;
// each thread works on a fixed chunk of local and ghost atoms.
const int ldelta = 1 + nlocal_neigh/nthreads;
const int lfrom = tid*ldelta;
const int lmax = lfrom +ldelta;
const int lto = (lmax > nlocal_neigh) ? nlocal_neigh : lmax;
// zero npartners for all current atoms and
// clear page data structures for this thread
for (i = lfrom; i < lto; i++) npartner[i] = 0;
for (ii = 0; ii < inum; ii++) {
i = ilist[ii];
jlist = firstneigh[i];
@ -111,13 +115,15 @@ void FixShearHistoryOMP::pre_exchange()
// get page chunks to store atom IDs and shear history for my atoms
for (ii = lfrom; ii < lto; ii++) {
for (ii = 0; ii < inum; ii++) {
i = ilist[ii];
n = npartner[i];
partner[i] = ipg.get(n);
shearpartner[i] = dpg.get(n);
if (partner[i] == NULL || shearpartner[i] == NULL)
error->one(FLERR,"Shear history overflow, boost neigh_modify one");
if ((i >= lfrom) && (i < lto)) {
n = npartner[i];
partner[i] = ipg.get(n);
shearpartner[i] = dpg.get(n);
if (partner[i] == NULL || shearpartner[i] == NULL)
error->one(FLERR,"Shear history overflow, boost neigh_modify one");
}
}
// 2nd loop over neighbor list
@ -161,7 +167,7 @@ void FixShearHistoryOMP::pre_exchange()
}
// set maxtouch = max # of partners of any owned atom
m = 0;
maxtouch = m = 0;
for (i = lfrom; i < lto; i++)
m = MAX(m,npartner[i]);

View File

@ -42,6 +42,16 @@ FixRecenter::FixRecenter(LAMMPS *lmp, int narg, char **arg) :
xcom = ycom = zcom = 0.0;
xflag = yflag = zflag = 1;
xinitflag = yinitflag = zinitflag = 0;
shift[0] = shift[1] = shift[2] = 0.0;
distance = 0.0;
scalar_flag = 1;
vector_flag = 1;
size_vector = 3;
extscalar = 1;
extvector = 1;
global_freq = 1;
/* ---------------------------------------------------------------------- */
if (strcmp(arg[3],"NULL") == 0) xflag = 0;
else if (strcmp(arg[3],"INIT") == 0) xinitflag = 1;
@ -177,10 +187,30 @@ void FixRecenter::initial_integrate(int vflag)
int *mask = atom->mask;
int nlocal = atom->nlocal;
shift[0] = xflag ? (xtarget - xcm[0]) : 0.0;
shift[1] = yflag ? (ytarget - xcm[1]) : 0.0;
shift[2] = zflag ? (ztarget - xcm[2]) : 0.0;
distance = sqrt(shift[0]*shift[0] + shift[1]*shift[1] + shift[2]*shift[2]);
for (int i = 0; i < nlocal; i++)
if (mask[i] & group2bit) {
if (xflag) x[i][0] += xtarget - xcm[0];
if (yflag) x[i][1] += ytarget - xcm[1];
if (zflag) x[i][2] += ztarget - xcm[2];
x[i][0] += shift[0];
x[i][1] += shift[1];
x[i][2] += shift[2];
}
}
/* ---------------------------------------------------------------------- */
double FixRecenter::compute_scalar()
{
return distance;
}
/* ---------------------------------------------------------------------- */
double FixRecenter::compute_vector(int n)
{
return shift[n];
}

View File

@ -1,4 +1,4 @@
/* ----------------------------------------------------------------------
/* -*- c++ -*- ----------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
http://lammps.sandia.gov, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
@ -30,12 +30,14 @@ class FixRecenter : public Fix {
int setmask();
void init();
void initial_integrate(int);
double compute_scalar();
double compute_vector(int);
private:
int group2bit,scaleflag;
int xflag,yflag,zflag;
int xinitflag,yinitflag,zinitflag;
double xcom,ycom,zcom,xinit,yinit,zinit,masstotal;
double xcom,ycom,zcom,xinit,yinit,zinit,masstotal,distance,shift[3];
};
}

View File

@ -145,7 +145,9 @@ void Irregular::migrate_atoms()
// create irregular communication plan, perform comm, destroy plan
// returned nrecv = size of buffer needed for incoming atoms
// debug: turn on sorting for repoducible irregular() via extra final arg
//int nrecv = create_atom(nsendatom,sizes,proclist,1);
int nrecv = create_atom(nsendatom,sizes,proclist);
if (nrecv > maxrecv) grow_recv(nrecv);
exchange_atom(buf_send,sizes,buf_recv);