Merge branch 'time-dumps2' of github.com:lammps/lammps into time-dumps2

# Conflicts:
#	src/dump_xyz.cpp
This commit is contained in:
Axel Kohlmeyer
2021-12-23 15:00:54 -05:00
3 changed files with 14 additions and 18 deletions

View File

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

View File

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

View File

@ -130,12 +130,10 @@ int DumpXYZ::modify_param(int narg, char **arg)
void DumpXYZ::write_header(bigint n) void DumpXYZ::write_header(bigint n)
{ {
if (me == 0) { if (me == 0) {
fprintf(fp,BIGINT_FORMAT "\n",n); if (time_flag) {
if (time_flag) double tcurrent = update->atime + (update->ntimestep-update->atimestep) + update->dt;
fprintf(fp,"Atoms. Timestep: " BIGINT_FORMAT " Time: %f\n", fmt::print(fp,"{}\n Atoms. Timestep: {} Time: {:.6f}\n", n, update->ntimestep, tcurrent);
update->ntimestep, compute_time()); } else fmt::print(fp,"{}\n Atoms. Timestep: {}\n", n, update->ntimestep);
else
fprintf(fp,"Atoms. Timestep: " BIGINT_FORMAT "\n",update->ntimestep);
} }
} }