use compute_time() func in xyz output

This commit is contained in:
Steve Plimpton
2021-12-21 14:05:16 -07:00
parent cad9f6bf6e
commit 6a442e1df4
4 changed files with 11 additions and 18 deletions

View File

@ -94,14 +94,11 @@ void DumpXYZGZ::write_header(bigint ndump)
{
if (me == 0) {
std::string header = fmt::format("{}\n", ndump);
if (time_flag) {
double tcurrent = update->atime +
(update->ntimestep-update->atimestep) + update->dt;
if (time_flag)
fprintf(fp,"Atoms. Timestep: " BIGINT_FORMAT " Time: %f\n",
update->ntimestep, tcurrent);
} else {
update->ntimestep, compute_time());
else
header += fmt::format("Atoms. Timestep: {}\n", update->ntimestep);
}
writer.write(header.c_str(), header.length());
}
}

View File

@ -102,14 +102,11 @@ void DumpXYZZstd::write_header(bigint ndump)
{
if (me == 0) {
std::string header = fmt::format("{}\n", ndump);
if (time_flag) {
double tcurrent = update->atime +
(update->ntimestep-update->atimestep) + update->dt;
if (time_flag)
fprintf(fp,"Atoms. Timestep: " BIGINT_FORMAT " Time: %f\n",
update->ntimestep, tcurrent);
} else {
update->ntimestep, compute_time());
else
fprintf(fp,"Atoms. Timestep: " BIGINT_FORMAT "\n",update->ntimestep);
}
writer.write(header.c_str(), header.length());
}
}

View File

@ -1132,6 +1132,7 @@ double Dump::compute_time()
{
return update->atime + (update->ntimestep - update->atimestep)*update->dt;
}
/* ----------------------------------------------------------------------
return # of bytes of allocated memory
------------------------------------------------------------------------- */

View File

@ -131,14 +131,12 @@ void DumpXYZ::write_header(bigint n)
{
if (me == 0) {
fprintf(fp,BIGINT_FORMAT "\n",n);
if (time_flag) {
double tcurrent = update->atime +
(update->ntimestep-update->atimestep) + update->dt;
if (time_flag)
fprintf(fp,"Atoms. Timestep: " BIGINT_FORMAT " Time: %f\n",
update->ntimestep, tcurrent);
} else {
update->ntimestep, compute_time());
else
fprintf(fp,"Atoms. Timestep: " BIGINT_FORMAT "\n",update->ntimestep);
}
}
}
}