diff --git a/src/BPM/bond_bpm.cpp b/src/BPM/bond_bpm.cpp index 5a20059860..d560b3c237 100644 --- a/src/BPM/bond_bpm.cpp +++ b/src/BPM/bond_bpm.cpp @@ -319,8 +319,7 @@ void BondBPM::write_restart(FILE *fp) void BondBPM::read_restart(FILE *fp) { - if (comm->me == 0) - utils::sfread(FLERR, &overlay_flag, sizeof(int), 1, fp, nullptr, error); + if (comm->me == 0) utils::sfread(FLERR, &overlay_flag, sizeof(int), 1, fp, nullptr, error); MPI_Bcast(&overlay_flag, 1, MPI_INT, 0, world); } diff --git a/src/BPM/bond_bpm_rotational.h b/src/BPM/bond_bpm_rotational.h index 8b9338d7db..9bc69a23d4 100644 --- a/src/BPM/bond_bpm_rotational.h +++ b/src/BPM/bond_bpm_rotational.h @@ -43,8 +43,8 @@ class BondBPMRotational : public BondBPM { double *Fcr, *Fcs, *Tct, *Tcb; int smooth_flag; - double elastic_forces(int, int, int, double, double, double, double *, double *, - double *, double *, double *, double *); + double elastic_forces(int, int, int, double, double, double, double *, double *, double *, + double *, double *, double *); void damping_forces(int, int, int, double *, double *, double *, double *, double *); void allocate(); diff --git a/src/BPM/bond_bpm_spring.cpp b/src/BPM/bond_bpm_spring.cpp index e87419e178..cf302d1599 100644 --- a/src/BPM/bond_bpm_spring.cpp +++ b/src/BPM/bond_bpm_spring.cpp @@ -356,8 +356,7 @@ void BondBPMSpring::write_restart_settings(FILE *fp) void BondBPMSpring::read_restart_settings(FILE *fp) { - if (comm->me == 0) - utils::sfread(FLERR, &smooth_flag, sizeof(int), 1, fp, nullptr, error); + if (comm->me == 0) utils::sfread(FLERR, &smooth_flag, sizeof(int), 1, fp, nullptr, error); MPI_Bcast(&smooth_flag, 1, MPI_INT, 0, world); } diff --git a/src/ELECTRODE/slab_dipole.cpp b/src/ELECTRODE/slab_dipole.cpp index 3f7538c85e..061556e87d 100644 --- a/src/ELECTRODE/slab_dipole.cpp +++ b/src/ELECTRODE/slab_dipole.cpp @@ -37,13 +37,13 @@ using namespace MathConst; */ SlabDipole::SlabDipole(LAMMPS *lmp) : BoundaryCorrection(lmp){}; -void SlabDipole::compute_corr(double qsum, double slab_volfactor, int eflag_atom, - int eflag_global, double &energy, double *eatom) +void SlabDipole::compute_corr(double qsum, double slab_volfactor, int eflag_atom, int eflag_global, + double &energy, double *eatom) { // compute local contribution to global dipole moment double *q = atom->q; double **x = atom->x; - double zprd_slab = domain->zprd*slab_volfactor; + double zprd_slab = domain->zprd * slab_volfactor; int nlocal = atom->nlocal; double dipole = 0.0; for (int i = 0; i < nlocal; i++) dipole += q[i] * x[i][2]; @@ -65,7 +65,8 @@ void SlabDipole::compute_corr(double qsum, double slab_volfactor, int eflag_atom // compute corrections double const e_slabcorr = MY_2PI * - (dipole_all * dipole_all - qsum * dipole_r2 - qsum * qsum * zprd_slab * zprd_slab / 12.0) / volume; + (dipole_all * dipole_all - qsum * dipole_r2 - qsum * qsum * zprd_slab * zprd_slab / 12.0) / + volume; double const qscale = qqrd2e * scale; if (eflag_global) energy += qscale * e_slabcorr; diff --git a/src/INTEL/pair_buck_coul_cut_intel.h b/src/INTEL/pair_buck_coul_cut_intel.h index cd09604258..792c5ea31c 100644 --- a/src/INTEL/pair_buck_coul_cut_intel.h +++ b/src/INTEL/pair_buck_coul_cut_intel.h @@ -15,7 +15,6 @@ Contributing author: Rodrigo Canales (RWTH Aachen University) ------------------------------------------------------------------------- */ - #ifdef PAIR_CLASS // clang-format off PairStyle(buck/coul/cut/intel,PairBuckCoulCutIntel); diff --git a/src/LATTE/fix_latte.h b/src/LATTE/fix_latte.h index 18730e7f5e..b1b8972c27 100644 --- a/src/LATTE/fix_latte.h +++ b/src/LATTE/fix_latte.h @@ -47,7 +47,7 @@ class FixLatte : public Fix { int coulomb, pbcflag, pe_peratom, virial_global, virial_peratom, neighflag; int exclude, excludebit; int eflag_caller; - char *id_pe,*id_exclude; + char *id_pe, *id_exclude; int *exclusion_group_ptr; int setupflag, newsystem; bigint natoms_last; diff --git a/src/MISC/pair_list.cpp b/src/MISC/pair_list.cpp index f6a27538ab..eeb9ca96e2 100644 --- a/src/MISC/pair_list.cpp +++ b/src/MISC/pair_list.cpp @@ -172,7 +172,8 @@ void PairList::compute(int eflag, int vflag) const double dexp = exp(-par.param.morse.alpha * dr); fpair = 2.0 * par.param.morse.d0 * par.param.morse.alpha * (dexp * dexp - dexp) / r; - if (eflag_either) epair = par.param.morse.d0 * (dexp * dexp - 2.0 * dexp + 1.0) - par.offset; + if (eflag_either) + epair = par.param.morse.d0 * (dexp * dexp - 2.0 * dexp + 1.0) - par.offset; } else if (par.style == LJ126) { diff --git a/src/MISC/pair_list.h b/src/MISC/pair_list.h index dab8ba3fc9..c7bd2149ee 100644 --- a/src/MISC/pair_list.h +++ b/src/MISC/pair_list.h @@ -53,7 +53,6 @@ class PairList : public Pair { double k, b1, b2; }; - union param_u { harm_p harm; morse_p morse; diff --git a/src/ML-PACE/pair_pace_extrapolation.cpp b/src/ML-PACE/pair_pace_extrapolation.cpp index 92fc8a7812..82dcf3b497 100644 --- a/src/ML-PACE/pair_pace_extrapolation.cpp +++ b/src/ML-PACE/pair_pace_extrapolation.cpp @@ -382,10 +382,10 @@ void PairPACEExtrapolation::coeff(int narg, char **arg) aceimpl->ace->load_active_set(active_set_inv_filename); bool is_linear_extrapolation_grade = aceimpl->ace->get_is_linear_extrapolation_grade(); if (comm->me == 0) { - if (is_linear_extrapolation_grade) - utils::logmesg(lmp, "LINEAR ASI is loaded\n"); - else - utils::logmesg(lmp, "FULL ASI is loaded\n"); + if (is_linear_extrapolation_grade) + utils::logmesg(lmp, "LINEAR ASI is loaded\n"); + else + utils::logmesg(lmp, "FULL ASI is loaded\n"); } // clear setflag since coeff() called once with I,J = * * diff --git a/src/OPENMP/pair_lj_cut_coul_cut_dielectric_omp.h b/src/OPENMP/pair_lj_cut_coul_cut_dielectric_omp.h index e663d81440..8e336fa08a 100644 --- a/src/OPENMP/pair_lj_cut_coul_cut_dielectric_omp.h +++ b/src/OPENMP/pair_lj_cut_coul_cut_dielectric_omp.h @@ -32,8 +32,7 @@ class PairLJCutCoulCutDielectricOMP : public PairLJCutCoulCutDielectric, public void compute(int, int) override; protected: - template - void eval(int ifrom, int ito, ThrData *const thr); + template void eval(int ifrom, int ito, ThrData *const thr); }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/pair_lj_cut_coul_debye_dielectric_omp.h b/src/OPENMP/pair_lj_cut_coul_debye_dielectric_omp.h index 9aa8bb8291..3737aeb918 100644 --- a/src/OPENMP/pair_lj_cut_coul_debye_dielectric_omp.h +++ b/src/OPENMP/pair_lj_cut_coul_debye_dielectric_omp.h @@ -32,8 +32,7 @@ class PairLJCutCoulDebyeDielectricOMP : public PairLJCutCoulDebyeDielectric, pub void compute(int, int) override; protected: - template - void eval(int ifrom, int ito, ThrData *const thr); + template void eval(int ifrom, int ito, ThrData *const thr); }; } // namespace LAMMPS_NS diff --git a/src/OPENMP/pair_lj_cut_coul_long_dielectric_omp.h b/src/OPENMP/pair_lj_cut_coul_long_dielectric_omp.h index 1c928a4244..051ea9a746 100644 --- a/src/OPENMP/pair_lj_cut_coul_long_dielectric_omp.h +++ b/src/OPENMP/pair_lj_cut_coul_long_dielectric_omp.h @@ -33,8 +33,7 @@ class PairLJCutCoulLongDielectricOMP : public PairLJCutCoulLongDielectric, publi void compute(int, int) override; protected: - template - void eval(int ifrom, int ito, ThrData *const thr); + template void eval(int ifrom, int ito, ThrData *const thr); }; } // namespace LAMMPS_NS diff --git a/src/bond.cpp b/src/bond.cpp index 1a184e1ed1..66430a9dcb 100644 --- a/src/bond.cpp +++ b/src/bond.cpp @@ -255,11 +255,10 @@ void Bond::ev_tally(int i, int j, int nlocal, int newton_bond, double ebond, dou for virial, have delx,dely,delz and fx,fy,fz ------------------------------------------------------------------------- */ -void Bond::ev_tally_xyz(int i, int j, int nlocal, int newton_bond, - double ebond, double fx, double fy, double fz, - double delx, double dely, double delz) +void Bond::ev_tally_xyz(int i, int j, int nlocal, int newton_bond, double ebond, double fx, + double fy, double fz, double delx, double dely, double delz) { - double ebondhalf,v[6]; + double ebondhalf, v[6]; if (eflag_either) { if (eflag_global) { diff --git a/src/bond_hybrid.cpp b/src/bond_hybrid.cpp index ec49871506..6a3e55e909 100644 --- a/src/bond_hybrid.cpp +++ b/src/bond_hybrid.cpp @@ -257,10 +257,9 @@ void BondHybrid::flags() // set comm_forward, comm_reverse, comm_reverse_off to max of any sub-style for (m = 0; m < nstyles; m++) { - if (styles[m]) comm_forward = MAX(comm_forward,styles[m]->comm_forward); - if (styles[m]) comm_reverse = MAX(comm_reverse,styles[m]->comm_reverse); - if (styles[m]) comm_reverse_off = MAX(comm_reverse_off, - styles[m]->comm_reverse_off); + if (styles[m]) comm_forward = MAX(comm_forward, styles[m]->comm_forward); + if (styles[m]) comm_reverse = MAX(comm_reverse, styles[m]->comm_reverse); + if (styles[m]) comm_reverse_off = MAX(comm_reverse_off, styles[m]->comm_reverse_off); } init_svector(); @@ -276,8 +275,7 @@ void BondHybrid::init_svector() // allocate svector single_extra = 0; - for (int m = 0; m < nstyles; m++) - single_extra = MAX(single_extra,styles[m]->single_extra); + for (int m = 0; m < nstyles; m++) single_extra = MAX(single_extra, styles[m]->single_extra); if (single_extra) { delete[] svector; @@ -415,14 +413,12 @@ double BondHybrid::single(int type, double rsq, int i, int j, double &fforce) void BondHybrid::copy_svector(int type) { - memset(svector,0,single_extra*sizeof(double)); + memset(svector, 0, single_extra * sizeof(double)); // there is only one style in bond style hybrid for a bond type Bond *this_style = styles[map[type]]; - for (int l = 0; this_style->single_extra; ++l) { - svector[l] = this_style->svector[l]; - } + for (int l = 0; this_style->single_extra; ++l) { svector[l] = this_style->svector[l]; } } /* ---------------------------------------------------------------------- diff --git a/src/dump.h b/src/dump.h index ecff27f7dd..e3e50c4765 100644 --- a/src/dump.h +++ b/src/dump.h @@ -45,9 +45,15 @@ class Dump : protected Pointers { void init(); virtual void write(); - virtual int pack_forward_comm(int, int *, double *, int, int *) { return 0; } + virtual int pack_forward_comm(int, int *, double *, int, int *) + { + return 0; + } virtual void unpack_forward_comm(int, int, double *) {} - virtual int pack_reverse_comm(int, int, double *) { return 0; } + virtual int pack_reverse_comm(int, int, double *) + { + return 0; + } virtual void unpack_reverse_comm(int, int *, double *) {} void modify_params(int, char **); @@ -91,9 +97,9 @@ class Dump : protected Pointers { char *refresh; // compute ID to invoke refresh() on int irefresh; // index of compute - int skipflag; // 1 if skip condition defined - char *skipvar; // name of variable to check for skip condition - int skipindex; // index of skip variable + int skipflag; // 1 if skip condition defined + char *skipvar; // name of variable to check for skip condition + int skipindex; // index of skip variable char boundstr[9]; // encoding of boundary flags @@ -151,11 +157,17 @@ class Dump : protected Pointers { virtual void init_style() = 0; virtual void openfile(); - virtual int modify_param(int, char **) { return 0; } + virtual int modify_param(int, char **) + { + return 0; + } virtual void write_header(bigint) = 0; virtual int count(); virtual void pack(tagint *) = 0; - virtual int convert_string(int, double *) { return 0; } + virtual int convert_string(int, double *) + { + return 0; + } virtual void write_data(int, double *) = 0; virtual void write_footer() {} diff --git a/src/fix_bond_history.cpp b/src/fix_bond_history.cpp index b5b51a963c..7faf46b835 100644 --- a/src/fix_bond_history.cpp +++ b/src/fix_bond_history.cpp @@ -87,8 +87,8 @@ void FixBondHistory::post_constructor() id_fix = utils::strdup(id + std::string("_FIX_PROP_ATOM")); id_array = utils::strdup(std::string("d2_") + id); - modify->add_fix(fmt::format("{} {} property/atom {} {} writedata no", id_fix, group->names[igroup], id_array, - nbond * ndata)); + modify->add_fix(fmt::format("{} {} property/atom {} {} writedata no", id_fix, + group->names[igroup], id_array, nbond * ndata)); int tmp1, tmp2; index = atom->find_custom(&id_array[3], tmp1, tmp2); } diff --git a/src/fix_pair.h b/src/fix_pair.h index c3d8454185..19a7c708be 100644 --- a/src/fix_pair.h +++ b/src/fix_pair.h @@ -46,10 +46,10 @@ class FixPair : public Fix { double memory_usage() override; private: - int nevery,nfield,ncols; + int nevery, nfield, ncols; bigint lasttime; char *pairname; - char **fieldname,**triggername; + char **fieldname, **triggername; int *trigger; int **triggerptr; diff --git a/src/fix_property_atom.cpp b/src/fix_property_atom.cpp index 38dd00c364..a98b27b2f2 100644 --- a/src/fix_property_atom.cpp +++ b/src/fix_property_atom.cpp @@ -154,8 +154,8 @@ FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) : border = utils::logical(FLERR, arg[iarg + 1], false, lmp); iarg += 2; } else if (strcmp(arg[iarg], "writedata") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal fix property/atom command"); - wd_section = utils::logical(FLERR,arg[iarg+1],false,lmp); + if (iarg + 2 > narg) error->all(FLERR, "Illegal fix property/atom command"); + wd_section = utils::logical(FLERR, arg[iarg + 1], false, lmp); iarg += 2; } else error->all(FLERR, "Illegal fix property/atom command"); diff --git a/src/fix_update_special_bonds.cpp b/src/fix_update_special_bonds.cpp index 78c520344c..3e2860f09c 100644 --- a/src/fix_update_special_bonds.cpp +++ b/src/fix_update_special_bonds.cpp @@ -54,7 +54,7 @@ void FixUpdateSpecialBonds::setup(int /*vflag*/) // error if more than one fix update/special/bonds if (modify->get_fix_by_style("UPDATE_SPECIAL_BONDS").size() > 1) - error->all(FLERR,"More than one fix update/special/bonds"); + error->all(FLERR, "More than one fix update/special/bonds"); // Require atoms know about all of their bonds and if they break if (force->newton_bond) error->all(FLERR, "Fix update/special/bonds requires Newton bond off"); @@ -131,14 +131,14 @@ void FixUpdateSpecialBonds::pre_exchange() // ignore n2, n3 since 1-3, 1-4 special factors required to be 1.0 n1 = nspecial[i][0]; if (n1 >= atom->maxspecial) - error->one(FLERR,"Special list size exceeded in fix update/special/bond"); + error->one(FLERR, "Special list size exceeded in fix update/special/bond"); special[i][n1] = tagj; nspecial[i][0] += 1; nspecial[i][1] = nspecial[i][2] = nspecial[i][0]; n1 = nspecial[j][0]; if (n1 >= atom->maxspecial) - error->one(FLERR,"Special list size exceeded in fix update/special/bond"); + error->one(FLERR, "Special list size exceeded in fix update/special/bond"); special[j][n1] = tagi; nspecial[j][0] += 1; nspecial[j][1] = nspecial[j][2] = nspecial[j][0]; @@ -210,8 +210,8 @@ void FixUpdateSpecialBonds::pre_force(int /*vflag*/) jnum = numneigh[i1]; for (jj = 0; jj < jnum; jj++) { j = jlist[jj]; - if (((j >> SBBITS) & 3) != 0) continue; // Skip bonded pairs - if (tag[j] == tag2) jlist[jj] = j ^ (1 << SBBITS); // Add 1-2 special bond bits + if (((j >> SBBITS) & 3) != 0) continue; // Skip bonded pairs + if (tag[j] == tag2) jlist[jj] = j ^ (1 << SBBITS); // Add 1-2 special bond bits } } @@ -220,8 +220,8 @@ void FixUpdateSpecialBonds::pre_force(int /*vflag*/) jnum = numneigh[i2]; for (jj = 0; jj < jnum; jj++) { j = jlist[jj]; - if (((j >> SBBITS) & 3) != 0) continue; // Skip bonded pairs - if (tag[j] == tag1) jlist[jj] = j ^ (1 << SBBITS); // Add 1-2 special bond bits + if (((j >> SBBITS) & 3) != 0) continue; // Skip bonded pairs + if (tag[j] == tag1) jlist[jj] = j ^ (1 << SBBITS); // Add 1-2 special bond bits } } } diff --git a/src/fix_vector.cpp b/src/fix_vector.cpp index f1da015382..a481e07380 100644 --- a/src/fix_vector.cpp +++ b/src/fix_vector.cpp @@ -47,8 +47,7 @@ FixVector::FixVector(LAMMPS *lmp, int narg, char **arg) : val.id = argi.get_name(); val.val.c = nullptr; - if ((val.which == ArgInfo::UNKNOWN) || (val.which == ArgInfo::NONE) || - (argi.get_dim() > 1)) + if ((val.which == ArgInfo::UNKNOWN) || (val.which == ArgInfo::NONE) || (argi.get_dim() > 1)) error->all(FLERR, "Invalid fix vector argument: {}", arg[iarg]); values.push_back(val); diff --git a/src/library.cpp b/src/library.cpp index 03f6c0e211..a4d016af62 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -3020,10 +3020,11 @@ Below is a brief C code demonstrating accessing this collected bond information. .. code-block:: c + #include "library.h" + + #include #include #include - #include - #include "library.h" int main(int argc, char **argv) { diff --git a/src/memory.h b/src/memory.h index 5493b5fa57..4075a521e8 100644 --- a/src/memory.h +++ b/src/memory.h @@ -1,3 +1,4 @@ +// clang-format off /* -*- c++ -*- ---------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -647,16 +648,15 @@ class Memory : protected Pointers { ------------------------------------------------------------------------- */ template - TYPE ****create4d_offset_last(TYPE ****&array, int n1lo, int n1hi, - int n2lo, int n2hi, int n3lo, int n3hi, int n4, - const char *name) + TYPE ****create4d_offset_last(TYPE ****&array, int n1lo, int n1hi, int n2lo, int n2hi, int n3lo, + int n3hi, int n4, const char *name) { if (n1lo > n1hi || n2lo > n2hi || n3lo > n3hi || n4 <= 0) return nullptr; int n1 = n1hi - n1lo + 1; int n2 = n2hi - n2lo + 1; int n3 = n3hi - n3lo + 1; - create(array,n1,n2,n3,n4,name); + create(array, n1, n2, n3, n4, name); bigint m = ((bigint) n1) * n2; for (bigint i = 0; i < m; i++) array[0][i] -= n3lo; @@ -666,19 +666,20 @@ class Memory : protected Pointers { } template - TYPE ****create4d_offset_last(TYPE *****& /*array*/, int /*n1lo*/, int /*n1hi*/, - int /*n2lo*/, int /*n2hi*/, - int /*n3lo*/, int /*n3hi*/, int /*n4*/, + TYPE ****create4d_offset_last(TYPE *****& /*array*/, int /*n1lo*/, int /*n1hi*/, int /*n2lo*/, + int /*n2hi*/, int /*n3lo*/, int /*n3hi*/, int /*n4*/, const char *name) - {fail(name); return nullptr;} + { + fail(name); + return nullptr; + } /* ---------------------------------------------------------------------- free a 4d array with indices 1,2,3 offset ------------------------------------------------------------------------- */ template - void destroy4d_offset_last(TYPE ****&array, - int n1_offset, int n2_offset, int n3_offset) + void destroy4d_offset_last(TYPE ****&array, int n1_offset, int n2_offset, int n3_offset) { if (array == nullptr) return; sfree(&array[n1_offset][n2_offset][n3_offset][0]); diff --git a/src/modify.cpp b/src/modify.cpp index aa978641a1..450430ba48 100644 --- a/src/modify.cpp +++ b/src/modify.cpp @@ -806,10 +806,12 @@ Fix *Modify::add_fix(int narg, char **arg, int trysuffix) // since some fixes access domain settings in their constructor // nullptr must be last entry in this list + // clang-format off const char *exceptions[] = {"GPU", "OMP", "INTEL", "property/atom", "cmap", "cmap3", "rx", "deprecated", "STORE/KIM", "amoeba/pitorsion", "amoeba/bitorsion", nullptr}; + // clang-format on if (domain->box_exist == 0) { int m;