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)
{
if (me == 0) {
std::string header = fmt::format("{}\n", ndump);
if (time_flag)
fprintf(fp,"Atoms. Timestep: " BIGINT_FORMAT " Time: %f\n",
update->ntimestep, compute_time());
else
header += fmt::format("Atoms. Timestep: {}\n", update->ntimestep);
auto header = fmt::format("{}\n", ndump);
if (time_flag) {
double tcurrent = update->atime + (update->ntimestep-update->atimestep) + update->dt;
header += fmt::format(" Atoms. Timestep: {} Time: {:.6f}\n", update->ntimestep, tcurrent);
} else header += fmt::format(" Atoms. Timestep: {}\n", update->ntimestep);
writer.write(header.c_str(), header.length());
}
}

View File

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