diff --git a/src/DPD-REACT/fix_shardlow.cpp b/src/DPD-REACT/fix_shardlow.cpp index 65fa14daeb..955f1ddd0a 100644 --- a/src/DPD-REACT/fix_shardlow.cpp +++ b/src/DPD-REACT/fix_shardlow.cpp @@ -549,12 +549,9 @@ void FixShardlow::initial_integrate(int /*vflag*/) error->all(FLERR,"Fix shardlow does not yet support triclinic geometries"); if (rcut >= bbx || rcut >= bby || rcut>= bbz ) - { - char fmt[] = {"Shardlow algorithm requires sub-domain length > 2*(rcut+skin). Either reduce the number of processors requested, or change the cutoff/skin: rcut= %e bbx= %e bby= %e bbz= %e\n"}; - char *msg = (char *) malloc(sizeof(fmt) + 4*15); - sprintf(msg, fmt, rcut, bbx, bby, bbz); - error->one(FLERR, msg); - } + error->one(FLERR,"Shardlow algorithm requires sub-domain length > 2*(rcut+skin). " + "Either reduce the number of processors requested, or change the cutoff/skin: " + "rcut= {} bbx= {} bby= {} bbz= {}\n", rcut, bbx, bby, bbz); NPairHalfBinNewtonSSA *np_ssa = dynamic_cast(list->np); if (!np_ssa) error->one(FLERR, "NPair wasn't a NPairHalfBinNewtonSSA object"); diff --git a/src/REPLICA/fix_pimd.cpp b/src/REPLICA/fix_pimd.cpp index bb4af16f1b..d4b3447f15 100644 --- a/src/REPLICA/fix_pimd.cpp +++ b/src/REPLICA/fix_pimd.cpp @@ -676,16 +676,11 @@ void FixPIMD::comm_exec(double **ptr) int index = atom->map(tag_send[i]); if (index < 0) { - char error_line[256]; - - sprintf(error_line, - "Atom " TAGINT_FORMAT " is missing at world [%d] " - "rank [%d] required by rank [%d] (" TAGINT_FORMAT ", " TAGINT_FORMAT - ", " TAGINT_FORMAT ").\n", - tag_send[i], universe->iworld, comm->me, plan_recv[iplan], atom->tag[0], - atom->tag[1], atom->tag[2]); - - error->universe_one(FLERR, error_line); + auto mesg = fmt::format("Atom {} is missing at world [{}] rank [{}] " + "required by rank [{}] ({}, {}, {}).\n", + tag_send[i], universe->iworld, comm->me, + plan_recv[iplan], atom->tag[0], atom->tag[1], atom->tag[2]); + error->universe_one(FLERR, mesg); } memcpy(wrap_ptr, ptr[index], ncpy); diff --git a/src/REPLICA/tad.cpp b/src/REPLICA/tad.cpp index 881ec1604c..0b1cc915c6 100644 --- a/src/REPLICA/tad.cpp +++ b/src/REPLICA/tad.cpp @@ -840,11 +840,9 @@ void TAD::initialize_event_list() { void TAD::delete_event_list() { - for (int i = 0; i < n_event_list; i++) { - char str[128]; - sprintf(str,"tad_event_%d",i); - modify->delete_fix(str); - } + for (int i = 0; i < n_event_list; i++) + modify->delete_fix(fmt::format("tad_event_{}",i)); + memory->sfree(fix_event_list); fix_event_list = nullptr; n_event_list = 0;