From a6767c85b01e6afd0ef71736ffc1d9aa14dd4ea2 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 4 Aug 2023 12:11:59 -0400 Subject: [PATCH] apply clang-format --- src/fix_update_special_bonds.cpp | 2 +- src/force.cpp | 10 +++++----- src/pair_buck_coul_cut.cpp | 6 +++--- src/pair_coul_cut.cpp | 4 ++-- src/pair_lj_cut_coul_cut.cpp | 4 ++-- src/read_data.cpp | 2 +- src/reset_atoms_id.cpp | 3 ++- src/thermo.cpp | 21 +++++++++++++-------- src/update.cpp | 4 ++-- 9 files changed, 31 insertions(+), 25 deletions(-) diff --git a/src/fix_update_special_bonds.cpp b/src/fix_update_special_bonds.cpp index dd12265e5d..159b2a1170 100644 --- a/src/fix_update_special_bonds.cpp +++ b/src/fix_update_special_bonds.cpp @@ -258,6 +258,6 @@ void FixUpdateSpecialBonds::write_restart(FILE *fp) pre_exchange(); if (comm->me == 0) { int size = 0; - fwrite(&size,sizeof(int),1,fp); + fwrite(&size, sizeof(int), 1, fp); } } diff --git a/src/force.cpp b/src/force.cpp index 347b3087cf..a135be8d69 100644 --- a/src/force.cpp +++ b/src/force.cpp @@ -346,7 +346,7 @@ Bond *Force::new_bond(const std::string &style, int trysuffix, int &sflag) { if (trysuffix && lmp->suffix_enable) { if (lmp->non_pair_suffix()) { - sflag = 1 + 2*lmp->pair_only_flag; + sflag = 1 + 2 * lmp->pair_only_flag; std::string estyle = style + "/" + lmp->non_pair_suffix(); if (bond_map->find(estyle) != bond_map->end()) { BondCreator &bond_creator = (*bond_map)[estyle]; @@ -414,7 +414,7 @@ Angle *Force::new_angle(const std::string &style, int trysuffix, int &sflag) { if (trysuffix && lmp->suffix_enable) { if (lmp->non_pair_suffix()) { - sflag = 1 + 2*lmp->pair_only_flag; + sflag = 1 + 2 * lmp->pair_only_flag; std::string estyle = style + "/" + lmp->non_pair_suffix(); if (angle_map->find(estyle) != angle_map->end()) { AngleCreator &angle_creator = (*angle_map)[estyle]; @@ -482,7 +482,7 @@ Dihedral *Force::new_dihedral(const std::string &style, int trysuffix, int &sfla { if (trysuffix && lmp->suffix_enable) { if (lmp->non_pair_suffix()) { - sflag = 1 + 2*lmp->pair_only_flag; + sflag = 1 + 2 * lmp->pair_only_flag; std::string estyle = style + "/" + lmp->non_pair_suffix(); if (dihedral_map->find(estyle) != dihedral_map->end()) { DihedralCreator &dihedral_creator = (*dihedral_map)[estyle]; @@ -550,7 +550,7 @@ Improper *Force::new_improper(const std::string &style, int trysuffix, int &sfla { if (trysuffix && lmp->suffix_enable) { if (lmp->non_pair_suffix()) { - sflag = 1 + 2*lmp->pair_only_flag; + sflag = 1 + 2 * lmp->pair_only_flag; std::string estyle = style + "/" + lmp->non_pair_suffix(); if (improper_map->find(estyle) != improper_map->end()) { ImproperCreator &improper_creator = (*improper_map)[estyle]; @@ -618,7 +618,7 @@ KSpace *Force::new_kspace(const std::string &style, int trysuffix, int &sflag) { if (trysuffix && lmp->suffix_enable) { if (lmp->non_pair_suffix()) { - sflag = 1 + 2*lmp->pair_only_flag; + sflag = 1 + 2 * lmp->pair_only_flag; std::string estyle = style + "/" + lmp->non_pair_suffix(); if (kspace_map->find(estyle) != kspace_map->end()) { KSpaceCreator &kspace_creator = (*kspace_map)[estyle]; diff --git a/src/pair_buck_coul_cut.cpp b/src/pair_buck_coul_cut.cpp index 369b77474f..933493eab6 100644 --- a/src/pair_buck_coul_cut.cpp +++ b/src/pair_buck_coul_cut.cpp @@ -477,8 +477,8 @@ double PairBuckCoulCut::single(int i, int j, int itype, int jtype, double rsq, d /* ---------------------------------------------------------------------- */ void PairBuckCoulCut::born_matrix(int i, int j, int itype, int jtype, double rsq, - double factor_coul, double factor_lj, double &dupair, - double &du2pair) + double factor_coul, double factor_lj, double &dupair, + double &du2pair) { double rinv, r2inv, r3inv, r6inv, r7inv, r8inv, r, rexp; double du_lj, du2_lj, du_coul, du2_coul; @@ -487,7 +487,7 @@ void PairBuckCoulCut::born_matrix(int i, int j, int itype, int jtype, double rsq double qqrd2e = force->qqrd2e; r = sqrt(rsq); - rexp = exp(-r*rhoinv[itype][jtype]); + rexp = exp(-r * rhoinv[itype][jtype]); r2inv = 1.0 / rsq; rinv = sqrt(r2inv); diff --git a/src/pair_coul_cut.cpp b/src/pair_coul_cut.cpp index f0a749baa8..806d7a1066 100644 --- a/src/pair_coul_cut.cpp +++ b/src/pair_coul_cut.cpp @@ -331,8 +331,8 @@ double PairCoulCut::single(int i, int j, int /*itype*/, int /*jtype*/, double rs /* ---------------------------------------------------------------------- */ void PairCoulCut::born_matrix(int i, int j, int /*itype*/, int /*jtype*/, double rsq, - double factor_coul, double /*factor_lj*/, double &dupair, - double &du2pair) + double factor_coul, double /*factor_lj*/, double &dupair, + double &du2pair) { double rinv, r2inv, r3inv; double du_coul, du2_coul; diff --git a/src/pair_lj_cut_coul_cut.cpp b/src/pair_lj_cut_coul_cut.cpp index e62e08ea4b..8e4e98a1ba 100644 --- a/src/pair_lj_cut_coul_cut.cpp +++ b/src/pair_lj_cut_coul_cut.cpp @@ -462,8 +462,8 @@ double PairLJCutCoulCut::single(int i, int j, int itype, int jtype, double rsq, /* ---------------------------------------------------------------------- */ void PairLJCutCoulCut::born_matrix(int i, int j, int itype, int jtype, double rsq, - double factor_coul, double factor_lj, double &dupair, - double &du2pair) + double factor_coul, double factor_lj, double &dupair, + double &du2pair) { double rinv, r2inv, r3inv, r6inv; double du_lj, du2_lj, du_coul, du2_coul; diff --git a/src/read_data.cpp b/src/read_data.cpp index e3087ae215..4b4602f1fc 100644 --- a/src/read_data.cpp +++ b/src/read_data.cpp @@ -2021,7 +2021,7 @@ void ReadData::pairIJcoeffs() if (eof) error->all(FLERR, "Unexpected end of data file"); if (tlabelflag && !lmap->is_complete(Atom::ATOM)) - error->all(FLERR,"Label map is incomplete: all types must be assigned a unique type label"); + error->all(FLERR, "Label map is incomplete: all types must be assigned a unique type label"); char *original = buf; for (i = 0; i < ntypes; i++) diff --git a/src/reset_atoms_id.cpp b/src/reset_atoms_id.cpp index 9e8ba3630d..a6382e6aee 100644 --- a/src/reset_atoms_id.cpp +++ b/src/reset_atoms_id.cpp @@ -43,7 +43,8 @@ static int compare_coords(const int, const int, void *); /* ---------------------------------------------------------------------- */ -ResetAtomsID::ResetAtomsID(LAMMPS *lmp) : Command(lmp) { +ResetAtomsID::ResetAtomsID(LAMMPS *lmp) : Command(lmp) +{ binlo = binhi = -1; } diff --git a/src/thermo.cpp b/src/thermo.cpp index 88ceb27f87..9f21146588 100644 --- a/src/thermo.cpp +++ b/src/thermo.cpp @@ -691,11 +691,12 @@ void Thermo::modify_params(int narg, char **arg) utils::bounds(FLERR, arg[iarg + 1], 1, nfield_initial, nlo, nhi, error); int icol = -1; for (int i = nlo - 1; i < nhi; i++) { - if (i < 0) icol = nfield_initial + i + 1; // doesn't happen currently - else icol = i; + if (i < 0) + icol = nfield_initial + i + 1; // doesn't happen currently + else + icol = i; if (icol < 0 || (icol >= nfield_initial)) - error->all(FLERR, "Invalid thermo_modify format argument: {}", - arg[iarg + 1]); + error->all(FLERR, "Invalid thermo_modify format argument: {}", arg[iarg + 1]); format_column_user[icol] = arg[iarg + 2]; } } else { @@ -1135,7 +1136,8 @@ void Thermo::check_temp(const std::string &keyword) error->all(FLERR, "Thermo keyword {} in variable requires thermo to use/init temperature", keyword); if (!temperature->is_initialized()) - error->all(FLERR,"Thermo keyword {} cannot be invoked before initialization by a run",keyword); + error->all(FLERR, "Thermo keyword {} cannot be invoked before initialization by a run", + keyword); if (!(temperature->invoked_flag & Compute::INVOKED_SCALAR)) { temperature->compute_scalar(); temperature->invoked_flag |= Compute::INVOKED_SCALAR; @@ -1154,7 +1156,8 @@ void Thermo::check_pe(const std::string &keyword) error->all(FLERR, "Thermo keyword {} in variable requires thermo to use/init potential energy", keyword); if (!pe->is_initialized()) - error->all(FLERR,"Thermo keyword {} cannot be invoked before initialization by a run",keyword); + error->all(FLERR, "Thermo keyword {} cannot be invoked before initialization by a run", + keyword); if (!(pe->invoked_flag & Compute::INVOKED_SCALAR)) { pe->compute_scalar(); pe->invoked_flag |= Compute::INVOKED_SCALAR; @@ -1170,7 +1173,8 @@ void Thermo::check_press_scalar(const std::string &keyword) if (!pressure) error->all(FLERR, "Thermo keyword {} in variable requires thermo to use/init press", keyword); if (!pressure->is_initialized()) - error->all(FLERR,"Thermo keyword {} cannot be invoked before initialization by a run",keyword); + error->all(FLERR, "Thermo keyword {} cannot be invoked before initialization by a run", + keyword); if (!(pressure->invoked_flag & Compute::INVOKED_SCALAR)) { pressure->compute_scalar(); pressure->invoked_flag |= Compute::INVOKED_SCALAR; @@ -1186,7 +1190,8 @@ void Thermo::check_press_vector(const std::string &keyword) if (!pressure) error->all(FLERR, "Thermo keyword {} in variable requires thermo to use/init press", keyword); if (!pressure->is_initialized()) - error->all(FLERR,"Thermo keyword {} cannot be invoked before initialization by a run",keyword); + error->all(FLERR, "Thermo keyword {} cannot be invoked before initialization by a run", + keyword); if (!(pressure->invoked_flag & Compute::INVOKED_VECTOR)) { pressure->compute_vector(); pressure->invoked_flag |= Compute::INVOKED_VECTOR; diff --git a/src/update.cpp b/src/update.cpp index e6b97e5731..1074d8dcf6 100644 --- a/src/update.cpp +++ b/src/update.cpp @@ -362,7 +362,7 @@ void Update::new_integrate(char *style, int narg, char **arg, int trysuffix, int { if (trysuffix && lmp->suffix_enable) { if (lmp->non_pair_suffix()) { - sflag = 1 + 2*lmp->pair_only_flag; + sflag = 1 + 2 * lmp->pair_only_flag; std::string estyle = style + std::string("/") + lmp->non_pair_suffix(); if (integrate_map->find(estyle) != integrate_map->end()) { IntegrateCreator &integrate_creator = (*integrate_map)[estyle]; @@ -428,7 +428,7 @@ void Update::new_minimize(char *style, int /* narg */, char ** /* arg */, int tr { if (trysuffix && lmp->suffix_enable) { if (lmp->non_pair_suffix()) { - sflag = 1 + 2*lmp->pair_only_flag; + sflag = 1 + 2 * lmp->pair_only_flag; std::string estyle = style + std::string("/") + lmp->non_pair_suffix(); if (minimize_map->find(estyle) != minimize_map->end()) { MinimizeCreator &minimize_creator = (*minimize_map)[estyle];