make more use of utils::logmesg()
This commit is contained in:
@ -113,7 +113,7 @@ void Balance::command(int narg, char **arg)
|
||||
if (domain->box_exist == 0)
|
||||
error->all(FLERR,"Balance command before simulation box is defined");
|
||||
|
||||
if (me == 0 && screen) fprintf(screen,"Balancing ...\n");
|
||||
if (me == 0) utils::logmesg(lmp,"Balancing ...\n");
|
||||
|
||||
// parse required arguments
|
||||
|
||||
|
||||
@ -49,7 +49,7 @@ void ChangeBox::command(int narg, char **arg)
|
||||
error->all(FLERR,"Change_box command before simulation box is defined");
|
||||
if (narg < 2) error->all(FLERR,"Illegal change_box command");
|
||||
|
||||
if (comm->me == 0 && screen) fprintf(screen,"Changing box ...\n");
|
||||
if (comm->me == 0) utils::logmesg(lmp,"Changing box ...\n");
|
||||
|
||||
// group
|
||||
|
||||
|
||||
@ -282,8 +282,7 @@ void DeleteAtoms::delete_overlap(int narg, char **arg)
|
||||
int group1bit = group->bitmask[igroup1];
|
||||
int group2bit = group->bitmask[igroup2];
|
||||
|
||||
if (comm->me == 0 && screen)
|
||||
fprintf(screen,"System init for delete_atoms ...\n");
|
||||
if (comm->me == 0) utils::logmesg(lmp,"System init for delete_atoms ...\n");
|
||||
|
||||
// request a full neighbor list for use by this command
|
||||
|
||||
|
||||
@ -51,11 +51,10 @@ void DeleteBonds::command(int narg, char **arg)
|
||||
// init entire system since comm->borders is done
|
||||
// comm::init needs neighbor::init needs pair::init needs kspace::init, etc
|
||||
|
||||
if (comm->me == 0 && screen)
|
||||
fprintf(screen,"System init for delete_bonds ...\n");
|
||||
if (comm->me == 0) utils::logmesg(lmp,"System init for delete_bonds ...\n");
|
||||
lmp->init();
|
||||
|
||||
if (comm->me == 0 && screen) fprintf(screen,"Deleting bonds ...\n");
|
||||
if (comm->me == 0) utils::logmesg(lmp,"Deleting bonds ...\n");
|
||||
|
||||
// identify group
|
||||
|
||||
|
||||
@ -34,6 +34,7 @@
|
||||
#include "math_extra.h"
|
||||
#include "memory.h"
|
||||
#include "error.h"
|
||||
#include "utils.h"
|
||||
#include "fmt/format.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
@ -68,7 +69,7 @@ void DisplaceAtoms::command(int narg, char **arg)
|
||||
error->all(FLERR,"Cannot displace_atoms after "
|
||||
"reading restart file with per-atom info");
|
||||
|
||||
if (comm->me == 0 && screen) fprintf(screen,"Displacing atoms ...\n");
|
||||
if (comm->me == 0) utils::logmesg(lmp,"Displacing atoms ...\n");
|
||||
|
||||
// group and style
|
||||
|
||||
|
||||
@ -120,7 +120,7 @@ void ReadDump::command(int narg, char **arg)
|
||||
|
||||
// find the snapshot and read/bcast/process header info
|
||||
|
||||
if (me == 0 && screen) fprintf(screen,"Scanning dump file ...\n");
|
||||
if (me == 0) utils::logmesg(lmp,"Scanning dump file ...\n");
|
||||
|
||||
bigint ntimestep = seek(nstep,1);
|
||||
if (ntimestep < 0)
|
||||
@ -135,8 +135,7 @@ void ReadDump::command(int narg, char **arg)
|
||||
|
||||
// read in the snapshot and reset system
|
||||
|
||||
if (me == 0 && screen)
|
||||
fprintf(screen,"Reading snapshot from dump file ...\n");
|
||||
if (me == 0) utils::logmesg(lmp,"Reading snapshot from dump file ...\n");
|
||||
|
||||
bigint natoms_prev = atom->natoms;
|
||||
atoms();
|
||||
|
||||
@ -103,7 +103,7 @@ void ReadRestart::command(int narg, char **arg)
|
||||
// open single restart file or base file for multiproc case
|
||||
|
||||
if (me == 0) {
|
||||
if (screen) fprintf(screen,"Reading restart file ...\n");
|
||||
utils::logmesg(lmp,"Reading restart file ...\n");
|
||||
std::string hfile = file;
|
||||
if (multiproc) {
|
||||
hfile.replace(hfile.find("%"),1,"base");
|
||||
@ -620,10 +620,9 @@ void ReadRestart::header()
|
||||
|
||||
if (flag == VERSION) {
|
||||
char *version = read_string();
|
||||
if (me == 0) {
|
||||
if (screen) fprintf(screen," restart file = %s, LAMMPS = %s\n",
|
||||
version,universe->version);
|
||||
}
|
||||
if (me == 0)
|
||||
utils::logmesg(lmp,fmt::format(" restart file = {}, LAMMPS = {}\n",
|
||||
version,universe->version));
|
||||
delete [] version;
|
||||
|
||||
// we have no forward compatibility, thus exit with error
|
||||
|
||||
@ -48,7 +48,7 @@ void Replicate::command(int narg, char **arg)
|
||||
int me = comm->me;
|
||||
int nprocs = comm->nprocs;
|
||||
|
||||
if (me == 0 && screen) fprintf(screen,"Replicating atoms ...\n");
|
||||
if (me == 0) utils::logmesg(lmp,"Replicating atoms ...\n");
|
||||
|
||||
// nrep = total # of replications
|
||||
|
||||
@ -349,12 +349,14 @@ void Replicate::command(int narg, char **arg)
|
||||
int size_buf_all = 0;
|
||||
MPI_Allreduce(&n, &size_buf_all, 1, MPI_INT, MPI_SUM, world);
|
||||
|
||||
if (me == 0 && screen) {
|
||||
fmt::print(screen," bounding box image = ({} {} {}) to ({} {} {})\n",
|
||||
_imagelo[0],_imagelo[1],_imagelo[2],
|
||||
_imagehi[0],_imagehi[1],_imagehi[2]);
|
||||
fmt::print(screen," bounding box extra memory = {:.2f} MB\n",
|
||||
(double)size_buf_all*sizeof(double)/1024/1024);
|
||||
if (me == 0) {
|
||||
auto mesg = fmt::format(" bounding box image = ({:.8} {:.8} {:.8}) "
|
||||
"to ({:.8} {:.8} {:.8})\n",
|
||||
_imagelo[0],_imagelo[1],_imagelo[2],
|
||||
_imagehi[0],_imagehi[1],_imagehi[2]);
|
||||
mesg += fmt::format(" bounding box extra memory = {:.2f} MB\n",
|
||||
(double)size_buf_all*sizeof(double)/1024/1024);
|
||||
utils::logmesg(lmp,mesg);
|
||||
}
|
||||
|
||||
// rnk offsets
|
||||
@ -632,11 +634,10 @@ void Replicate::command(int narg, char **arg)
|
||||
int sum = 0;
|
||||
MPI_Reduce(&num_replicas_added, &sum, 1, MPI_INT, MPI_SUM, 0, world);
|
||||
double avg = (double) sum / nprocs;
|
||||
if (me == 0 && screen)
|
||||
fprintf(screen," average # of replicas added to proc = %.2f "
|
||||
"out of %i (%.2f %%)\n",
|
||||
avg,nx*ny*nz,avg/(nx*ny*nz)*100.0);
|
||||
|
||||
if (me == 0)
|
||||
utils::logmesg(lmp,fmt::format(" average # of replicas added to proc ="
|
||||
" {:.2f} out of {} ({:.2f}%)\n",
|
||||
avg,nx*ny*nz,avg/(nx*ny*nz)*100.0));
|
||||
} else {
|
||||
|
||||
for (int iproc = 0; iproc < nprocs; iproc++) {
|
||||
|
||||
@ -82,7 +82,7 @@ void Set::command(int narg, char **arg)
|
||||
// loop over keyword/value pairs
|
||||
// call appropriate routine to reset attributes
|
||||
|
||||
if (comm->me == 0 && screen) fprintf(screen,"Setting atom values ...\n");
|
||||
if (comm->me == 0) utils::logmesg(lmp,"Setting atom values ...\n");
|
||||
|
||||
int allcount,origarg;
|
||||
|
||||
@ -1264,7 +1264,7 @@ void Set::topology(int keyword)
|
||||
// init entire system since comm->exchange is done
|
||||
// comm::init needs neighbor::init needs pair::init needs kspace::init, etc
|
||||
|
||||
if (comm->me == 0 && screen) fprintf(screen," system init for set ...\n");
|
||||
if (comm->me == 0) utils::logmesg(lmp," system init for set ...\n");
|
||||
lmp->init();
|
||||
|
||||
if (domain->triclinic) domain->x2lamda(atom->nlocal);
|
||||
|
||||
@ -105,8 +105,7 @@ void WriteData::command(int narg, char **arg)
|
||||
// e.g. pair hybrid coeffs, dpd ghost-atom velocity setting
|
||||
|
||||
if (noinit == 0) {
|
||||
if (comm->me == 0 && screen)
|
||||
fputs("System init for write_data ...\n",screen);
|
||||
if (comm->me == 0) utils::logmesg(lmp,"System init for write_data ...\n");
|
||||
lmp->init();
|
||||
|
||||
// move atoms to new processors before writing file
|
||||
|
||||
@ -87,8 +87,7 @@ void WriteRestart::command(int narg, char **arg)
|
||||
// comm::init needs neighbor::init needs pair::init needs kspace::init, etc
|
||||
|
||||
if (noinit == 0) {
|
||||
if (comm->me == 0 && screen)
|
||||
fprintf(screen,"System init for write_restart ...\n");
|
||||
if (comm->me == 0) utils::logmesg(lmp,"System init for write_restart ...\n");
|
||||
lmp->init();
|
||||
|
||||
// move atoms to new processors before writing file
|
||||
|
||||
Reference in New Issue
Block a user