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

This commit is contained in:
sjplimp 2010-09-15 23:12:22 +00:00
parent b66411a556
commit 083d7a0b0a
2 changed files with 23 additions and 17 deletions

View File

@ -225,12 +225,10 @@ void DumpXTC::pack(int *ids)
int iz = (image[i] >> 20) - 512; int iz = (image[i] >> 20) - 512;
if (domain->triclinic) { if (domain->triclinic) {
buf[m++] = tag[i];
buf[m++] = sfactor * (x[i][0] + ix * xprd + iy * xy + iz * xz); buf[m++] = sfactor * (x[i][0] + ix * xprd + iy * xy + iz * xz);
buf[m++] = sfactor * (x[i][1] + iy * yprd + iz * yz); buf[m++] = sfactor * (x[i][1] + iy * yprd + iz * yz);
buf[m++] = sfactor * (x[i][2] + iz * zprd); buf[m++] = sfactor * (x[i][2] + iz * zprd);
} else { } else {
buf[m++] = tag[i];
buf[m++] = sfactor * (x[i][0] + ix * xprd); buf[m++] = sfactor * (x[i][0] + ix * xprd);
buf[m++] = sfactor * (x[i][1] + iy * yprd); buf[m++] = sfactor * (x[i][1] + iy * yprd);
buf[m++] = sfactor * (x[i][2] + iz * zprd); buf[m++] = sfactor * (x[i][2] + iz * zprd);
@ -241,7 +239,6 @@ void DumpXTC::pack(int *ids)
} else { } else {
for (int i = 0; i < nlocal; i++) for (int i = 0; i < nlocal; i++)
if (mask[i] & groupbit) { if (mask[i] & groupbit) {
buf[m++] = tag[i];
buf[m++] = sfactor*x[i][0]; buf[m++] = sfactor*x[i][0];
buf[m++] = sfactor*x[i][1]; buf[m++] = sfactor*x[i][1];
buf[m++] = sfactor*x[i][2]; buf[m++] = sfactor*x[i][2];

View File

@ -70,7 +70,7 @@ Dump::Dump(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp)
maxbuf = maxsort = maxproc = 0; maxbuf = maxsort = maxproc = 0;
buf = bufsort = NULL; buf = bufsort = NULL;
idsort = index = proclist = NULL; ids = idsort = index = proclist = NULL;
irregular = NULL; irregular = NULL;
// parse filename for special syntax // parse filename for special syntax
@ -123,6 +123,7 @@ Dump::~Dump()
memory->sfree(buf); memory->sfree(buf);
memory->sfree(bufsort); memory->sfree(bufsort);
memory->sfree(ids);
memory->sfree(idsort); memory->sfree(idsort);
memory->sfree(index); memory->sfree(index);
memory->sfree(proclist); memory->sfree(proclist);
@ -148,16 +149,16 @@ void Dump::init()
init_style(); init_style();
if (!sort_flag) { if (!sort_flag) {
memory->sfree(buf);
memory->sfree(bufsort); memory->sfree(bufsort);
memory->sfree(ids);
memory->sfree(idsort); memory->sfree(idsort);
memory->sfree(index); memory->sfree(index);
memory->sfree(proclist); memory->sfree(proclist);
delete irregular; delete irregular;
maxbuf = maxsort = maxproc = 0; maxsort = maxproc = 0;
buf = bufsort = NULL; bufsort = NULL;
idsort = index = proclist = NULL; ids = idsort = index = proclist = NULL;
irregular = NULL; irregular = NULL;
} }
@ -252,7 +253,7 @@ void Dump::write()
if (me == 0) { if (me == 0) {
for (int iproc = 0; iproc < nprocs; iproc++) { for (int iproc = 0; iproc < nprocs; iproc++) {
if (iproc) { if (iproc) {
MPI_Irecv(buf,maxbuf,MPI_DOUBLE,iproc,0,world,&request); MPI_Irecv(buf,maxbuf*size_one,MPI_DOUBLE,iproc,0,world,&request);
MPI_Send(&tmp,0,MPI_INT,iproc,0,world); MPI_Send(&tmp,0,MPI_INT,iproc,0,world);
MPI_Wait(&request,&status); MPI_Wait(&request,&status);
MPI_Get_count(&status,MPI_DOUBLE,&nlines); MPI_Get_count(&status,MPI_DOUBLE,&nlines);
@ -455,11 +456,19 @@ void Dump::sort()
// copy data from bufsort to buf using index // copy data from bufsort to buf using index
if (nme > maxbuf) { int nmax;
maxbuf = nme; if (multiproc) nmax = nme;
else MPI_Allreduce(&nme,&nmax,1,MPI_INT,MPI_MAX,world);
if (nmax > maxbuf) {
maxbuf = nmax;
memory->sfree(buf); memory->sfree(buf);
buf = (double *) buf = (double *)
memory->smalloc(maxbuf*size_one*sizeof(double),"dump:buf"); memory->smalloc(maxbuf*size_one*sizeof(double),"dump:buf");
if (sortcol == 0) {
memory->sfree(ids);
ids = (int *) memory->smalloc(maxbuf*sizeof(int),"dump:ids");
}
} }
int nbytes = size_one*sizeof(double); int nbytes = size_one*sizeof(double);
@ -468,9 +477,9 @@ void Dump::sort()
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
compare two atom IDs in sort data structure compare two atom IDs
called via qsort_r in sort() method called via qsort() in sort() method
is a static method so access sort data structure via ptr is a static method so access data via dumpptr
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
int Dump::idcompare(const void *pi, const void *pj) int Dump::idcompare(const void *pi, const void *pj)
@ -486,9 +495,9 @@ int Dump::idcompare(const void *pi, const void *pj)
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
compare two buffer quantities in sort data structure with size_one stride compare two buffer values with size_one stride
called via qsort_r in sort() method called via qsort() in sort() method
is a static method so access sort data structure via ptr is a static method so access data via dumpptr
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
int Dump::bufcompare(const void *pi, const void *pj) int Dump::bufcompare(const void *pi, const void *pj)