simplifications in REPLICA

This commit is contained in:
Axel Kohlmeyer
2020-06-29 12:35:20 -04:00
parent 96d943513e
commit 6ace98b64e
4 changed files with 53 additions and 64 deletions

View File

@ -15,6 +15,7 @@
#include <mpi.h> #include <mpi.h>
#include <cmath> #include <cmath>
#include <cstring> #include <cstring>
#include <string>
#include "atom.h" #include "atom.h"
#include "update.h" #include "update.h"
#include "group.h" #include "group.h"
@ -29,6 +30,7 @@
#include "math_extra.h" #include "math_extra.h"
#include "memory.h" #include "memory.h"
#include "error.h" #include "error.h"
#include "fmt/format.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
using namespace FixConst; using namespace FixConst;
@ -858,12 +860,11 @@ void FixHyperLocal::pre_reverse(int /* eflag */, int /* vflag */)
int allcount; int allcount;
MPI_Allreduce(&checkbias_count,&allcount,1,MPI_INT,MPI_SUM,world); MPI_Allreduce(&checkbias_count,&allcount,1,MPI_INT,MPI_SUM,world);
if (allcount) { if (allcount) {
char str[128]; std::string mesg = fmt::format("Fix hyper/local biased bonds too close: "
sprintf(str,"Fix hyper/local biased bonds too close: " "cumulative atom count {}",allcount);
"cumulative atom count %d",allcount);
if (checkbias_flag == WARN) { if (checkbias_flag == WARN) {
if (me == 0) error->warning(FLERR,str); if (me == 0) error->warning(FLERR,mesg);
} else error->all(FLERR,str); } else error->all(FLERR,mesg);
} }
} }
} }

View File

@ -14,6 +14,7 @@
#include "hyper.h" #include "hyper.h"
#include <mpi.h> #include <mpi.h>
#include <cstring> #include <cstring>
#include <string>
#include "update.h" #include "update.h"
#include "domain.h" #include "domain.h"
#include "region.h" #include "region.h"
@ -31,6 +32,8 @@
#include "timer.h" #include "timer.h"
#include "memory.h" #include "memory.h"
#include "error.h" #include "error.h"
#include "utils.h"
#include "fmt/format.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
@ -247,10 +250,7 @@ void Hyper::command(int narg, char **arg)
update->nsteps = nsteps; update->nsteps = nsteps;
if (me == 0) { if (me == 0) utils::logmesg(lmp,"Final hyper stats ...\n\n");
if (screen) fprintf(screen,"Final hyper stats ...\n\n");
if (logfile) fprintf(logfile,"Final hyper stats ...\n\n");
}
// subset of quantities also available in fix hyper output // subset of quantities also available in fix hyper output
// set t_hyper to no-boost value when hyperenable is not set // set t_hyper to no-boost value when hyperenable is not set
@ -298,55 +298,47 @@ void Hyper::command(int narg, char **arg)
} }
if (me == 0) { if (me == 0) {
FILE *out; std::string mesg = "Cummulative quantities for fix hyper:\n";
for (int iout = 0; iout < 2; iout++) { mesg += fmt::format(" hyper time = {}\n",t_hyper);
if (iout == 0) out = screen;
if (iout == 1) out = logfile;
if (!out) continue;
fprintf(out,"Cummulative quantities for fix hyper:\n");
fprintf(out," hyper time = %g\n",t_hyper);
if (hyperenable) if (hyperenable)
fprintf(out," time boost factor = %g\n", t_hyper / mesg += fmt::format(" time boost factor = {}\n", t_hyper /
((update->ntimestep -fix_hyper->ntimestep_initial)*update->dt)); ((update->ntimestep -fix_hyper->ntimestep_initial)*update->dt));
else fprintf(out," time boost factor = 1\n"); else mesg += " time boost factor = 1\n";
fprintf(out," event timesteps = %d\n",nevent_running); mesg += fmt::format(" event timesteps = {}\n",nevent_running);
fprintf(out," # of atoms in events = %d\n",nevent_atoms_running); mesg += fmt::format(" # of atoms in events = {}\n",nevent_atoms_running);
fprintf(out,"Quantities for this hyper run:\n"); mesg += "Quantities for this hyper run:\n";
fprintf(out," event timesteps = %d\n",nevent); mesg += fmt::format(" event timesteps = {}\n",nevent);
fprintf(out," # of atoms in events = %d\n",nevent_atoms); mesg += fmt::format(" # of atoms in events = {}\n",nevent_atoms);
fprintf(out," max length of any bond = %g\n",maxbondlen); mesg += fmt::format(" max length of any bond = {}\n",maxbondlen);
fprintf(out," max drift distance of any atom = %g\n",maxdrift); mesg += fmt::format(" max drift distance of any atom = {}\n",maxdrift);
fprintf(out," fraction of biased bonds with zero bias = %g\n",fraczero); mesg += fmt::format(" fraction of biased bonds with zero bias = {}\n",fraczero);
fprintf(out," fraction of biased bonds with negative strain = %g\n", mesg += fmt::format(" fraction of biased bonds with negative strain = {}\n",fracneg);
fracneg); mesg += "Current quantities:\n";
fprintf(out,"Current quantities:\n"); mesg += fmt::format(" ave bonds/atom = {}\n",avebonds);
fprintf(out," ave bonds/atom = %g\n",avebonds);
if (hyperstyle == LOCAL) { if (hyperstyle == LOCAL) {
fprintf(out,"Cummulative quantities specific to fix hyper/local:\n"); mesg += "Cummulative quantities specific to fix hyper/local:\n";
fprintf(out," # of new bonds formed = %g\n",nnewbond); mesg += fmt::format(" # of new bonds formed = {}\n",nnewbond);
fprintf(out," max bonds/atom = %g\n",maxbondperatom); mesg += fmt::format(" max bonds/atom = {}\n",maxbondperatom);
fprintf(out,"Quantities for this hyper run specific to " mesg += "Quantities for this hyper run specific to fix hyper/local:\n";
"fix hyper/local:\n"); mesg += fmt::format(" ave boost for all bonds/step = {}\n",aveboost);
fprintf(out," ave boost for all bonds/step = %g\n",aveboost); mesg += fmt::format(" ave biased bonds/step = {}\n",avenbias);
fprintf(out," ave biased bonds/step = %g\n",avenbias); mesg += fmt::format(" ave bias coeff of all bonds = {}\n",avebiascoeff);
fprintf(out," ave bias coeff of all bonds = %g\n",avebiascoeff); mesg += fmt::format(" min bias coeff of any bond = {}\n",minbiascoeff);
fprintf(out," min bias coeff of any bond = %g\n",minbiascoeff); mesg += fmt::format(" max bias coeff of any bond = {}\n",maxbiascoeff);
fprintf(out," max bias coeff of any bond = %g\n",maxbiascoeff); mesg += fmt::format(" max dist from my subbox of any "
fprintf(out," max dist from my subbox of any " "non-maxstrain bond ghost atom = {}\n",rmaxever);
"non-maxstrain bond ghost atom = %g\n",rmaxever); mesg += fmt::format(" max dist from my box of any bond ghost atom = {}\n",
fprintf(out," max dist from my box of any bond ghost atom = %g\n",
rmaxeverbig); rmaxeverbig);
fprintf(out," count of bond ghost neighbors " mesg += fmt::format(" count of bond ghost neighbors "
"not found on reneighbor steps = %g\n",allghost_toofar); "not found on reneighbor steps = {}\n",allghost_toofar);
fprintf(out," bias overlaps = %g\n",biasoverlap); mesg += fmt::format(" bias overlaps = {}\n",biasoverlap);
fprintf(out," CPU time for bond builds = %g\n",tbondbuild); mesg += fmt::format(" CPU time for bond builds = {}\n",tbondbuild);
fprintf(out,"Current quantities specific to fix hyper/local:\n"); mesg += "Current quantities specific to fix hyper/local:\n";
fprintf(out," neighbor bonds/bond = %g\n",neighbondperbond); mesg += fmt::format(" neighbor bonds/bond = {}\n",neighbondperbond);
fprintf(out," ave boost coeff for all bonds = %g\n",avebiasnow); mesg += fmt::format(" ave boost coeff for all bonds = {}\n",avebiasnow);
}
fprintf(out,"\n");
} }
utils::logmesg(lmp, mesg);
} }
// timing stats // timing stats

View File

@ -40,6 +40,7 @@
#include "timer.h" #include "timer.h"
#include "memory.h" #include "memory.h"
#include "error.h" #include "error.h"
#include "utils.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
@ -440,10 +441,7 @@ void PRD::command(int narg, char **arg)
nsteps,atom->natoms); nsteps,atom->natoms);
} }
if (me == 0) { if (me == 0) utils::logmesg(lmp,"\nPRD done\n");
if (screen) fprintf(screen,"\nPRD done\n");
if (logfile) fprintf(logfile,"\nPRD done\n");
}
finish->end(2); finish->end(2);

View File

@ -37,6 +37,7 @@
#include "timer.h" #include "timer.h"
#include "memory.h" #include "memory.h"
#include "error.h" #include "error.h"
#include "utils.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
@ -398,10 +399,7 @@ void TAD::command(int narg, char **arg)
if ((me_universe == 0) && ulogfile_neb) fclose(ulogfile_neb); if ((me_universe == 0) && ulogfile_neb) fclose(ulogfile_neb);
if (me == 0) { if (me == 0) utils::logmesg(lmp,"\nTAD done\n");
if (screen) fprintf(screen,"\nTAD done\n");
if (logfile) fprintf(logfile,"\nTAD done\n");
}
finish->end(3); finish->end(3);