remove redundant calls to fmt::format() from calls to error->one/all() and utils::logmesg()
This commit is contained in:
@ -84,7 +84,7 @@ void ElectrodeMatrix::compute_array(double **array, bool timer_flag)
|
||||
electrode_kspace->compute_matrix(&mpos[0], array, timer_flag);
|
||||
MPI_Barrier(world);
|
||||
if (timer_flag && (comm->me == 0))
|
||||
utils::logmesg(lmp, fmt::format("KSpace time: {:.4g} s\n", MPI_Wtime() - kspace_time));
|
||||
utils::logmesg(lmp, "KSpace time: {:.4g} s\n", MPI_Wtime() - kspace_time);
|
||||
//cout << array[0][0] << ", " << array[0][1] << endl;
|
||||
pair_contribution(array);
|
||||
//cout << array[0][0] << ", " << array[0][1] << endl;
|
||||
|
||||
@ -60,10 +60,10 @@ ElectrodeVector::~ElectrodeVector()
|
||||
{
|
||||
if (timer_flag && (comm->me == 0)) {
|
||||
try {
|
||||
utils::logmesg(lmp, fmt::format("B time: {:.4g} s\n", b_time_total));
|
||||
utils::logmesg(lmp, fmt::format("B kspace time: {:.4g} s\n", kspace_time_total));
|
||||
utils::logmesg(lmp, fmt::format("B pair time: {:.4g} s\n", pair_time_total));
|
||||
utils::logmesg(lmp, fmt::format("B boundary time: {:.4g} s\n", boundary_time_total));
|
||||
utils::logmesg(lmp, "B time: {:.4g} s\n", b_time_total);
|
||||
utils::logmesg(lmp, "B kspace time: {:.4g} s\n", kspace_time_total);
|
||||
utils::logmesg(lmp, "B pair time: {:.4g} s\n", pair_time_total);
|
||||
utils::logmesg(lmp, "B boundary time: {:.4g} s\n", boundary_time_total);
|
||||
} catch (std::exception &) {
|
||||
}
|
||||
}
|
||||
|
||||
@ -136,7 +136,7 @@ void PPPMElectrode::init()
|
||||
}
|
||||
|
||||
if (order < 2 || order > MAXORDER)
|
||||
error->all(FLERR, fmt::format("PPPM/electrode order cannot be < 2 or > {}", MAXORDER));
|
||||
error->all(FLERR, "PPPM/electrode order cannot be < 2 or > {}", MAXORDER);
|
||||
|
||||
// compute two charge force
|
||||
|
||||
@ -816,7 +816,7 @@ void PPPMElectrode::one_step_multiplication(bigint *imat, double *greens_real, d
|
||||
memory->destroy(rho1d_j);
|
||||
MPI_Barrier(world);
|
||||
if (timer_flag && (comm->me == 0))
|
||||
utils::logmesg(lmp, fmt::format("Single step time: {:.4g} s\n", MPI_Wtime() - step1_time));
|
||||
utils::logmesg(lmp, "Single step time: {:.4g} s\n", MPI_Wtime() - step1_time);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------*/
|
||||
@ -917,7 +917,7 @@ void PPPMElectrode::two_step_multiplication(bigint *imat, double *greens_real, d
|
||||
}
|
||||
MPI_Barrier(world);
|
||||
if (timer_flag && (comm->me == 0))
|
||||
utils::logmesg(lmp, fmt::format("step 1 time: {:.4g} s\n", MPI_Wtime() - step1_time));
|
||||
utils::logmesg(lmp, "step 1 time: {:.4g} s\n", MPI_Wtime() - step1_time);
|
||||
|
||||
// nested loop over electrode atoms i and j and stencil of i
|
||||
// in theory could reuse make_rho1d_j here -- but this step is already
|
||||
@ -958,7 +958,7 @@ void PPPMElectrode::two_step_multiplication(bigint *imat, double *greens_real, d
|
||||
MPI_Barrier(world);
|
||||
memory->destroy(gw);
|
||||
if (timer_flag && (comm->me == 0))
|
||||
utils::logmesg(lmp, fmt::format("step 2 time: {:.4g} s\n", MPI_Wtime() - step2_time));
|
||||
utils::logmesg(lmp, "step 2 time: {:.4g} s\n", MPI_Wtime() - step2_time);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
||||
@ -719,7 +719,7 @@ void PPPMElectrodeIntel::one_step_multiplication(bigint *imat, double *greens_re
|
||||
MPI_Barrier(world);
|
||||
memory->destroy(rho1d_j);
|
||||
if (timer_flag && (comm->me == 0))
|
||||
utils::logmesg(lmp, fmt::format("Single step time: {:.4g} s\n", MPI_Wtime() - step1_time));
|
||||
utils::logmesg(lmp, "Single step time: {:.4g} s\n", MPI_Wtime() - step1_time);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------*/
|
||||
@ -844,7 +844,7 @@ void PPPMElectrodeIntel::two_step_multiplication(bigint *imat, double *greens_re
|
||||
}
|
||||
MPI_Barrier(world);
|
||||
if (timer_flag && (comm->me == 0))
|
||||
utils::logmesg(lmp, fmt::format("step 1 time: {:.4g} s\n", MPI_Wtime() - step1_time));
|
||||
utils::logmesg(lmp, "step 1 time: {:.4g} s\n", MPI_Wtime() - step1_time);
|
||||
|
||||
// nested loop over electrode atoms i and j and stencil of i
|
||||
double step2_time = MPI_Wtime();
|
||||
@ -914,7 +914,7 @@ void PPPMElectrodeIntel::two_step_multiplication(bigint *imat, double *greens_re
|
||||
}
|
||||
MPI_Barrier(world);
|
||||
if (timer_flag && (comm->me == 0))
|
||||
utils::logmesg(lmp, fmt::format("step 2 time: {:.4g} s\n", MPI_Wtime() - step2_time));
|
||||
utils::logmesg(lmp, "step 2 time: {:.4g} s\n", MPI_Wtime() - step2_time);
|
||||
}
|
||||
|
||||
template <class flt_t, class acc_t, int use_table>
|
||||
|
||||
@ -382,8 +382,7 @@ void PairReaxFFKokkos<DeviceType>::init_md()
|
||||
if (swb < 0)
|
||||
error->one(FLERR,"Negative upper Taper-radius cutoff");
|
||||
else if (swb < 5)
|
||||
error->one(FLERR,fmt::format("Warning: very low Taper-radius cutoff: "
|
||||
"{}\n", swb));
|
||||
error->one(FLERR,"Warning: very low Taper-radius cutoff: {}\n", swb);
|
||||
|
||||
d1 = swb - swa;
|
||||
d7 = powint(d1,7);
|
||||
|
||||
@ -1873,7 +1873,7 @@ void PairBOP::read_table(char *filename)
|
||||
reader = new PotentialFileReader(lmp, filename, "BOP");
|
||||
bop_types = reader->next_int();
|
||||
if (bop_types <= 0)
|
||||
error->one(FLERR,fmt::format("BOP potential file with {} elements",bop_types));
|
||||
error->one(FLERR,"BOP potential file with {} elements",bop_types);
|
||||
|
||||
bop_elements = new char*[bop_types];
|
||||
bop_masses = new double[bop_types];
|
||||
@ -2221,8 +2221,7 @@ void PairBOP::write_tables(int npts)
|
||||
int param = elem2param[i][j];
|
||||
PairParameters & pair = pairParameters[param];
|
||||
|
||||
filename = fmt::format("{}{}_Pair_SPR_{}",bop_elements[i],
|
||||
bop_elements[j],comm->me);
|
||||
filename = fmt::format("{}{}_Pair_SPR_{}",bop_elements[i],bop_elements[j],comm->me);
|
||||
|
||||
fp = fopen(filename.c_str(), "w");
|
||||
xmin = (pair.betaS)->get_xmin();
|
||||
@ -2240,8 +2239,7 @@ void PairBOP::write_tables(int npts)
|
||||
fclose(fp);
|
||||
|
||||
if (pair.cutL != 0) {
|
||||
filename = fmt::format("{}{}_Pair_L_{}",bop_elements[i],
|
||||
bop_elements[j],comm->me);
|
||||
filename = fmt::format("{}{}_Pair_L_{}",bop_elements[i],bop_elements[j],comm->me);
|
||||
fp = fopen(filename.c_str(), "w");
|
||||
xmin = (pair.cphi)->get_xmin();
|
||||
xmax = (pair.cphi)->get_xmax();
|
||||
@ -2254,8 +2252,7 @@ void PairBOP::write_tables(int npts)
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
filename = fmt::format("{}{}_Pair_BO_{}", bop_elements[i],
|
||||
bop_elements[j], comm->me);
|
||||
filename = fmt::format("{}{}_Pair_BO_{}", bop_elements[i],bop_elements[j], comm->me);
|
||||
fp = fopen(filename.c_str(), "w");
|
||||
xmin = (pair.bo)->get_xmin();
|
||||
xmax = (pair.bo)->get_xmax();
|
||||
|
||||
@ -240,7 +240,7 @@ MDIEngine::MDIEngine(LAMMPS *_lmp, int narg, char **arg) : Pointers(_lmp)
|
||||
break;
|
||||
|
||||
} else
|
||||
error->all(FLERR, fmt::format("MDI engine exited with invalid command: {}", mdicmd));
|
||||
error->all(FLERR, "MDI engine exited with invalid command: {}", mdicmd);
|
||||
}
|
||||
|
||||
// clean up
|
||||
|
||||
@ -224,8 +224,8 @@ void FixQEqReaxFFOMP::compute_H()
|
||||
} // omp
|
||||
|
||||
if (m_fill >= H.m)
|
||||
error->all(FLERR,fmt::format("Fix qeq/reaxff: H matrix size has been "
|
||||
"exceeded: m_fill={} H.m={}\n", m_fill, H.m));
|
||||
error->all(FLERR,"Fix qeq/reaxff: H matrix size has been exceeded: m_fill={} H.m={}\n",
|
||||
m_fill, H.m);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
@ -467,9 +467,8 @@ int FixQEqReaxFFOMP::CG(double *b, double *x)
|
||||
}
|
||||
|
||||
if ((i >= imax) && maxwarn && (comm->me == 0))
|
||||
error->warning(FLERR,fmt::format("Fix qeq/reaxff/omp CG convergence failed "
|
||||
"after {} iterations at step {}",
|
||||
i,update->ntimestep));
|
||||
error->warning(FLERR,"Fix qeq/reaxff/omp CG convergence failed after {} iterations at step {}",
|
||||
i,update->ntimestep);
|
||||
return i;
|
||||
}
|
||||
|
||||
@ -796,9 +795,8 @@ int FixQEqReaxFFOMP::dual_CG(double *b1, double *b2, double *x1, double *x2)
|
||||
}
|
||||
|
||||
if ((i >= imax) && maxwarn && (comm->me == 0))
|
||||
error->warning(FLERR,fmt::format("Fix qeq/reaxff/omp CG convergence failed "
|
||||
"after {} iterations at step {}",
|
||||
i,update->ntimestep));
|
||||
error->warning(FLERR,"Fix qeq/reaxff/omp CG convergence failed after {} iterations at step {}",
|
||||
i,update->ntimestep);
|
||||
return matvecs_s + matvecs_t;
|
||||
}
|
||||
|
||||
|
||||
@ -138,11 +138,10 @@ void MSMCGOMP::compute(int eflag, int vflag)
|
||||
/ static_cast<double>(atom->natoms);
|
||||
|
||||
if (me == 0)
|
||||
utils::logmesg(MSM::lmp,fmt::format(" MSM/cg optimization cutoff: {:.8}\n"
|
||||
" Total charged atoms: {:.1f}%\n"
|
||||
" Min/max charged atoms/proc: {:.1f}%"
|
||||
" {:.1f}%\n",smallq,
|
||||
charged_frac,charged_fmin,charged_fmax));
|
||||
utils::logmesg(MSM::lmp," MSM/cg optimization cutoff: {:.8}\n"
|
||||
" Total charged atoms: {:.1f}%\n"
|
||||
" Min/max charged atoms/proc: {:.1f}%"
|
||||
" {:.1f}%\n",smallq, charged_frac,charged_fmin,charged_fmax);
|
||||
}
|
||||
|
||||
// only need to rebuild this list after a neighbor list update
|
||||
|
||||
@ -810,8 +810,7 @@ void FixQEq::read_file(char *file)
|
||||
|
||||
for (int n=1; n <= ntypes; ++n)
|
||||
if (setflag[n] == 0)
|
||||
error->one(FLERR,fmt::format("Parameters for atom type {} missing in "
|
||||
"qeq parameter file", n));
|
||||
error->one(FLERR,"Parameters for atom type {} missing in qeq parameter file", n);
|
||||
delete[] setflag;
|
||||
}
|
||||
|
||||
|
||||
@ -697,8 +697,8 @@ void FixQEqReaxFF::compute_H()
|
||||
}
|
||||
|
||||
if (m_fill >= H.m)
|
||||
error->all(FLERR,fmt::format("Fix qeq/reaxff H matrix size has been "
|
||||
"exceeded: m_fill={} H.m={}\n", m_fill, H.m));
|
||||
error->all(FLERR,"Fix qeq/reaxff H matrix size has been exceeded: m_fill={} H.m={}\n",
|
||||
m_fill, H.m);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
@ -772,9 +772,8 @@ int FixQEqReaxFF::CG(double *b, double *x)
|
||||
}
|
||||
|
||||
if ((i >= imax) && maxwarn && (comm->me == 0))
|
||||
error->warning(FLERR,fmt::format("Fix qeq/reaxff CG convergence failed "
|
||||
"after {} iterations at step {}",
|
||||
i,update->ntimestep));
|
||||
error->warning(FLERR, "Fix qeq/reaxff CG convergence failed after {} iterations at step {}",
|
||||
i,update->ntimestep);
|
||||
return i;
|
||||
}
|
||||
|
||||
|
||||
@ -56,8 +56,8 @@ FixReaxFFBonds::FixReaxFFBonds(LAMMPS *lmp, int narg, char **arg) :
|
||||
if (!fp) error->one(FLERR,"Cannot open compressed file");
|
||||
} else fp = fopen(arg[4],"w");
|
||||
|
||||
if (!fp) error->one(FLERR,fmt::format("Cannot open fix reaxff/bonds file {}: {}",
|
||||
arg[4],utils::getsyserror()));
|
||||
if (!fp) error->one(FLERR,"Cannot open fix reaxff/bonds file {}: {}",
|
||||
arg[4],utils::getsyserror());
|
||||
}
|
||||
|
||||
if (atom->tag_consecutive() == 0)
|
||||
|
||||
@ -253,8 +253,8 @@ namespace ReaxFF {
|
||||
|
||||
if (Nflag || wsr->num_far >= far_nbrs->num_intrs * DANGER_ZONE) {
|
||||
if (wsr->num_far > far_nbrs->num_intrs)
|
||||
error->one(FLERR,fmt::format("step{}: ran out of space on far_nbrs: top={}, max={}",
|
||||
data->step, wsr->num_far, far_nbrs->num_intrs));
|
||||
error->one(FLERR, "step{}: ran out of space on far_nbrs: top={}, max={}",
|
||||
data->step, wsr->num_far, far_nbrs->num_intrs);
|
||||
|
||||
newsize = static_cast<int>
|
||||
(MAX(wsr->num_far*safezone, mincap*REAX_MIN_NBRS));
|
||||
|
||||
@ -129,9 +129,11 @@ void NEB::command(int narg, char **arg)
|
||||
if (nevery <= 0)
|
||||
error->universe_all(FLERR, fmt::format("Illegal NEB command every parameter: {}", nevery));
|
||||
if (n1steps % nevery)
|
||||
error->all(FLERR, fmt::format("NEB N1 value {} incompatible with every {}", n1steps, nevery));
|
||||
error->universe_all(FLERR, fmt::format("NEB N1 value {} incompatible with every {}",
|
||||
n1steps, nevery));
|
||||
if (n2steps % nevery)
|
||||
error->all(FLERR, fmt::format("NEB N2 value {} incompatible with every {}", n2steps, nevery));
|
||||
error->universe_all(FLERR, fmt::format("NEB N2 value {} incompatible with every {}",
|
||||
n2steps, nevery));
|
||||
|
||||
// replica info
|
||||
|
||||
|
||||
@ -97,7 +97,7 @@ void TemperGrem::command(int narg, char **arg)
|
||||
|
||||
FixNH *nh = dynamic_cast<FixNH *>(modify->get_fix_by_id(arg[4]));
|
||||
if (!nh)
|
||||
error->all(FLERR,fmt::format("Fix {} for Nose-Hoover fix does not exist", arg[4]));
|
||||
error->universe_all(FLERR,fmt::format("Fix {} for Nose-Hoover fix does not exist", arg[4]));
|
||||
|
||||
// get result from nvt vs npt check from fix_grem
|
||||
|
||||
|
||||
@ -530,7 +530,7 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) :
|
||||
if (infile == nullptr)
|
||||
error->one(FLERR,"Cannot open input script {}: {}", arg[inflag], utils::getsyserror());
|
||||
if (!helpflag)
|
||||
utils::logmesg(this,fmt::format("LAMMPS ({}{})\n", version, update_string));
|
||||
utils::logmesg(this,"LAMMPS ({}{})\n", version, update_string);
|
||||
|
||||
// warn against using I/O redirection in parallel runs
|
||||
if ((inflag == 0) && (universe->nprocs > 1))
|
||||
@ -626,8 +626,7 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) :
|
||||
}
|
||||
|
||||
if ((me == 0) && (!helpflag))
|
||||
utils::logmesg(this,fmt::format("LAMMPS ({})\nProcessor partition = {}\n",
|
||||
version, universe->iworld));
|
||||
utils::logmesg(this,"LAMMPS ({})\nProcessor partition = {}\n", version, universe->iworld);
|
||||
}
|
||||
|
||||
// check consistency of datatype settings in lmptype.h
|
||||
@ -762,8 +761,7 @@ LAMMPS::~LAMMPS() noexcept(false)
|
||||
totalclock = (totalclock - seconds) / 60.0;
|
||||
int minutes = fmod(totalclock,60.0);
|
||||
int hours = (totalclock - minutes) / 60.0;
|
||||
utils::logmesg(this,fmt::format("Total wall time: {}:{:02d}:{:02d}\n",
|
||||
hours, minutes, seconds));
|
||||
utils::logmesg(this, "Total wall time: {}:{:02d}:{:02d}\n", hours, minutes, seconds);
|
||||
}
|
||||
|
||||
if (universe->nworlds == 1) {
|
||||
|
||||
@ -364,7 +364,7 @@ void ReadData::command(int narg, char **arg)
|
||||
// check if data file is available and readable
|
||||
|
||||
if (!platform::file_is_readable(arg[0]))
|
||||
error->all(FLERR, fmt::format("Cannot open file {}: {}", arg[0], utils::getsyserror()));
|
||||
error->all(FLERR, "Cannot open file {}: {}", arg[0], utils::getsyserror());
|
||||
|
||||
// reset so we can warn about reset image flags exactly once per data file
|
||||
|
||||
|
||||
@ -62,12 +62,11 @@ void Special::build()
|
||||
if (me == 0) {
|
||||
const double * const special_lj = force->special_lj;
|
||||
const double * const special_coul = force->special_coul;
|
||||
auto mesg = fmt::format("Finding 1-2 1-3 1-4 neighbors ...\n"
|
||||
" 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]);
|
||||
utils::logmesg(lmp,mesg);
|
||||
utils::logmesg(lmp, "Finding 1-2 1-3 1-4 neighbors ...\n"
|
||||
" 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]);
|
||||
}
|
||||
|
||||
// set onefive_flag if special_bonds command set it
|
||||
@ -162,7 +161,7 @@ void Special::build()
|
||||
if (onefive_flag) {
|
||||
onefive_build();
|
||||
if (me == 0)
|
||||
utils::logmesg(lmp,fmt::format("{:>6} = max # of 1-5 neighbors\n",maxall));
|
||||
utils::logmesg(lmp,"{:>6} = max # of 1-5 neighbors\n",maxall);
|
||||
}
|
||||
|
||||
// finish processing the onetwo, onethree, onefour, onefive lists
|
||||
|
||||
@ -557,7 +557,7 @@ void utils::bounds(const char *file, int line, const std::string &str,
|
||||
// check for illegal charcters
|
||||
size_t found = str.find_first_not_of("*-0123456789");
|
||||
if (found != std::string::npos) {
|
||||
if (error) error->all(file, line, fmt::format("Invalid range string: {}", str));
|
||||
if (error) error->all(file, line, "Invalid range string: {}", str);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -580,17 +580,14 @@ void utils::bounds(const char *file, int line, const std::string &str,
|
||||
|
||||
if (error) {
|
||||
if ((nlo <= 0) || (nhi <= 0))
|
||||
error->all(file, line, fmt::format("Invalid range string: {}", str));
|
||||
error->all(file, line, "Invalid range string: {}", str);
|
||||
|
||||
if (nlo < nmin)
|
||||
error->all(file, line, fmt::format("Numeric index {} is out of bounds ({}-{})",
|
||||
nlo, nmin, nmax));
|
||||
error->all(file, line, "Numeric index {} is out of bounds ({}-{})", nlo, nmin, nmax);
|
||||
else if (nhi > nmax)
|
||||
error->all(file, line, fmt::format("Numeric index {} is out of bounds ({}-{})",
|
||||
nhi, nmin, nmax));
|
||||
error->all(file, line, "Numeric index {} is out of bounds ({}-{})", nhi, nmin, nmax);
|
||||
else if (nlo > nhi)
|
||||
error->all(file, line, fmt::format("Numeric index {} is out of bounds ({}-{})",
|
||||
nlo, nmin, nhi));
|
||||
error->all(file, line, "Numeric index {} is out of bounds ({}-{})", nlo, nmin, nhi);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user