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

This commit is contained in:
sjplimp
2011-01-04 19:12:58 +00:00
parent f3300e9536
commit d5aa03447b
27 changed files with 580 additions and 487 deletions

View File

@ -17,6 +17,7 @@
#include "sys/types.h"
#include "dirent.h"
#include "read_restart.h"
#include "lmptype.h"
#include "atom.h"
#include "atom_vec.h"
#include "domain.h"
@ -290,13 +291,13 @@ void ReadRestart::command(int narg, char **arg)
// check that all atoms were assigned to procs
double natoms;
double rlocal = atom->nlocal;
MPI_Allreduce(&rlocal,&natoms,1,MPI_DOUBLE,MPI_SUM,world);
bigint natoms;
bigint nblocal = atom->nlocal;
MPI_Allreduce(&nblocal,&natoms,1,MPI_UNSIGNED_LONG,MPI_SUM,world);
if (me == 0) {
if (screen) fprintf(screen," %.15g atoms\n",natoms);
if (logfile) fprintf(logfile," %.15g atoms\n",natoms);
if (screen) fprintf(screen," %lu atoms\n",natoms);
if (logfile) fprintf(logfile," %lu atoms\n",natoms);
}
if (natoms != atom->natoms) error->all("Did not assign all atoms correctly");
@ -594,7 +595,7 @@ void ReadRestart::header()
delete [] style;
} else if (flag == NATOMS) {
atom->natoms = read_double();
atom->natoms = read_bigint();
} else if (flag == NTYPES) {
atom->ntypes = read_int();
} else if (flag == NBONDS) {
@ -809,3 +810,15 @@ char *ReadRestart::read_char()
MPI_Bcast(value,n,MPI_CHAR,0,world);
return value;
}
/* ----------------------------------------------------------------------
read a bigint from restart file and bcast it
------------------------------------------------------------------------- */
bigint ReadRestart::read_bigint()
{
bigint value;
if (me == 0) fread(&value,sizeof(bigint),1,fp);
MPI_Bcast(&value,1,MPI_UNSIGNED_LONG,0,world);
return value;
}