simplify format handling
This commit is contained in:
@ -18,18 +18,19 @@
|
||||
|
||||
#include "fix_ipi.h"
|
||||
|
||||
#include <cstring>
|
||||
#include "atom.h"
|
||||
#include "force.h"
|
||||
#include "update.h"
|
||||
#include "comm.h"
|
||||
#include "compute.h"
|
||||
#include "domain.h"
|
||||
#include "error.h"
|
||||
#include "force.h"
|
||||
#include "irregular.h"
|
||||
#include "kspace.h"
|
||||
#include "modify.h"
|
||||
#include "compute.h"
|
||||
#include "comm.h"
|
||||
#include "neighbor.h"
|
||||
#include "irregular.h"
|
||||
#include "domain.h"
|
||||
#include "update.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
using namespace FixConst;
|
||||
@ -83,15 +84,13 @@ static void open_socket(int &sockfd, int inet, int port, char* host,
|
||||
|
||||
// fetches information on the host
|
||||
struct addrinfo hints, *res;
|
||||
char service[256];
|
||||
|
||||
memset(&hints, 0, sizeof(hints));
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
hints.ai_family = AF_UNSPEC;
|
||||
hints.ai_flags = AI_PASSIVE;
|
||||
|
||||
sprintf(service,"%d",port); // convert the port number to a string
|
||||
ai_err = getaddrinfo(host, service, &hints, &res);
|
||||
ai_err = getaddrinfo(host, std::to_string(port).c_str(), &hints, &res);
|
||||
if (ai_err!=0)
|
||||
error->one(FLERR,"Error fetching host data. Wrong host name?");
|
||||
|
||||
|
||||
@ -246,10 +246,8 @@ void FixSRP::setup_pre_force(int /*zz*/)
|
||||
int nadd_all = 0, ndel_all = 0;
|
||||
MPI_Allreduce(&ndel,&ndel_all,1,MPI_INT,MPI_SUM,world);
|
||||
MPI_Allreduce(&nadd,&nadd_all,1,MPI_INT,MPI_SUM,world);
|
||||
if (comm->me == 0) {
|
||||
sprintf(str, "Removed/inserted %d/%d bond particles.", ndel_all,nadd_all);
|
||||
error->message(FLERR,str);
|
||||
}
|
||||
if (comm->me == 0)
|
||||
error->message(FLERR,"Removed/inserted {}/{} bond particles.", ndel_all,nadd_all);
|
||||
|
||||
// check ghost comm distances
|
||||
// warn and change if shorter from estimate
|
||||
@ -276,11 +274,9 @@ void FixSRP::setup_pre_force(int /*zz*/)
|
||||
cutghostmin = comm->cutghost[2]/length2;
|
||||
|
||||
// stop if cutghost is insufficient
|
||||
if (cutneighmax_srp > cutghostmin) {
|
||||
sprintf(str, "Communication cutoff too small for fix srp. "
|
||||
"Need %f, current %f.", cutneighmax_srp, cutghostmin);
|
||||
error->all(FLERR,str);
|
||||
}
|
||||
if (cutneighmax_srp > cutghostmin)
|
||||
error->all(FLERR,"Communication cutoff too small for fix srp. "
|
||||
"Need {:.8}, current {:.8}", cutneighmax_srp, cutghostmin);
|
||||
|
||||
// assign tags for new atoms, update map
|
||||
atom->tag_extend();
|
||||
@ -515,14 +511,8 @@ void FixSRP::post_run()
|
||||
|
||||
bigint ndelete = natoms_previous - atom->natoms;
|
||||
|
||||
if (comm->me == 0) {
|
||||
if (screen) fprintf(screen,"Deleted " BIGINT_FORMAT
|
||||
" atoms, new total = " BIGINT_FORMAT "\n",
|
||||
ndelete,atom->natoms);
|
||||
if (logfile) fprintf(logfile,"Deleted " BIGINT_FORMAT
|
||||
" atoms, new total = " BIGINT_FORMAT "\n",
|
||||
ndelete,atom->natoms);
|
||||
}
|
||||
if (comm->me == 0)
|
||||
utils::logmesg(lmp,"Deleted {} atoms, new total = {}\n",ndelete,atom->natoms);
|
||||
|
||||
// verlet calls box_too_small_check() in post_run
|
||||
// this check maps all bond partners
|
||||
|
||||
@ -28,24 +28,23 @@ Please contact Timothy Sirk for questions (tim.sirk@us.army.mil).
|
||||
|
||||
#include "pair_srp.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include <cstring>
|
||||
#include "atom.h"
|
||||
#include "citeme.h"
|
||||
#include "comm.h"
|
||||
#include "force.h"
|
||||
#include "neighbor.h"
|
||||
#include "neigh_list.h"
|
||||
#include "memory.h"
|
||||
#include "error.h"
|
||||
#include "domain.h"
|
||||
#include "modify.h"
|
||||
#include "error.h"
|
||||
#include "fix.h"
|
||||
#include "fix_srp.h"
|
||||
#include "thermo.h"
|
||||
#include "force.h"
|
||||
#include "memory.h"
|
||||
#include "modify.h"
|
||||
#include "neigh_list.h"
|
||||
#include "neighbor.h"
|
||||
#include "output.h"
|
||||
#include "citeme.h"
|
||||
#include "thermo.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
@ -79,26 +78,15 @@ PairSRP::PairSRP(LAMMPS *lmp) : Pair(lmp)
|
||||
nextra = 1;
|
||||
segment = nullptr;
|
||||
|
||||
// generate unique fix-id for this pair style instance
|
||||
|
||||
fix_id = strdup("XX_FIX_SRP");
|
||||
fix_id[0] = '0' + srp_instance / 10;
|
||||
fix_id[1] = '0' + srp_instance % 10;
|
||||
++srp_instance;
|
||||
|
||||
// create fix SRP instance here
|
||||
// create fix SRP instance here with unique fix id
|
||||
// similar to granular pair styles with history,
|
||||
// this should be early enough that FixSRP::pre_exchange()
|
||||
// will be invoked before other fixes that migrate atoms
|
||||
// this is checked for in FixSRP
|
||||
|
||||
char **fixarg = new char*[3];
|
||||
fixarg[0] = fix_id;
|
||||
fixarg[1] = (char *) "all";
|
||||
fixarg[2] = (char *) "SRP";
|
||||
modify->add_fix(3,fixarg);
|
||||
modify->add_fix(fmt::format("{:02d}_FIX_SRP all SRP",srp_instance));
|
||||
f_srp = (FixSRP *) modify->fix[modify->nfix-1];
|
||||
delete [] fixarg;
|
||||
++srp_instance;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
@ -468,10 +456,8 @@ void PairSRP::init_style()
|
||||
if (f_srp != (FixSRP *)modify->fix[ifix])
|
||||
error->all(FLERR,"Fix SRP has been changed unexpectedly");
|
||||
|
||||
if (comm->me == 0) {
|
||||
if (screen) fprintf(screen,"Using type %d for bond particles\n",bptype);
|
||||
if (logfile) fprintf(logfile,"Using type %d for bond particles\n",bptype);
|
||||
}
|
||||
if (comm->me == 0)
|
||||
utils::logmesg(lmp,"Using type {} for bond particles\n",bptype);
|
||||
|
||||
// set bond and bond particle types in fix srp
|
||||
// bonds of this type will be represented by bond particles
|
||||
|
||||
Reference in New Issue
Block a user