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

This commit is contained in:
sjplimp 2008-04-08 13:58:15 +00:00
parent cc5def9f6e
commit cfe0d02a30
8 changed files with 31 additions and 19 deletions

View File

@ -59,11 +59,13 @@ void DumpBond::init()
void DumpBond::write_header(int ndump)
{
fprintf(fp,"ITEM: TIMESTEP\n");
fprintf(fp,"%d\n",update->ntimestep);
fprintf(fp,"ITEM: NUMBER OF BONDS\n");
fprintf(fp,"%d\n",ndump);
fprintf(fp,"ITEM: BONDS\n");
if (me == 0) {
fprintf(fp,"ITEM: TIMESTEP\n");
fprintf(fp,"%d\n",update->ntimestep);
fprintf(fp,"ITEM: NUMBER OF BONDS\n");
fprintf(fp,"%d\n",ndump);
fprintf(fp,"ITEM: BONDS\n");
}
}
/* ---------------------------------------------------------------------- */

View File

@ -151,7 +151,7 @@ void DumpXTC::openfile()
void DumpXTC::write_header(int n)
{
// realloc coords if necessary
// all procs realloc types & coords if necessary
if (n != natoms) {
memory->sfree(coords);
@ -161,6 +161,10 @@ void DumpXTC::write_header(int n)
coords = (float *) memory->smalloc(3*natoms*sizeof(float),"dump:coords");
}
// only proc 0 writes header
if (me != 0) return;
int tmp = XTC_MAGIC;
xdr_int(&xd,&tmp);
xdr_int(&xd,&n);

View File

@ -602,7 +602,7 @@ void Atom::tag_extend()
/* ----------------------------------------------------------------------
check if atom tags are consecutive from 1 to Natoms
return 0 if any tag <= 0 or maxtag > Natoms
return 0 if any tag <= 0 or maxtag != Natoms
return 1 if OK (doesn't actually check if all tag values are used)
------------------------------------------------------------------------- */
@ -620,7 +620,7 @@ int Atom::tag_consecutive()
}
MPI_Allreduce(check,check_all,2,MPI_INT,MPI_MAX,world);
if (check_all[0] || check_all[1] > natoms) return 0;
if (check_all[0] || check_all[1] != static_cast<int> (natoms)) return 0;
return 1;
}

View File

@ -153,7 +153,7 @@ void Dump::write()
// write timestep header
if (multiproc) write_header(nme);
else if (me == 0) write_header(ntotal);
else write_header(ntotal);
// grow communication buffer if necessary

View File

@ -110,7 +110,7 @@ int DumpAtom::modify_param(int narg, char **arg)
void DumpAtom::write_header(int ndump)
{
(this->*header_choice)(ndump);
if (me == 0) (this->*header_choice)(ndump);
}
/* ---------------------------------------------------------------------- */

View File

@ -206,7 +206,7 @@ void DumpCustom::init()
void DumpCustom::write_header(int ndump)
{
(this->*header_choice)(ndump);
if (me == 0) (this->*header_choice)(ndump);
}
/* ---------------------------------------------------------------------- */

View File

@ -179,11 +179,13 @@ void DumpDCD::write_header(int n)
dim[4] = (h[0]*h[5]) / alen/blen;
}
uint32_t out_integer = 48;
fwrite_int32(fp,out_integer);
fwrite(dim,out_integer,1,fp);
fwrite_int32(fp,out_integer);
if (flush_flag) fflush(fp);
if (me == 0) {
uint32_t out_integer = 48;
fwrite_int32(fp,out_integer);
fwrite(dim,out_integer,1,fp);
fwrite_int32(fp,out_integer);
if (flush_flag) fflush(fp);
}
}
/* ---------------------------------------------------------------------- */

View File

@ -94,7 +94,7 @@ double DumpXYZ::memory_usage()
void DumpXYZ::write_header(int n)
{
// realloc types & coords if necessary
// all procs realloc types & coords if necessary
if (igroup == 0 && n != natoms) {
memory->sfree(types);
@ -106,8 +106,12 @@ void DumpXYZ::write_header(int n)
coords = (float *) memory->smalloc(3*natoms*sizeof(float),"dump:coords");
}
fprintf(fp,"%d\n",n);
fprintf(fp,"Atoms\n");
// only proc 0 writes header
if (me == 0) {
fprintf(fp,"%d\n",n);
fprintf(fp,"Atoms\n");
}
}
/* ---------------------------------------------------------------------- */