diff --git a/src/atom_vec.cpp b/src/atom_vec.cpp index 60526adcf2..b9d94b1dd2 100644 --- a/src/atom_vec.cpp +++ b/src/atom_vec.cpp @@ -1687,7 +1687,7 @@ void AtomVec::data_atom(double *coord, imageint imagetmp, const std::vector &, - std::string &); + virtual void data_atom(double *, imageint, const std::vector &, std::string &); virtual void data_atom_post(int) {} virtual void data_atom_bonus(int, const std::vector &) {} virtual void data_body(int, int, int, int *, double *) {} diff --git a/src/compute_property_grid.h b/src/compute_property_grid.h index 05c306a406..eefb0a9503 100644 --- a/src/compute_property_grid.h +++ b/src/compute_property_grid.h @@ -41,7 +41,7 @@ class ComputePropertyGrid : public Compute { double memory_usage() override; private: - int nxgrid,nygrid,nzgrid; + int nxgrid, nygrid, nzgrid; int nvalues; int dimension; int triclinic; @@ -49,12 +49,12 @@ class ComputePropertyGrid : public Compute { class Grid2d *grid2d; class Grid3d *grid3d; - int nxlo_in,nxhi_in,nylo_in,nyhi_in,nzlo_in,nzhi_in; - int nxlo_out,nxhi_out,nylo_out,nyhi_out,nzlo_out,nzhi_out; + int nxlo_in, nxhi_in, nylo_in, nyhi_in, nzlo_in, nzhi_in; + int nxlo_out, nxhi_out, nylo_out, nyhi_out, nzlo_out, nzhi_out; int ngridout; - double **vec2d,***vec3d; - double ***array2d,****array3d; + double **vec2d, ***vec3d; + double ***array2d, ****array3d; // local methods diff --git a/src/compute_temp_sphere.cpp b/src/compute_temp_sphere.cpp index 2294177e6f..2ee067abcb 100644 --- a/src/compute_temp_sphere.cpp +++ b/src/compute_temp_sphere.cpp @@ -74,10 +74,8 @@ ComputeTempSphere::ComputeTempSphere(LAMMPS *lmp, int narg, char **arg) : // error checks - if (!atom->omega_flag) - error->all(FLERR,"Compute temp/sphere requires atom attribute omega"); - if (!atom->radius_flag) - error->all(FLERR,"Compute temp/sphere requires atom attribute radius"); + if (!atom->omega_flag) error->all(FLERR, "Compute temp/sphere requires atom attribute omega"); + if (!atom->radius_flag) error->all(FLERR, "Compute temp/sphere requires atom attribute radius"); } /* ---------------------------------------------------------------------- */ diff --git a/src/error.h b/src/error.h index 95a58c81e3..89d168652a 100644 --- a/src/error.h +++ b/src/error.h @@ -14,8 +14,8 @@ #ifndef LMP_ERROR_H #define LMP_ERROR_H -#include "pointers.h" #include "exceptions.h" +#include "pointers.h" namespace LAMMPS_NS { diff --git a/src/fix_ave_histo.h b/src/fix_ave_histo.h index d112223dce..7f21b49006 100644 --- a/src/fix_ave_histo.h +++ b/src/fix_ave_histo.h @@ -37,9 +37,9 @@ class FixAveHisto : public Fix { protected: struct value_t { - int which; // type of data: COMPUTE, FIX, VARIABLE - int argindex; // 1-based index if data is vector, else 0 - std::string id; // compute/fix/variable ID + int which; // type of data: COMPUTE, FIX, VARIABLE + int argindex; // 1-based index if data is vector, else 0 + std::string id; // compute/fix/variable ID union { class Compute *c; class Fix *f; diff --git a/src/fix_bond_history.cpp b/src/fix_bond_history.cpp index 00ef0449f8..38ea497ebe 100644 --- a/src/fix_bond_history.cpp +++ b/src/fix_bond_history.cpp @@ -33,7 +33,8 @@ static constexpr int DELTA = 8192; /* ---------------------------------------------------------------------- */ FixBondHistory::FixBondHistory(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), bondstore(nullptr), bondtype_orig(nullptr), bondstore_comp(nullptr), bondstore_orig(nullptr), id_fix(nullptr), id_array(nullptr) + Fix(lmp, narg, arg), bondstore(nullptr), bondtype_orig(nullptr), bondstore_comp(nullptr), + bondstore_orig(nullptr), id_fix(nullptr), id_array(nullptr) { if (narg != 5) error->all(FLERR, "Illegal fix bond/history command"); @@ -259,8 +260,7 @@ void FixBondHistory::post_neighbor() if (hybrid_flag) { nbondlist_orig = nbondlist; - for (n = 0; n < nbondlist; n++) - bondtype_orig[n] = bondlist[n][2]; + for (n = 0; n < nbondlist; n++) bondtype_orig[n] = bondlist[n][2]; } updated_bond_flag = 1; @@ -328,8 +328,7 @@ void FixBondHistory::compress_history() if (type <= 0) continue; if (!setflag[type]) continue; - for (int m = 0; m < ndata; m++) - bondstore_comp[ncomp][m] = bondstore[n][m]; + for (int m = 0; m < ndata; m++) bondstore_comp[ncomp][m] = bondstore[n][m]; ncomp += 1; } } @@ -352,8 +351,7 @@ void FixBondHistory::uncompress_history() if (type <= 0) continue; if (!setflag[type]) continue; - for (int m = 0; m < ndata; m++) - bondstore_orig[n][m] = bondstore[ncomp][m]; + for (int m = 0; m < ndata; m++) bondstore_orig[n][m] = bondstore[ncomp][m]; ncomp += 1; } } diff --git a/src/fix_deposit.h b/src/fix_deposit.h index 5d2824fba3..c5070e96eb 100644 --- a/src/fix_deposit.h +++ b/src/fix_deposit.h @@ -67,7 +67,7 @@ class FixDeposit : public Fix { void find_maxid(); void options(int, char **); - int vartest(double, double, double); // evaluate a variable with new atom position + int vartest(double, double, double); // evaluate a variable with new atom position }; } // namespace LAMMPS_NS diff --git a/src/fix_efield.cpp b/src/fix_efield.cpp index 236395093c..81be66b3e3 100644 --- a/src/fix_efield.cpp +++ b/src/fix_efield.cpp @@ -40,8 +40,8 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ FixEfield::FixEfield(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), xstr(nullptr), ystr(nullptr), zstr(nullptr), estr(nullptr), - pstr(nullptr), idregion(nullptr), region(nullptr), efield(nullptr) + Fix(lmp, narg, arg), xstr(nullptr), ystr(nullptr), zstr(nullptr), estr(nullptr), pstr(nullptr), + idregion(nullptr), region(nullptr), efield(nullptr) { if (narg < 6) utils::missing_cmd_args(FLERR, std::string("fix ") + style, error); diff --git a/src/fix_nvt_sllod.h b/src/fix_nvt_sllod.h index 081f6e657d..42508d0a1f 100644 --- a/src/fix_nvt_sllod.h +++ b/src/fix_nvt_sllod.h @@ -32,7 +32,7 @@ class FixNVTSllod : public FixNH { private: int nondeformbias; - int psllod_flag; // 0 for SLLOD, 1 for p-SLLOD + int psllod_flag; // 0 for SLLOD, 1 for p-SLLOD void nh_v_temp() override; }; diff --git a/src/fix_store_atom.h b/src/fix_store_atom.h index e13b8aa37d..15afb42a42 100644 --- a/src/fix_store_atom.h +++ b/src/fix_store_atom.h @@ -49,11 +49,11 @@ class FixStoreAtom : public Fix { double memory_usage() override; private: - int vecflag; // 1 if ncol=1 - int arrayflag; // 1 if a 2d array (vector per atom) - int tensorflag; // 1 if a 3d array (array per atom) - int ghostflag; // 0/1 to communicate values with ghost atoms - int restartflag; // 0/1 to store values in restart files + int vecflag; // 1 if ncol=1 + int arrayflag; // 1 if a 2d array (vector per atom) + int tensorflag; // 1 if a 3d array (array per atom) + int ghostflag; // 0/1 to communicate values with ghost atoms + int restartflag; // 0/1 to store values in restart files int n1, n2; // size of 3d dims of per-atom data struct int nvalues; // number of per-atom values diff --git a/src/fix_store_state.h b/src/fix_store_state.h index 8bb23ecc95..15c5471193 100644 --- a/src/fix_store_state.h +++ b/src/fix_store_state.h @@ -55,12 +55,12 @@ class FixStoreState : public Fix { int d; int i; } val; - void (FixStoreState::* pack_choice)(int); // ptr to pack function + void (FixStoreState::*pack_choice)(int); // ptr to pack function }; std::vector values; double **avalues; // archived atom properties - double *vbuf; // 1d ptr to values + double *vbuf; // 1d ptr to values int comflag; double cm[3]; // center of mass diff --git a/src/fix_wall_region.cpp b/src/fix_wall_region.cpp index d6fc63f55c..3d817f34f4 100644 --- a/src/fix_wall_region.cpp +++ b/src/fix_wall_region.cpp @@ -127,7 +127,8 @@ void FixWallRegion::init() // ensure all particles in group are extended particles if (style == COLLOID) { - if (!atom->radius_flag) error->all(FLERR, "Fix wall/region colloid requires atom attribute radius"); + if (!atom->radius_flag) + error->all(FLERR, "Fix wall/region colloid requires atom attribute radius"); double *radius = atom->radius; int *mask = atom->mask; diff --git a/src/grid2d.cpp b/src/grid2d.cpp index e1265839f9..87d3b68d6c 100644 --- a/src/grid2d.cpp +++ b/src/grid2d.cpp @@ -88,11 +88,10 @@ Grid2d::Grid2d(LAMMPS *lmp, MPI_Comm gcomm, int gnx, int gny) : Grid2d::Grid2d(LAMMPS *lmp, MPI_Comm gcomm, int gnx, int gny, int ixlo, int ixhi, int iylo, int iyhi, int oxlo, int oxhi, int oylo, int oyhi) : - Pointers(lmp), - swap(nullptr), requests(nullptr), srequest(nullptr), rrequest(nullptr), sresponse(nullptr), - rresponse(nullptr), send(nullptr), recv(nullptr), copy(nullptr), send_remap(nullptr), - recv_remap(nullptr), overlap_procs(nullptr), xsplit(nullptr), ysplit(nullptr), zsplit(nullptr), - grid2proc(nullptr), rcbinfo(nullptr), overlap_list(nullptr) + Pointers(lmp), swap(nullptr), requests(nullptr), srequest(nullptr), rrequest(nullptr), + sresponse(nullptr), rresponse(nullptr), send(nullptr), recv(nullptr), copy(nullptr), + send_remap(nullptr), recv_remap(nullptr), overlap_procs(nullptr), xsplit(nullptr), + ysplit(nullptr), zsplit(nullptr), grid2proc(nullptr), rcbinfo(nullptr), overlap_list(nullptr) { gridcomm = gcomm; MPI_Comm_rank(gridcomm, &me); diff --git a/src/label_map.cpp b/src/label_map.cpp index 52bf3f92f2..a9ffd60877 100644 --- a/src/label_map.cpp +++ b/src/label_map.cpp @@ -40,8 +40,7 @@ static const char cite_type_label_framework[] = LabelMap::LabelMap(LAMMPS *_lmp, int _natomtypes, int _nbondtypes, int _nangletypes, int _ndihedraltypes, int _nimpropertypes) : - Pointers(_lmp), - natomtypes(_natomtypes), nbondtypes(_nbondtypes), nangletypes(_nangletypes), + Pointers(_lmp), natomtypes(_natomtypes), nbondtypes(_nbondtypes), nangletypes(_nangletypes), ndihedraltypes(_ndihedraltypes), nimpropertypes(_nimpropertypes) { if (lmp->citeme) lmp->citeme->add(cite_type_label_framework); diff --git a/src/lammps.h b/src/lammps.h index 4ec3f384d9..1fdcb2e614 100644 --- a/src/lammps.h +++ b/src/lammps.h @@ -87,9 +87,9 @@ class LAMMPS { static const char *git_descriptor(); using argv = std::vector; - static std::vector argv_pointers(argv & args); + static std::vector argv_pointers(argv &args); - LAMMPS(argv & args, MPI_Comm); + LAMMPS(argv &args, MPI_Comm); LAMMPS(int, char **, MPI_Comm); ~LAMMPS() noexcept(false); void create(); diff --git a/src/min.h b/src/min.h index a395a98bbc..90193ddbc1 100644 --- a/src/min.h +++ b/src/min.h @@ -117,7 +117,7 @@ class Min : protected Pointers { class FixMinimize *fix_minimize; // fix that stores auxiliary data Compute *pe_compute; // compute for potential energy - double ecurrent; // current potential energy + double ecurrent; // current potential energy bigint ndoftotal; // total dof for entire problem diff --git a/src/modify.h b/src/modify.h index 26e056d507..261d6990e1 100644 --- a/src/modify.h +++ b/src/modify.h @@ -115,12 +115,11 @@ 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(); - int get_fix_mask(Fix *ifix) const { + int get_fix_mask(Fix *ifix) const + { for (int i = 0; i < nfix; ++i) { if (fix[i] == ifix) return fmask[i]; } diff --git a/src/neighbor.h b/src/neighbor.h index 8533fe5efa..0323ff63c7 100644 --- a/src/neighbor.h +++ b/src/neighbor.h @@ -185,9 +185,9 @@ class Neighbor : protected Pointers { int triclinic; // 0 if domain is orthog, 1 if triclinic int newton_pair; // 0 if newton off for pairwise, 1 if on - int must_check; // 1 if must check other classes to reneigh - int restart_check; // 1 if restart enabled, 0 if no - std::vectorfixchecklist; // which fixes to check + int must_check; // 1 if must check other classes to reneigh + int restart_check; // 1 if restart enabled, 0 if no + std::vector fixchecklist; // which fixes to check double triggersq; // trigger = build when atom moves this dist diff --git a/src/pair.h b/src/pair.h index d36b48f340..ce9e189aa5 100644 --- a/src/pair.h +++ b/src/pair.h @@ -123,9 +123,9 @@ class Pair : protected Pointers { ExecutionSpace execution_space; unsigned int datamask_read, datamask_modify; - int kokkosable; // 1 if Kokkos pair - int reverse_comm_device; // 1 if reverse comm on Device - int fuse_force_clear_flag; // 1 if can fuse force clear with force compute + int kokkosable; // 1 if Kokkos pair + int reverse_comm_device; // 1 if reverse comm on Device + int fuse_force_clear_flag; // 1 if can fuse force clear with force compute Pair(class LAMMPS *); ~Pair() override; diff --git a/src/pair_hybrid_molecular.cpp b/src/pair_hybrid_molecular.cpp index 67b654da61..ec68cefafb 100644 --- a/src/pair_hybrid_molecular.cpp +++ b/src/pair_hybrid_molecular.cpp @@ -62,8 +62,7 @@ double PairHybridMolecular::init_one(int i, int j) // plus I,I and J,J need the same number of substyles if (setflag[i][j] == 0) { - if (nmap[i][i] != nmap[j][j]) - error->one(FLERR,"All pair coeffs are not set"); + if (nmap[i][i] != nmap[j][j]) error->one(FLERR, "All pair coeffs are not set"); int num = 0; for (int k = 0; k < nmap[i][i]; ++k) { for (int l = 0; l < nmap[j][j]; ++l) { @@ -74,8 +73,7 @@ double PairHybridMolecular::init_one(int i, int j) } } } - if (nmap[i][i] != nmap[i][j]) - error->one(FLERR,"All pair coeffs are not set"); + if (nmap[i][i] != nmap[i][j]) error->one(FLERR, "All pair coeffs are not set"); } nmap[j][i] = nmap[i][j]; @@ -92,16 +90,16 @@ double PairHybridMolecular::init_one(int i, int j) for (int k = 0; k < nmap[i][j]; k++) { map[j][i][k] = map[i][j][k]; - double cut = styles[map[i][j][k]]->init_one(i,j); + double cut = styles[map[i][j][k]]->init_one(i, j); if (styles[map[i][j][k]]->did_mix) did_mix = true; - styles[map[i][j][k]]->cutsq[i][j] = styles[map[i][j][k]]->cutsq[j][i] = cut*cut; + styles[map[i][j][k]]->cutsq[i][j] = styles[map[i][j][k]]->cutsq[j][i] = cut * cut; if (styles[map[i][j][k]]->ghostneigh) - cutghost[i][j] = cutghost[j][i] = MAX(cutghost[i][j],styles[map[i][j][k]]->cutghost[i][j]); + cutghost[i][j] = cutghost[j][i] = MAX(cutghost[i][j], styles[map[i][j][k]]->cutghost[i][j]); if (tail_flag) { etail_ij += styles[map[i][j][k]]->etail_ij; ptail_ij += styles[map[i][j][k]]->ptail_ij; } - cutmax = MAX(cutmax,cut); + cutmax = MAX(cutmax, cut); int istyle; for (istyle = 0; istyle < nstyles; istyle++) @@ -133,8 +131,7 @@ double PairHybridMolecular::init_one(int i, int j) double PairHybridMolecular::single(int i, int j, int itype, int jtype, double rsq, double factor_coul, double factor_lj, double &fforce) { - if (nmap[itype][jtype] == 0) - error->one(FLERR,"Invoked pair single() on sub-style none"); + if (nmap[itype][jtype] == 0) error->one(FLERR, "Invoked pair single() on sub-style none"); double fone; fforce = 0.0; @@ -145,18 +142,19 @@ double PairHybridMolecular::single(int i, int j, int itype, int jtype, double rs const int mystyle = map[itype][jtype][m]; if (rsq < styles[mystyle]->cutsq[itype][jtype]) { if (styles[mystyle]->single_enable == 0) - error->one(FLERR,"Pair hybrid/molecular sub-style {} does not support single() call", + error->one(FLERR, "Pair hybrid/molecular sub-style {} does not support single() call", keywords[mystyle]); if ((special_lj[mystyle] != nullptr) || (special_coul[mystyle] != nullptr)) - error->one(FLERR,"Pair hybrid/molecular single() calls do not support per sub-style " + error->one(FLERR, + "Pair hybrid/molecular single() calls do not support per sub-style " "special bond values"); - esum += styles[mystyle]->single(i,j,itype,jtype,rsq,factor_coul,factor_lj,fone); + esum += styles[mystyle]->single(i, j, itype, jtype, rsq, factor_coul, factor_lj, fone); fforce += fone; } } - if (single_extra) copy_svector(itype,jtype); + if (single_extra) copy_svector(itype, jtype); return esum; } diff --git a/src/potential_file_reader.cpp b/src/potential_file_reader.cpp index 613225a797..9c73e30f17 100644 --- a/src/potential_file_reader.cpp +++ b/src/potential_file_reader.cpp @@ -47,8 +47,7 @@ using namespace LAMMPS_NS; PotentialFileReader::PotentialFileReader(LAMMPS *lmp, const std::string &filename, const std::string &potential_name, const std::string &name_suffix, const int auto_convert) : - Pointers(lmp), - reader(nullptr), filename(filename), filetype(potential_name + name_suffix), + Pointers(lmp), reader(nullptr), filename(filename), filetype(potential_name + name_suffix), unit_convert(auto_convert) { if (comm->me != 0) { error->one(FLERR, "FileReader should only be called by proc 0!"); } diff --git a/src/region_cone.cpp b/src/region_cone.cpp index 64f0495dd6..c0cb2dbee6 100644 --- a/src/region_cone.cpp +++ b/src/region_cone.cpp @@ -33,8 +33,9 @@ static constexpr double BIG = 1.0e20; /* ---------------------------------------------------------------------- */ -RegCone::RegCone(LAMMPS *lmp, int narg, char **arg) : Region(lmp, narg, arg), lo(0.0), hi(0.0), - c1str(nullptr), c2str(nullptr), rlostr(nullptr), rhistr(nullptr), lostr(nullptr), histr(nullptr) +RegCone::RegCone(LAMMPS *lmp, int narg, char **arg) : + Region(lmp, narg, arg), lo(0.0), hi(0.0), c1str(nullptr), c2str(nullptr), rlostr(nullptr), + rhistr(nullptr), lostr(nullptr), histr(nullptr) { options(narg - 9, &arg[9]); @@ -172,7 +173,6 @@ RegCone::RegCone(LAMMPS *lmp, int narg, char **arg) : Region(lmp, narg, arg), lo radiushi = xscale * utils::numeric(FLERR, arg[6], false, lmp); rhistyle = CONSTANT; } - } lostyle = CONSTANT; @@ -265,7 +265,7 @@ RegCone::RegCone(LAMMPS *lmp, int narg, char **arg) : Region(lmp, narg, arg), lo if (hi <= lo) error->all(FLERR, "Illegal cone length in region cone command"); // extent of cone - maxradius = ( (radiuslo > radiushi) ? radiuslo : radiushi); + maxradius = ((radiuslo > radiushi) ? radiuslo : radiushi); if (interior) { bboxflag = 1; diff --git a/src/replicate.h b/src/replicate.h index defb35d1c6..56e9f719b4 100644 --- a/src/replicate.h +++ b/src/replicate.h @@ -31,7 +31,7 @@ class Replicate : public Command { Replicate(class LAMMPS *); void command(int, char **) override; -private: + private: int bbox_flag, bond_flag; class Atom *old; diff --git a/src/text_file_reader.cpp b/src/text_file_reader.cpp index 0b8d717687..df928dcc1c 100644 --- a/src/text_file_reader.cpp +++ b/src/text_file_reader.cpp @@ -189,9 +189,9 @@ void TextFileReader::next_dvector(double *list, int n) char *ptr = next_line(); if (ptr == nullptr) { - if (i == 0) { // EOF without any records + if (i == 0) { // EOF without any records throw EOFException("EOF reached"); - } else if (i < n) { // EOF with incomplete data + } else if (i < n) { // EOF with incomplete data throw FileReaderException( fmt::format("Incorrect format in {} file! {}/{} values", filetype, i, n)); } diff --git a/src/thermo.h b/src/thermo.h index 4d18c3be7e..52f69e7609 100644 --- a/src/thermo.h +++ b/src/thermo.h @@ -57,7 +57,7 @@ class Thermo : protected Pointers { private: int nfield, nfield_initial; int *vtype; - int triclinic_general; // set by thermo_modify + int triclinic_general; // set by thermo_modify std::string line; std::vector keyword, format, format_column_user, keyword_user; @@ -237,7 +237,6 @@ class Thermo : protected Pointers { void compute_nbuild(); void compute_ndanger(); - }; } // namespace LAMMPS_NS