diff --git a/src/bond.cpp b/src/bond.cpp index 97030ca64f..280f383da0 100644 --- a/src/bond.cpp +++ b/src/bond.cpp @@ -92,8 +92,7 @@ void Bond::init() void Bond::settings(int narg, char **args) { - if (narg > 0) - error->all(FLERR, "Illegal bond_style {} argument: {}", force->bond_style, args[0]); + if (narg > 0) error->all(FLERR, "Illegal bond_style {} argument: {}", force->bond_style, args[0]); } /* ---------------------------------------------------------------------- diff --git a/src/compute_centro_atom.cpp b/src/compute_centro_atom.cpp index 7e048aa78f..b3cedae89e 100644 --- a/src/compute_centro_atom.cpp +++ b/src/compute_centro_atom.cpp @@ -323,11 +323,11 @@ void ComputeCentroAtom::compute_peratom() #define SWAP(a, b) \ tmp = a; \ - (a) = b; \ + (a) = b; \ (b) = tmp; #define ISWAP(a, b) \ itmp = a; \ - (a) = b; \ + (a) = b; \ (b) = itmp; void ComputeCentroAtom::select(int k, int n, double *arr) diff --git a/src/compute_orientorder_atom.cpp b/src/compute_orientorder_atom.cpp index 7cb9886ac2..e224c0d509 100644 --- a/src/compute_orientorder_atom.cpp +++ b/src/compute_orientorder_atom.cpp @@ -334,28 +334,28 @@ double ComputeOrientOrderAtom::memory_usage() #define SWAP(a, b) \ do { \ tmp = a; \ - (a) = b; \ - (b) = tmp; \ + (a) = b; \ + (b) = tmp; \ } while (0) #define ISWAP(a, b) \ do { \ itmp = a; \ - (a) = b; \ - (b) = itmp; \ + (a) = b; \ + (b) = itmp; \ } while (0) -#define SWAP3(a, b) \ - do { \ - tmp = (a)[0]; \ - (a)[0] = (b)[0]; \ - (b)[0] = tmp; \ - tmp = (a)[1]; \ - (a)[1] = (b)[1]; \ - (b)[1] = tmp; \ - tmp = (a)[2]; \ - (a)[2] = (b)[2]; \ - (b)[2] = tmp; \ +#define SWAP3(a, b) \ + do { \ + tmp = (a)[0]; \ + (a)[0] = (b)[0]; \ + (b)[0] = tmp; \ + tmp = (a)[1]; \ + (a)[1] = (b)[1]; \ + (b)[1] = tmp; \ + tmp = (a)[2]; \ + (a)[2] = (b)[2]; \ + (b)[2] = tmp; \ } while (0) /* ---------------------------------------------------------------------- */ diff --git a/src/create_atoms.cpp b/src/create_atoms.cpp index 191f9cb407..52e766cbac 100644 --- a/src/create_atoms.cpp +++ b/src/create_atoms.cpp @@ -179,8 +179,8 @@ void CreateAtoms::command(int narg, char **arg) error->all(FLERR, "Illegal create_atoms command"); iarg += 2; } else if (strcmp(arg[iarg], "var") == 0) { - if (style == SINGLE) error->all(FLERR, "Illegal create_atoms command: " - "can't combine 'var' keyword with 'single' style!"); + if (style == SINGLE) + error->all(FLERR, "Cannot combine 'var' keyword with 'single' style of create_atoms"); if (iarg + 2 > narg) error->all(FLERR, "Illegal create_atoms command"); delete[] vstr; vstr = utils::strdup(arg[iarg + 1]); @@ -244,7 +244,7 @@ void CreateAtoms::command(int narg, char **arg) error->all(FLERR, "Create_atoms maxtry can only be used with random style"); if (iarg + 2 > narg) error->all(FLERR, "Illegal create_atoms command"); maxtry = utils::inumeric(FLERR, arg[iarg + 1], false, lmp); - if (maxtry <= 0) error->all(FLERR,"Illegal create_atoms command"); + if (maxtry <= 0) error->all(FLERR, "Illegal create_atoms command"); iarg += 2; } else error->all(FLERR, "Illegal create_atoms command"); @@ -256,10 +256,8 @@ void CreateAtoms::command(int narg, char **arg) if (ntype <= 0 || ntype > atom->ntypes) error->all(FLERR, "Invalid atom type in create_atoms command"); } else if (mode == MOLECULE) { - if (onemol->xflag == 0) - error->all(FLERR, "Create_atoms molecule must have coordinates"); - if (onemol->typeflag == 0) - error->all(FLERR, "Create_atoms molecule must have atom types"); + if (onemol->xflag == 0) error->all(FLERR, "Create_atoms molecule must have coordinates"); + if (onemol->typeflag == 0) error->all(FLERR, "Create_atoms molecule must have atom types"); if (ntype + onemol->ntypes <= 0 || ntype + onemol->ntypes > atom->ntypes) error->all(FLERR, "Invalid atom type in create_atoms mol command"); if (onemol->tag_require && !atom->tag_enable) @@ -670,7 +668,7 @@ void CreateAtoms::add_random() if (overlapflag) { double odist = overlap; if (mode == MOLECULE) odist += onemol->molradius; - odistsq = odist*odist; + odistsq = odist * odist; } // random number generator, same for all procs @@ -718,7 +716,7 @@ void CreateAtoms::add_random() // insert Nrandom new atom/molecule into simulation box - int ntry,success; + int ntry, success; int ninsert = 0; for (int i = 0; i < nrandom; i++) { @@ -766,7 +764,7 @@ void CreateAtoms::add_random() dely = xone[1] - x[i][1]; delz = xone[2] - x[i][2]; domain->minimum_image(delx, dely, delz); - distsq = delx*delx + dely*dely + delz*delz; + distsq = delx * delx + dely * dely + delz * delz; if (distsq < odistsq) { reject = 1; break; @@ -982,8 +980,7 @@ void CreateAtoms::loop_lattice(int action) // if variable test specified, eval variable - if (varflag && vartest(x) == 0) - continue; + if (varflag && vartest(x) == 0) continue; // test if atom/molecule position is in my subbox diff --git a/src/improper_hybrid.cpp b/src/improper_hybrid.cpp index 6de5dfd343..9708935c8c 100644 --- a/src/improper_hybrid.cpp +++ b/src/improper_hybrid.cpp @@ -160,7 +160,7 @@ void ImproperHybrid::compute(int eflag, int vflag) void ImproperHybrid::allocate() { allocated = 1; - int np1 = atom->nimpropertypes +1; + int np1 = atom->nimpropertypes + 1; memory->create(map, np1, "improper:map"); memory->create(setflag, np1, "improper:setflag"); diff --git a/src/kspace.h b/src/kspace.h index baf984ff74..3dca77c3c3 100644 --- a/src/kspace.h +++ b/src/kspace.h @@ -51,7 +51,7 @@ class KSpace : protected Pointers { // of neighbor lists int mixflag; // 1 if geometric mixing rules are enforced // for LJ coefficients - bool conp_one_step; // calculate A matrix in one step with pppm + bool conp_one_step; // calculate A matrix in one step with pppm int slabflag, wireflag; int scalar_pressure_flag; // 1 if using MSM fast scalar pressure double slab_volfactor, wire_volfactor; diff --git a/src/modify.h b/src/modify.h index 4aeb53dcc6..820b957033 100644 --- a/src/modify.h +++ b/src/modify.h @@ -113,9 +113,7 @@ class Modify : protected Pointers { int find_fix(const std::string &); // new API Fix *get_fix_by_id(const std::string &) const; - Fix *get_fix_by_index(int idx) const { - return ((idx >= 0) && (idx < nfix)) ? fix[idx] : nullptr; - } + Fix *get_fix_by_index(int idx) const { return ((idx >= 0) && (idx < nfix)) ? fix[idx] : nullptr; } const std::vector get_fix_by_style(const std::string &) const; const std::vector &get_fix_list(); @@ -129,7 +127,8 @@ class Modify : protected Pointers { int find_compute(const std::string &); // new API Compute *get_compute_by_id(const std::string &) const; - Compute *get_compute_by_index(int idx) const { + Compute *get_compute_by_index(int idx) const + { return ((idx >= 0) && (idx < ncompute)) ? compute[idx] : nullptr; } const std::vector get_compute_by_style(const std::string &) const; diff --git a/src/thermo.cpp b/src/thermo.cpp index 257c2b78ce..c3cd5adcf5 100644 --- a/src/thermo.cpp +++ b/src/thermo.cpp @@ -336,7 +336,7 @@ void Thermo::header() else if ((vtype[i] == INT) || (vtype[i] == BIGINT)) hdr += fmt::format("{:^11} ", head); } else if (lineflag == YAMLLINE) - hdr += fmt::format("'{}', ", head); + hdr += fmt::format("'{}', ", head); } if (lineflag == YAMLLINE) hdr += "]\ndata:"; diff --git a/src/utils.cpp b/src/utils.cpp index 71f90145c8..87de538dfb 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -669,7 +669,7 @@ int utils::expand_args(const char *file, int line, int narg, char **arg, int mod } } - // fix + // fix } else if (word[0] == 'f') { auto fix = lmp->modify->get_fix_by_id(id); @@ -692,7 +692,7 @@ int utils::expand_args(const char *file, int line, int narg, char **arg, int mod } } - // vector variable + // vector variable } else if (word[0] == 'v') { int index = lmp->input->variable->find(id.c_str()); @@ -709,8 +709,8 @@ int utils::expand_args(const char *file, int line, int narg, char **arg, int mod } } - // only match custom array reference with a '*' wildcard - // number range in the first pair of square brackets + // only match custom array reference with a '*' wildcard + // number range in the first pair of square brackets } else if ((word[0] == 'i') || (word[0] == 'd')) { int flag, cols;