delay change_box error check on per-atom restart data existing

This commit is contained in:
Steve Plimpton
2020-02-20 12:48:44 -07:00
parent 7434267f57
commit b9a9bebd37
2 changed files with 47 additions and 15 deletions

View File

@ -46,9 +46,6 @@ void ChangeBox::command(int narg, char **arg)
if (domain->box_exist == 0)
error->all(FLERR,"Change_box command before simulation box is defined");
if (narg < 2) error->all(FLERR,"Illegal change_box command");
if (modify->nfix_restart_peratom)
error->all(FLERR,"Cannot change_box after "
"reading restart file with per-atom info");
if (comm->me == 0 && screen) fprintf(screen,"Changing box ...\n");
@ -174,6 +171,21 @@ void ChangeBox::command(int narg, char **arg)
if (nops == 0) error->all(FLERR,"Illegal change_box command");
// move_atoms = 1 if need to move atoms to new procs after box changes
// anything other than ORTHO or TRICLINIC may cause atom movement
int move_atoms = 0;
for (int m = 0; m < nops; m++) {
if (ops[m].style != ORTHO || ops[m].style != TRICLINIC) move_atoms = 1;
}
// error if moving atoms and there is stored per-atom restart state
// disallowed b/c restart per-atom fix info will not move with atoms
if (move_atoms && modify->nfix_restart_peratom)
error->all(FLERR,"Change_box parameter not allowed after "
"reading restart file with per-atom info");
// read options from end of input line
options(narg-iarg,&arg[iarg]);
@ -350,6 +362,10 @@ void ChangeBox::command(int narg, char **arg)
if (domain->triclinic) domain->lamda2x(atom->nlocal);
}
// done if don't need to move atoms
if (!move_atoms) return;
// move atoms back inside simulation box and to new processors
// use remap() instead of pbc()
// in case box moved a long distance relative to atoms