git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@11079 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
@ -442,6 +442,7 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator)
|
|||||||
|
|
||||||
// if restartflag set, process 2 command and quit
|
// if restartflag set, process 2 command and quit
|
||||||
// add args between wdfirst and wdlast to write_data
|
// add args between wdfirst and wdlast to write_data
|
||||||
|
// also add "noinit" to prevent write_data from doing system init
|
||||||
|
|
||||||
if (restartflag) {
|
if (restartflag) {
|
||||||
char cmd[128];
|
char cmd[128];
|
||||||
@ -450,7 +451,7 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator)
|
|||||||
sprintf(cmd,"write_data %s",dfile);
|
sprintf(cmd,"write_data %s",dfile);
|
||||||
for (iarg = wdfirst; iarg < wdlast; iarg++)
|
for (iarg = wdfirst; iarg < wdlast; iarg++)
|
||||||
sprintf(&cmd[strlen(cmd)]," %s",arg[iarg]);
|
sprintf(&cmd[strlen(cmd)]," %s",arg[iarg]);
|
||||||
strcat(cmd,"\n");
|
strcat(cmd," noinit\n");
|
||||||
input->one(cmd);
|
input->one(cmd);
|
||||||
error->done();
|
error->done();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -71,8 +71,10 @@ void WriteData::command(int narg, char **arg)
|
|||||||
} else strcpy(file,arg[0]);
|
} else strcpy(file,arg[0]);
|
||||||
|
|
||||||
// read optional args
|
// read optional args
|
||||||
|
// noinit is a hidden arg, only used by -r command-line switch
|
||||||
|
|
||||||
pairflag = II;
|
pairflag = II;
|
||||||
|
int noinit = 0;
|
||||||
|
|
||||||
int iarg = 1;
|
int iarg = 1;
|
||||||
while (iarg < narg) {
|
while (iarg < narg) {
|
||||||
@ -82,29 +84,40 @@ void WriteData::command(int narg, char **arg)
|
|||||||
else if (strcmp(arg[iarg+1],"ij") == 0) pairflag = IJ;
|
else if (strcmp(arg[iarg+1],"ij") == 0) pairflag = IJ;
|
||||||
else error->all(FLERR,"Illegal write_data command");
|
else error->all(FLERR,"Illegal write_data command");
|
||||||
iarg += 2;
|
iarg += 2;
|
||||||
|
} else if (strcmp(arg[iarg],"noinit") == 0) {
|
||||||
|
noinit = 1;
|
||||||
|
iarg++;
|
||||||
} else error->all(FLERR,"Illegal write_data command");
|
} else error->all(FLERR,"Illegal write_data command");
|
||||||
}
|
}
|
||||||
|
|
||||||
// init entire system since comm->exchange is done
|
// init entire system since comm->exchange is done
|
||||||
// comm::init needs neighbor::init needs pair::init needs kspace::init, etc
|
// comm::init needs neighbor::init needs pair::init needs kspace::init, etc
|
||||||
|
// exception is when called by -r command-line switch
|
||||||
|
// then write_data immediately follows reading of restart file
|
||||||
|
// assume that read_restart initialized necessary values
|
||||||
|
// if don't make exception:
|
||||||
|
// pair->init() can fail due to various unset values:
|
||||||
|
// e.g. pair hybrid coeffs, dpd ghost-atom velocity setting
|
||||||
|
|
||||||
if (comm->me == 0 && screen)
|
if (noinit == 0) {
|
||||||
fprintf(screen,"System init for write_data ...\n");
|
if (comm->me == 0 && screen)
|
||||||
lmp->init();
|
fprintf(screen,"System init for write_data ...\n");
|
||||||
|
lmp->init();
|
||||||
|
|
||||||
// move atoms to new processors before writing file
|
// move atoms to new processors before writing file
|
||||||
// do setup_pre_exchange to force update of per-atom info if needed
|
// do setup_pre_exchange to force update of per-atom info if needed
|
||||||
// enforce PBC in case atoms are outside box
|
// enforce PBC in case atoms are outside box
|
||||||
// call borders() to rebuild atom map since exchange() destroys map
|
// call borders() to rebuild atom map since exchange() destroys map
|
||||||
|
|
||||||
modify->setup_pre_exchange();
|
modify->setup_pre_exchange();
|
||||||
if (domain->triclinic) domain->x2lamda(atom->nlocal);
|
if (domain->triclinic) domain->x2lamda(atom->nlocal);
|
||||||
domain->pbc();
|
domain->pbc();
|
||||||
domain->reset_box();
|
domain->reset_box();
|
||||||
comm->setup();
|
comm->setup();
|
||||||
comm->exchange();
|
comm->exchange();
|
||||||
comm->borders();
|
comm->borders();
|
||||||
if (domain->triclinic) domain->lamda2x(atom->nlocal+atom->nghost);
|
if (domain->triclinic) domain->lamda2x(atom->nlocal+atom->nghost);
|
||||||
|
}
|
||||||
|
|
||||||
write(file);
|
write(file);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user