From e4dbfee49838c097879443d33b30b4c80881df01 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 23 Jan 2025 00:11:31 -0500 Subject: [PATCH] replace fmt::print() with utils::print() --- src/AMOEBA/fix_amoeba_pitorsion.cpp | 4 +- src/BODY/body_nparticle.cpp | 8 +- src/BODY/body_rounded_polygon.cpp | 10 +- src/BODY/body_rounded_polyhedron.cpp | 14 +-- src/ELECTRODE/fix_electrode_conp.cpp | 4 +- src/EXTRA-COMMAND/group2ndx.cpp | 4 +- src/EXTRA-DUMP/dump_yaml.cpp | 26 ++--- src/EXTRA-FIX/fix_ave_correlate_long.cpp | 2 +- src/EXTRA-FIX/fix_tmd.cpp | 2 +- src/EXTRA-FIX/fix_ttm.cpp | 2 +- src/EXTRA-FIX/fix_ttm_grid.cpp | 2 +- src/EXTRA-FIX/fix_ttm_mod.cpp | 2 +- src/INTEL/verlet_lrt_intel.cpp | 2 +- src/KOKKOS/min_kokkos.cpp | 6 +- src/KOKKOS/verlet_kokkos.cpp | 2 +- src/KSPACE/pair_lj_long_coul_long.cpp | 6 +- src/LATBOLTZ/fix_lb_fluid.cpp | 20 ++-- src/MANYBODY/fix_qeq_comb.cpp | 8 +- src/MANYBODY/pair_comb3.cpp | 2 +- src/ML-POD/fitpod_command.cpp | 44 ++++---- src/MOLECULE/fix_cmap.cpp | 4 +- src/OPENMP/fix_qeq_comb_omp.cpp | 2 +- src/PHONON/dynamical_matrix.cpp | 2 +- src/PHONON/fix_phonon.cpp | 60 +++++------ src/PHONON/third_order.cpp | 6 +- src/QTB/fix_qbmsst.cpp | 2 +- src/QTB/fix_qtb.cpp | 2 +- src/REAXFF/fix_reaxff_bonds.cpp | 10 +- src/REAXFF/fix_reaxff_species.cpp | 12 +-- src/REPLICA/fix_alchemy.cpp | 8 +- src/REPLICA/neb.cpp | 24 ++--- src/REPLICA/prd.cpp | 8 +- src/REPLICA/tad.cpp | 12 +-- src/RIGID/fix_rigid.cpp | 5 +- src/RIGID/fix_rigid_small.cpp | 4 +- src/SPIN/neb_spin.cpp | 4 +- src/SRD/fix_srd.cpp | 4 +- src/UEF/dump_cfg_uef.cpp | 2 +- src/angle_write.cpp | 6 +- src/atom_vec.cpp | 40 +++---- src/atom_vec_ellipsoid.cpp | 2 +- src/atom_vec_line.cpp | 2 +- src/atom_vec_tri.cpp | 2 +- src/balance.cpp | 14 +-- src/bond.cpp | 2 +- src/dihedral_write.cpp | 6 +- src/dump_atom.cpp | 30 +++--- src/dump_cfg.cpp | 2 +- src/dump_custom.cpp | 30 +++--- src/dump_grid.cpp | 28 ++--- src/dump_local.cpp | 12 +-- src/dump_xyz.cpp | 3 +- src/error.cpp | 2 +- src/fix_ave_chunk.cpp | 2 +- src/fix_ave_correlate.cpp | 2 +- src/fix_ave_histo.cpp | 2 +- src/fix_ave_histo_weight.cpp | 2 +- src/fix_ave_time.cpp | 16 +-- src/fix_print.cpp | 2 +- src/fix_property_atom.cpp | 2 +- src/fix_restrain.cpp | 2 +- src/info.cpp | 128 +++++++++++------------ src/label_map.cpp | 30 +++--- src/lammps.cpp | 20 ++-- src/library.cpp | 2 +- src/min.cpp | 6 +- src/pair.cpp | 2 +- src/verlet.cpp | 2 +- src/write_data.cpp | 52 ++++----- 69 files changed, 397 insertions(+), 397 deletions(-) diff --git a/src/AMOEBA/fix_amoeba_pitorsion.cpp b/src/AMOEBA/fix_amoeba_pitorsion.cpp index 33af4a3c31..352e559d6b 100644 --- a/src/AMOEBA/fix_amoeba_pitorsion.cpp +++ b/src/AMOEBA/fix_amoeba_pitorsion.cpp @@ -773,9 +773,9 @@ bigint FixAmoebaPiTorsion::read_data_skip_lines(char *keyword) void FixAmoebaPiTorsion::write_data_header(FILE *fp, int mth) { - if (mth == 0) fmt::print(fp,"{} pitorsions\n",npitorsions); + if (mth == 0) utils::print(fp,"{} pitorsions\n",npitorsions); else if (mth == 1) - fmt::print(fp, "{} pitorsion types\n",npitorsion_types); + utils::print(fp, "{} pitorsion types\n",npitorsion_types); } /* ---------------------------------------------------------------------- diff --git a/src/BODY/body_nparticle.cpp b/src/BODY/body_nparticle.cpp index 4a34f31f54..14841e6054 100644 --- a/src/BODY/body_nparticle.cpp +++ b/src/BODY/body_nparticle.cpp @@ -261,22 +261,22 @@ int BodyNparticle::write_data_body(FILE *fp, double *buf) // atomID ninteger ndouble - fmt::print(fp,"{} {} {}\n",ubuf(buf[m]).i,ubuf(buf[m+1]).i,ubuf(buf[m+2]).i); + utils::print(fp,"{} {} {}\n",ubuf(buf[m]).i,ubuf(buf[m+1]).i,ubuf(buf[m+2]).i); m += 3; const int nsub = (int) ubuf(buf[m++]).i; - fmt::print(fp,"{}\n",nsub); + utils::print(fp,"{}\n",nsub); // inertia - fmt::print(fp,"{} {} {} {} {} {}\n", + utils::print(fp,"{} {} {} {} {} {}\n", buf[m+0],buf[m+1],buf[m+2],buf[m+3],buf[m+4],buf[m+5]); m += 6; // nsub vertices for (int i = 0; i < nsub; i++) { - fmt::print(fp,"{} {} {}\n",buf[m],buf[m+1],buf[m+2]); + utils::print(fp,"{} {} {}\n",buf[m],buf[m+1],buf[m+2]); m += 3; } diff --git a/src/BODY/body_rounded_polygon.cpp b/src/BODY/body_rounded_polygon.cpp index 5de0654d25..366db6264f 100644 --- a/src/BODY/body_rounded_polygon.cpp +++ b/src/BODY/body_rounded_polygon.cpp @@ -398,27 +398,27 @@ int BodyRoundedPolygon::write_data_body(FILE *fp, double *buf) // atomID ninteger ndouble - fmt::print(fp,"{} {} {}\n",ubuf(buf[m]).i,ubuf(buf[m+1]).i,ubuf(buf[m+2]).i); + utils::print(fp,"{} {} {}\n",ubuf(buf[m]).i,ubuf(buf[m+1]).i,ubuf(buf[m+2]).i); m += 3; const int nsub = (int) ubuf(buf[m++]).i; - fmt::print(fp,"{}\n",nsub); + utils::print(fp,"{}\n",nsub); // inertia - fmt::print(fp,"{} {} {} {} {} {}\n", + utils::print(fp,"{} {} {} {} {} {}\n", buf[m+0],buf[m+1],buf[m+2],buf[m+3],buf[m+4],buf[m+5]); m += 6; // nsub vertices for (int i = 0; i < nsub; i++, m+=3) - fmt::print(fp,"{} {} {}\n",buf[m],buf[m+1],buf[m+2]); + utils::print(fp,"{} {} {}\n",buf[m],buf[m+1],buf[m+2]); // rounded diameter double diameter = buf[m++]; - fmt::print(fp,"{}\n",diameter); + utils::print(fp,"{}\n",diameter); return m; } diff --git a/src/BODY/body_rounded_polyhedron.cpp b/src/BODY/body_rounded_polyhedron.cpp index f34a212087..bd16dac96c 100644 --- a/src/BODY/body_rounded_polyhedron.cpp +++ b/src/BODY/body_rounded_polyhedron.cpp @@ -476,7 +476,7 @@ int BodyRoundedPolyhedron::write_data_body(FILE *fp, double *buf) // atomID ninteger ndouble - fmt::print(fp,"{} {} {}\n",ubuf(buf[m]).i,ubuf(buf[m+1]).i,ubuf(buf[m+2]).i); + utils::print(fp,"{} {} {}\n",ubuf(buf[m]).i,ubuf(buf[m+1]).i,ubuf(buf[m+2]).i); m += 3; // nvert, nedge, nface @@ -484,27 +484,27 @@ int BodyRoundedPolyhedron::write_data_body(FILE *fp, double *buf) const int nsub = (int) ubuf(buf[m++]).i; const int nedge = (int) ubuf(buf[m++]).i; const int nface = (int) ubuf(buf[m++]).i; - fmt::print(fp,"{} {} {}\n",nsub,nedge,nface); + utils::print(fp,"{} {} {}\n",nsub,nedge,nface); // inertia - fmt::print(fp,"{} {} {} {} {} {}\n", + utils::print(fp,"{} {} {} {} {} {}\n", buf[m+0],buf[m+1],buf[m+2],buf[m+3],buf[m+4],buf[m+5]); m += 6; // nsub vertices for (int i = 0; i < nsub; i++, m+=3) - fmt::print(fp,"{} {} {}\n",buf[m],buf[m+1],buf[m+2]); + utils::print(fp,"{} {} {}\n",buf[m],buf[m+1],buf[m+2]); // nedge 2-tuples and nface 4-tuples // unless nsub = 1 or 2 if (nsub > 2) { for (int i = 0; i < nedge; i++, m+=2) - fmt::print(fp,"{} {}\n",static_cast (buf[m]),static_cast (buf[m+1])); + utils::print(fp,"{} {}\n",static_cast (buf[m]),static_cast (buf[m+1])); for (int i = 0; i < nface; i++, m+=4) - fmt::print(fp,"{} {} {} {}\n", + utils::print(fp,"{} {} {} {}\n", static_cast (buf[m]),static_cast (buf[m+1]), static_cast (buf[m+2]),static_cast (buf[m+3])); } @@ -512,7 +512,7 @@ int BodyRoundedPolyhedron::write_data_body(FILE *fp, double *buf) // rounded diameter double diameter = buf[m++]; - fmt::print(fp,"{}\n",diameter); + utils::print(fp,"{}\n",diameter); return m; } diff --git a/src/ELECTRODE/fix_electrode_conp.cpp b/src/ELECTRODE/fix_electrode_conp.cpp index a50984fe17..a64eb5f71d 100644 --- a/src/ELECTRODE/fix_electrode_conp.cpp +++ b/src/ELECTRODE/fix_electrode_conp.cpp @@ -1363,10 +1363,10 @@ int FixElectrodeConp::setmask() void FixElectrodeConp::write_to_file(FILE *file, const std::vector &tags, const std::vector> &mat) { - for (const auto &t : tags) fmt::print(file, "{:20}", t); + for (const auto &t : tags) utils::print(file, "{:20}", t); fputs("\n", file); for (const auto &vec : mat) { - for (const auto &x : vec) fmt::print(file, "{:20.11e}", x); + for (const auto &x : vec) utils::print(file, "{:20.11e}", x); fputs("\n", file); } } diff --git a/src/EXTRA-COMMAND/group2ndx.cpp b/src/EXTRA-COMMAND/group2ndx.cpp index 56bf848923..e19d16f0f5 100644 --- a/src/EXTRA-COMMAND/group2ndx.cpp +++ b/src/EXTRA-COMMAND/group2ndx.cpp @@ -93,7 +93,7 @@ void Group2Ndx::write_group(FILE *fp, int gid) if (gid == 0) { fputs("[ System ]\n", fp); } else { - fmt::print(fp, "[ {} ]\n", group->names[gid]); + utils::print(fp, "[ {} ]\n", group->names[gid]); } width = log10((double) atom->natoms) + 2; cols = 80 / width; @@ -142,7 +142,7 @@ void Group2Ndx::write_group(FILE *fp, int gid) if (fp) { int i, j; for (i = 0, j = 0; i < gcount; ++i) { - fmt::print(fp, "{:>{}}", recvlist[i], width); + utils::print(fp, "{:>{}}", recvlist[i], width); ++j; if (j == cols) { fputs("\n", fp); diff --git a/src/EXTRA-DUMP/dump_yaml.cpp b/src/EXTRA-DUMP/dump_yaml.cpp index 6c21c24f77..c26b0591e2 100644 --- a/src/EXTRA-DUMP/dump_yaml.cpp +++ b/src/EXTRA-DUMP/dump_yaml.cpp @@ -94,31 +94,31 @@ void DumpYAML::write_header(bigint ndump) if (comm->me == 0) { const std::string boundary(boundstr); - fmt::print(fp, "---\ncreator: LAMMPS\ntimestep: {}\n", update->ntimestep); - if (unit_flag) fmt::print(fp, "units: {}\n", update->unit_style); - if (time_flag) fmt::print(fp, "time: {:.16g}\n", compute_time()); + utils::print(fp, "---\ncreator: LAMMPS\ntimestep: {}\n", update->ntimestep); + if (unit_flag) utils::print(fp, "units: {}\n", update->unit_style); + if (time_flag) utils::print(fp, "time: {:.16g}\n", compute_time()); - fmt::print(fp, "natoms: {}\n", ndump); + utils::print(fp, "natoms: {}\n", ndump); fputs("boundary: [ ", fp); for (const auto &bflag : boundary) { if (bflag == ' ') continue; - fmt::print(fp, "{}, ", bflag); + utils::print(fp, "{}, ", bflag); } fputs("]\n", fp); - if (thermo) fmt::print(fp, thermo_data); + if (thermo) utils::print(fp, thermo_data); - fmt::print(fp, "box:\n - [ {}, {} ]\n", boxxlo, boxxhi); - fmt::print(fp, " - [ {}, {} ]\n", boxylo, boxyhi); - fmt::print(fp, " - [ {}, {} ]\n", boxzlo, boxzhi); - if (domain->triclinic) fmt::print(fp, " - [ {}, {}, {} ]\n", boxxy, boxxz, boxyz); + utils::print(fp, "box:\n - [ {}, {} ]\n", boxxlo, boxxhi); + utils::print(fp, " - [ {}, {} ]\n", boxylo, boxyhi); + utils::print(fp, " - [ {}, {} ]\n", boxzlo, boxzhi); + if (domain->triclinic) utils::print(fp, " - [ {}, {}, {} ]\n", boxxy, boxxz, boxyz); - fmt::print(fp, "keywords: [ "); + utils::print(fp, "keywords: [ "); for (const auto &item : utils::split_words(columns)) { if (item.find_first_of(special_chars) == std::string::npos) - fmt::print(fp, "{}, ", item); + utils::print(fp, "{}, ", item); else - fmt::print(fp, "'{}', ", item); + utils::print(fp, "'{}', ", item); } fputs(" ]\ndata:\n", fp); } else // reset so that the remainder of the output is not multi-proc diff --git a/src/EXTRA-FIX/fix_ave_correlate_long.cpp b/src/EXTRA-FIX/fix_ave_correlate_long.cpp index abb1ad87de..557e416275 100644 --- a/src/EXTRA-FIX/fix_ave_correlate_long.cpp +++ b/src/EXTRA-FIX/fix_ave_correlate_long.cpp @@ -489,7 +489,7 @@ void FixAveCorrelateLong::end_of_step() if (fp && comm->me == 0) { clearerr(fp); if (overwrite) (void) platform::fseek(fp,filepos); - fmt::print(fp,"# Timestep: {}\n", ntimestep); + utils::print(fp,"# Timestep: {}\n", ntimestep); for (unsigned int i=0; i < npcorr; ++i) { fprintf(fp, "%lg ", t[i]*update->dt*nevery); for (int j=0; j < npair; ++j) { diff --git a/src/EXTRA-FIX/fix_tmd.cpp b/src/EXTRA-FIX/fix_tmd.cpp index 242efcf41c..aac069dc9d 100644 --- a/src/EXTRA-FIX/fix_tmd.cpp +++ b/src/EXTRA-FIX/fix_tmd.cpp @@ -270,7 +270,7 @@ void FixTMD::initial_integrate(int /*vflag*/) work_lambda += lambda*(rho_target - rho_old); if (!(update->ntimestep % nfileevery) && (previous_stat != update->ntimestep)) { - fmt::print(fp, "{} {} {} {} {} {} {} {}\n", update->ntimestep,rho_target,rho_old, + utils::print(fp, "{} {} {} {} {} {} {} {}\n", update->ntimestep,rho_target,rho_old, gamma_back,gamma_forward,lambda,work_lambda,work_analytical); fflush(fp); previous_stat = update->ntimestep; diff --git a/src/EXTRA-FIX/fix_ttm.cpp b/src/EXTRA-FIX/fix_ttm.cpp index f5f3aa457e..1609d6285a 100644 --- a/src/EXTRA-FIX/fix_ttm.cpp +++ b/src/EXTRA-FIX/fix_ttm.cpp @@ -523,7 +523,7 @@ void FixTTM::write_electron_temperatures(const std::string &filename) FILE *fp = fopen(filename.c_str(),"w"); if (!fp) error->one(FLERR,"Fix ttm could not open output file {}: {}", filename,utils::getsyserror()); - fmt::print(fp,"# DATE: {} UNITS: {} COMMENT: Electron temperature on " + utils::print(fp,"# DATE: {} UNITS: {} COMMENT: Electron temperature on " "{}x{}x{} grid at step {} - created by fix {}\n", utils::current_date(), update->unit_style, nxgrid, nygrid, nzgrid, update->ntimestep, style); diff --git a/src/EXTRA-FIX/fix_ttm_grid.cpp b/src/EXTRA-FIX/fix_ttm_grid.cpp index d9c6f13e2f..49a186a3ee 100644 --- a/src/EXTRA-FIX/fix_ttm_grid.cpp +++ b/src/EXTRA-FIX/fix_ttm_grid.cpp @@ -411,7 +411,7 @@ void FixTTMGrid::write_restart_file(const char *file) if (fpout == nullptr) error->one(FLERR,"Cannot open fix ttm/grid restart file {}: {}",outfile,utils::getsyserror()); - fmt::print(fpout,"# DATE: {} UNITS: {} COMMENT: " + utils::print(fpout,"# DATE: {} UNITS: {} COMMENT: " "Electron temperature on {}x{}x{} grid at step {} - " "created by fix {}\n", utils::current_date(),update->unit_style, diff --git a/src/EXTRA-FIX/fix_ttm_mod.cpp b/src/EXTRA-FIX/fix_ttm_mod.cpp index 6ad3ca1b0a..6d6e9c0638 100644 --- a/src/EXTRA-FIX/fix_ttm_mod.cpp +++ b/src/EXTRA-FIX/fix_ttm_mod.cpp @@ -628,7 +628,7 @@ void FixTTMMod::write_electron_temperatures(const std::string &filename) FILE *fp = fopen(filename.c_str(),"w"); if (!fp) error->one(FLERR,"Fix ttm/mod could not open output file {}: {}", filename, utils::getsyserror()); - fmt::print(fp,"# DATE: {} UNITS: {} COMMENT: Electron temperature " + utils::print(fp,"# DATE: {} UNITS: {} COMMENT: Electron temperature " "{}x{}x{} grid at step {}. Created by fix {}\n", utils::current_date(), update->unit_style, nxgrid, nygrid, nzgrid, update->ntimestep, style); diff --git a/src/INTEL/verlet_lrt_intel.cpp b/src/INTEL/verlet_lrt_intel.cpp index 9df17d8cef..3e18295461 100644 --- a/src/INTEL/verlet_lrt_intel.cpp +++ b/src/INTEL/verlet_lrt_intel.cpp @@ -94,7 +94,7 @@ void VerletLRTIntel::setup(int flag) if (comm->me == 0 && screen) { fputs("Setting up VerletLRTIntel run ...\n",screen); if (flag) { - fmt::print(screen," Unit style : {}\n" + utils::print(screen," Unit style : {}\n" " Current step : {}\n" " Time step : {}\n", update->unit_style,update->ntimestep,update->dt); diff --git a/src/KOKKOS/min_kokkos.cpp b/src/KOKKOS/min_kokkos.cpp index 3460fe9009..fca7a16e62 100644 --- a/src/KOKKOS/min_kokkos.cpp +++ b/src/KOKKOS/min_kokkos.cpp @@ -73,10 +73,10 @@ void MinKokkos::init() void MinKokkos::setup(int flag) { if (comm->me == 0 && screen) { - fmt::print(screen,"Setting up {} style minimization ...\n", update->minimize_style); + utils::print(screen,"Setting up {} style minimization ...\n", update->minimize_style); if (flag) { - fmt::print(screen," Unit style : {}\n", update->unit_style); - fmt::print(screen," Current step : {}\n", update->ntimestep); + utils::print(screen," Unit style : {}\n", update->unit_style); + utils::print(screen," Current step : {}\n", update->ntimestep); timer->print_timeout(screen); } } diff --git a/src/KOKKOS/verlet_kokkos.cpp b/src/KOKKOS/verlet_kokkos.cpp index d839362aa5..a492b5a9c9 100644 --- a/src/KOKKOS/verlet_kokkos.cpp +++ b/src/KOKKOS/verlet_kokkos.cpp @@ -77,7 +77,7 @@ void VerletKokkos::setup(int flag) if (comm->me == 0 && screen) { fputs("Setting up Verlet run ...\n",screen); if (flag) { - fmt::print(screen," Unit style : {}\n" + utils::print(screen," Unit style : {}\n" " Current step : {}\n" " Time step : {}\n", update->unit_style,update->ntimestep,update->dt); diff --git a/src/KSPACE/pair_lj_long_coul_long.cpp b/src/KSPACE/pair_lj_long_coul_long.cpp index 5f3c0327db..2955b24fe8 100644 --- a/src/KSPACE/pair_lj_long_coul_long.cpp +++ b/src/KSPACE/pair_lj_long_coul_long.cpp @@ -410,7 +410,7 @@ void PairLJLongCoulLong::read_restart_settings(FILE *fp) void PairLJLongCoulLong::write_data(FILE *fp) { for (int i = 1; i <= atom->ntypes; i++) - fmt::print(fp,"{} {} {}\n",i,epsilon_read[i][i],sigma_read[i][i]); + utils::print(fp,"{} {} {}\n",i,epsilon_read[i][i],sigma_read[i][i]); } /* ---------------------------------------------------------------------- @@ -423,10 +423,10 @@ void PairLJLongCoulLong::write_data_all(FILE *fp) for (int i = 1; i <= atom->ntypes; i++) { for (int j = i; j <= atom->ntypes; j++) { if (ewald_order & (1<<6)) { - fmt::print(fp,"{} {} {} {}\n",i,j, + utils::print(fp,"{} {} {} {}\n",i,j, epsilon[i][j],sigma[i][j]); } else { - fmt::print(fp,"{} {} {} {} {}\n",i,j, + utils::print(fp,"{} {} {} {} {}\n",i,j, epsilon[i][j],sigma[i][j],cut_lj[i][j]); } } diff --git a/src/LATBOLTZ/fix_lb_fluid.cpp b/src/LATBOLTZ/fix_lb_fluid.cpp index 773f60cf0e..286b56cab5 100644 --- a/src/LATBOLTZ/fix_lb_fluid.cpp +++ b/src/LATBOLTZ/fix_lb_fluid.cpp @@ -2364,7 +2364,7 @@ void FixLbFluid::dump(const bigint step) bigint offset = frameindex * block * (1 + 3); double time = dump_time_index ? update->ntimestep * dt_lb : frameindex; - fmt::print(dump_file_handle_xdmf, + utils::print(dump_file_handle_xdmf, " \n" " \n\n"); + utils::print(dump_file_handle_xdmf, " \n\n"); frameindex++; } @@ -3726,18 +3726,18 @@ void FixLbFluid::initializeGeometry() if (!outfile) error->one(FLERR, " file {} could not be opened: {}", datfile, utils::getsyserror()); - fmt::print(outfile, "\n me: {} px: {} py: {} pz: {}\n", me, comm->myloc[0], comm->myloc[1], + utils::print(outfile, "\n me: {} px: {} py: {} pz: {}\n", me, comm->myloc[0], comm->myloc[1], comm->myloc[2]); for (i = 0; i < subNbx; i++) { - fmt::print(outfile, "i={}\n", i); + utils::print(outfile, "i={}\n", i); for (k = subNbz - 1; k > -1; k--) { if (k == subNbz - 2 || k == 0) { for (j = 0; j < subNby + 2; j++) fputs("---", outfile); fputs("\n", outfile); } for (j = 0; j < subNby; j++) { - fmt::print(outfile, " {} ", sublattice[i][j][k].type); + utils::print(outfile, " {} ", sublattice[i][j][k].type); if (j == 0 || j == subNby - 2) fputs(" | ", outfile); if (j == subNby - 1) fputs("\n", outfile); } @@ -3754,16 +3754,16 @@ void FixLbFluid::initializeGeometry() if (!outfile) error->one(FLERR, " file {} could not be opened: {}", datfile, utils::getsyserror()); - fmt::print("\nme: {}\n", me); + utils::print("\nme: {}\n", me); for (i = 0; i < subNbx; i++) { - fmt::print("i={}\n", i); + utils::print("i={}\n", i); for (k = subNbz - 1; k > -1; k--) { if (k == subNbz - 2 || k == 0) { for (j = 0; j < subNby + 2; j++) fputs("---", outfile); fputs("\bn", outfile); } for (j = 0; j < subNby; j++) { - fmt::print(outfile, " {} ", sublattice[i][j][k].orientation); + utils::print(outfile, " {} ", sublattice[i][j][k].orientation); if (j == 0 || j == subNby - 2) fputs(" | ", outfile); if (j == subNby - 1) fputs("\n", outfile); } diff --git a/src/MANYBODY/fix_qeq_comb.cpp b/src/MANYBODY/fix_qeq_comb.cpp index 6edd2fbbb0..88c6fb4be4 100644 --- a/src/MANYBODY/fix_qeq_comb.cpp +++ b/src/MANYBODY/fix_qeq_comb.cpp @@ -203,7 +203,7 @@ void FixQEQComb::post_force(int /*vflag*/) // charge-equilibration loop if (me == 0 && fp) - fmt::print(fp,"Charge equilibration on step {}\n", update->ntimestep); + utils::print(fp,"Charge equilibration on step {}\n", update->ntimestep); heatpq = 0.05; qmass = 0.016; @@ -268,7 +268,7 @@ void FixQEQComb::post_force(int /*vflag*/) if (enegchk <= precision && enegmax <= 100.0*precision) break; if (me == 0 && fp) - fmt::print(fp," iteration: {}, enegtot {:.6g}, " + utils::print(fp," iteration: {}, enegtot {:.6g}, " "enegmax {:.6g}, fq deviation: {:.6g}\n", iloop,enegtot,enegmax,enegchk); @@ -281,9 +281,9 @@ void FixQEQComb::post_force(int /*vflag*/) if (me == 0 && fp) { if (iloop == loopmax) - fmt::print(fp,"Charges did not converge in {} iterations\n",iloop); + utils::print(fp,"Charges did not converge in {} iterations\n",iloop); else - fmt::print(fp,"Charges converged in {} iterations to {:.10f} tolerance\n", + utils::print(fp,"Charges converged in {} iterations to {:.10f} tolerance\n", iloop,enegchk); } } diff --git a/src/MANYBODY/pair_comb3.cpp b/src/MANYBODY/pair_comb3.cpp index b4228dbb4f..3a02ed73b1 100644 --- a/src/MANYBODY/pair_comb3.cpp +++ b/src/MANYBODY/pair_comb3.cpp @@ -164,7 +164,7 @@ void PairComb3::settings(int narg, char **arg) else error->all(FLERR,"Illegal pair_style command"); if (comm->me == 0 && screen) - fmt::print(screen," PairComb3: polarization is {} \n", + utils::print(screen," PairComb3: polarization is {} \n", pol_flag ? "on" : "off"); } diff --git a/src/ML-POD/fitpod_command.cpp b/src/ML-POD/fitpod_command.cpp index fbe9ecd396..ea8e5e22d3 100644 --- a/src/ML-POD/fitpod_command.cpp +++ b/src/ML-POD/fitpod_command.cpp @@ -163,15 +163,15 @@ void FitPOD::command(int narg, char **arg) n2 = fastpodptr->nComponents * fastpodptr->nClusters * fastpodptr->nelements; } - fmt::print(fp, "model_coefficients: {} {} {}\n", nCoeffAll, n1, n2); + utils::print(fp, "model_coefficients: {} {} {}\n", nCoeffAll, n1, n2); for (int count = 0; count < nCoeffAll; count++) { - fmt::print(fp, "{:<10.{}f}\n", desc.c[count], traindata.precision); + utils::print(fp, "{:<10.{}f}\n", desc.c[count], traindata.precision); } for (int count = 0; count < n1; count++) { - fmt::print(fp, "{:<10.{}f}\n", fastpodptr->Proj[count], 14); + utils::print(fp, "{:<10.{}f}\n", fastpodptr->Proj[count], 14); } for (int count = 0; count < n2; count++) { - fmt::print(fp, "{:<10.{}f}\n", fastpodptr->Centroids[count], 14); + utils::print(fp, "{:<10.{}f}\n", fastpodptr->Centroids[count], 14); } fclose(fp); } @@ -1751,7 +1751,7 @@ void FitPOD::print_analysis(const datastruct &data, double *outarray, double *er data.training ? "Training" : "Test"); utils::logmesg(lmp, mystr); - fmt::print(fp_errors, mystr); + utils::print(fp_errors, mystr); std::string sa(lm + 80, '-'); sa += '\n'; @@ -1759,12 +1759,12 @@ void FitPOD::print_analysis(const datastruct &data, double *outarray, double *er " {:^{}} | # configs | # atoms | MAE energy | RMSE energy | MAE force | RMSE force\n", "File", lm); utils::logmesg(lmp, sa + sb + sa); - fmt::print(fp_errors, sa + sb + sa); + utils::print(fp_errors, sa + sb + sa); int ci = 0, m = 8, nc = 0, nf = 0; for (int file = 0; file < nfiles; file++) { - fmt::print(fp_analysis, "# {}\n", data.filenames[file]); - fmt::print(fp_analysis, + utils::print(fp_analysis, "# {}\n", data.filenames[file]); + utils::print(fp_analysis, " config # atoms volume energy DFT energy energy error " " force DFT force force error\n"); @@ -1772,14 +1772,14 @@ void FitPOD::print_analysis(const datastruct &data, double *outarray, double *er int nconfigs = data.num_config[file]; nc += nconfigs; for (int ii = 0; ii < nconfigs; ii++) { // loop over each configuration in a file - fmt::print(fp_analysis, "{:6} {:8} ", outarray[m * ci], outarray[1 + m * ci]); + utils::print(fp_analysis, "{:6} {:8} ", outarray[m * ci], outarray[1 + m * ci]); double vol = latticevolume(&data.lattice[9 * ci]); - fmt::print(fp_analysis, "{:<15.10} ", vol); + utils::print(fp_analysis, "{:<15.10} ", vol); for (int count = 2; count < m; count++) - fmt::print(fp_analysis, "{:<15.10} ", outarray[count + m * ci]); - fmt::print(fp_analysis, "\n"); + utils::print(fp_analysis, "{:<15.10} ", outarray[count + m * ci]); + utils::print(fp_analysis, "\n"); nforceall += 3 * data.num_atom[ci]; ci += 1; @@ -1792,23 +1792,23 @@ void FitPOD::print_analysis(const datastruct &data, double *outarray, double *er data.filenames[file], lm, nconfigs, nforceall / 3, errors[0 + 4 * q], errors[1 + 4 * q], errors[2 + 4 * q], errors[3 + 4 * q]); utils::logmesg(lmp, s); - fmt::print(fp_errors, s); + utils::print(fp_errors, s); } utils::logmesg(lmp, sa); - fmt::print(fp_errors, sa); + utils::print(fp_errors, sa); auto s = fmt::format("{:<{}} {:>10} {:>11} {:<10.6f} {:<10.6f} {:<10.6f} {:<10.6f}\n", "All files", lm, nc, nf / 3, errors[0], errors[1], errors[2], errors[3]); utils::logmesg(lmp, s + sa); - fmt::print(fp_errors, "{}", s + sa); + utils::print(fp_errors, "{}", s + sa); mystr = fmt::format("**************** End of Error Analysis for the {} Data Set ****************\n", data.training ? "Training" : "Test"); utils::logmesg(lmp, mystr); - fmt::print(fp_errors, mystr); + utils::print(fp_errors, mystr); fclose(fp_errors); fclose(fp_analysis); @@ -2254,14 +2254,14 @@ void FitPOD::savedata2textfile(std::string filename, std::string text, double *A int precision = 15; FILE *fp = fopen(filename.c_str(), "w"); if (dim == 1) { - fmt::print(fp, text, n); - for (int i = 0; i < n; i++) fmt::print(fp, "{:<10.{}f} \n", A[i], precision); + utils::print(fp, text, n); + for (int i = 0; i < n; i++) utils::print(fp, "{:<10.{}f} \n", A[i], precision); } else if (dim == 2) { - fmt::print(fp, text, n); - fmt::print(fp, "{} \n", m); + utils::print(fp, text, n); + utils::print(fp, "{} \n", m); for (int j = 0; j < n; j++) { - for (int i = 0; i < m; i++) fmt::print(fp, "{:<10.{}f} ", A[j + i * n], precision); - fmt::print(fp, " \n"); + for (int i = 0; i < m; i++) utils::print(fp, "{:<10.{}f} ", A[j + i * n], precision); + utils::print(fp, " \n"); } } fclose(fp); diff --git a/src/MOLECULE/fix_cmap.cpp b/src/MOLECULE/fix_cmap.cpp index 02116965b5..29fa8e4072 100644 --- a/src/MOLECULE/fix_cmap.cpp +++ b/src/MOLECULE/fix_cmap.cpp @@ -1051,7 +1051,7 @@ bigint FixCMAP::read_data_skip_lines(char * /*keyword*/) void FixCMAP::write_data_header(FILE *fp, int /*mth*/) { - fmt::print(fp,"{} crossterms\n",ncmap); + utils::print(fp,"{} crossterms\n",ncmap); } /* ---------------------------------------------------------------------- @@ -1129,7 +1129,7 @@ void FixCMAP::write_data_section(int /*mth*/, FILE *fp, int n, double **buf, int index) { for (int i = 0; i < n; i++) - fmt::print(fp,"{} {} {} {} {} {} {}\n", + utils::print(fp,"{} {} {} {} {} {} {}\n", index+i,ubuf(buf[i][0]).i, ubuf(buf[i][1]).i, ubuf(buf[i][2]).i, ubuf(buf[i][3]).i,ubuf(buf[i][4]).i,ubuf(buf[i][5]).i); } diff --git a/src/OPENMP/fix_qeq_comb_omp.cpp b/src/OPENMP/fix_qeq_comb_omp.cpp index a2fcf85367..8d5eb284cc 100644 --- a/src/OPENMP/fix_qeq_comb_omp.cpp +++ b/src/OPENMP/fix_qeq_comb_omp.cpp @@ -99,7 +99,7 @@ void FixQEQCombOMP::post_force(int /* vflag */) // charge-equilibration loop - if (me == 0 && fp) fmt::print(fp, "Charge equilibration on step {}\n", update->ntimestep); + if (me == 0 && fp) utils::print(fp, "Charge equilibration on step {}\n", update->ntimestep); heatpq = 0.05; qmass = 0.016; diff --git a/src/PHONON/dynamical_matrix.cpp b/src/PHONON/dynamical_matrix.cpp index c2ba34c4c2..a0199747c4 100644 --- a/src/PHONON/dynamical_matrix.cpp +++ b/src/PHONON/dynamical_matrix.cpp @@ -282,7 +282,7 @@ void DynamicalMatrix::calculateMatrix() if (me == 0 && screen) { fputs("Calculating Dynamical Matrix ...\n", screen); - fmt::print(screen," Total # of atoms = {}\n" + utils::print(screen," Total # of atoms = {}\n" " Atoms in group = {}\n" " Total dynamical matrix elements = {}\n", natoms, gcount, dynlen*dynlen); diff --git a/src/PHONON/fix_phonon.cpp b/src/PHONON/fix_phonon.cpp index 74670ebde5..37f84b6f12 100644 --- a/src/PHONON/fix_phonon.cpp +++ b/src/PHONON/fix_phonon.cpp @@ -186,21 +186,21 @@ FixPhonon::FixPhonon(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) flog = fopen(logfile, "w"); if (flog == nullptr) error->one(FLERR,"Can not open output file {}: {}", logfile,utils::getsyserror()); - fmt::print(flog,"############################################################\n"); - fmt::print(flog,"# group name of the atoms under study : {}\n", group->names[igroup]); - fmt::print(flog,"# total number of atoms in the group : {}\n", ngroup); - fmt::print(flog,"# dimension of the system : {} D\n", sysdim); - fmt::print(flog,"# number of atoms per unit cell : {}\n", nucell); - fmt::print(flog,"# dimension of the FFT mesh : {} x {} x {}\n", nx, ny, nz); - fmt::print(flog,"# number of wait steps before measurement : {}\n", waitsteps); - fmt::print(flog,"# frequency of the measurement : {}\n", nevery); - fmt::print(flog,"# output result after this many measurement: {}\n", nfreq); - fmt::print(flog,"# number of processors used by this run : {}\n", nprocs); - fmt::print(flog,"############################################################\n"); - fmt::print(flog,"# mapping information between lattice indices and atom id\n"); - fmt::print(flog,"# nx ny nz nucell\n"); - fmt::print(flog,"{} {} {} {}\n", nx, ny, nz, nucell); - fmt::print(flog,"# l1 l2 l3 k atom_id\n"); + utils::print(flog,"############################################################\n"); + utils::print(flog,"# group name of the atoms under study : {}\n", group->names[igroup]); + utils::print(flog,"# total number of atoms in the group : {}\n", ngroup); + utils::print(flog,"# dimension of the system : {} D\n", sysdim); + utils::print(flog,"# number of atoms per unit cell : {}\n", nucell); + utils::print(flog,"# dimension of the FFT mesh : {} x {} x {}\n", nx, ny, nz); + utils::print(flog,"# number of wait steps before measurement : {}\n", waitsteps); + utils::print(flog,"# frequency of the measurement : {}\n", nevery); + utils::print(flog,"# output result after this many measurement: {}\n", nfreq); + utils::print(flog,"# number of processors used by this run : {}\n", nprocs); + utils::print(flog,"############################################################\n"); + utils::print(flog,"# mapping information between lattice indices and atom id\n"); + utils::print(flog,"# nx ny nz nucell\n"); + utils::print(flog,"{} {} {} {}\n", nx, ny, nz, nucell); + utils::print(flog,"# l1 l2 l3 k atom_id\n"); int ix, iy, iz, iu; for (idx = 0; idx < ngroup; ++idx) { itag = surf2tag[idx]; @@ -208,9 +208,9 @@ FixPhonon::FixPhonon(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) iz = (idx/nucell)%nz; iy = (idx/(nucell*nz))%ny; ix = (idx/(nucell*nz*ny))%nx; - fmt::print(flog,"{} {} {} {} {}\n", ix, iy, iz, iu, itag); + utils::print(flog,"{} {} {} {} {}\n", ix, iy, iz, iu, itag); } - fmt::print(flog,"############################################################\n"); + utils::print(flog,"############################################################\n"); fflush(flog); } surf2tag.clear(); @@ -737,16 +737,16 @@ void FixPhonon::postprocess( ) fclose(fp_bin); // write log file, here however, it is the dynamical matrix that is written - fmt::print(flog,"############################################################\n"); - fmt::print(flog,"# Current time step : {}\n", update->ntimestep); - fmt::print(flog,"# Total number of measurements : {}\n", neval); - fmt::print(flog,"# Average temperature of the measurement : {}\n", TempAve); - fmt::print(flog,"# Boltzmann constant under current units : {}\n", boltz); - fmt::print(flog,"# basis vector A1 = [{} {} {}]\n", basevec[0], basevec[1], basevec[2]); - fmt::print(flog,"# basis vector A2 = [{} {} {}]\n", basevec[3], basevec[4], basevec[5]); - fmt::print(flog,"# basis vector A3 = [{} {} {}]\n", basevec[6], basevec[7], basevec[8]); - fmt::print(flog,"############################################################\n"); - fmt::print(flog,"# qx\t qy \t qz \t\t Phi(q)\n"); + utils::print(flog,"############################################################\n"); + utils::print(flog,"# Current time step : {}\n", update->ntimestep); + utils::print(flog,"# Total number of measurements : {}\n", neval); + utils::print(flog,"# Average temperature of the measurement : {}\n", TempAve); + utils::print(flog,"# Boltzmann constant under current units : {}\n", boltz); + utils::print(flog,"# basis vector A1 = [{} {} {}]\n", basevec[0], basevec[1], basevec[2]); + utils::print(flog,"# basis vector A2 = [{} {} {}]\n", basevec[3], basevec[4], basevec[5]); + utils::print(flog,"# basis vector A3 = [{} {} {}]\n", basevec[6], basevec[7], basevec[8]); + utils::print(flog,"############################################################\n"); + utils::print(flog,"# qx\t qy \t qz \t\t Phi(q)\n"); EnforceASR(); @@ -765,10 +765,10 @@ void FixPhonon::postprocess( ) double qy = double(iy)/double(ny); for (int iz = 0; iz < nz; ++iz) { double qz = double(iz)/double(nz); - fmt::print(flog,"{} {} {}", qx, qy, qz); + utils::print(flog,"{} {} {}", qx, qy, qz); for (idim = 0; idim < fft_dim2; ++idim) - fmt::print(flog, " {} {}", std::real(Phi_all[idq][idim]), std::imag(Phi_all[idq][idim])); - fmt::print(flog, "\n"); + utils::print(flog, " {} {}", std::real(Phi_all[idq][idim]), std::imag(Phi_all[idq][idim])); + utils::print(flog, "\n"); ++idq; } } diff --git a/src/PHONON/third_order.cpp b/src/PHONON/third_order.cpp index c31aae0086..378905bd29 100644 --- a/src/PHONON/third_order.cpp +++ b/src/PHONON/third_order.cpp @@ -295,7 +295,7 @@ void ThirdOrder::calculateMatrix() if (comm->me == 0 && screen) { fputs("Calculating Third Order ...\n", screen); - fmt::print(screen," Total # of atoms = {}\n" + utils::print(screen," Total # of atoms = {}\n" " Atoms in group = {}\n" " Total third order elements = {}\n", natoms, gcount, dynlen*dynlen*dynlen); @@ -432,7 +432,7 @@ void ThirdOrder::writeMatrix(double *dynmat, bigint i, int a, bigint j, int b) for (int k = 0; k < atom->natoms; k++){ norm = square(dynmat[k*3])+square(dynmat[k*3+1])+square(dynmat[k*3+2]); if (norm > 1.0e-16) - fmt::print(fp, "{} {} {} {} {} {:17.8f} {:17.8f} {:17.8f}\n", + utils::print(fp, "{} {} {} {} {} {:17.8f} {:17.8f} {:17.8f}\n", i+1, a+1, j+1, b+1, k+1, dynmat[k*3] * conversion, dynmat[k*3+1] * conversion, dynmat[k*3+2] * conversion); } @@ -440,7 +440,7 @@ void ThirdOrder::writeMatrix(double *dynmat, bigint i, int a, bigint j, int b) for (int k = 0; k < gcount; k++){ norm = square(dynmat[k*3])+square(dynmat[k*3+1])+square(dynmat[k*3+2]); if (norm > 1.0e-16) - fmt::print(fp, "{} {} {} {} {} {:17.8f} {:17.8f} {:17.8f}\n", + utils::print(fp, "{} {} {} {} {} {:17.8f} {:17.8f} {:17.8f}\n", i+1, a+1, j+1, b+1, groupmap[k]+1, dynmat[k*3] * conversion, dynmat[k*3+1] * conversion, dynmat[k*3+2] * conversion); } diff --git a/src/QTB/fix_qbmsst.cpp b/src/QTB/fix_qbmsst.cpp index 7dd7547efd..883e65b09e 100644 --- a/src/QTB/fix_qbmsst.cpp +++ b/src/QTB/fix_qbmsst.cpp @@ -360,7 +360,7 @@ void FixQBMSST::init() h_timestep=alpha*dtv; } if (comm->me == 0 && screen) - fmt::print(screen,"The effective maximum frequency is now {} inverse time unit " + utils::print(screen,"The effective maximum frequency is now {} inverse time unit " "with alpha value as {}!\n", 0.5/h_timestep, alpha); //gfactor is the random force \sqrt{\frac{2\gamma{}m_{i}}{\alpha*\delta{}t}}, \sqrt{12} makes the random array variance equal to unit. diff --git a/src/QTB/fix_qtb.cpp b/src/QTB/fix_qtb.cpp index 8f73a04927..4324238b97 100644 --- a/src/QTB/fix_qtb.cpp +++ b/src/QTB/fix_qtb.cpp @@ -170,7 +170,7 @@ void FixQTB::init() h_timestep=alpha*dtv; } if (comm->me == 0 && screen) - fmt::print(screen,"The effective maximum frequency is now {} inverse time unit " + utils::print(screen,"The effective maximum frequency is now {} inverse time unit " "with alpha value as {}!\n", 0.5/h_timestep, alpha); // set force prefactors diff --git a/src/REAXFF/fix_reaxff_bonds.cpp b/src/REAXFF/fix_reaxff_bonds.cpp index a5ce478c1d..54ad593486 100644 --- a/src/REAXFF/fix_reaxff_bonds.cpp +++ b/src/REAXFF/fix_reaxff_bonds.cpp @@ -253,11 +253,11 @@ void FixReaxFFBonds::RecvBuffer(double *buf, int nbuf, int nbuf_local, MPI_Request irequest, irequest2; if (me == 0) { - fmt::print(fp,"# Timestep {}\n#\n",ntimestep); - fmt::print(fp,"# Number of particles {}\n#\n",natoms); - fmt::print(fp,"# Max number of bonds per atom {} with coarse bond order cutoff {:5.3f}\n", + utils::print(fp,"# Timestep {}\n#\n",ntimestep); + utils::print(fp,"# Number of particles {}\n#\n",natoms); + utils::print(fp,"# Max number of bonds per atom {} with coarse bond order cutoff {:5.3f}\n", maxnum,cutof3); - fmt::print(fp,"# Particle connection table and bond orders\n" + utils::print(fp,"# Particle connection table and bond orders\n" "# id type nb id_1...id_nb mol bo_1...bo_nb abo nlp q\n"); } @@ -292,7 +292,7 @@ void FixReaxFFBonds::RecvBuffer(double *buf, int nbuf, int nbuf_local, j += (1+numbonds); mesg += fmt::format("{:14.3f}{:14.3f}{:14.3f}\n",sbotmp,nlptmp,avqtmp); - fmt::print(fp, mesg); + utils::print(fp, mesg); } } } else { diff --git a/src/REAXFF/fix_reaxff_species.cpp b/src/REAXFF/fix_reaxff_species.cpp index 4ef7799c24..1916597a69 100644 --- a/src/REAXFF/fix_reaxff_species.cpp +++ b/src/REAXFF/fix_reaxff_species.cpp @@ -794,12 +794,12 @@ void FixReaxFFSpecies::WriteFormulas(int Nmole, int Nspec) if (itemp != 1) molname += std::to_string(itemp); } } - fmt::print(fp, " {:>11}", molname); + utils::print(fp, " {:>11}", molname); } fputs("\n", fp); - fmt::print(fp, "{:>11} {:>11} {:>11}", ntimestep, Nmole, Nspec); - for (i = 0; i < Nmoltype; i++) fmt::print(fp, " {:>11}", NMol[i]); + utils::print(fp, "{:>11} {:>11} {:>11}", ntimestep, Nmole, Nspec); + for (i = 0; i < Nmoltype; i++) utils::print(fp, " {:>11}", NMol[i]); fputs("\n", fp); } @@ -838,7 +838,7 @@ void FixReaxFFSpecies::WritePos(int Nmole, int Nspec) for (int j = 0; j < 3; j++) halfbox[j] = box[j] / 2; if (comm->me == 0) { - fmt::print(pos, + utils::print(pos, "Timestep {} NMole {} NSpec {} xlo {:f} " "xhi {:f} ylo {:f} yhi {:f} zlo {:f} zhi {:f}\n", update->ntimestep, Nmole, Nspec, domain->boxlo[0], domain->boxhi[0], @@ -1062,7 +1062,7 @@ void FixReaxFFSpecies::DeleteSpecies(int Nmole, int Nspec) for (int m = 0; m < Nspec; m++) { if (deletecount[m] > 0) { if (printflag == 0) { - fmt::print(fdel, "Timestep {}", update->ntimestep); + utils::print(fdel, "Timestep {}", update->ntimestep); printflag = 1; } fprintf(fdel, " %g ", deletecount[m]); @@ -1085,7 +1085,7 @@ void FixReaxFFSpecies::DeleteSpecies(int Nmole, int Nspec) if (deletecount[i]) writeflag = 1; if (writeflag) { - fmt::print(fdel, "{}", update->ntimestep); + utils::print(fdel, "{}", update->ntimestep); for (i = 0; i < ndelspec; i++) { fprintf(fdel, "\t%g", deletecount[i]); } fprintf(fdel, "\n"); fflush(fdel); diff --git a/src/REPLICA/fix_alchemy.cpp b/src/REPLICA/fix_alchemy.cpp index f3b79d0956..69a2c3f36a 100644 --- a/src/REPLICA/fix_alchemy.cpp +++ b/src/REPLICA/fix_alchemy.cpp @@ -242,8 +242,8 @@ void FixAlchemy::setup(int vflag) if (universe->me == 0) { progress = 0; auto msg = fmt::format("Starting alchemical run\n"); - if (universe->uscreen) fmt::print(universe->uscreen, msg); - if (universe->ulogfile) fmt::print(universe->ulogfile, msg); + if (universe->uscreen) utils::print(universe->uscreen, msg); + if (universe->ulogfile) utils::print(universe->ulogfile, msg); } // recheck domain decomposition, atom ordering, and synchronize positions @@ -325,8 +325,8 @@ void FixAlchemy::post_force(int /*vflag*/) if ((status / 10) > (progress / 10)) { progress = status; auto msg = fmt::format(" Alchemical run progress: {:>3d}%\n", progress); - if (universe->uscreen) fmt::print(universe->uscreen, msg); - if (universe->ulogfile) fmt::print(universe->ulogfile, msg); + if (universe->uscreen) utils::print(universe->uscreen, msg); + if (universe->ulogfile) utils::print(universe->ulogfile, msg); } } } diff --git a/src/REPLICA/neb.cpp b/src/REPLICA/neb.cpp index b14748565b..4b242965c8 100644 --- a/src/REPLICA/neb.cpp +++ b/src/REPLICA/neb.cpp @@ -241,19 +241,19 @@ void NEB::run() if (me_universe == 0) { if (uscreen) { - fmt::print(uscreen, " Step {:^14} {:^14} {:^14} {:^14} {:^14} {:^14} {:^14} {:^14} ", + utils::print(uscreen, " Step {:^14} {:^14} {:^14} {:^14} {:^14} {:^14} {:^14} {:^14} ", "MaxReplicaForce", "MaxAtomForce", "GradV0", "GradV1", "GradVc", "EBF", "EBR", "RDT"); if (print_mode != TERSE) { for (int i = 1; i <= nreplica; ++i) - fmt::print(uscreen, "{:^14} {:^14} ", "RD" + std::to_string(i), "PE" + std::to_string(i)); + utils::print(uscreen, "{:^14} {:^14} ", "RD" + std::to_string(i), "PE" + std::to_string(i)); } if (print_mode == VERBOSE) { for (int i = 1; i <= nreplica; ++i) { auto idx = std::to_string(i); - fmt::print(uscreen, "{:^12}{:^12}{:^12} {:^12} {:^12}{:^12} ", "pathangle" + idx, + utils::print(uscreen, "{:^12}{:^12}{:^12} {:^12} {:^12}{:^12} ", "pathangle" + idx, "angletangrad" + idx, "anglegrad" + idx, "gradV" + idx, "RepForce" + idx, "MaxAtomForce" + idx); } @@ -262,20 +262,20 @@ void NEB::run() } if (ulogfile) { - fmt::print(ulogfile, " Step {:^14} {:^14} {:^14} {:^14} {:^14} {:^14} {:^14} {:^14} ", + utils::print(ulogfile, " Step {:^14} {:^14} {:^14} {:^14} {:^14} {:^14} {:^14} {:^14} ", "MaxReplicaForce", "MaxAtomForce", "GradV0", "GradV1", "GradVc", "EBF", "EBR", "RDT"); if (print_mode != TERSE) { for (int i = 1; i <= nreplica; ++i) - fmt::print(ulogfile, "{:^14} {:^14} ", "RD" + std::to_string(i), + utils::print(ulogfile, "{:^14} {:^14} ", "RD" + std::to_string(i), "PE" + std::to_string(i)); } if (print_mode == VERBOSE) { for (int i = 1; i <= nreplica; ++i) { auto idx = std::to_string(i); - fmt::print(ulogfile, "{:^12}{:^12}{:^12} {:^12} {:^12}{:^12} ", "pathangle" + idx, + utils::print(ulogfile, "{:^12}{:^12}{:^12} {:^12} {:^12}{:^12} ", "pathangle" + idx, "angletangrad" + idx, "anglegrad" + idx, "gradV" + idx, "RepForce" + idx, "MaxAtomForce" + idx); } @@ -340,19 +340,19 @@ void NEB::run() if (me_universe == 0) { if (uscreen) { - fmt::print(uscreen, " Step {:^14} {:^14} {:^14} {:^14} {:^14} {:^14} {:^14} {:^14} ", + utils::print(uscreen, " Step {:^14} {:^14} {:^14} {:^14} {:^14} {:^14} {:^14} {:^14} ", "MaxReplicaForce", "MaxAtomForce", "GradV0", "GradV1", "GradVc", "EBF", "EBR", "RDT"); if (print_mode != TERSE) { for (int i = 1; i <= nreplica; ++i) - fmt::print(uscreen, "{:^14} {:^14} ", "RD" + std::to_string(i), "PE" + std::to_string(i)); + utils::print(uscreen, "{:^14} {:^14} ", "RD" + std::to_string(i), "PE" + std::to_string(i)); } if (print_mode == VERBOSE) { for (int i = 1; i <= nreplica; ++i) { auto idx = std::to_string(i); - fmt::print(uscreen, "{:^12}{:^12}{:^12} {:^12} {:^12}{:^12} ", "pathangle" + idx, + utils::print(uscreen, "{:^12}{:^12}{:^12} {:^12} {:^12}{:^12} ", "pathangle" + idx, "angletangrad" + idx, "anglegrad" + idx, "gradV" + idx, "RepForce" + idx, "MaxAtomForce" + idx); } @@ -361,20 +361,20 @@ void NEB::run() } if (ulogfile) { - fmt::print(ulogfile, " Step {:^14} {:^14} {:^14} {:^14} {:^14} {:^14} {:^14} {:^14} ", + utils::print(ulogfile, " Step {:^14} {:^14} {:^14} {:^14} {:^14} {:^14} {:^14} {:^14} ", "MaxReplicaForce", "MaxAtomForce", "GradV0", "GradV1", "GradVc", "EBF", "EBR", "RDT"); if (print_mode != TERSE) { for (int i = 1; i <= nreplica; ++i) - fmt::print(ulogfile, "{:^14} {:^14} ", "RD" + std::to_string(i), + utils::print(ulogfile, "{:^14} {:^14} ", "RD" + std::to_string(i), "PE" + std::to_string(i)); } if (print_mode == VERBOSE) { for (int i = 1; i <= nreplica; ++i) { auto idx = std::to_string(i); - fmt::print(ulogfile, "{:^12}{:^12}{:^12} {:^12} {:^12}{:^12} ", "pathangle" + idx, + utils::print(ulogfile, "{:^12}{:^12}{:^12} {:^12} {:^12}{:^12} ", "pathangle" + idx, "angletangrad" + idx, "anglegrad" + idx, "gradV" + idx, "RepForce" + idx, "MaxAtomForce" + idx); } diff --git a/src/REPLICA/prd.cpp b/src/REPLICA/prd.cpp index 252f74a4e3..91150d8a38 100644 --- a/src/REPLICA/prd.cpp +++ b/src/REPLICA/prd.cpp @@ -417,8 +417,8 @@ void PRD::command(int narg, char **arg) if (me_universe == 0) { auto mesg = fmt::format("Loop time of {} on {} procs for {} steps with {} atoms\n", timer->get_wall(Timer::TOTAL), nprocs_universe, nsteps,atom->natoms); - if (universe->uscreen) fmt::print(universe->uscreen, mesg); - if (universe->ulogfile) fmt::print(universe->ulogfile, mesg); + if (universe->uscreen) utils::print(universe->uscreen, mesg); + if (universe->ulogfile) utils::print(universe->ulogfile, mesg); } if (me == 0) utils::logmesg(lmp,"\nPRD done\n"); @@ -725,8 +725,8 @@ void PRD::log_event() fix_event->event_number, fix_event->correlated_event, fix_event->ncoincident, fix_event->replica_number); - if (universe->uscreen) fmt::print(universe->uscreen, mesg); - if (universe->ulogfile) fmt::print(universe->ulogfile, mesg); + if (universe->uscreen) utils::print(universe->uscreen, mesg); + if (universe->ulogfile) utils::print(universe->ulogfile, mesg); } } diff --git a/src/REPLICA/tad.cpp b/src/REPLICA/tad.cpp index b9b04a63d5..38ddfceb84 100644 --- a/src/REPLICA/tad.cpp +++ b/src/REPLICA/tad.cpp @@ -366,8 +366,8 @@ void TAD::command(int narg, char **arg) if (me_universe == 0) { auto mesg = fmt::format("Loop time of {} on {} procs for {} steps with {} atoms\n", timer->get_wall(Timer::TOTAL), nprocs_universe, nsteps,atom->natoms); - if (universe->uscreen) fmt::print(universe->uscreen, mesg); - if (universe->ulogfile) fmt::print(universe->ulogfile, mesg); + if (universe->uscreen) utils::print(universe->uscreen, mesg); + if (universe->ulogfile) utils::print(universe->ulogfile, mesg); } if ((me_universe == 0) && ulogfile_neb) fclose(ulogfile_neb); @@ -504,8 +504,8 @@ void TAD::log_event(int ievent) fix_event->event_number, ievent, "E ", fix_event->ebarrier, tfrac, fix_event->tlo, deltfirst); - if (universe->uscreen) fmt::print(universe->uscreen, mesg); - if (universe->ulogfile) fmt::print(universe->ulogfile, mesg); + if (universe->uscreen) utils::print(universe->uscreen, mesg); + if (universe->ulogfile) utils::print(universe->ulogfile, mesg); } // dump snapshot of quenched coords @@ -895,8 +895,8 @@ void TAD::compute_tlo(int ievent) fix_event->event_number, ievent, statstr, ebarrier, tfrac, fix_event->tlo, deltlo); - if (universe->uscreen) fmt::print(universe->uscreen, mesg); - if (universe->ulogfile) fmt::print(universe->ulogfile, mesg); + if (universe->uscreen) utils::print(universe->uscreen, mesg); + if (universe->ulogfile) utils::print(universe->ulogfile, mesg); } } diff --git a/src/RIGID/fix_rigid.cpp b/src/RIGID/fix_rigid.cpp index fc99e637f9..b0c6d46ee4 100644 --- a/src/RIGID/fix_rigid.cpp +++ b/src/RIGID/fix_rigid.cpp @@ -1,3 +1,4 @@ + /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -2436,8 +2437,8 @@ void FixRigid::write_restart_file(const char *file) if (fp == nullptr) error->one(FLERR,"Cannot open fix rigid restart file {}: {}",outfile,utils::getsyserror()); - fmt::print(fp,"# fix rigid mass, COM, inertia tensor info for {} bodies on timestep {}\n\n",nbody,update->ntimestep); - fmt::print(fp,"{}\n",nbody); + utils::print(fp,"# fix rigid mass, COM, inertia tensor info for {} bodies on timestep {}\n\n",nbody,update->ntimestep); + utils::print(fp,"{}\n",nbody); // compute I tensor against xyz axes from diagonalized I and current quat // Ispace = P Idiag P_transpose diff --git a/src/RIGID/fix_rigid_small.cpp b/src/RIGID/fix_rigid_small.cpp index 0bfd8032c5..6ba2e5eb1c 100644 --- a/src/RIGID/fix_rigid_small.cpp +++ b/src/RIGID/fix_rigid_small.cpp @@ -2625,9 +2625,9 @@ void FixRigidSmall::write_restart_file(const char *file) error->one(FLERR, "Cannot open fix {} restart file {}: {}", style, outfile, utils::getsyserror()); - fmt::print(fp,"# fix rigid mass, COM, inertia tensor info for " + utils::print(fp,"# fix rigid mass, COM, inertia tensor info for " "{} bodies on timestep {}\n\n",nbody,update->ntimestep); - fmt::print(fp,"{}\n",nbody); + utils::print(fp,"{}\n",nbody); } // communication buffer for all my rigid body info diff --git a/src/SPIN/neb_spin.cpp b/src/SPIN/neb_spin.cpp index b1b9dc077e..00b92b906a 100644 --- a/src/SPIN/neb_spin.cpp +++ b/src/SPIN/neb_spin.cpp @@ -805,7 +805,7 @@ void NEBSpin::print_status() FILE *uscreen = universe->uscreen; FILE *ulogfile = universe->ulogfile; if (uscreen) { - fmt::print(uscreen,"{} {:12.8g} {:12.8g} ",update->ntimestep,fmaxreplica,fmaxatom); + utils::print(uscreen,"{} {:12.8g} {:12.8g} ",update->ntimestep,fmaxreplica,fmaxatom); fprintf(uscreen,"%12.8g %12.8g %12.8g ",gradvnorm0,gradvnorm1,gradvnormc); fprintf(uscreen,"%12.8g %12.8g %12.8g ",ebf,ebr,endpt); for (int i = 0; i < nreplica; i++) @@ -819,7 +819,7 @@ void NEBSpin::print_status() } if (ulogfile) { - fmt::print(ulogfile,"{} {:12.8} {:12.8g} ",update->ntimestep,fmaxreplica,fmaxatom); + utils::print(ulogfile,"{} {:12.8} {:12.8g} ",update->ntimestep,fmaxreplica,fmaxatom); fprintf(ulogfile,"%12.8g %12.8g %12.8g ",gradvnorm0,gradvnorm1,gradvnormc); fprintf(ulogfile,"%12.8g %12.8g %12.8g ",ebf,ebr,endpt); for (int i = 0; i < nreplica; i++) diff --git a/src/SRD/fix_srd.cpp b/src/SRD/fix_srd.cpp index 9b153a1c28..6b8ce1e9d6 100644 --- a/src/SRD/fix_srd.cpp +++ b/src/SRD/fix_srd.cpp @@ -3956,7 +3956,7 @@ void FixSRD::print_collision(int i, int j, int ibounce, double t_remain, double double **v = atom->v; if (type != WALL) { - fmt::print("COLLISION between SRD {} and BIG {}\n", atom->tag[i], atom->tag[j]); + utils::print("COLLISION between SRD {} and BIG {}\n", atom->tag[i], atom->tag[j]); printf(" bounce # = %d\n", ibounce + 1); printf(" local indices: %d %d\n", i, j); printf(" timestep = %g\n", dt); @@ -3997,7 +3997,7 @@ void FixSRD::print_collision(int i, int j, int ibounce, double t_remain, double } else { int dim = wallwhich[j] / 2; - fmt::print("COLLISION between SRD {} and WALL {}\n", atom->tag[i], j); + utils::print("COLLISION between SRD {} and WALL {}\n", atom->tag[i], j); printf(" bounce # = %d\n", ibounce + 1); printf(" local indices: %d %d\n", i, j); printf(" timestep = %g\n", dt); diff --git a/src/UEF/dump_cfg_uef.cpp b/src/UEF/dump_cfg_uef.cpp index 776c4675f3..f2a9ae69aa 100644 --- a/src/UEF/dump_cfg_uef.cpp +++ b/src/UEF/dump_cfg_uef.cpp @@ -84,7 +84,7 @@ void DumpCFGUef::write_header(bigint n) if (atom->peri_flag) scale = atom->pdscale; else if (unwrapflag == 1) scale = UNWRAPEXPAND; - fmt::print(fp,"Number of particles = {}\n",n); + utils::print(fp,"Number of particles = {}\n",n); fprintf(fp,"A = %g Angstrom (basic length-scale)\n",scale); // in box[][] columns are cell edges // in H0, rows are cell edges diff --git a/src/angle_write.cpp b/src/angle_write.cpp index 1be5f1acac..863183995b 100644 --- a/src/angle_write.cpp +++ b/src/angle_write.cpp @@ -106,7 +106,7 @@ void AngleWrite::command(int narg, char **arg) utils::current_date()); fp = fopen(table_file.c_str(), "w"); if (fp) - fmt::print(fp, "# DATE: {} UNITS: {} Created by angle_write\n", utils::current_date(), + utils::print(fp, "# DATE: {} UNITS: {} Created by angle_write\n", utils::current_date(), update->unit_style); } if (fp == nullptr) @@ -173,9 +173,9 @@ void AngleWrite::command(int narg, char **arg) // evaluate energy and force at each of N distances - fmt::print(fp, "# Angle potential {} for angle type {}: i,theta,energy,force\n", + utils::print(fp, "# Angle potential {} for angle type {}: i,theta,energy,force\n", force->angle_style, atype); - fmt::print(fp, "\n{}\nN {} EQ {:.15g}\n\n", keyword, n, theta0); + utils::print(fp, "\n{}\nN {} EQ {:.15g}\n\n", keyword, n, theta0); #define GET_ENERGY(myphi, mytheta) \ theta = mytheta; \ diff --git a/src/atom_vec.cpp b/src/atom_vec.cpp index 0529d5cb54..bdcbc90997 100644 --- a/src/atom_vec.cpp +++ b/src/atom_vec.cpp @@ -1797,7 +1797,7 @@ void AtomVec::write_data(FILE *fp, int n, double **buf) int i, j, m, nn, datatype, cols; for (i = 0; i < n; i++) { - fmt::print(fp, "{}", ubuf(buf[i][0]).i); + utils::print(fp, "{}", ubuf(buf[i][0]).i); j = 1; for (nn = 1; nn < ndata_atom; nn++) { @@ -1805,30 +1805,30 @@ void AtomVec::write_data(FILE *fp, int n, double **buf) cols = mdata_atom.cols[nn]; if (datatype == Atom::DOUBLE) { if (cols == 0) { - fmt::print(fp, " {:.16}", buf[i][j++]); + utils::print(fp, " {:.16}", buf[i][j++]); } else { - for (m = 0; m < cols; m++) fmt::print(fp, " {}", buf[i][j++]); + for (m = 0; m < cols; m++) utils::print(fp, " {}", buf[i][j++]); } } else if (datatype == Atom::INT) { if (cols == 0) { if (atom->types_style == Atom::LABELS && atom->peratom[mdata_atom.index[nn]].name == "type") { - fmt::print(fp, " {}", atom->lmap->typelabel[ubuf(buf[i][j++]).i - 1]); + utils::print(fp, " {}", atom->lmap->typelabel[ubuf(buf[i][j++]).i - 1]); } else - fmt::print(fp, " {}", ubuf(buf[i][j++]).i); + utils::print(fp, " {}", ubuf(buf[i][j++]).i); } else { - for (m = 0; m < cols; m++) fmt::print(fp, " {}", ubuf(buf[i][j++]).i); + for (m = 0; m < cols; m++) utils::print(fp, " {}", ubuf(buf[i][j++]).i); } } else if (datatype == Atom::BIGINT) { if (cols == 0) { - fmt::print(fp, " {}", ubuf(buf[i][j++]).i); + utils::print(fp, " {}", ubuf(buf[i][j++]).i); } else { - for (m = 0; m < cols; m++) fmt::print(fp, " {}", ubuf(buf[i][j++]).i); + for (m = 0; m < cols; m++) utils::print(fp, " {}", ubuf(buf[i][j++]).i); } } } - fmt::print(fp, " {} {} {}\n", ubuf(buf[i][j]).i, ubuf(buf[i][j + 1]).i, ubuf(buf[i][j + 2]).i); + utils::print(fp, " {} {} {}\n", ubuf(buf[i][j]).i, ubuf(buf[i][j + 1]).i, ubuf(buf[i][j + 2]).i); } } @@ -1940,7 +1940,7 @@ void AtomVec::write_vel(FILE *fp, int n, double **buf) int i, j, m, nn, datatype, cols; for (i = 0; i < n; i++) { - fmt::print(fp, "{}", ubuf(buf[i][0]).i); + utils::print(fp, "{}", ubuf(buf[i][0]).i); j = 1; for (nn = 1; nn < ndata_vel; nn++) { @@ -1948,21 +1948,21 @@ void AtomVec::write_vel(FILE *fp, int n, double **buf) cols = mdata_vel.cols[nn]; if (datatype == Atom::DOUBLE) { if (cols == 0) { - fmt::print(fp, " {}", buf[i][j++]); + utils::print(fp, " {}", buf[i][j++]); } else { - for (m = 0; m < cols; m++) fmt::print(fp, " {}", buf[i][j++]); + for (m = 0; m < cols; m++) utils::print(fp, " {}", buf[i][j++]); } } else if (datatype == Atom::INT) { if (cols == 0) { - fmt::print(fp, " {}", ubuf(buf[i][j++]).i); + utils::print(fp, " {}", ubuf(buf[i][j++]).i); } else { - for (m = 0; m < cols; m++) fmt::print(fp, " {}", ubuf(buf[i][j++]).i); + for (m = 0; m < cols; m++) utils::print(fp, " {}", ubuf(buf[i][j++]).i); } } else if (datatype == Atom::BIGINT) { if (cols == 0) { - fmt::print(fp, " {}", ubuf(buf[i][j++]).i); + utils::print(fp, " {}", ubuf(buf[i][j++]).i); } else { - for (m = 0; m < cols; m++) fmt::print(fp, " {}", ubuf(buf[i][j++]).i); + for (m = 0; m < cols; m++) utils::print(fp, " {}", ubuf(buf[i][j++]).i); } } } @@ -2026,7 +2026,7 @@ void AtomVec::write_bond(FILE *fp, int n, tagint **buf, int index) for (int i = 0; i < n; i++) { typestr = std::to_string(buf[i][0]); if (atom->types_style == Atom::LABELS) typestr = atom->lmap->btypelabel[buf[i][0] - 1]; - fmt::print(fp, "{} {} {} {}\n", index, typestr, buf[i][1], buf[i][2]); + utils::print(fp, "{} {} {} {}\n", index, typestr, buf[i][1], buf[i][2]); index++; } } @@ -2091,7 +2091,7 @@ void AtomVec::write_angle(FILE *fp, int n, tagint **buf, int index) for (int i = 0; i < n; i++) { typestr = std::to_string(buf[i][0]); if (atom->types_style == Atom::LABELS) typestr = atom->lmap->atypelabel[buf[i][0] - 1]; - fmt::print(fp, "{} {} {} {} {}\n", index, typestr, buf[i][1], buf[i][2], buf[i][3]); + utils::print(fp, "{} {} {} {} {}\n", index, typestr, buf[i][1], buf[i][2], buf[i][3]); index++; } } @@ -2154,7 +2154,7 @@ void AtomVec::write_dihedral(FILE *fp, int n, tagint **buf, int index) for (int i = 0; i < n; i++) { typestr = std::to_string(buf[i][0]); if (atom->types_style == Atom::LABELS) typestr = atom->lmap->dtypelabel[buf[i][0] - 1]; - fmt::print(fp, "{} {} {} {} {} {}\n", index, typestr, buf[i][1], buf[i][2], buf[i][3], + utils::print(fp, "{} {} {} {} {} {}\n", index, typestr, buf[i][1], buf[i][2], buf[i][3], buf[i][4]); index++; } @@ -2218,7 +2218,7 @@ void AtomVec::write_improper(FILE *fp, int n, tagint **buf, int index) for (int i = 0; i < n; i++) { typestr = std::to_string(buf[i][0]); if (atom->types_style == Atom::LABELS) typestr = atom->lmap->itypelabel[buf[i][0] - 1]; - fmt::print(fp, "{} {} {} {} {} {}\n", index, typestr, buf[i][1], buf[i][2], buf[i][3], + utils::print(fp, "{} {} {} {} {} {}\n", index, typestr, buf[i][1], buf[i][2], buf[i][3], buf[i][4]); index++; } diff --git a/src/atom_vec_ellipsoid.cpp b/src/atom_vec_ellipsoid.cpp index 417c3cf5fa..cd54729798 100644 --- a/src/atom_vec_ellipsoid.cpp +++ b/src/atom_vec_ellipsoid.cpp @@ -530,7 +530,7 @@ void AtomVecEllipsoid::write_data_bonus(FILE *fp, int n, double *buf, int /*flag { int i = 0; while (i < n) { - fmt::print(fp, "{} {} {} {} {} {} {} {}\n", ubuf(buf[i]).i, buf[i + 1], buf[i + 2], buf[i + 3], + utils::print(fp, "{} {} {} {} {} {} {} {}\n", ubuf(buf[i]).i, buf[i + 1], buf[i + 2], buf[i + 3], buf[i + 4], buf[i + 5], buf[i + 6], buf[i + 7]); i += size_data_bonus; } diff --git a/src/atom_vec_line.cpp b/src/atom_vec_line.cpp index 6ec4836770..ef5056c93c 100644 --- a/src/atom_vec_line.cpp +++ b/src/atom_vec_line.cpp @@ -564,7 +564,7 @@ void AtomVecLine::write_data_bonus(FILE *fp, int n, double *buf, int /*flag*/) { int i = 0; while (i < n) { - fmt::print(fp, "{} {} {} {} {}\n", ubuf(buf[i]).i, buf[i + 1], buf[i + 2], buf[i + 3], + utils::print(fp, "{} {} {} {} {}\n", ubuf(buf[i]).i, buf[i + 1], buf[i + 2], buf[i + 3], buf[i + 4]); i += size_data_bonus; } diff --git a/src/atom_vec_tri.cpp b/src/atom_vec_tri.cpp index 888ed954fc..21e7682b32 100644 --- a/src/atom_vec_tri.cpp +++ b/src/atom_vec_tri.cpp @@ -780,7 +780,7 @@ void AtomVecTri::write_data_bonus(FILE *fp, int n, double *buf, int /*flag*/) { int i = 0; while (i < n) { - fmt::print(fp, "{} {} {} {} {} {} {} {} {} {}\n", ubuf(buf[i]).i, buf[i + 1], buf[i + 2], + utils::print(fp, "{} {} {} {} {} {} {} {} {} {}\n", ubuf(buf[i]).i, buf[i + 1], buf[i + 2], buf[i + 3], buf[i + 4], buf[i + 5], buf[i + 6], buf[i + 7], buf[i + 8], buf[i + 9]); i += size_data_bonus; } diff --git a/src/balance.cpp b/src/balance.cpp index 42463752f9..fa4e68a8b8 100644 --- a/src/balance.cpp +++ b/src/balance.cpp @@ -1219,7 +1219,7 @@ void Balance::dumpout(bigint tstep) double *boxlo = domain->boxlo; double *boxhi = domain->boxhi; - fmt::print(fp,"ITEM: TIMESTEP\n{}\n",tstep); + utils::print(fp,"ITEM: TIMESTEP\n{}\n",tstep); fprintf(fp,"ITEM: NUMBER OF NODES\n"); if (dimension == 2) fprintf(fp,"%d\n",4*nprocs); else fprintf(fp,"%d\n",8*nprocs); @@ -1294,7 +1294,7 @@ void Balance::dumpout(bigint tstep) // write out one square/cube per processor for 2d/3d - fmt::print(fp,"ITEM: TIMESTEP\n{}\n",tstep); + utils::print(fp,"ITEM: TIMESTEP\n{}\n",tstep); if (dimension == 2) fprintf(fp,"ITEM: NUMBER OF SQUARES\n"); else fprintf(fp,"ITEM: NUMBER OF CUBES\n"); fprintf(fp,"%d\n",nprocs); @@ -1339,13 +1339,13 @@ void Balance::debug_shift_output(int idim, int m, int np, double *split) fprintf(stderr,"Dimension %s, Iteration %d\n",dim,m); fprintf(stderr," Count:"); - for (i = 0; i <= np; i++) fmt::print(stderr," {}",count[i]); + for (i = 0; i <= np; i++) utils::print(stderr," {}",count[i]); fprintf(stderr,"\n"); fprintf(stderr," Sum:"); - for (i = 0; i <= np; i++) fmt::print(stderr," {}",sum[i]); + for (i = 0; i <= np; i++) utils::print(stderr," {}",sum[i]); fprintf(stderr,"\n"); fprintf(stderr," Target:"); - for (i = 0; i <= np; i++) fmt::print(stderr," {}",target[i]); + for (i = 0; i <= np; i++) utils::print(stderr," {}",target[i]); fprintf(stderr,"\n"); fprintf(stderr," Actual cut:"); for (i = 0; i <= np; i++) @@ -1358,13 +1358,13 @@ void Balance::debug_shift_output(int idim, int m, int np, double *split) for (i = 0; i <= np; i++) fprintf(stderr," %g",lo[i]); fprintf(stderr,"\n"); fprintf(stderr," Low-sum:"); - for (i = 0; i <= np; i++) fmt::print(stderr," {}",losum[i]); + for (i = 0; i <= np; i++) utils::print(stderr," {}",losum[i]); fprintf(stderr,"\n"); fprintf(stderr," Hi:"); for (i = 0; i <= np; i++) fprintf(stderr," %g",hi[i]); fprintf(stderr,"\n"); fprintf(stderr," Hi-sum:"); - for (i = 0; i <= np; i++) fmt::print(stderr," {}",hisum[i]); + for (i = 0; i <= np; i++) utils::print(stderr," {}",hisum[i]); fprintf(stderr,"\n"); fprintf(stderr," Delta:"); for (i = 0; i < np; i++) fprintf(stderr," %g",split[i+1]-split[i]); diff --git a/src/bond.cpp b/src/bond.cpp index e0ca37aa73..f5af30062e 100644 --- a/src/bond.cpp +++ b/src/bond.cpp @@ -388,7 +388,7 @@ void Bond::write_file(int narg, char **arg) utils::current_date()); fp = fopen(table_file.c_str(), "w"); if (fp) - fmt::print(fp, "# DATE: {} UNITS: {} Created by bond_write\n", utils::current_date(), + utils::print(fp, "# DATE: {} UNITS: {} Created by bond_write\n", utils::current_date(), update->unit_style); } if (fp == nullptr) diff --git a/src/dihedral_write.cpp b/src/dihedral_write.cpp index 51041c46fc..11d283dc27 100644 --- a/src/dihedral_write.cpp +++ b/src/dihedral_write.cpp @@ -107,7 +107,7 @@ void DihedralWrite::command(int narg, char **arg) utils::current_date()); fp = fopen(table_file.c_str(), "w"); if (fp) - fmt::print(fp, "# DATE: {} UNITS: {} Created by dihedral_write\n", utils::current_date(), + utils::print(fp, "# DATE: {} UNITS: {} Created by dihedral_write\n", utils::current_date(), update->unit_style); } if (fp == nullptr) @@ -169,9 +169,9 @@ void DihedralWrite::command(int narg, char **arg) // evaluate energy and force at each of N distances - fmt::print(fp, "# Dihedral potential {} for dihedral type {}: i,theta,energy,force\n", + utils::print(fp, "# Dihedral potential {} for dihedral type {}: i,theta,energy,force\n", force->dihedral_style, dtype); - fmt::print(fp, "\n{}\nN {} DEGREES\n\n", keyword, n); + utils::print(fp, "\n{}\nN {} DEGREES\n\n", keyword, n); #define GET_ENERGY(myphi, mytheta) \ theta = mytheta; \ diff --git a/src/dump_atom.cpp b/src/dump_atom.cpp index 2238a3a81d..e81157b4ad 100644 --- a/src/dump_atom.cpp +++ b/src/dump_atom.cpp @@ -369,19 +369,19 @@ void DumpAtom::header_item(bigint ndump) { if (unit_flag && !unit_count) { ++unit_count; - fmt::print(fp,"ITEM: UNITS\n{}\n",update->unit_style); + utils::print(fp,"ITEM: UNITS\n{}\n",update->unit_style); } - if (time_flag) fmt::print(fp,"ITEM: TIME\n{:.16}\n",compute_time()); + if (time_flag) utils::print(fp,"ITEM: TIME\n{:.16}\n",compute_time()); - fmt::print(fp, "ITEM: TIMESTEP\n{}\nITEM: NUMBER OF ATOMS\n{}\n", update->ntimestep, ndump); + utils::print(fp, "ITEM: TIMESTEP\n{}\nITEM: NUMBER OF ATOMS\n{}\n", update->ntimestep, ndump); - fmt::print(fp,"ITEM: BOX BOUNDS {}\n" + utils::print(fp,"ITEM: BOX BOUNDS {}\n" "{:>1.16e} {:>1.16e}\n" "{:>1.16e} {:>1.16e}\n" "{:>1.16e} {:>1.16e}\n", boundstr,boxxlo,boxxhi,boxylo,boxyhi,boxzlo,boxzhi); - fmt::print(fp,"ITEM: ATOMS {}\n",columns); + utils::print(fp,"ITEM: ATOMS {}\n",columns); } /* ---------------------------------------------------------------------- */ @@ -390,19 +390,19 @@ void DumpAtom::header_item_triclinic(bigint ndump) { if (unit_flag && !unit_count) { ++unit_count; - fmt::print(fp,"ITEM: UNITS\n{}\n",update->unit_style); + utils::print(fp,"ITEM: UNITS\n{}\n",update->unit_style); } - if (time_flag) fmt::print(fp,"ITEM: TIME\n{:.16}\n",compute_time()); + if (time_flag) utils::print(fp,"ITEM: TIME\n{:.16}\n",compute_time()); - fmt::print(fp, "ITEM: TIMESTEP\n{}\nITEM: NUMBER OF ATOMS\n{}\n", update->ntimestep, ndump); + utils::print(fp, "ITEM: TIMESTEP\n{}\nITEM: NUMBER OF ATOMS\n{}\n", update->ntimestep, ndump); - fmt::print(fp,"ITEM: BOX BOUNDS xy xz yz {}\n" + utils::print(fp,"ITEM: BOX BOUNDS xy xz yz {}\n" "{:>1.16e} {:>1.16e} {:>1.16e}\n" "{:>1.16e} {:>1.16e} {:>1.16e}\n" "{:>1.16e} {:>1.16e} {:>1.16e}\n", boundstr,boxxlo,boxxhi,boxxy,boxylo,boxyhi,boxxz,boxzlo,boxzhi,boxyz); - fmt::print(fp,"ITEM: ATOMS {}\n",columns); + utils::print(fp,"ITEM: ATOMS {}\n",columns); } /* ---------------------------------------------------------------------- */ @@ -411,13 +411,13 @@ void DumpAtom::header_item_triclinic_general(bigint ndump) { if (unit_flag && !unit_count) { ++unit_count; - fmt::print(fp,"ITEM: UNITS\n{}\n",update->unit_style); + utils::print(fp,"ITEM: UNITS\n{}\n",update->unit_style); } - if (time_flag) fmt::print(fp,"ITEM: TIME\n{:.16}\n",compute_time()); + if (time_flag) utils::print(fp,"ITEM: TIME\n{:.16}\n",compute_time()); - fmt::print(fp,"ITEM: TIMESTEP\n{}\nITEM: NUMBER OF ATOMS\n{}\n", update->ntimestep, ndump); + utils::print(fp,"ITEM: TIMESTEP\n{}\nITEM: NUMBER OF ATOMS\n{}\n", update->ntimestep, ndump); - fmt::print(fp,"ITEM: BOX BOUNDS abc origin {}\n" + utils::print(fp,"ITEM: BOX BOUNDS abc origin {}\n" "{:>1.16e} {:>1.16e} {:>1.16e} {:>1.16e}\n" "{:>1.16e} {:>1.16e} {:>1.16e} {:>1.16e}\n" "{:>1.16e} {:>1.16e} {:>1.16e} {:>1.16e}\n", @@ -426,7 +426,7 @@ void DumpAtom::header_item_triclinic_general(bigint ndump) domain->bvec[0],domain->bvec[1],domain->bvec[2],domain->boxlo[1], domain->cvec[0],domain->cvec[1],domain->cvec[2],domain->boxlo[2]); - fmt::print(fp,"ITEM: ATOMS {}\n",columns); + utils::print(fp,"ITEM: ATOMS {}\n",columns); } /* ---------------------------------------------------------------------- */ diff --git a/src/dump_cfg.cpp b/src/dump_cfg.cpp index 0d22ece2c3..d756977487 100644 --- a/src/dump_cfg.cpp +++ b/src/dump_cfg.cpp @@ -142,7 +142,7 @@ void DumpCFG::write_header(bigint n) header += fmt::format("auxiliary[{}] = {}\n",i-5,keyword_user[i]); else header += fmt::format("auxiliary[{}] = {}\n",i-5,auxname[i-5]); - fmt::print(fp, header); + utils::print(fp, header); } /* ---------------------------------------------------------------------- diff --git a/src/dump_custom.cpp b/src/dump_custom.cpp index fdba2e5477..dd53511e09 100644 --- a/src/dump_custom.cpp +++ b/src/dump_custom.cpp @@ -647,21 +647,21 @@ void DumpCustom::header_item(bigint ndump) { if (unit_flag && !unit_count) { ++unit_count; - fmt::print(fp,"ITEM: UNITS\n{}\n",update->unit_style); + utils::print(fp,"ITEM: UNITS\n{}\n",update->unit_style); } - if (time_flag) fmt::print(fp,"ITEM: TIME\n{:.16}\n",compute_time()); + if (time_flag) utils::print(fp,"ITEM: TIME\n{:.16}\n",compute_time()); - fmt::print(fp,"ITEM: TIMESTEP\n{}\n" + utils::print(fp,"ITEM: TIMESTEP\n{}\n" "ITEM: NUMBER OF ATOMS\n{}\n", update->ntimestep, ndump); - fmt::print(fp,"ITEM: BOX BOUNDS {}\n" + utils::print(fp,"ITEM: BOX BOUNDS {}\n" "{:>1.16e} {:>1.16e}\n" "{:>1.16e} {:>1.16e}\n" "{:>1.16e} {:>1.16e}\n", boundstr,boxxlo,boxxhi,boxylo,boxyhi,boxzlo,boxzhi); - fmt::print(fp,"ITEM: ATOMS {}\n",columns); + utils::print(fp,"ITEM: ATOMS {}\n",columns); } /* ---------------------------------------------------------------------- */ @@ -670,21 +670,21 @@ void DumpCustom::header_item_triclinic(bigint ndump) { if (unit_flag && !unit_count) { ++unit_count; - fmt::print(fp,"ITEM: UNITS\n{}\n",update->unit_style); + utils::print(fp,"ITEM: UNITS\n{}\n",update->unit_style); } - if (time_flag) fmt::print(fp,"ITEM: TIME\n{:.16}\n",compute_time()); + if (time_flag) utils::print(fp,"ITEM: TIME\n{:.16}\n",compute_time()); - fmt::print(fp,"ITEM: TIMESTEP\n{}\n" + utils::print(fp,"ITEM: TIMESTEP\n{}\n" "ITEM: NUMBER OF ATOMS\n{}\n", update->ntimestep, ndump); - fmt::print(fp,"ITEM: BOX BOUNDS xy xz yz {}\n" + utils::print(fp,"ITEM: BOX BOUNDS xy xz yz {}\n" "{:>1.16e} {:>1.16e} {:>1.16e}\n" "{:>1.16e} {:>1.16e} {:>1.16e}\n" "{:>1.16e} {:>1.16e} {:>1.16e}\n", boundstr,boxxlo,boxxhi,boxxy,boxylo,boxyhi,boxxz,boxzlo,boxzhi,boxyz); - fmt::print(fp,"ITEM: ATOMS {}\n",columns); + utils::print(fp,"ITEM: ATOMS {}\n",columns); } /* ---------------------------------------------------------------------- */ @@ -693,13 +693,13 @@ void DumpCustom::header_item_triclinic_general(bigint ndump) { if (unit_flag && !unit_count) { ++unit_count; - fmt::print(fp,"ITEM: UNITS\n{}\n",update->unit_style); + utils::print(fp,"ITEM: UNITS\n{}\n",update->unit_style); } - if (time_flag) fmt::print(fp,"ITEM: TIME\n{:.16}\n",compute_time()); + if (time_flag) utils::print(fp,"ITEM: TIME\n{:.16}\n",compute_time()); - fmt::print(fp,"ITEM: TIMESTEP\n{}\nITEM: NUMBER OF ATOMS\n{}\n", update->ntimestep, ndump); + utils::print(fp,"ITEM: TIMESTEP\n{}\nITEM: NUMBER OF ATOMS\n{}\n", update->ntimestep, ndump); - fmt::print(fp,"ITEM: BOX BOUNDS abc origin {}\n" + utils::print(fp,"ITEM: BOX BOUNDS abc origin {}\n" "{:>1.16e} {:>1.16e} {:>1.16e} {:>1.16e}\n" "{:>1.16e} {:>1.16e} {:>1.16e} {:>1.16e}\n" "{:>1.16e} {:>1.16e} {:>1.16e} {:>1.16e}\n", @@ -708,7 +708,7 @@ void DumpCustom::header_item_triclinic_general(bigint ndump) domain->bvec[0],domain->bvec[1],domain->bvec[2],domain->boxlo[1], domain->cvec[0],domain->cvec[1],domain->cvec[2],domain->boxlo[2]); - fmt::print(fp,"ITEM: ATOMS {}\n",columns); + utils::print(fp,"ITEM: ATOMS {}\n",columns); } /* ---------------------------------------------------------------------- */ diff --git a/src/dump_grid.cpp b/src/dump_grid.cpp index b052712e95..2d3d9a105b 100644 --- a/src/dump_grid.cpp +++ b/src/dump_grid.cpp @@ -431,19 +431,19 @@ void DumpGrid::header_item(bigint /*ndump*/) { if (unit_flag && !unit_count) { ++unit_count; - fmt::print(fp,"ITEM: UNITS\n{}\n",update->unit_style); + utils::print(fp,"ITEM: UNITS\n{}\n",update->unit_style); } - if (time_flag) fmt::print(fp,"ITEM: TIME\n{:.16}\n",compute_time()); + if (time_flag) utils::print(fp,"ITEM: TIME\n{:.16}\n",compute_time()); - fmt::print(fp,"ITEM: TIMESTEP\n{}\n",update->ntimestep); - fmt::print(fp,"ITEM: BOX BOUNDS {}\n" + utils::print(fp,"ITEM: TIMESTEP\n{}\n",update->ntimestep); + utils::print(fp,"ITEM: BOX BOUNDS {}\n" "{:>1.16e} {:>1.16e}\n" "{:>1.16e} {:>1.16e}\n" "{:>1.16e} {:>1.16e}\n", boundstr,boxxlo,boxxhi,boxylo,boxyhi,boxzlo,boxzhi); - fmt::print(fp,"ITEM: DIMENSION\n{}\n",domain->dimension); - fmt::print(fp,"ITEM: GRID SIZE nx ny nz\n{} {} {}\n",nxgrid,nygrid,nzgrid); - fmt::print(fp,"ITEM: GRID CELLS {}\n",columns); + utils::print(fp,"ITEM: DIMENSION\n{}\n",domain->dimension); + utils::print(fp,"ITEM: GRID SIZE nx ny nz\n{} {} {}\n",nxgrid,nygrid,nzgrid); + utils::print(fp,"ITEM: GRID CELLS {}\n",columns); } /* ---------------------------------------------------------------------- */ @@ -452,19 +452,19 @@ void DumpGrid::header_item_triclinic(bigint /*ndump*/) { if (unit_flag && !unit_count) { ++unit_count; - fmt::print(fp,"ITEM: UNITS\n{}\n",update->unit_style); + utils::print(fp,"ITEM: UNITS\n{}\n",update->unit_style); } - if (time_flag) fmt::print(fp,"ITEM: TIME\n{:.16}\n",compute_time()); + if (time_flag) utils::print(fp,"ITEM: TIME\n{:.16}\n",compute_time()); - fmt::print(fp,"ITEM: TIMESTEP\n{}\n",update->ntimestep); - fmt::print(fp,"ITEM: BOX BOUNDS xy xz yz {}\n" + utils::print(fp,"ITEM: TIMESTEP\n{}\n",update->ntimestep); + utils::print(fp,"ITEM: BOX BOUNDS xy xz yz {}\n" "{:>1.16e} {:>1.16e} {:>1.16e}\n" "{:>1.16e} {:>1.16e} {:>1.16e}\n" "{:>1.16e} {:>1.16e} {:>1.16e}\n", boundstr,boxxlo,boxxhi,boxxy,boxylo,boxyhi,boxxz,boxzlo,boxzhi,boxyz); - fmt::print(fp,"ITEM: DIMENSION\n{}\n",domain->dimension); - fmt::print(fp,"ITEM: GRID SIZE nx ny nz\n{} {} {}\n",nxgrid,nygrid,nzgrid); - fmt::print(fp,"ITEM: GRID CELLS {}\n",columns); + utils::print(fp,"ITEM: DIMENSION\n{}\n",domain->dimension); + utils::print(fp,"ITEM: GRID SIZE nx ny nz\n{} {} {}\n",nxgrid,nygrid,nzgrid); + utils::print(fp,"ITEM: GRID CELLS {}\n",columns); } /* ---------------------------------------------------------------------- */ diff --git a/src/dump_local.cpp b/src/dump_local.cpp index bcf2a3a757..7394ec4481 100644 --- a/src/dump_local.cpp +++ b/src/dump_local.cpp @@ -292,29 +292,29 @@ void DumpLocal::write_header(bigint ndump) if (me == 0) { if (unit_flag && !unit_count) { ++unit_count; - fmt::print(fp,"ITEM: UNITS\n{}\n",update->unit_style); + utils::print(fp,"ITEM: UNITS\n{}\n",update->unit_style); } - if (time_flag) fmt::print(fp,"ITEM: TIME\n{:.16}\n",compute_time()); + if (time_flag) utils::print(fp,"ITEM: TIME\n{:.16}\n",compute_time()); - fmt::print(fp,"ITEM: TIMESTEP\n{}\n" + utils::print(fp,"ITEM: TIMESTEP\n{}\n" "ITEM: NUMBER OF {}\n{}\n", update->ntimestep, label, ndump); if (domain->triclinic) { - fmt::print(fp,"ITEM: BOX BOUNDS xy xz yz {}\n" + utils::print(fp,"ITEM: BOX BOUNDS xy xz yz {}\n" "{:>1.16e} {:>1.16e} {:>1.16e}\n" "{:>1.16e} {:>1.16e} {:>1.16e}\n" "{:>1.16e} {:>1.16e} {:>1.16e}\n", boundstr,boxxlo,boxxhi,boxxy,boxylo,boxyhi,boxxz,boxzlo,boxzhi,boxyz); } else { - fmt::print(fp,"ITEM: BOX BOUNDS {}\n" + utils::print(fp,"ITEM: BOX BOUNDS {}\n" "{:>1.16e} {:>1.16e}\n" "{:>1.16e} {:>1.16e}\n" "{:>1.16e} {:>1.16e}\n", boundstr,boxxlo,boxxhi,boxylo,boxyhi,boxzlo,boxzhi); } - fmt::print(fp,"ITEM: {} {}\n", label, columns); + utils::print(fp,"ITEM: {} {}\n", label, columns); } } diff --git a/src/dump_xyz.cpp b/src/dump_xyz.cpp index 84a8ead6fd..69892888bc 100644 --- a/src/dump_xyz.cpp +++ b/src/dump_xyz.cpp @@ -161,8 +161,7 @@ void DumpXYZ::write_header(bigint n) auto header = fmt::format("{}\n Atoms. Timestep: {}", n, update->ntimestep); if (time_flag) header += fmt::format(" Time: {:.6f}", compute_time()); - header += "\n"; - fmt::print(fp, header); + utils::print(fp, header + "\n"); } } diff --git a/src/error.cpp b/src/error.cpp index 6dbd0a20b3..7322c2146d 100644 --- a/src/error.cpp +++ b/src/error.cpp @@ -103,7 +103,7 @@ void Error::universe_warn(const std::string &file, int line, const std::string & ++numwarn; if ((maxwarn != 0) && ((numwarn > maxwarn) || (allwarn > maxwarn) || (maxwarn < 0))) return; if (universe->uscreen) - fmt::print(universe->uscreen,"WARNING on proc {}: {} ({}:{})\n", + utils::print(universe->uscreen,"WARNING on proc {}: {} ({}:{})\n", universe->me,str,truncpath(file),line); } diff --git a/src/fix_ave_chunk.cpp b/src/fix_ave_chunk.cpp index 6a3c2e2032..f5dc36eac9 100644 --- a/src/fix_ave_chunk.cpp +++ b/src/fix_ave_chunk.cpp @@ -902,7 +902,7 @@ void FixAveChunk::end_of_step() if (overwrite) (void) platform::fseek(fp,filepos); double count = 0.0; for (m = 0; m < nchunk; m++) count += count_total[m]; - fmt::print(fp,"{} {} {}\n",ntimestep,nchunk,count); + utils::print(fp,"{} {} {}\n",ntimestep,nchunk,count); int compress = cchunk->compress; int *chunkID = cchunk->chunkID; diff --git a/src/fix_ave_correlate.cpp b/src/fix_ave_correlate.cpp index 08cd673122..a99ffd3d68 100644 --- a/src/fix_ave_correlate.cpp +++ b/src/fix_ave_correlate.cpp @@ -466,7 +466,7 @@ void FixAveCorrelate::end_of_step() if (fp && comm->me == 0) { clearerr(fp); if (overwrite) platform::fseek(fp,filepos); - fmt::print(fp,"{} {}\n",ntimestep,nrepeat); + utils::print(fp,"{} {}\n",ntimestep,nrepeat); for (i = 0; i < nrepeat; i++) { fprintf(fp,"%d %d %d",i+1,i*nevery,count[i]); if (count[i]) diff --git a/src/fix_ave_histo.cpp b/src/fix_ave_histo.cpp index 35fd3fc4f9..53db1e13c6 100644 --- a/src/fix_ave_histo.cpp +++ b/src/fix_ave_histo.cpp @@ -717,7 +717,7 @@ void FixAveHisto::end_of_step() if (fp && comm->me == 0) { clearerr(fp); if (overwrite) (void) platform::fseek(fp,filepos); - fmt::print(fp,"{} {} {} {} {} {}\n",ntimestep,nbins, + utils::print(fp,"{} {} {} {} {} {}\n",ntimestep,nbins, stats_total[0],stats_total[1],stats_total[2],stats_total[3]); if (stats_total[0] != 0.0) for (int i = 0; i < nbins; i++) diff --git a/src/fix_ave_histo_weight.cpp b/src/fix_ave_histo_weight.cpp index c6f9b6ad22..e5a47881a5 100644 --- a/src/fix_ave_histo_weight.cpp +++ b/src/fix_ave_histo_weight.cpp @@ -454,7 +454,7 @@ void FixAveHistoWeight::end_of_step() if (fp && comm->me == 0) { clearerr(fp); if (overwrite) (void) platform::fseek(fp,filepos); - fmt::print(fp,"{} {} {} {} {} {}\n",ntimestep,nbins, + utils::print(fp,"{} {} {} {} {} {}\n",ntimestep,nbins, stats_total[0],stats_total[1],stats_total[2],stats_total[3]); if (stats_total[0] != 0.0) for (int i = 0; i < nbins; i++) diff --git a/src/fix_ave_time.cpp b/src/fix_ave_time.cpp index b48b5cd7ba..ce6587dc27 100644 --- a/src/fix_ave_time.cpp +++ b/src/fix_ave_time.cpp @@ -667,14 +667,14 @@ void FixAveTime::invoke_scalar(bigint ntimestep) if (!yaml_header || overwrite) { yaml_header = true; fputs("keywords: ['Step', ", fp); - for (const auto &val : values) fmt::print(fp, "'{}', ", val.keyword); + for (const auto &val : values) utils::print(fp, "'{}', ", val.keyword); fputs("]\ndata:\n", fp); } - fmt::print(fp, " - [{}, ", ntimestep); - for (i = 0; i < nvalues; i++) fmt::print(fp,"{}, ",vector_total[i]/norm); + utils::print(fp, " - [{}, ", ntimestep); + for (i = 0; i < nvalues; i++) utils::print(fp,"{}, ",vector_total[i]/norm); fputs("]\n", fp); } else { - fmt::print(fp,"{}",ntimestep); + utils::print(fp,"{}",ntimestep); for (i = 0; i < nvalues; i++) fprintf(fp,format,vector_total[i]/norm); fprintf(fp,"\n"); if (ferror(fp)) @@ -885,17 +885,17 @@ void FixAveTime::invoke_vector(bigint ntimestep) if (!yaml_header || overwrite) { yaml_header = true; fputs("keywords: [", fp); - for (const auto &val : values) fmt::print(fp, "'{}', ", val.keyword); + for (const auto &val : values) utils::print(fp, "'{}', ", val.keyword); fputs("]\ndata:\n", fp); } - fmt::print(fp, " {}:\n", ntimestep); + utils::print(fp, " {}:\n", ntimestep); for (int i = 0; i < nrows; i++) { fputs(" - [", fp); - for (int j = 0; j < nvalues; j++) fmt::print(fp,"{}, ",array_total[i][j]/norm); + for (int j = 0; j < nvalues; j++) utils::print(fp,"{}, ",array_total[i][j]/norm); fputs("]\n", fp); } } else { - fmt::print(fp,"{} {}\n",ntimestep,nrows); + utils::print(fp,"{} {}\n",ntimestep,nrows); for (int i = 0; i < nrows; i++) { fprintf(fp,"%d",i+1); for (int j = 0; j < nvalues; j++) fprintf(fp,format,array_total[i][j]/norm); diff --git a/src/fix_print.cpp b/src/fix_print.cpp index 8e0a4a1921..1d60addfa4 100644 --- a/src/fix_print.cpp +++ b/src/fix_print.cpp @@ -181,7 +181,7 @@ void FixPrint::end_of_step() if (comm->me == 0) { if (screenflag) utils::logmesg(lmp, std::string(copy) + "\n"); if (fp) { - fmt::print(fp, "{}\n", copy); + utils::print(fp, "{}\n", copy); fflush(fp); } } diff --git a/src/fix_property_atom.cpp b/src/fix_property_atom.cpp index f88d6551b4..d1cc65adad 100644 --- a/src/fix_property_atom.cpp +++ b/src/fix_property_atom.cpp @@ -543,7 +543,7 @@ void FixPropertyAtom::write_data_section(int /*mth*/, FILE *fp, int n, double ** icol += ncol; } } - fmt::print(fp, line + "\n"); + utils::print(fp, line + "\n"); } } diff --git a/src/fix_restrain.cpp b/src/fix_restrain.cpp index cc95fc93f3..9b157ee90f 100644 --- a/src/fix_restrain.cpp +++ b/src/fix_restrain.cpp @@ -616,7 +616,7 @@ void FixRestrain::restrain_dihedral(int m) me,update->ntimestep,atom->tag[i1], atom->tag[i2],atom->tag[i3],atom->tag[i4]); error->warning(FLERR,str); - fmt::print(screen," 1st atom: {} {} {} {}\n" + utils::print(screen," 1st atom: {} {} {} {}\n" " 2nd atom: {} {} {} {}\n" " 3rd atom: {} {} {} {}\n" " 4th atom: {} {} {} {}\n", diff --git a/src/info.cpp b/src/info.cpp index bf98f77b58..17b1f417ea 100644 --- a/src/info.cpp +++ b/src/info.cpp @@ -270,25 +270,25 @@ void Info::command(int narg, char **arg) fputs("\nInfo-Info-Info-Info-Info-Info-Info-Info-Info-Info-Info\n",out); std::tm now = fmt::localtime(std::time(nullptr)); - fmt::print(out,"Printed on {}", std::asctime(&now)); + utils::print(out,"Printed on {}", std::asctime(&now)); if (flags & CONFIG) { - fmt::print(out,"\nLAMMPS version: {} / {}\n", lmp->version, lmp->num_ver); + utils::print(out,"\nLAMMPS version: {} / {}\n", lmp->version, lmp->num_ver); if (LAMMPS::has_git_info()) - fmt::print(out,"Git info: {} / {} / {}\n", + utils::print(out,"Git info: {} / {} / {}\n", LAMMPS::git_branch(), LAMMPS::git_descriptor(),LAMMPS::git_commit()); - fmt::print(out,"\nOS information: {}\n\n",platform::os_info()); + utils::print(out,"\nOS information: {}\n\n",platform::os_info()); - fmt::print(out,"sizeof(smallint): {}-bit\n" + utils::print(out,"sizeof(smallint): {}-bit\n" "sizeof(imageint): {}-bit\n" "sizeof(tagint): {}-bit\n" "sizeof(bigint): {}-bit\n", sizeof(smallint)*8, sizeof(imageint)*8, sizeof(tagint)*8, sizeof(bigint)*8); - fmt::print(out,"\nCompiler: {} with {}\nC++ standard: {}\n", + utils::print(out,"\nCompiler: {} with {}\nC++ standard: {}\n", platform::compiler_info(),platform::openmp_standard(),platform::cxx_standard()); fputs(get_fmt_info().c_str(), out); @@ -307,7 +307,7 @@ void Info::command(int narg, char **arg) #else // defined(LAMMPS_SMALLSMALL) fputs("-DLAMMPS_SMALLSMALL\n",out); #endif - if (has_gzip_support()) fmt::print(out,"\n{}\n",platform::compress_info()); + if (has_gzip_support()) utils::print(out,"\n{}\n",platform::compress_info()); int ncword, ncline = 0; fputs("\nInstalled packages:\n\n",out); @@ -317,17 +317,17 @@ void Info::command(int narg, char **arg) ncline = 0; fputs("\n",out); } - fmt::print(out,"{} ",*pkg); + utils::print(out,"{} ",*pkg); ncline += ncword + 1; } fputs("\n",out); } if (flags & ACCELERATOR) { - fmt::print(out,"\nAccelerator configuration:\n\n{}", + utils::print(out,"\nAccelerator configuration:\n\n{}", get_accelerator_info()); if (Info::has_gpu_device()) - fmt::print(out,"\nAvailable GPU devices:\n{}\n",get_gpu_device_info()); + utils::print(out,"\nAvailable GPU devices:\n{}\n",get_gpu_device_info()); } if (flags & MEMORY) { @@ -336,18 +336,18 @@ void Info::command(int narg, char **arg) get_memory_info(meminfo); fputs("\nMemory allocation information (MPI rank 0):\n\n",out); - fmt::print(out,"Total dynamically allocated memory: {:.4} Mbyte\n", + utils::print(out,"Total dynamically allocated memory: {:.4} Mbyte\n", meminfo[0]); #if defined(_WIN32) - fmt::print(out,"Non-shared memory use: {:.4} Mbyte\n",meminfo[1]); - fmt::print(out,"Maximum working set size: {:.4} Mbyte\n",meminfo[2]); + utils::print(out,"Non-shared memory use: {:.4} Mbyte\n",meminfo[1]); + utils::print(out,"Maximum working set size: {:.4} Mbyte\n",meminfo[2]); #else #if defined(__linux__) - fmt::print(out,"Current reserved memory pool size: {:.4} Mbyte\n", + utils::print(out,"Current reserved memory pool size: {:.4} Mbyte\n", meminfo[1]); #endif - fmt::print(out,"Maximum resident set size: {:.4} Mbyte\n",meminfo[2]); + utils::print(out,"Maximum resident set size: {:.4} Mbyte\n",meminfo[2]); #endif } @@ -355,18 +355,18 @@ void Info::command(int narg, char **arg) int major,minor; std::string version = platform::mpi_info(major,minor); - fmt::print(out,"\nCommunication information:\n" + utils::print(out,"\nCommunication information:\n" "MPI library level: MPI v{}.{}\n" "MPI version: {}\n",major,minor,version); - fmt::print(out,"Comm style = {}, Comm layout = {}\n" + utils::print(out,"Comm style = {}, Comm layout = {}\n" "Communicate velocities for ghost atoms = {}\n", commstyles[comm->style], commlayout[comm->layout], comm->ghost_velocity ? "yes" : "no"); if (domain->box_exist) { if (comm->mode == 0) - fmt::print(out,"Communication mode = single\n" + utils::print(out,"Communication mode = single\n" "Communication cutoff = {}\n", comm->get_comm_cutoff()); @@ -381,7 +381,7 @@ void Info::command(int narg, char **arg) } if (comm->cutusermulti) cut = MAX(cut,comm->cutusermulti[i]); - fmt::print(out,"Communication cutoff for collection {} = {:.8}\n", i, cut); + utils::print(out,"Communication cutoff for collection {} = {:.8}\n", i, cut); } } @@ -391,13 +391,13 @@ void Info::command(int narg, char **arg) for (int i=1; i <= atom->ntypes && neighbor->cuttype; ++i) { cut = neighbor->cuttype[i]; if (comm->cutusermultiold) cut = MAX(cut,comm->cutusermultiold[i]); - fmt::print(out,"Communication cutoff for type {} = {:.8}\n", i, cut); + utils::print(out,"Communication cutoff for type {} = {:.8}\n", i, cut); } } } - fmt::print(out,"Nprocs = {}, Nthreads = {}\n",comm->nprocs,comm->nthreads); + utils::print(out,"Nprocs = {}, Nthreads = {}\n",comm->nprocs,comm->nthreads); if (domain->box_exist) - fmt::print(out,"Processor grid = {} x {} x {}\n",comm->procgrid[0], + utils::print(out,"Processor grid = {} x {} x {}\n",comm->procgrid[0], comm->procgrid[1], comm->procgrid[2]); } @@ -408,80 +408,80 @@ void Info::command(int narg, char **arg) if (flags & SYSTEM) { fputs("\nSystem information:\n",out); - fmt::print(out,"Units = {}\n", update->unit_style); - fmt::print(out,"Atom style = {}\n", atom->get_style()); - fmt::print(out,"Atom map = {}\n", mapstyles[atom->map_style]); + utils::print(out,"Units = {}\n", update->unit_style); + utils::print(out,"Atom style = {}\n", atom->get_style()); + utils::print(out,"Atom map = {}\n", mapstyles[atom->map_style]); if (atom->molecular != Atom::ATOMIC) { const char *msg; msg = (atom->molecular == Atom::TEMPLATE) ? "template" : "standard"; - fmt::print(out,"Molecule type = {}\n",msg); + utils::print(out,"Molecule type = {}\n",msg); } - fmt::print(out,"Atoms = {:12}, types = {:8d}, style = {}\n", + utils::print(out,"Atoms = {:12}, types = {:8d}, style = {}\n", atom->natoms, atom->ntypes, force->pair_style); - if (atom->tag_enable) fmt::print(out,"Atoms with atom IDs\n"); - if (atom->molecule) fmt::print(out,"Atoms with molecule IDs\n"); - if (atom->mass) fmt::print(out,"Atoms with per-type masses\n"); - if (atom->rmass) fmt::print(out,"Atoms with per-atom masses\n"); - if (atom->q) fmt::print(out,"Atoms with per-atom charges\n"); + if (atom->tag_enable) utils::print(out,"Atoms with atom IDs\n"); + if (atom->molecule) utils::print(out,"Atoms with molecule IDs\n"); + if (atom->mass) utils::print(out,"Atoms with per-type masses\n"); + if (atom->rmass) utils::print(out,"Atoms with per-atom masses\n"); + if (atom->q) utils::print(out,"Atoms with per-atom charges\n"); if (force->pair && utils::strmatch(force->pair_style,"^hybrid")) { auto hybrid = dynamic_cast(force->pair); - fmt::print(out,"Hybrid sub-styles:"); + utils::print(out,"Hybrid sub-styles:"); for (int i=0; i < hybrid->nstyles; ++i) - fmt::print(out," {}", hybrid->keywords[i]); + utils::print(out," {}", hybrid->keywords[i]); fputc('\n',out); } if (atom->molecular != Atom::ATOMIC) { const char *msg; msg = force->bond_style ? force->bond_style : "none"; - fmt::print(out,"Bonds = {:12}, types = {:8}, style = {}\n", + utils::print(out,"Bonds = {:12}, types = {:8}, style = {}\n", atom->nbonds, atom->nbondtypes, msg); msg = force->angle_style ? force->angle_style : "none"; - fmt::print(out,"Angles = {:12}, types = {:8}, style = {}\n", + utils::print(out,"Angles = {:12}, types = {:8}, style = {}\n", atom->nangles, atom->nangletypes, msg); msg = force->dihedral_style ? force->dihedral_style : "none"; - fmt::print(out,"Dihedrals = {:12}, types = {:8}, style = {}\n", + utils::print(out,"Dihedrals = {:12}, types = {:8}, style = {}\n", atom->ndihedrals, atom->ndihedraltypes, msg); msg = force->improper_style ? force->improper_style : "none"; - fmt::print(out,"Impropers = {:12}, types = {:8}, style = {}\n", + utils::print(out,"Impropers = {:12}, types = {:8}, style = {}\n", atom->nimpropers, atom->nimpropertypes, msg); const double * const special_lj = force->special_lj; const double * const special_coul = force->special_coul; - fmt::print(out,"Special bond factors lj = {:<8} {:<8} {:<8}\n" + utils::print(out,"Special bond factors lj = {:<8} {:<8} {:<8}\n" "Special bond factors coul = {:<8} {:<8} {:<8}\n", special_lj[1],special_lj[2],special_lj[3], special_coul[1],special_coul[2],special_coul[3]); } - fmt::print(out,"Kspace style = {}\n", + utils::print(out,"Kspace style = {}\n", force->kspace ? force->kspace_style : "none"); if (domain->box_exist) { - fmt::print(out,"\nDimensions = {}\n",domain->dimension); - fmt::print(out,"{} box = {:.8} x {:.8} x {:.8}\n", + utils::print(out,"\nDimensions = {}\n",domain->dimension); + utils::print(out,"{} box = {:.8} x {:.8} x {:.8}\n", domain->triclinic ? "Triclinic" : "Orthogonal", domain->xprd, domain->yprd, domain->zprd); - fmt::print(out,"Boundaries = {},{} {},{} {},{}\n", + utils::print(out,"Boundaries = {},{} {},{} {},{}\n", bstyles[domain->boundary[0][0]],bstyles[domain->boundary[0][1]], bstyles[domain->boundary[1][0]],bstyles[domain->boundary[1][1]], bstyles[domain->boundary[2][0]],bstyles[domain->boundary[2][1]]); - fmt::print(out,"xlo, xhi = {:.8}, {:.8}\n", domain->boxlo[0], domain->boxhi[0]); - fmt::print(out,"ylo, yhi = {:.8}, {:.8}\n", domain->boxlo[1], domain->boxhi[1]); - fmt::print(out,"zlo, zhi = {:.8}, {:.8}\n", domain->boxlo[2], domain->boxhi[2]); + utils::print(out,"xlo, xhi = {:.8}, {:.8}\n", domain->boxlo[0], domain->boxhi[0]); + utils::print(out,"ylo, yhi = {:.8}, {:.8}\n", domain->boxlo[1], domain->boxhi[1]); + utils::print(out,"zlo, zhi = {:.8}, {:.8}\n", domain->boxlo[2], domain->boxhi[2]); if (domain->triclinic) - fmt::print(out,"Xy, xz, yz = {:.8}, {:.8}, {:.8}\n", + utils::print(out,"Xy, xz, yz = {:.8}, {:.8}, {:.8}\n", domain->xy, domain->xz, domain->yz); } else { fputs("\nBox has not yet been created\n",out); } - fmt::print(out,"\nCurrent timestep number = {}\n", update->ntimestep); - fmt::print(out,"Current timestep size = {}\n", update->dt); + utils::print(out,"\nCurrent timestep number = {}\n", update->ntimestep); + utils::print(out,"Current timestep size = {}\n", update->dt); } if (domain->box_exist && (flags & COEFFS)) { @@ -492,7 +492,7 @@ void Info::command(int narg, char **arg) fputs("\nPair Coeffs:\n",out); for (int i=1; i <= atom->ntypes; ++i) for (int j=i; j <= atom->ntypes; ++j) { - fmt::print(out,"{:6d} {:6d}:",i,j); + utils::print(out,"{:6d} {:6d}:",i,j); if (pair->allocated && pair->setflag[i][j]) fputs(" is set\n",out); else fputs(" is not set\n",out); } @@ -503,7 +503,7 @@ void Info::command(int narg, char **arg) if (bond) { fputs("\nBond Coeffs:\n",out); for (int i=1; i <= atom->nbondtypes; ++i) { - fmt::print(out,"{:6d}:",i); + utils::print(out,"{:6d}:",i); if (bond->allocated && bond->setflag[i]) fputs(" is set\n",out); else fputs (" is not set\n",out); } @@ -515,7 +515,7 @@ void Info::command(int narg, char **arg) if (angle) { fputs("\nAngle Coeffs:\n",out); for (int i=1; i <= atom->nangletypes; ++i) { - fmt::print(out,"{:6d}:",i); + utils::print(out,"{:6d}:",i); if (angle->allocated && angle->setflag[i]) fputs(" is set\n",out); else fputs (" is not set\n",out); } @@ -527,7 +527,7 @@ void Info::command(int narg, char **arg) if (dihedral) { fputs("\nDihedral Coeffs:\n",out); for (int i=1; i <= atom->ndihedraltypes; ++i) { - fmt::print(out,"{:6d}:",i); + utils::print(out,"{:6d}:",i); if (dihedral->allocated && dihedral->setflag[i]) fputs(" is set\n",out); else fputs (" is not set\n",out); } @@ -539,7 +539,7 @@ void Info::command(int narg, char **arg) if (b) { fputs("\nImproper Coeffs:\n",out); for (int i=1; i <= atom->nimpropertypes; ++i) { - fmt::print(out,"{:6d}:",i); + utils::print(out,"{:6d}:",i); if (b->allocated && b->setflag[i]) fputs(" is set\n",out); else fputs (" is not set\n",out); } @@ -554,7 +554,7 @@ void Info::command(int narg, char **arg) fputs("\nGroup information:\n",out); for (int i=0; i < ngroup; ++i) { if (names[i]) - fmt::print(out,"Group[{:2d}]: {:16} ({})\n", + utils::print(out,"Group[{:2d}]: {:16} ({})\n", i, names[i], dynamic[i] ? "dynamic" : "static"); } } @@ -563,11 +563,11 @@ void Info::command(int narg, char **arg) fputs("\nRegion information:\n",out); int i=0; for (auto ® : domain->get_region_list()) { - fmt::print(out,"Region[{:3d}]: {:16} style = {:16} side = {}\n", + utils::print(out,"Region[{:3d}]: {:16} style = {:16} side = {}\n", i, std::string(reg->id)+',', std::string(reg->style)+',', reg->interior ? "in" : "out"); if (reg->bboxflag) - fmt::print(out," Boundary: lo {:.8} {:.8} {:.8} hi {:.8} {:.8} {:.8}\n", + utils::print(out," Boundary: lo {:.8} {:.8} {:.8} hi {:.8} {:.8} {:.8}\n", reg->extent_xlo, reg->extent_ylo, reg->extent_zlo, reg->extent_xhi, reg->extent_yhi, reg->extent_zhi); @@ -580,7 +580,7 @@ void Info::command(int narg, char **arg) char **names = group->names; fputs("\nCompute information:\n",out); for (const auto &compute : modify->get_compute_list()) - fmt::print(out,"Compute[{:3d}]: {:16} style = {:16} group = {}\n", i++, + utils::print(out,"Compute[{:3d}]: {:16} style = {:16} group = {}\n", i++, std::string(compute->id)+',',std::string(compute->style)+',', names[compute->igroup]); } @@ -593,13 +593,13 @@ void Info::command(int narg, char **arg) char **names = group->names; fputs("\nDump information:\n",out); for (int i=0; i < ndump; ++i) { - fmt::print(out,"Dump[{:3d}]: {:16} file = {:16} style = {:16} group = {:16} ", + utils::print(out,"Dump[{:3d}]: {:16} file = {:16} style = {:16} group = {:16} ", i, std::string(dump[i]->id)+',',std::string(dump[i]->filename)+',', std::string(dump[i]->style)+',',std::string(names[dump[i]->igroup])+','); if (nevery[i]) { - fmt::print(out,"every = {}\n", nevery[i]); + utils::print(out,"every = {}\n", nevery[i]); } else { - fmt::print(out,"every = {}\n", vnames[i]); + utils::print(out,"every = {}\n", vnames[i]); } } } @@ -609,7 +609,7 @@ void Info::command(int narg, char **arg) char **names = group->names; fputs("\nFix information:\n",out); for (const auto &fix : modify->get_fix_list()) - fmt::print(out, "Fix[{:3d}]: {:16} style = {:16} group = {}\n",i++, + utils::print(out, "Fix[{:3d}]: {:16} style = {:16} group = {}\n",i++, std::string(fix->id)+',',std::string(fix->style)+',',names[fix->igroup]); } @@ -618,7 +618,7 @@ void Info::command(int narg, char **arg) fputs("\nVariable information:\n",out); for (int i=0; i < nvar; ++i) { auto vinfo = get_variable_info(i); - fmt::print(out, get_variable_info(i)); + utils::print(out, get_variable_info(i)); } } @@ -635,7 +635,7 @@ void Info::command(int narg, char **arg) wallclock = (wallclock - walls) / 60.0; wallm = fmod(wallclock,60.0); wallh = (wallclock - wallm) / 60.0; - fmt::print(out,"\nTotal time information (MPI rank 0):\n" + utils::print(out,"\nTotal time information (MPI rank 0):\n" " CPU time: {:4d}:{:02d}:{:02d}\n" " Wall time: {:4d}:{:02d}:{:02d}\n", cpuh,cpum,cpus,wallh,wallm,walls); diff --git a/src/label_map.cpp b/src/label_map.cpp index 9934868c49..24cef51062 100644 --- a/src/label_map.cpp +++ b/src/label_map.cpp @@ -335,28 +335,28 @@ bool LabelMap::is_complete(int mode) const void LabelMap::write_data(FILE *fp) { if (is_complete(Atom::ATOM)) { - fmt::print(fp, "\nAtom Type Labels\n\n"); - for (int i = 0; i < natomtypes; i++) fmt::print(fp, "{} {}\n", i + 1, typelabel[i]); + utils::print(fp, "\nAtom Type Labels\n\n"); + for (int i = 0; i < natomtypes; i++) utils::print(fp, "{} {}\n", i + 1, typelabel[i]); } if (force->bond && is_complete(Atom::BOND)) { - fmt::print(fp, "\nBond Type Labels\n\n"); - for (int i = 0; i < nbondtypes; i++) fmt::print(fp, "{} {}\n", i + 1, btypelabel[i]); + utils::print(fp, "\nBond Type Labels\n\n"); + for (int i = 0; i < nbondtypes; i++) utils::print(fp, "{} {}\n", i + 1, btypelabel[i]); } if (force->angle && is_complete(Atom::ANGLE)) { - fmt::print(fp, "\nAngle Type Labels\n\n"); - for (int i = 0; i < nangletypes; i++) fmt::print(fp, "{} {}\n", i + 1, atypelabel[i]); + utils::print(fp, "\nAngle Type Labels\n\n"); + for (int i = 0; i < nangletypes; i++) utils::print(fp, "{} {}\n", i + 1, atypelabel[i]); } if (force->dihedral && is_complete(Atom::DIHEDRAL)) { - fmt::print(fp, "\nDihedral Type Labels\n\n"); - for (int i = 0; i < ndihedraltypes; i++) fmt::print(fp, "{} {}\n", i + 1, dtypelabel[i]); + utils::print(fp, "\nDihedral Type Labels\n\n"); + for (int i = 0; i < ndihedraltypes; i++) utils::print(fp, "{} {}\n", i + 1, dtypelabel[i]); } if (force->improper && is_complete(Atom::IMPROPER)) { - fmt::print(fp, "\nImproper Type Labels\n\n"); - for (int i = 0; i < nimpropertypes; i++) fmt::print(fp, "{} {}\n", i + 1, itypelabel[i]); + utils::print(fp, "\nImproper Type Labels\n\n"); + for (int i = 0; i < nimpropertypes; i++) utils::print(fp, "{} {}\n", i + 1, itypelabel[i]); } } @@ -473,31 +473,31 @@ void LabelMap::write_map(const std::string &filename) if (typelabel_map.size() > 0) { fputs("labelmap atom", fp); for (int i = 0; i < natomtypes; ++i) - if (!typelabel[i].empty()) fmt::print(fp, " {} \"\"\" {} \"\"\"", i + 1, typelabel[i]); + if (!typelabel[i].empty()) utils::print(fp, " {} \"\"\" {} \"\"\"", i + 1, typelabel[i]); fputc('\n', fp); } if (btypelabel_map.size() > 0) { fputs("labelmap bond", fp); for (int i = 0; i < nbondtypes; ++i) - if (!btypelabel[i].empty()) fmt::print(fp, " {} \"\"\" {} \"\"\"", i + 1, btypelabel[i]); + if (!btypelabel[i].empty()) utils::print(fp, " {} \"\"\" {} \"\"\"", i + 1, btypelabel[i]); fputc('\n', fp); } if (atypelabel_map.size() > 0) { fputs("labelmap angle", fp); for (int i = 0; i < nangletypes; ++i) - if (!atypelabel[i].empty()) fmt::print(fp, " {} \"\"\" {} \"\"\"", i + 1, atypelabel[i]); + if (!atypelabel[i].empty()) utils::print(fp, " {} \"\"\" {} \"\"\"", i + 1, atypelabel[i]); fputc('\n', fp); } if (dtypelabel_map.size() > 0) { fputs("labelmap dihedral", fp); for (int i = 0; i < ndihedraltypes; ++i) - if (!dtypelabel[i].empty()) fmt::print(fp, " {} \"\"\" {} \"\"\"", i + 1, dtypelabel[i]); + if (!dtypelabel[i].empty()) utils::print(fp, " {} \"\"\" {} \"\"\"", i + 1, dtypelabel[i]); fputc('\n', fp); } if (itypelabel_map.size() > 0) { fputs("labelmap improper", fp); for (int i = 0; i < nimpropertypes; ++i) - if (!itypelabel[i].empty()) fmt::print(fp, " {} \"\"\" {} \"\"\"", i + 1, itypelabel[i]); + if (!itypelabel[i].empty()) utils::print(fp, " {} \"\"\" {} \"\"\"", i + 1, itypelabel[i]); fputc('\n', fp); } fclose(fp); diff --git a/src/lammps.cpp b/src/lammps.cpp index 1abc34a11b..f8a1c9950c 100644 --- a/src/lammps.cpp +++ b/src/lammps.cpp @@ -651,12 +651,12 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) : // screen and logfile messages for universe and world if ((universe->me == 0) && (!helpflag)) { - const char fmt[] = "LAMMPS ({})\nRunning on {} partitions of processors\n"; + constexpr char fmt[] = "LAMMPS ({})\nRunning on {} partitions of processors\n"; if (universe->uscreen) - fmt::print(universe->uscreen,fmt,version,universe->nworlds); + utils::print(universe->uscreen,fmt,version,universe->nworlds); if (universe->ulogfile) - fmt::print(universe->ulogfile,fmt,version,universe->nworlds); + utils::print(universe->ulogfile,fmt,version,universe->nworlds); } if ((me == 0) && (!helpflag)) @@ -1454,21 +1454,21 @@ void LAMMPS::print_config(FILE *fp) const char *pkg; int ncword, ncline = 0; - fmt::print(fp,"OS: {}\n\n",platform::os_info()); + utils::print(fp,"OS: {}\n\n",platform::os_info()); - fmt::print(fp,"Compiler: {} with {}\nC++ standard: {}\n", + utils::print(fp,"Compiler: {} with {}\nC++ standard: {}\n", platform::compiler_info(),platform::openmp_standard(), platform::cxx_standard()); fputs(Info::get_fmt_info().c_str(),fp); int major,minor; std::string infobuf = platform::mpi_info(major,minor); - fmt::print(fp,"\nMPI v{}.{}: {}\n\n",major,minor,infobuf); + utils::print(fp,"\nMPI v{}.{}: {}\n\n",major,minor,infobuf); - fmt::print(fp,"Accelerator configuration:\n\n{}\n", + utils::print(fp,"Accelerator configuration:\n\n{}\n", Info::get_accelerator_info()); #if defined(LMP_GPU) - fmt::print(fp,"Compatible GPU present: {}\n\n",Info::has_gpu_device() ? "yes" : "no"); + utils::print(fp,"Compatible GPU present: {}\n\n",Info::has_gpu_device() ? "yes" : "no"); #endif fputs("FFT information:\n\n",fp); @@ -1489,14 +1489,14 @@ void LAMMPS::print_config(FILE *fp) fputs("-DLAMMPS_SMALLSMALL\n",fp); #endif - fmt::print(fp,"sizeof(smallint): {}-bit\n" + utils::print(fp,"sizeof(smallint): {}-bit\n" "sizeof(imageint): {}-bit\n" "sizeof(tagint): {}-bit\n" "sizeof(bigint): {}-bit\n", sizeof(smallint)*8, sizeof(imageint)*8, sizeof(tagint)*8, sizeof(bigint)*8); - if (Info::has_gzip_support()) fmt::print(fp,"\n{}\n",platform::compress_info()); + if (Info::has_gzip_support()) utils::print(fp,"\n{}\n",platform::compress_info()); fputs("\nInstalled packages:\n\n",fp); for (int i = 0; nullptr != (pkg = installed_packages[i]); ++i) { diff --git a/src/library.cpp b/src/library.cpp index c5341eec83..2cd9879e76 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -187,7 +187,7 @@ void *lammps_open(int argc, char **argv, MPI_Comm comm, void **ptr) } catch(LAMMPSException &e) { lammps_last_global_errormessage = e.what(); - fmt::print(stderr, "LAMMPS Exception: {}", e.what()); + utils::print(stderr, "LAMMPS Exception: {}", e.what()); if (ptr) *ptr = nullptr; } return (void *) lmp; diff --git a/src/min.cpp b/src/min.cpp index 931031e44a..e20e4c191f 100644 --- a/src/min.cpp +++ b/src/min.cpp @@ -197,10 +197,10 @@ void Min::init() void Min::setup(int flag) { if (comm->me == 0 && screen) { - fmt::print(screen,"Setting up {} style minimization ...\n", update->minimize_style); + utils::print(screen,"Setting up {} style minimization ...\n", update->minimize_style); if (flag) { - fmt::print(screen," Unit style : {}\n", update->unit_style); - fmt::print(screen," Current step : {}\n", update->ntimestep); + utils::print(screen," Unit style : {}\n", update->unit_style); + utils::print(screen," Current step : {}\n", update->ntimestep); timer->print_timeout(screen); } } diff --git a/src/pair.cpp b/src/pair.cpp index 8e9a4e44be..8f10d81d99 100644 --- a/src/pair.cpp +++ b/src/pair.cpp @@ -1843,7 +1843,7 @@ void Pair::write_file(int narg, char **arg) utils::logmesg(lmp,"Creating table file {} with DATE: {}\n", table_file, utils::current_date()); fp = fopen(table_file.c_str(),"w"); - if (fp) fmt::print(fp,"# DATE: {} UNITS: {} Created by pair_write\n", + if (fp) utils::print(fp,"# DATE: {} UNITS: {} Created by pair_write\n", utils::current_date(), update->unit_style); } if (fp == nullptr) diff --git a/src/verlet.cpp b/src/verlet.cpp index 0222a0d2a0..f0a307bdd2 100644 --- a/src/verlet.cpp +++ b/src/verlet.cpp @@ -95,7 +95,7 @@ void Verlet::setup(int flag) if (comm->me == 0 && screen) { fputs("Setting up Verlet run ...\n",screen); if (flag) { - fmt::print(screen," Unit style : {}\n" + utils::print(screen," Unit style : {}\n" " Current step : {}\n" " Time step : {}\n", update->unit_style,update->ntimestep,update->dt); diff --git a/src/write_data.cpp b/src/write_data.cpp index 76d1c598ca..85950f3b47 100644 --- a/src/write_data.cpp +++ b/src/write_data.cpp @@ -274,41 +274,41 @@ void WriteData::write(const std::string &file) void WriteData::header() { - fmt::print(fp,"LAMMPS data file via write_data, version {}, timestep = {}, units = {}\n\n", + utils::print(fp,"LAMMPS data file via write_data, version {}, timestep = {}, units = {}\n\n", lmp->version, update->ntimestep, update->unit_style); - fmt::print(fp,"{} atoms\n{} atom types\n",atom->natoms,atom->ntypes); + utils::print(fp,"{} atoms\n{} atom types\n",atom->natoms,atom->ntypes); // only write out number of types for atom style template if (atom->molecular == Atom::MOLECULAR) { if (atom->nbonds || atom->nbondtypes) - fmt::print(fp,"{} bonds\n{} bond types\n", + utils::print(fp,"{} bonds\n{} bond types\n", nbonds,atom->nbondtypes); if (atom->nangles || atom->nangletypes) - fmt::print(fp,"{} angles\n{} angle types\n", + utils::print(fp,"{} angles\n{} angle types\n", nangles,atom->nangletypes); if (atom->ndihedrals || atom->ndihedraltypes) - fmt::print(fp,"{} dihedrals\n{} dihedral types\n", + utils::print(fp,"{} dihedrals\n{} dihedral types\n", ndihedrals,atom->ndihedraltypes); if (atom->nimpropers || atom->nimpropertypes) - fmt::print(fp,"{} impropers\n{} improper types\n", + utils::print(fp,"{} impropers\n{} improper types\n", nimpropers,atom->nimpropertypes); } if (atom->molecular == Atom::TEMPLATE) { - if (atom->nbondtypes) fmt::print(fp,"{} bond types\n",atom->nbondtypes); - if (atom->nangletypes) fmt::print(fp,"{} angle types\n",atom->nangletypes); - if (atom->ndihedraltypes) fmt::print(fp,"{} dihedral types\n",atom->ndihedraltypes); - if (atom->nimpropertypes) fmt::print(fp,"{} improper types\n",atom->nimpropertypes); + if (atom->nbondtypes) utils::print(fp,"{} bond types\n",atom->nbondtypes); + if (atom->nangletypes) utils::print(fp,"{} angle types\n",atom->nangletypes); + if (atom->ndihedraltypes) utils::print(fp,"{} dihedral types\n",atom->ndihedraltypes); + if (atom->nimpropertypes) utils::print(fp,"{} improper types\n",atom->nimpropertypes); } // bonus info - if (atom->ellipsoid_flag) fmt::print(fp,"{} ellipsoids\n",atom->nellipsoids); - if (atom->line_flag) fmt::print(fp,"{} lines\n",atom->nlines); - if (atom->tri_flag) fmt::print(fp,"{} triangles\n",atom->ntris); - if (atom->body_flag) fmt::print(fp,"{} bodies\n",atom->nbodies); + if (atom->ellipsoid_flag) utils::print(fp,"{} ellipsoids\n",atom->nellipsoids); + if (atom->line_flag) utils::print(fp,"{} lines\n",atom->nlines); + if (atom->tri_flag) utils::print(fp,"{} triangles\n",atom->ntris); + if (atom->body_flag) utils::print(fp,"{} bodies\n",atom->nbodies); // fix info @@ -321,19 +321,19 @@ void WriteData::header() // box info: orthogonal, restricted triclinic, or general triclinic (if requested) if (!domain->triclinic_general) { - fmt::print(fp,"\n{} {} xlo xhi\n{} {} ylo yhi\n{} {} zlo zhi\n", + utils::print(fp,"\n{} {} xlo xhi\n{} {} ylo yhi\n{} {} zlo zhi\n", domain->boxlo[0],domain->boxhi[0], domain->boxlo[1],domain->boxhi[1], domain->boxlo[2],domain->boxhi[2]); if (domain->triclinic) - fmt::print(fp,"{} {} {} xy xz yz\n",domain->xy,domain->xz,domain->yz); + utils::print(fp,"{} {} {} xy xz yz\n",domain->xy,domain->xz,domain->yz); } else if (domain->triclinic_general) { - fmt::print(fp,"\n{} {} {} avec\n{} {} {} bvec\n{} {} {} cvec\n", + utils::print(fp,"\n{} {} {} avec\n{} {} {} bvec\n{} {} {} cvec\n", domain->avec[0],domain->avec[1],domain->avec[2], domain->bvec[0],domain->bvec[1],domain->bvec[2], domain->cvec[0],domain->cvec[1],domain->cvec[2]); - fmt::print(fp,"{} {} {} abc origin\n", + utils::print(fp,"{} {} {} abc origin\n", domain->boxlo[0],domain->boxlo[1],domain->boxlo[2]); } } @@ -348,7 +348,7 @@ void WriteData::type_arrays() double *mass = atom->mass; fputs("\nMasses\n\n",fp); for (int i = 1; i <= atom->ntypes; i++) - fmt::print(fp,"{} {:.16g}\n",i,mass[i]); + utils::print(fp,"{} {:.16g}\n",i,mass[i]); } } @@ -363,7 +363,7 @@ void WriteData::force_fields() if ((comm->me == 0) && (force->pair->mixed_flag == 0)) error->warning(FLERR,"Not all mixed pair coeffs generated from mixing. " "Use write_data with 'pair ij' option to store all pair coeffs."); - fmt::print(fp,"\nPair Coeffs # {}\n\n", force->pair_style); + utils::print(fp,"\nPair Coeffs # {}\n\n", force->pair_style); force->pair->write_data(fp); } else if (pairflag == IJ) { // try computing mixed pair coeffs in case we skipped lmp->init() @@ -375,24 +375,24 @@ void WriteData::force_fields() if (!force->pair->setflag[i][j]) force->pair->init_one(i, j); } - fmt::print(fp,"\nPairIJ Coeffs # {}\n\n", force->pair_style); + utils::print(fp,"\nPairIJ Coeffs # {}\n\n", force->pair_style); force->pair->write_data_all(fp); } } if (force->bond && force->bond->writedata && atom->nbondtypes) { - fmt::print(fp,"\nBond Coeffs # {}\n\n", force->bond_style); + utils::print(fp,"\nBond Coeffs # {}\n\n", force->bond_style); force->bond->write_data(fp); } if (force->angle && force->angle->writedata && atom->nangletypes) { - fmt::print(fp,"\nAngle Coeffs # {}\n\n", force->angle_style); + utils::print(fp,"\nAngle Coeffs # {}\n\n", force->angle_style); force->angle->write_data(fp); } if (force->dihedral && force->dihedral->writedata && atom->ndihedraltypes) { - fmt::print(fp,"\nDihedral Coeffs # {}\n\n", force->dihedral_style); + utils::print(fp,"\nDihedral Coeffs # {}\n\n", force->dihedral_style); force->dihedral->write_data(fp); } if (force->improper && force->improper->writedata && atom->nimpropertypes) { - fmt::print(fp,"\nImproper Coeffs # {}\n\n", force->improper_style); + utils::print(fp,"\nImproper Coeffs # {}\n\n", force->improper_style); force->improper->write_data(fp); } } @@ -429,7 +429,7 @@ void WriteData::atoms() MPI_Status status; MPI_Request request; - fmt::print(fp,"\nAtoms # {}\n\n",atom->atom_style); + utils::print(fp,"\nAtoms # {}\n\n",atom->atom_style); for (int iproc = 0; iproc < comm->nprocs; iproc++) { if (iproc) { MPI_Irecv(&buf[0][0],maxrow*ncol,MPI_DOUBLE,iproc,0,world,&request);