apply clang-format

This commit is contained in:
Axel Kohlmeyer
2022-05-14 18:01:34 -04:00
parent a79814793e
commit 8e6b0425f7
9 changed files with 37 additions and 42 deletions

View File

@ -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]);
}
/* ----------------------------------------------------------------------

View File

@ -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)

View File

@ -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)
/* ---------------------------------------------------------------------- */

View File

@ -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

View File

@ -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");

View File

@ -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;

View File

@ -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<Fix *> get_fix_by_style(const std::string &) const;
const std::vector<Fix *> &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<Compute *> get_compute_by_style(const std::string &) const;

View File

@ -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:";

View File

@ -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;