diff --git a/src/compute_dihedral.cpp b/src/compute_dihedral.cpp index 86fd1b116e..2fda5b1f1c 100644 --- a/src/compute_dihedral.cpp +++ b/src/compute_dihedral.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -25,10 +24,9 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ ComputeDihedral::ComputeDihedral(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), - emine(nullptr) + Compute(lmp, narg, arg), emine(nullptr) { - if (narg != 3) error->all(FLERR,"Illegal compute dihedral command"); + if (narg != 3) error->all(FLERR, "Illegal compute dihedral command"); vector_flag = 1; extvector = 1; @@ -37,9 +35,8 @@ ComputeDihedral::ComputeDihedral(LAMMPS *lmp, int narg, char **arg) : // check if dihedral style hybrid exists - dihedral = dynamic_cast( force->dihedral_match("hybrid")); - if (!dihedral) - error->all(FLERR, "Dihedral style for compute dihedral command is not hybrid"); + dihedral = dynamic_cast(force->dihedral_match("hybrid")); + if (!dihedral) error->all(FLERR, "Dihedral style for compute dihedral command is not hybrid"); size_vector = nsub = dihedral->nstyles; emine = new double[nsub]; @@ -50,8 +47,8 @@ ComputeDihedral::ComputeDihedral(LAMMPS *lmp, int narg, char **arg) : ComputeDihedral::~ComputeDihedral() { - delete [] emine; - delete [] vector; + delete[] emine; + delete[] vector; } /* ---------------------------------------------------------------------- */ @@ -60,11 +57,10 @@ void ComputeDihedral::init() { // recheck dihedral style in case it has been changed - dihedral = dynamic_cast( force->dihedral_match("hybrid")); - if (!dihedral) - error->all(FLERR, "Dihedral style for compute dihedral command is not hybrid"); + dihedral = dynamic_cast(force->dihedral_match("hybrid")); + if (!dihedral) error->all(FLERR, "Dihedral style for compute dihedral command is not hybrid"); if (dihedral->nstyles != nsub) - error->all(FLERR,"Dihedral style for compute dihedral command has changed"); + error->all(FLERR, "Dihedral style for compute dihedral command has changed"); } /* ---------------------------------------------------------------------- */ @@ -73,10 +69,9 @@ void ComputeDihedral::compute_vector() { invoked_vector = update->ntimestep; if (update->eflag_global != invoked_vector) - error->all(FLERR,"Energy was not tallied on needed timestep"); + error->all(FLERR, "Energy was not tallied on needed timestep"); - for (int i = 0; i < nsub; i++) - emine[i] = dihedral->styles[i]->energy; + for (int i = 0; i < nsub; i++) emine[i] = dihedral->styles[i]->energy; - MPI_Allreduce(emine,vector,nsub,MPI_DOUBLE,MPI_SUM,world); + MPI_Allreduce(emine, vector, nsub, MPI_DOUBLE, MPI_SUM, world); } diff --git a/src/compute_improper.cpp b/src/compute_improper.cpp index 3e0780be49..d2b426c5b3 100644 --- a/src/compute_improper.cpp +++ b/src/compute_improper.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -14,21 +13,20 @@ #include "compute_improper.h" -#include "update.h" +#include "error.h" #include "force.h" #include "improper.h" #include "improper_hybrid.h" -#include "error.h" +#include "update.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ ComputeImproper::ComputeImproper(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), - emine(nullptr) + Compute(lmp, narg, arg), emine(nullptr) { - if (narg != 3) error->all(FLERR,"Illegal compute improper command"); + if (narg != 3) error->all(FLERR, "Illegal compute improper command"); vector_flag = 1; extvector = 1; @@ -37,9 +35,8 @@ ComputeImproper::ComputeImproper(LAMMPS *lmp, int narg, char **arg) : // check if improper style hybrid exists - improper = dynamic_cast( force->improper_match("hybrid")); - if (!improper) - error->all(FLERR, "Improper style for compute improper command is not hybrid"); + improper = dynamic_cast(force->improper_match("hybrid")); + if (!improper) error->all(FLERR, "Improper style for compute improper command is not hybrid"); size_vector = nsub = improper->nstyles; emine = new double[nsub]; @@ -50,8 +47,8 @@ ComputeImproper::ComputeImproper(LAMMPS *lmp, int narg, char **arg) : ComputeImproper::~ComputeImproper() { - delete [] emine; - delete [] vector; + delete[] emine; + delete[] vector; } /* ---------------------------------------------------------------------- */ @@ -60,11 +57,10 @@ void ComputeImproper::init() { // recheck improper style in case it has been changed - improper = dynamic_cast( force->improper_match("hybrid")); - if (!improper) - error->all(FLERR, "Improper style for compute improper command is not hybrid"); + improper = dynamic_cast(force->improper_match("hybrid")); + if (!improper) error->all(FLERR, "Improper style for compute improper command is not hybrid"); if (improper->nstyles != nsub) - error->all(FLERR,"Improper style for compute improper command has changed"); + error->all(FLERR, "Improper style for compute improper command has changed"); } /* ---------------------------------------------------------------------- */ @@ -73,10 +69,9 @@ void ComputeImproper::compute_vector() { invoked_vector = update->ntimestep; if (update->eflag_global != invoked_vector) - error->all(FLERR,"Energy was not tallied on needed timestep"); + error->all(FLERR, "Energy was not tallied on needed timestep"); - for (int i = 0; i < nsub; i++) - emine[i] = improper->styles[i]->energy; + for (int i = 0; i < nsub; i++) emine[i] = improper->styles[i]->energy; - MPI_Allreduce(emine,vector,nsub,MPI_DOUBLE,MPI_SUM,world); + MPI_Allreduce(emine, vector, nsub, MPI_DOUBLE, MPI_SUM, world); } diff --git a/src/fix_dummy.cpp b/src/fix_dummy.cpp index d8a4df173b..eb8c08f43e 100644 --- a/src/fix_dummy.cpp +++ b/src/fix_dummy.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -13,16 +12,16 @@ ------------------------------------------------------------------------- */ #include "fix_dummy.h" -#include #include "error.h" +#include + using namespace LAMMPS_NS; using namespace FixConst; /* ---------------------------------------------------------------------- */ -FixDummy::FixDummy(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg) +FixDummy::FixDummy(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) { // process optional args // customize here and in setmask() by adding a new keyword from fix.h @@ -39,14 +38,22 @@ FixDummy::FixDummy(LAMMPS *lmp, int narg, char **arg) : int iarg = 3; while (iarg < narg) { - if (strcmp(arg[iarg],"initial_integrate") == 0) initial_integrate_flag = 1; - else if (strcmp(arg[iarg],"final_integrate") == 0) final_integrate_flag = 1; - else if (strcmp(arg[iarg],"pre_exchange") == 0) pre_exchange_flag = 1; - else if (strcmp(arg[iarg],"pre_neighbor") == 0) pre_neighbor_flag = 1; - else if (strcmp(arg[iarg],"pre_force") == 0) pre_force_flag = 1; - else if (strcmp(arg[iarg],"post_force") == 0) post_force_flag = 1; - else if (strcmp(arg[iarg],"end_of_step") == 0) end_of_step_flag = 1; - else error->all(FLERR,"Illegal fix DUMMY command"); + if (strcmp(arg[iarg], "initial_integrate") == 0) + initial_integrate_flag = 1; + else if (strcmp(arg[iarg], "final_integrate") == 0) + final_integrate_flag = 1; + else if (strcmp(arg[iarg], "pre_exchange") == 0) + pre_exchange_flag = 1; + else if (strcmp(arg[iarg], "pre_neighbor") == 0) + pre_neighbor_flag = 1; + else if (strcmp(arg[iarg], "pre_force") == 0) + pre_force_flag = 1; + else if (strcmp(arg[iarg], "post_force") == 0) + post_force_flag = 1; + else if (strcmp(arg[iarg], "end_of_step") == 0) + end_of_step_flag = 1; + else + error->all(FLERR, "Illegal fix DUMMY command"); iarg++; } } diff --git a/src/fix_nve_noforce.cpp b/src/fix_nve_noforce.cpp index d043dcbd4a..7b79dcc267 100644 --- a/src/fix_nve_noforce.cpp +++ b/src/fix_nve_noforce.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -24,10 +23,9 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ -FixNVENoforce::FixNVENoforce(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg) +FixNVENoforce::FixNVENoforce(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) { - if (narg != 3) error->all(FLERR,"Illegal fix nve/noforce command"); + if (narg != 3) error->all(FLERR, "Illegal fix nve/noforce command"); time_integrate = 1; } @@ -48,8 +46,8 @@ void FixNVENoforce::init() { dtv = update->dt; - if (utils::strmatch(update->integrate_style,"^respa")) - step_respa = (dynamic_cast( update->integrate))->step; + if (utils::strmatch(update->integrate_style, "^respa")) + step_respa = (dynamic_cast(update->integrate))->step; } /* ---------------------------------------------------------------------- */ @@ -75,7 +73,7 @@ void FixNVENoforce::initial_integrate(int /*vflag*/) void FixNVENoforce::initial_integrate_respa(int vflag, int ilevel, int flag) { - if (flag) return; // only used by NPT,NPH + if (flag) return; // only used by NPT,NPH dtv = step_respa[ilevel]; diff --git a/src/fix_nvt_sphere.cpp b/src/fix_nvt_sphere.cpp index aff4462356..349da470c7 100644 --- a/src/fix_nvt_sphere.cpp +++ b/src/fix_nvt_sphere.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -23,19 +22,15 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ -FixNVTSphere::FixNVTSphere(LAMMPS *lmp, int narg, char **arg) : - FixNHSphere(lmp, narg, arg) +FixNVTSphere::FixNVTSphere(LAMMPS *lmp, int narg, char **arg) : FixNHSphere(lmp, narg, arg) { - if (!tstat_flag) - error->all(FLERR,"Temperature control must be used with fix nvt/sphere"); - if (pstat_flag) - error->all(FLERR,"Pressure control can not be used with fix nvt/sphere"); + if (!tstat_flag) error->all(FLERR, "Temperature control must be used with fix nvt/sphere"); + if (pstat_flag) error->all(FLERR, "Pressure control can not be used with fix nvt/sphere"); // create a new compute temp style // id = fix-ID + temp id_temp = utils::strdup(std::string(id) + "_temp"); - modify->add_compute(fmt::format("{} {} temp/sphere", - id_temp,group->names[igroup])); + modify->add_compute(fmt::format("{} {} temp/sphere", id_temp, group->names[igroup])); tcomputeflag = 1; } diff --git a/src/fix_wall_harmonic.cpp b/src/fix_wall_harmonic.cpp index 1afca23c96..4b55dde8aa 100644 --- a/src/fix_wall_harmonic.cpp +++ b/src/fix_wall_harmonic.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -21,8 +20,7 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ -FixWallHarmonic::FixWallHarmonic(LAMMPS *lmp, int narg, char **arg) : - FixWall(lmp, narg, arg) +FixWallHarmonic::FixWallHarmonic(LAMMPS *lmp, int narg, char **arg) : FixWall(lmp, narg, arg) { dynamic_group_allow = 1; } @@ -36,7 +34,7 @@ FixWallHarmonic::FixWallHarmonic(LAMMPS *lmp, int narg, char **arg) : void FixWallHarmonic::wall_particle(int m, int which, double coord) { - double delta,dr,fwall; + double delta, dr, fwall; double vn; double **x = atom->x; @@ -52,25 +50,29 @@ void FixWallHarmonic::wall_particle(int m, int which, double coord) for (int i = 0; i < nlocal; i++) if (mask[i] & groupbit) { - if (side < 0) delta = x[i][dim] - coord; - else delta = coord - x[i][dim]; + if (side < 0) + delta = x[i][dim] - coord; + else + delta = coord - x[i][dim]; if (delta >= cutoff[m]) continue; if (delta <= 0.0) { onflag = 1; continue; } - dr = cutoff[m]-delta; - fwall = side * 2.0*epsilon[m]*dr; + dr = cutoff[m] - delta; + fwall = side * 2.0 * epsilon[m] * dr; f[i][dim] -= fwall; - ewall[0] += epsilon[m]*dr*dr; - ewall[m+1] += fwall; + ewall[0] += epsilon[m] * dr * dr; + ewall[m + 1] += fwall; if (evflag) { - if (side < 0) vn = -fwall*delta; - else vn = fwall*delta; - v_tally(dim,i,vn); + if (side < 0) + vn = -fwall * delta; + else + vn = fwall * delta; + v_tally(dim, i, vn); } } - if (onflag) error->one(FLERR,"Particle on or inside fix wall surface"); + if (onflag) error->one(FLERR, "Particle on or inside fix wall surface"); } diff --git a/src/fix_wall_morse.cpp b/src/fix_wall_morse.cpp index afac920c01..942e8e0e04 100644 --- a/src/fix_wall_morse.cpp +++ b/src/fix_wall_morse.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -13,17 +12,17 @@ ------------------------------------------------------------------------- */ #include "fix_wall_morse.h" -#include #include "atom.h" #include "error.h" +#include + using namespace LAMMPS_NS; using namespace FixConst; /* ---------------------------------------------------------------------- */ -FixWallMorse::FixWallMorse(LAMMPS *lmp, int narg, char **arg) : - FixWall(lmp, narg, arg) +FixWallMorse::FixWallMorse(LAMMPS *lmp, int narg, char **arg) : FixWall(lmp, narg, arg) { dynamic_group_allow = 1; } @@ -34,7 +33,7 @@ void FixWallMorse::precompute(int m) { coeff1[m] = 2.0 * epsilon[m] * alpha[m]; const double alpha_dr = -alpha[m] * (cutoff[m] - sigma[m]); - offset[m] = epsilon[m] * (exp(2.0*alpha_dr) - 2.0*exp(alpha_dr)); + offset[m] = epsilon[m] * (exp(2.0 * alpha_dr) - 2.0 * exp(alpha_dr)); } /* ---------------------------------------------------------------------- @@ -46,7 +45,7 @@ void FixWallMorse::precompute(int m) void FixWallMorse::wall_particle(int m, int which, double coord) { - double delta,fwall; + double delta, fwall; double vn; double **x = atom->x; @@ -62,8 +61,10 @@ void FixWallMorse::wall_particle(int m, int which, double coord) for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { - if (side < 0) delta = x[i][dim] - coord; - else delta = coord - x[i][dim]; + if (side < 0) + delta = x[i][dim] - coord; + else + delta = coord - x[i][dim]; if (delta >= cutoff[m]) continue; if (delta <= 0.0) { onflag = 1; @@ -71,18 +72,20 @@ void FixWallMorse::wall_particle(int m, int which, double coord) } double dr = delta - sigma[m]; double dexp = exp(-alpha[m] * dr); - fwall = side * coeff1[m] * (dexp*dexp - dexp) / delta; - ewall[0] += epsilon[m] * (dexp*dexp - 2.0*dexp) - offset[m]; + fwall = side * coeff1[m] * (dexp * dexp - dexp) / delta; + ewall[0] += epsilon[m] * (dexp * dexp - 2.0 * dexp) - offset[m]; f[i][dim] -= fwall; - ewall[m+1] += fwall; + ewall[m + 1] += fwall; if (evflag) { - if (side < 0) vn = -fwall*delta; - else vn = fwall*delta; + if (side < 0) + vn = -fwall * delta; + else + vn = fwall * delta; v_tally(dim, i, vn); } } } - if (onflag) error->one(FLERR,"Particle on or inside fix wall surface"); + if (onflag) error->one(FLERR, "Particle on or inside fix wall surface"); } diff --git a/src/npair_copy.cpp b/src/npair_copy.cpp index b3cab53e0a..38a36d0ba5 100644 --- a/src/npair_copy.cpp +++ b/src/npair_copy.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories diff --git a/src/npair_full_bin_atomonly.cpp b/src/npair_full_bin_atomonly.cpp index b8c4378280..aa7a91dbbe 100644 --- a/src/npair_full_bin_atomonly.cpp +++ b/src/npair_full_bin_atomonly.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -32,8 +31,8 @@ NPairFullBinAtomonly::NPairFullBinAtomonly(LAMMPS *lmp) : NPair(lmp) {} void NPairFullBinAtomonly::build(NeighList *list) { - int i,j,k,n,itype,jtype,ibin; - double xtmp,ytmp,ztmp,delx,dely,delz,rsq; + int i, j, k, n, itype, jtype, ibin; + double xtmp, ytmp, ztmp, delx, dely, delz, rsq; int *neighptr; double **x = atom->x; @@ -66,16 +65,16 @@ void NPairFullBinAtomonly::build(NeighList *list) ibin = atom2bin[i]; for (k = 0; k < nstencil; k++) { - for (j = binhead[ibin+stencil[k]]; j >= 0; j = bins[j]) { + for (j = binhead[ibin + stencil[k]]; j >= 0; j = bins[j]) { if (i == j) continue; jtype = type[j]; - if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue; + if (exclude && exclusion(i, j, itype, jtype, mask, molecule)) continue; delx = xtmp - x[j][0]; dely = ytmp - x[j][1]; delz = ztmp - x[j][2]; - rsq = delx*delx + dely*dely + delz*delz; + rsq = delx * delx + dely * dely + delz * delz; if (rsq <= cutneighsq[itype][jtype]) neighptr[n++] = j; } @@ -85,8 +84,7 @@ void NPairFullBinAtomonly::build(NeighList *list) firstneigh[i] = neighptr; numneigh[i] = n; ipage->vgot(n); - if (ipage->status()) - error->one(FLERR,"Neighbor list overflow, boost neigh_modify one"); + if (ipage->status()) error->one(FLERR, "Neighbor list overflow, boost neigh_modify one"); } list->inum = inum; diff --git a/src/npair_halffull_newtoff.cpp b/src/npair_halffull_newtoff.cpp index 475325c2f0..57c121b933 100644 --- a/src/npair_halffull_newtoff.cpp +++ b/src/npair_halffull_newtoff.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -35,8 +34,8 @@ NPairHalffullNewtoff::NPairHalffullNewtoff(LAMMPS *lmp) : NPair(lmp) {} void NPairHalffullNewtoff::build(NeighList *list) { - int i,j,ii,jj,n,jnum,joriginal; - int *neighptr,*jlist; + int i, j, ii, jj, n, jnum, joriginal; + int *neighptr, *jlist; int *ilist = list->ilist; int *numneigh = list->numneigh; @@ -74,8 +73,7 @@ void NPairHalffullNewtoff::build(NeighList *list) firstneigh[i] = neighptr; numneigh[i] = n; ipage->vgot(n); - if (ipage->status()) - error->one(FLERR,"Neighbor list overflow, boost neigh_modify one"); + if (ipage->status()) error->one(FLERR, "Neighbor list overflow, boost neigh_modify one"); } list->inum = inum; diff --git a/src/npair_skip_size.cpp b/src/npair_skip_size.cpp index f4fe760e08..b0134fd82c 100644 --- a/src/npair_skip_size.cpp +++ b/src/npair_skip_size.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -32,8 +31,8 @@ NPairSkipSize::NPairSkipSize(LAMMPS *lmp) : NPair(lmp) {} void NPairSkipSize::build(NeighList *list) { - int i,j,ii,jj,n,itype,jnum,joriginal; - int *neighptr,*jlist; + int i, j, ii, jj, n, itype, jnum, joriginal; + int *neighptr, *jlist; int *type = atom->type; int *ilist = list->ilist; @@ -80,8 +79,7 @@ void NPairSkipSize::build(NeighList *list) firstneigh[i] = neighptr; numneigh[i] = n; ipage->vgot(n); - if (ipage->status()) - error->one(FLERR,"Neighbor list overflow, boost neigh_modify one"); + if (ipage->status()) error->one(FLERR, "Neighbor list overflow, boost neigh_modify one"); } list->inum = inum; diff --git a/src/nstencil_full_bin_2d.cpp b/src/nstencil_full_bin_2d.cpp index ba4ca97ed6..5c79f3ae8a 100644 --- a/src/nstencil_full_bin_2d.cpp +++ b/src/nstencil_full_bin_2d.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -26,12 +25,11 @@ NStencilFullBin2d::NStencilFullBin2d(LAMMPS *lmp) : NStencil(lmp) {} void NStencilFullBin2d::create() { - int i,j; + int i, j; nstencil = 0; for (j = -sy; j <= sy; j++) for (i = -sx; i <= sx; i++) - if (bin_distance(i,j,0) < cutneighmaxsq) - stencil[nstencil++] = j*mbinx + i; + if (bin_distance(i, j, 0) < cutneighmaxsq) stencil[nstencil++] = j * mbinx + i; } diff --git a/src/nstencil_full_bin_3d.cpp b/src/nstencil_full_bin_3d.cpp index 8aa593eb0b..837bf109f2 100644 --- a/src/nstencil_full_bin_3d.cpp +++ b/src/nstencil_full_bin_3d.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -26,13 +25,13 @@ NStencilFullBin3d::NStencilFullBin3d(LAMMPS *lmp) : NStencil(lmp) {} void NStencilFullBin3d::create() { - int i,j,k; + int i, j, k; nstencil = 0; for (k = -sz; k <= sz; k++) for (j = -sy; j <= sy; j++) for (i = -sx; i <= sx; i++) - if (bin_distance(i,j,k) < cutneighmaxsq) - stencil[nstencil++] = k*mbiny*mbinx + j*mbinx + i; + if (bin_distance(i, j, k) < cutneighmaxsq) + stencil[nstencil++] = k * mbiny * mbinx + j * mbinx + i; } diff --git a/src/nstencil_full_ghost_bin_2d.cpp b/src/nstencil_full_ghost_bin_2d.cpp index b5a6bac56c..32c4440647 100644 --- a/src/nstencil_full_ghost_bin_2d.cpp +++ b/src/nstencil_full_ghost_bin_2d.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -29,16 +28,16 @@ NStencilFullGhostBin2d::NStencilFullGhostBin2d(LAMMPS *lmp) : NStencil(lmp) void NStencilFullGhostBin2d::create() { - int i,j; + int i, j; nstencil = 0; for (j = -sy; j <= sy; j++) for (i = -sx; i <= sx; i++) - if (bin_distance(i,j,0) < cutneighmaxsq) { + if (bin_distance(i, j, 0) < cutneighmaxsq) { stencilxyz[nstencil][0] = i; stencilxyz[nstencil][1] = j; stencilxyz[nstencil][2] = 0; - stencil[nstencil++] = j*mbinx + i; + stencil[nstencil++] = j * mbinx + i; } } diff --git a/src/nstencil_full_ghost_bin_3d.cpp b/src/nstencil_full_ghost_bin_3d.cpp index 2023495c34..3d43e35e04 100644 --- a/src/nstencil_full_ghost_bin_3d.cpp +++ b/src/nstencil_full_ghost_bin_3d.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -29,17 +28,17 @@ NStencilFullGhostBin3d::NStencilFullGhostBin3d(LAMMPS *lmp) : NStencil(lmp) void NStencilFullGhostBin3d::create() { - int i,j,k; + int i, j, k; nstencil = 0; for (k = -sz; k <= sz; k++) for (j = -sy; j <= sy; j++) for (i = -sx; i <= sx; i++) - if (bin_distance(i,j,k) < cutneighmaxsq) { + if (bin_distance(i, j, k) < cutneighmaxsq) { stencilxyz[nstencil][0] = i; stencilxyz[nstencil][1] = j; stencilxyz[nstencil][2] = k; - stencil[nstencil++] = k*mbiny*mbinx + j*mbinx + i; + stencil[nstencil++] = k * mbiny * mbinx + j * mbinx + i; } } diff --git a/src/nstencil_full_multi_2d.cpp b/src/nstencil_full_multi_2d.cpp index 52ae88d09e..d6e5fd2a9d 100644 --- a/src/nstencil_full_multi_2d.cpp +++ b/src/nstencil_full_multi_2d.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -50,7 +49,6 @@ void NStencilFullMulti2d::create() int n = ncollections; double cutsq; - for (icollection = 0; icollection < n; icollection++) { for (jcollection = 0; jcollection < n; jcollection++) { if (flag_skip_multi[icollection][jcollection]) { @@ -72,8 +70,8 @@ void NStencilFullMulti2d::create() for (j = -sy; j <= sy; j++) for (i = -sx; i <= sx; i++) - if (bin_distance_multi(i,j,0,bin_collection) < cutsq) - stencil_multi[icollection][jcollection][ns++] = j*mbinx + i; + if (bin_distance_multi(i, j, 0, bin_collection) < cutsq) + stencil_multi[icollection][jcollection][ns++] = j * mbinx + i; nstencil_multi[icollection][jcollection] = ns; } diff --git a/src/nstencil_full_multi_old_2d.cpp b/src/nstencil_full_multi_old_2d.cpp index d653e1080e..3747e99699 100644 --- a/src/nstencil_full_multi_old_2d.cpp +++ b/src/nstencil_full_multi_old_2d.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -27,8 +26,8 @@ NStencilFullMultiOld2d::NStencilFullMultiOld2d(LAMMPS *lmp) : NStencil(lmp) {} void NStencilFullMultiOld2d::create() { - int i,j,n; - double rsq,typesq; + int i, j, n; + double rsq, typesq; int *s; double *distsq; @@ -40,10 +39,10 @@ void NStencilFullMultiOld2d::create() n = 0; for (j = -sy; j <= sy; j++) for (i = -sx; i <= sx; i++) { - rsq = bin_distance(i,j,0); + rsq = bin_distance(i, j, 0); if (rsq < typesq) { distsq[n] = rsq; - s[n++] = j*mbinx + i; + s[n++] = j * mbinx + i; } } nstencil_multi_old[itype] = n; diff --git a/src/nstencil_full_multi_old_3d.cpp b/src/nstencil_full_multi_old_3d.cpp index 849ee5a9f9..04f10c5362 100644 --- a/src/nstencil_full_multi_old_3d.cpp +++ b/src/nstencil_full_multi_old_3d.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -27,8 +26,8 @@ NStencilFullMultiOld3d::NStencilFullMultiOld3d(LAMMPS *lmp) : NStencil(lmp) {} void NStencilFullMultiOld3d::create() { - int i,j,k,n; - double rsq,typesq; + int i, j, k, n; + double rsq, typesq; int *s; double *distsq; @@ -41,10 +40,10 @@ void NStencilFullMultiOld3d::create() for (k = -sz; k <= sz; k++) for (j = -sy; j <= sy; j++) for (i = -sx; i <= sx; i++) { - rsq = bin_distance(i,j,k); + rsq = bin_distance(i, j, k); if (rsq < typesq) { distsq[n] = rsq; - s[n++] = k*mbiny*mbinx + j*mbinx + i; + s[n++] = k * mbiny * mbinx + j * mbinx + i; } } nstencil_multi_old[itype] = n; diff --git a/src/nstencil_half_bin_2d.cpp b/src/nstencil_half_bin_2d.cpp index 004d6a8016..b1ad0237a7 100644 --- a/src/nstencil_half_bin_2d.cpp +++ b/src/nstencil_half_bin_2d.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -26,13 +25,12 @@ NStencilHalfBin2d::NStencilHalfBin2d(LAMMPS *lmp) : NStencil(lmp) {} void NStencilHalfBin2d::create() { - int i,j; + int i, j; nstencil = 0; for (j = 0; j <= sy; j++) for (i = -sx; i <= sx; i++) if (j > 0 || (j == 0 && i > 0)) - if (bin_distance(i,j,0) < cutneighmaxsq) - stencil[nstencil++] = j*mbinx + i; + if (bin_distance(i, j, 0) < cutneighmaxsq) stencil[nstencil++] = j * mbinx + i; } diff --git a/src/nstencil_half_bin_2d_tri.cpp b/src/nstencil_half_bin_2d_tri.cpp index 9f5ace1ed1..7b7ce962a2 100644 --- a/src/nstencil_half_bin_2d_tri.cpp +++ b/src/nstencil_half_bin_2d_tri.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -18,8 +17,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -NStencilHalfBin2dTri::NStencilHalfBin2dTri(LAMMPS *lmp) : - NStencil(lmp) {} +NStencilHalfBin2dTri::NStencilHalfBin2dTri(LAMMPS *lmp) : NStencil(lmp) {} /* ---------------------------------------------------------------------- create stencil based on bin geometry and cutoff @@ -27,12 +25,11 @@ NStencilHalfBin2dTri::NStencilHalfBin2dTri(LAMMPS *lmp) : void NStencilHalfBin2dTri::create() { - int i,j; + int i, j; nstencil = 0; for (j = 0; j <= sy; j++) for (i = -sx; i <= sx; i++) - if (bin_distance(i,j,0) < cutneighmaxsq) - stencil[nstencil++] = j*mbinx + i; + if (bin_distance(i, j, 0) < cutneighmaxsq) stencil[nstencil++] = j * mbinx + i; } diff --git a/src/nstencil_half_bin_3d.cpp b/src/nstencil_half_bin_3d.cpp index a8cacdb601..736bf151ee 100644 --- a/src/nstencil_half_bin_3d.cpp +++ b/src/nstencil_half_bin_3d.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -26,7 +25,7 @@ NStencilHalfBin3d::NStencilHalfBin3d(LAMMPS *lmp) : NStencil(lmp) {} void NStencilHalfBin3d::create() { - int i,j,k; + int i, j, k; nstencil = 0; @@ -34,6 +33,6 @@ void NStencilHalfBin3d::create() for (j = -sy; j <= sy; j++) for (i = -sx; i <= sx; i++) if (k > 0 || j > 0 || (j == 0 && i > 0)) - if (bin_distance(i,j,k) < cutneighmaxsq) - stencil[nstencil++] = k*mbiny*mbinx + j*mbinx + i; + if (bin_distance(i, j, k) < cutneighmaxsq) + stencil[nstencil++] = k * mbiny * mbinx + j * mbinx + i; } diff --git a/src/nstencil_half_bin_3d_tri.cpp b/src/nstencil_half_bin_3d_tri.cpp index 8d1920ae8c..a5376d0208 100644 --- a/src/nstencil_half_bin_3d_tri.cpp +++ b/src/nstencil_half_bin_3d_tri.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -18,8 +17,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -NStencilHalfBin3dTri::NStencilHalfBin3dTri(LAMMPS *lmp) : - NStencil(lmp) {} +NStencilHalfBin3dTri::NStencilHalfBin3dTri(LAMMPS *lmp) : NStencil(lmp) {} /* ---------------------------------------------------------------------- create stencil based on bin geometry and cutoff @@ -27,13 +25,13 @@ NStencilHalfBin3dTri::NStencilHalfBin3dTri(LAMMPS *lmp) : void NStencilHalfBin3dTri::create() { - int i,j,k; + int i, j, k; nstencil = 0; for (k = 0; k <= sz; k++) for (j = -sy; j <= sy; j++) for (i = -sx; i <= sx; i++) - if (bin_distance(i,j,k) < cutneighmaxsq) - stencil[nstencil++] = k*mbiny*mbinx + j*mbinx + i; + if (bin_distance(i, j, k) < cutneighmaxsq) + stencil[nstencil++] = k * mbiny * mbinx + j * mbinx + i; } diff --git a/src/nstencil_half_multi_old_2d.cpp b/src/nstencil_half_multi_old_2d.cpp index 7a2f5a25e2..b4869b37f4 100644 --- a/src/nstencil_half_multi_old_2d.cpp +++ b/src/nstencil_half_multi_old_2d.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -19,8 +18,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -NStencilHalfMultiOld2d:: -NStencilHalfMultiOld2d(LAMMPS *lmp) : NStencil(lmp) {} +NStencilHalfMultiOld2d::NStencilHalfMultiOld2d(LAMMPS *lmp) : NStencil(lmp) {} /* ---------------------------------------------------------------------- create stencil based on bin geometry and cutoff @@ -28,8 +26,8 @@ NStencilHalfMultiOld2d(LAMMPS *lmp) : NStencil(lmp) {} void NStencilHalfMultiOld2d::create() { - int i,j,n; - double rsq,typesq; + int i, j, n; + double rsq, typesq; int *s; double *distsq; @@ -42,10 +40,10 @@ void NStencilHalfMultiOld2d::create() for (j = 0; j <= sy; j++) for (i = -sx; i <= sx; i++) if (j > 0 || (j == 0 && i > 0)) { - rsq = bin_distance(i,j,0); + rsq = bin_distance(i, j, 0); if (rsq < typesq) { distsq[n] = rsq; - s[n++] = j*mbinx + i; + s[n++] = j * mbinx + i; } } nstencil_multi_old[itype] = n; diff --git a/src/nstencil_half_multi_old_2d_tri.cpp b/src/nstencil_half_multi_old_2d_tri.cpp index 7e5158cc31..e6cf2d311e 100644 --- a/src/nstencil_half_multi_old_2d_tri.cpp +++ b/src/nstencil_half_multi_old_2d_tri.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -19,8 +18,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -NStencilHalfMultiOld2dTri:: -NStencilHalfMultiOld2dTri(LAMMPS *lmp) : NStencil(lmp) {} +NStencilHalfMultiOld2dTri::NStencilHalfMultiOld2dTri(LAMMPS *lmp) : NStencil(lmp) {} /* ---------------------------------------------------------------------- create stencil based on bin geometry and cutoff @@ -28,8 +26,8 @@ NStencilHalfMultiOld2dTri(LAMMPS *lmp) : NStencil(lmp) {} void NStencilHalfMultiOld2dTri::create() { - int i,j,n; - double rsq,typesq; + int i, j, n; + double rsq, typesq; int *s; double *distsq; @@ -41,10 +39,10 @@ void NStencilHalfMultiOld2dTri::create() n = 0; for (j = 0; j <= sy; j++) for (i = -sx; i <= sx; i++) { - rsq = bin_distance(i,j,0); + rsq = bin_distance(i, j, 0); if (rsq < typesq) { distsq[n] = rsq; - s[n++] = j*mbinx + i; + s[n++] = j * mbinx + i; } } nstencil_multi_old[itype] = n; diff --git a/src/nstencil_half_multi_old_3d.cpp b/src/nstencil_half_multi_old_3d.cpp index cdb22c2d13..ada8c66610 100644 --- a/src/nstencil_half_multi_old_3d.cpp +++ b/src/nstencil_half_multi_old_3d.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -19,8 +18,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -NStencilHalfMultiOld3d:: -NStencilHalfMultiOld3d(LAMMPS *lmp) : NStencil(lmp) {} +NStencilHalfMultiOld3d::NStencilHalfMultiOld3d(LAMMPS *lmp) : NStencil(lmp) {} /* ---------------------------------------------------------------------- create stencil based on bin geometry and cutoff @@ -28,8 +26,8 @@ NStencilHalfMultiOld3d(LAMMPS *lmp) : NStencil(lmp) {} void NStencilHalfMultiOld3d::create() { - int i,j,k,n; - double rsq,typesq; + int i, j, k, n; + double rsq, typesq; int *s; double *distsq; @@ -43,10 +41,10 @@ void NStencilHalfMultiOld3d::create() for (j = -sy; j <= sy; j++) for (i = -sx; i <= sx; i++) if (k > 0 || j > 0 || (j == 0 && i > 0)) { - rsq = bin_distance(i,j,k); + rsq = bin_distance(i, j, k); if (rsq < typesq) { distsq[n] = rsq; - s[n++] = k*mbiny*mbinx + j*mbinx + i; + s[n++] = k * mbiny * mbinx + j * mbinx + i; } } nstencil_multi_old[itype] = n; diff --git a/src/nstencil_half_multi_old_3d_tri.cpp b/src/nstencil_half_multi_old_3d_tri.cpp index 6fb9b6d3d1..c58fe509ef 100644 --- a/src/nstencil_half_multi_old_3d_tri.cpp +++ b/src/nstencil_half_multi_old_3d_tri.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -19,8 +18,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -NStencilHalfMultiOld3dTri:: -NStencilHalfMultiOld3dTri(LAMMPS *lmp) : NStencil(lmp) {} +NStencilHalfMultiOld3dTri::NStencilHalfMultiOld3dTri(LAMMPS *lmp) : NStencil(lmp) {} /* ---------------------------------------------------------------------- create stencil based on bin geometry and cutoff @@ -28,8 +26,8 @@ NStencilHalfMultiOld3dTri(LAMMPS *lmp) : NStencil(lmp) {} void NStencilHalfMultiOld3dTri::create() { - int i,j,k,n; - double rsq,typesq; + int i, j, k, n; + double rsq, typesq; int *s; double *distsq; @@ -42,10 +40,10 @@ void NStencilHalfMultiOld3dTri::create() for (k = 0; k <= sz; k++) for (j = -sy; j <= sy; j++) for (i = -sx; i <= sx; i++) { - rsq = bin_distance(i,j,k); + rsq = bin_distance(i, j, k); if (rsq < typesq) { distsq[n] = rsq; - s[n++] = k*mbiny*mbinx + j*mbinx + i; + s[n++] = k * mbiny * mbinx + j * mbinx + i; } } nstencil_multi_old[itype] = n; diff --git a/src/ntopo_bond_all.cpp b/src/ntopo_bond_all.cpp index ab397cab7b..b3cd3011a5 100644 --- a/src/ntopo_bond_all.cpp +++ b/src/ntopo_bond_all.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -15,14 +14,13 @@ #include "ntopo_bond_all.h" #include "atom.h" -#include "force.h" #include "domain.h" -#include "update.h" +#include "error.h" +#include "force.h" +#include "memory.h" #include "output.h" #include "thermo.h" -#include "memory.h" -#include "error.h" - +#include "update.h" using namespace LAMMPS_NS; @@ -39,7 +37,7 @@ NTopoBondAll::NTopoBondAll(LAMMPS *lmp) : NTopo(lmp) void NTopoBondAll::build() { - int i,m,atom1; + int i, m, atom1; int nlocal = atom->nlocal; int *num_bond = atom->num_bond; @@ -58,16 +56,17 @@ void NTopoBondAll::build() if (atom1 == -1) { nmissing++; if (lostbond == Thermo::ERROR) - error->one(FLERR,"Bond atoms {} {} missing on " - "proc {} at step {}",tag[i], - bond_atom[i][m],me,update->ntimestep); + error->one(FLERR, + "Bond atoms {} {} missing on " + "proc {} at step {}", + tag[i], bond_atom[i][m], me, update->ntimestep); continue; } - atom1 = domain->closest_image(i,atom1); + atom1 = domain->closest_image(i, atom1); if (newton_bond || i < atom1) { if (nbondlist == maxbond) { maxbond += DELTA; - memory->grow(bondlist,maxbond,3,"neigh_topo:bondlist"); + memory->grow(bondlist, maxbond, 3, "neigh_topo:bondlist"); } bondlist[nbondlist][0] = i; bondlist[nbondlist][1] = atom1; @@ -80,7 +79,6 @@ void NTopoBondAll::build() if (lostbond == Thermo::IGNORE) return; int all; - MPI_Allreduce(&nmissing,&all,1,MPI_INT,MPI_SUM,world); - if (all && (me == 0)) - error->warning(FLERR,"Bond atoms missing at step {}",update->ntimestep); + MPI_Allreduce(&nmissing, &all, 1, MPI_INT, MPI_SUM, world); + if (all && (me == 0)) error->warning(FLERR, "Bond atoms missing at step {}", update->ntimestep); } diff --git a/src/ntopo_bond_partial.cpp b/src/ntopo_bond_partial.cpp index 851703776b..de6d0bf151 100644 --- a/src/ntopo_bond_partial.cpp +++ b/src/ntopo_bond_partial.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -15,14 +14,13 @@ #include "ntopo_bond_partial.h" #include "atom.h" -#include "force.h" #include "domain.h" -#include "update.h" +#include "error.h" +#include "force.h" +#include "memory.h" #include "output.h" #include "thermo.h" -#include "memory.h" -#include "error.h" - +#include "update.h" using namespace LAMMPS_NS; @@ -39,7 +37,7 @@ NTopoBondPartial::NTopoBondPartial(LAMMPS *lmp) : NTopo(lmp) void NTopoBondPartial::build() { - int i,m,atom1; + int i, m, atom1; int nlocal = atom->nlocal; int *num_bond = atom->num_bond; @@ -59,16 +57,17 @@ void NTopoBondPartial::build() if (atom1 == -1) { nmissing++; if (lostbond == Thermo::ERROR) - error->one(FLERR,"Bond atoms {} {} missing on " - "proc {} at step {}",tag[i], - bond_atom[i][m],me,update->ntimestep); + error->one(FLERR, + "Bond atoms {} {} missing on " + "proc {} at step {}", + tag[i], bond_atom[i][m], me, update->ntimestep); continue; } - atom1 = domain->closest_image(i,atom1); + atom1 = domain->closest_image(i, atom1); if (newton_bond || i < atom1) { if (nbondlist == maxbond) { maxbond += DELTA; - memory->grow(bondlist,maxbond,3,"neigh_topo:bondlist"); + memory->grow(bondlist, maxbond, 3, "neigh_topo:bondlist"); } bondlist[nbondlist][0] = i; bondlist[nbondlist][1] = atom1; @@ -81,7 +80,6 @@ void NTopoBondPartial::build() if (lostbond == Thermo::IGNORE) return; int all; - MPI_Allreduce(&nmissing,&all,1,MPI_INT,MPI_SUM,world); - if (all && (me == 0)) - error->warning(FLERR,"Bond atoms missing at step {}",update->ntimestep); + MPI_Allreduce(&nmissing, &all, 1, MPI_INT, MPI_SUM, world); + if (all && (me == 0)) error->warning(FLERR, "Bond atoms missing at step {}", update->ntimestep); } diff --git a/src/reader.cpp b/src/reader.cpp index eb8cd9ffb6..c7b99260e7 100644 --- a/src/reader.cpp +++ b/src/reader.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -41,19 +40,19 @@ void Reader::open_file(const std::string &file) if (platform::has_compress_extension(file)) { compressed = true; fp = platform::compressed_read(file); - if (!fp) error->one(FLERR,"Cannot open compressed file for reading"); + if (!fp) error->one(FLERR, "Cannot open compressed file for reading"); } else { compressed = false; if (utils::strmatch(file, "\\.bin$")) { binary = true; - fp = fopen(file.c_str(),"rb"); + fp = fopen(file.c_str(), "rb"); } else { - fp = fopen(file.c_str(),"r"); + fp = fopen(file.c_str(), "r"); binary = false; } } - if (!fp) error->one(FLERR,"Cannot open file {}: {}", file, utils::getsyserror()); + if (!fp) error->one(FLERR, "Cannot open file {}: {}", file, utils::getsyserror()); } /* ---------------------------------------------------------------------- @@ -64,8 +63,10 @@ void Reader::open_file(const std::string &file) void Reader::close_file() { if (fp == nullptr) return; - if (compressed) platform::pclose(fp); - else fclose(fp); + if (compressed) + platform::pclose(fp); + else + fclose(fp); fp = nullptr; } @@ -73,8 +74,7 @@ void Reader::close_file() detect unused arguments ------------------------------------------------------------------------- */ -void Reader::settings(int narg, char** /*args*/) +void Reader::settings(int narg, char ** /*args*/) { - if (narg > 0) - error->all(FLERR,"Illegal read_dump command"); + if (narg > 0) error->all(FLERR, "Illegal read_dump command"); } diff --git a/src/write_dump.cpp b/src/write_dump.cpp index e9f610fe31..2ce28f01e4 100644 --- a/src/write_dump.cpp +++ b/src/write_dump.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -34,41 +33,39 @@ using namespace LAMMPS_NS; void WriteDump::command(int narg, char **arg) { - if (narg < 3) error->all(FLERR,"Illegal write_dump command"); + if (narg < 3) error->all(FLERR, "Illegal write_dump command"); // modindex = index in args of "modify" keyword // will be narg if "modify" is not present int modindex; for (modindex = 0; modindex < narg; modindex++) - if (strcmp(arg[modindex],"modify") == 0) break; + if (strcmp(arg[modindex], "modify") == 0) break; // create the Dump instance // create dump command line with extra required args - auto dumpargs = new char*[modindex+2]; - dumpargs[0] = (char *) "WRITE_DUMP"; // dump id - dumpargs[1] = arg[0]; // group - dumpargs[2] = arg[1]; // dump style - std::string ntimestep = std::to_string(MAX(update->ntimestep,1)); - dumpargs[3] = (char *) ntimestep.c_str(); // dump frequency + auto dumpargs = new char *[modindex + 2]; + dumpargs[0] = (char *) "WRITE_DUMP"; // dump id + dumpargs[1] = arg[0]; // group + dumpargs[2] = arg[1]; // dump style + std::string ntimestep = std::to_string(MAX(update->ntimestep, 1)); + dumpargs[3] = (char *) ntimestep.c_str(); // dump frequency - for (int i = 2; i < modindex; ++i) dumpargs[i+2] = arg[i]; + for (int i = 2; i < modindex; ++i) dumpargs[i + 2] = arg[i]; - Dump *dump = output->add_dump(modindex+2, dumpargs); - if (modindex < narg) dump->modify_params(narg-modindex-1,&arg[modindex+1]); + Dump *dump = output->add_dump(modindex + 2, dumpargs); + if (modindex < narg) dump->modify_params(narg - modindex - 1, &arg[modindex + 1]); // write out one frame and then delete the dump again // set multifile_override for DumpImage so that filename needs no "*" - if (strcmp(arg[1],"image") == 0) - (dynamic_cast( dump))->multifile_override = 1; + if (strcmp(arg[1], "image") == 0) (dynamic_cast(dump))->multifile_override = 1; - if (strcmp(arg[1],"cfg") == 0) - (dynamic_cast( dump))->multifile_override = 1; + if (strcmp(arg[1], "cfg") == 0) (dynamic_cast(dump))->multifile_override = 1; if ((update->first_update == 0) && (comm->me == 0)) - error->warning(FLERR,"Calling write_dump before a full system init."); + error->warning(FLERR, "Calling write_dump before a full system init."); dump->init(); dump->write();