logic for dumps every steps and time delta

This commit is contained in:
Steve Plimpton
2021-12-07 13:46:36 -07:00
parent 1afdd3c011
commit 26492b13d5
3 changed files with 160 additions and 74 deletions

View File

@ -918,9 +918,22 @@ void Dump::modify_params(int narg, char **arg)
else delay_flag = 0;
iarg += 2;
} else if (strcmp(arg[iarg],"header") == 0) {
} else if (strcmp(arg[iarg],"delta") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal dump_modify command");
header_flag = utils::logical(FLERR,arg[iarg+1],false,lmp);
int idump;
for (idump = 0; idump < output->ndump; idump++)
if (strcmp(id,output->dump[idump]->id) == 0) break;
double delta;
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) {
delete [] output->var_dump[idump];
output->var_dump[idump] = utils::strdup(&arg[iarg+1][2]);
delta = 0.0;
} else {
delta = utils::numeric(FLERR,arg[iarg+1],false,lmp);
if (delta <= 0.0) error->all(FLERR,"Illegal dump_modify command");
}
output->mode_dump[idump] = 1;
output->delta_dump[idump] = delta;
iarg += 2;
} else if (strcmp(arg[iarg],"every") == 0) {
@ -937,28 +950,10 @@ void Dump::modify_params(int narg, char **arg)
n = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
if (n <= 0) error->all(FLERR,"Illegal dump_modify command");
}
output->time_dump[idump] = 0;
output->mode_dump[idump] = 0;
output->every_dump[idump] = n;
iarg += 2;
} else if (strcmp(arg[iarg],"delta") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal dump_modify command");
int idump;
for (idump = 0; idump < output->ndump; idump++)
if (strcmp(id,output->dump[idump]->id) == 0) break;
double delta;
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) {
delete [] output->var_dump[idump];
output->var_dump[idump] = utils::strdup(&arg[iarg+1][2]);
delta = 0.0;
} else {
delta = utils::numeric(FLERR,arg[iarg+1],false,lmp);
if (delta <= 0.0) error->all(FLERR,"Illegal dump_modify command");
}
output->time_dump[idump] = 1;
output->delta_dump[idump] = delta;
iarg += 2;
} else if (strcmp(arg[iarg],"fileper") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal dump_modify command");
if (!multiproc)
@ -1026,6 +1021,11 @@ void Dump::modify_params(int narg, char **arg)
iarg += n;
}
} else if (strcmp(arg[iarg],"header") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal dump_modify command");
header_flag = utils::logical(FLERR,arg[iarg+1],false,lmp);
iarg += 2;
} else if (strcmp(arg[iarg],"maxfiles") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal dump_modify command");
if (!multifile)