add a hidden "noinit" flag to write_dump that works the same as for write_data
This commit is contained in:
@ -382,8 +382,7 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) :
|
|||||||
if (iarg+3 > narg)
|
if (iarg+3 > narg)
|
||||||
error->universe_all(FLERR,"Invalid command-line argument");
|
error->universe_all(FLERR,"Invalid command-line argument");
|
||||||
if (restart2dump)
|
if (restart2dump)
|
||||||
error->universe_all(FLERR,
|
error->universe_all(FLERR, "Cannot use both -restart2data and -restart2dump");
|
||||||
"Cannot use both -restart2data and -restart2dump");
|
|
||||||
restart2data = 1;
|
restart2data = 1;
|
||||||
restartfile = arg[iarg+1];
|
restartfile = arg[iarg+1];
|
||||||
inflag = -1; // skip inflag check
|
inflag = -1; // skip inflag check
|
||||||
@ -405,8 +404,7 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) :
|
|||||||
if (iarg+3 > narg)
|
if (iarg+3 > narg)
|
||||||
error->universe_all(FLERR,"Invalid command-line argument");
|
error->universe_all(FLERR,"Invalid command-line argument");
|
||||||
if (restart2data)
|
if (restart2data)
|
||||||
error->universe_all(FLERR,
|
error->universe_all(FLERR, "Cannot use both -restart2data and -restart2dump");
|
||||||
"Cannot use both -restart2data and -restart2dump");
|
|
||||||
restart2dump = 1;
|
restart2dump = 1;
|
||||||
restartfile = arg[iarg+1];
|
restartfile = arg[iarg+1];
|
||||||
inflag = -1; // skip inflag check
|
inflag = -1; // skip inflag check
|
||||||
@ -728,7 +726,6 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) :
|
|||||||
// if either restart conversion option was used, invoke 2 commands and quit
|
// if either restart conversion option was used, invoke 2 commands and quit
|
||||||
// add args between wfirst and wlast to write_data or write_data command
|
// add args between wfirst and wlast to write_data or write_data command
|
||||||
// add "noinit" to write_data to prevent a system init
|
// add "noinit" to write_data to prevent a system init
|
||||||
// write_dump will just give a warning message about no init
|
|
||||||
|
|
||||||
if (restart2data || restart2dump) {
|
if (restart2data || restart2dump) {
|
||||||
std::string cmd = fmt::format("read_restart {}",restartfile);
|
std::string cmd = fmt::format("read_restart {}",restartfile);
|
||||||
@ -738,7 +735,7 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) :
|
|||||||
else cmd = "write_dump";
|
else cmd = "write_dump";
|
||||||
for (iarg = wfirst; iarg < wlast; iarg++)
|
for (iarg = wfirst; iarg < wlast; iarg++)
|
||||||
cmd += fmt::format(" {}", arg[iarg]);
|
cmd += fmt::format(" {}", arg[iarg]);
|
||||||
if (restart2data) cmd += " noinit";
|
cmd += " noinit";
|
||||||
input->one(cmd);
|
input->one(cmd);
|
||||||
error->done(0);
|
error->done(0);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -57,9 +57,17 @@ void WriteDump::command(int narg, char **arg)
|
|||||||
dumpargs[2] = arg[1]; // dump style
|
dumpargs[2] = arg[1]; // dump style
|
||||||
dumpargs[3] = utils::strdup(std::to_string(dumpfreq)); // dump frequency
|
dumpargs[3] = utils::strdup(std::to_string(dumpfreq)); // dump frequency
|
||||||
|
|
||||||
for (int i = 2; i < modindex; ++i) dumpargs[i + 2] = arg[i];
|
// copy arguments up to modify, but skip over "noinit" if present
|
||||||
|
int noinitwarn = 0;
|
||||||
|
for (int i = 2; i < modindex; ++i) {
|
||||||
|
if (strcmp(arg[i], "noinit") == 0) {
|
||||||
|
noinitwarn = 1;
|
||||||
|
} else {
|
||||||
|
dumpargs[i + 2 - noinitwarn] = arg[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
auto *dump = output->add_dump(modindex + 2, dumpargs);
|
auto *dump = output->add_dump(modindex + 2 - noinitwarn, dumpargs);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (modindex < narg) dump->modify_params(narg - modindex - 1, &arg[modindex + 1]);
|
if (modindex < narg) dump->modify_params(narg - modindex - 1, &arg[modindex + 1]);
|
||||||
@ -75,7 +83,7 @@ void WriteDump::command(int narg, char **arg)
|
|||||||
|
|
||||||
if (strcmp(arg[1], "image") == 0) (dynamic_cast<DumpImage *>(dump))->multifile_override = 1;
|
if (strcmp(arg[1], "image") == 0) (dynamic_cast<DumpImage *>(dump))->multifile_override = 1;
|
||||||
if (strcmp(arg[1], "cfg") == 0) (dynamic_cast<DumpCFG *>(dump))->multifile_override = 1;
|
if (strcmp(arg[1], "cfg") == 0) (dynamic_cast<DumpCFG *>(dump))->multifile_override = 1;
|
||||||
if ((update->first_update == 0) && (comm->me == 0))
|
if ((update->first_update == 0) && (comm->me == 0) && (noinitwarn == 0))
|
||||||
error->warning(FLERR, "Calling write_dump before a full system init.");
|
error->warning(FLERR, "Calling write_dump before a full system init.");
|
||||||
|
|
||||||
dump->init();
|
dump->init();
|
||||||
|
|||||||
Reference in New Issue
Block a user