enable and apply clang-format

This commit is contained in:
Axel Kohlmeyer
2022-05-22 07:04:35 -04:00
parent 9a973e67fa
commit cd8bef3b0b
30 changed files with 202 additions and 246 deletions

View File

@ -1,4 +1,3 @@
// clang-format off
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories https://www.lammps.org/, Sandia National Laboratories
@ -25,8 +24,7 @@ using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
ComputeDihedral::ComputeDihedral(LAMMPS *lmp, int narg, char **arg) : ComputeDihedral::ComputeDihedral(LAMMPS *lmp, int narg, char **arg) :
Compute(lmp, narg, arg), Compute(lmp, narg, arg), emine(nullptr)
emine(nullptr)
{ {
if (narg != 3) error->all(FLERR, "Illegal compute dihedral command"); if (narg != 3) error->all(FLERR, "Illegal compute dihedral command");
@ -38,8 +36,7 @@ ComputeDihedral::ComputeDihedral(LAMMPS *lmp, int narg, char **arg) :
// check if dihedral style hybrid exists // check if dihedral style hybrid exists
dihedral = dynamic_cast<DihedralHybrid *>(force->dihedral_match("hybrid")); dihedral = dynamic_cast<DihedralHybrid *>(force->dihedral_match("hybrid"));
if (!dihedral) if (!dihedral) error->all(FLERR, "Dihedral style for compute dihedral command is not hybrid");
error->all(FLERR, "Dihedral style for compute dihedral command is not hybrid");
size_vector = nsub = dihedral->nstyles; size_vector = nsub = dihedral->nstyles;
emine = new double[nsub]; emine = new double[nsub];
@ -61,8 +58,7 @@ void ComputeDihedral::init()
// recheck dihedral style in case it has been changed // recheck dihedral style in case it has been changed
dihedral = dynamic_cast<DihedralHybrid *>(force->dihedral_match("hybrid")); dihedral = dynamic_cast<DihedralHybrid *>(force->dihedral_match("hybrid"));
if (!dihedral) if (!dihedral) error->all(FLERR, "Dihedral style for compute dihedral command is not hybrid");
error->all(FLERR, "Dihedral style for compute dihedral command is not hybrid");
if (dihedral->nstyles != nsub) 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");
} }
@ -75,8 +71,7 @@ void ComputeDihedral::compute_vector()
if (update->eflag_global != invoked_vector) 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++) for (int i = 0; i < nsub; i++) emine[i] = dihedral->styles[i]->energy;
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);
} }

View File

@ -1,4 +1,3 @@
// clang-format off
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories https://www.lammps.org/, Sandia National Laboratories
@ -14,19 +13,18 @@
#include "compute_improper.h" #include "compute_improper.h"
#include "update.h" #include "error.h"
#include "force.h" #include "force.h"
#include "improper.h" #include "improper.h"
#include "improper_hybrid.h" #include "improper_hybrid.h"
#include "error.h" #include "update.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
ComputeImproper::ComputeImproper(LAMMPS *lmp, int narg, char **arg) : ComputeImproper::ComputeImproper(LAMMPS *lmp, int narg, char **arg) :
Compute(lmp, narg, arg), Compute(lmp, narg, arg), emine(nullptr)
emine(nullptr)
{ {
if (narg != 3) error->all(FLERR, "Illegal compute improper command"); if (narg != 3) error->all(FLERR, "Illegal compute improper command");
@ -38,8 +36,7 @@ ComputeImproper::ComputeImproper(LAMMPS *lmp, int narg, char **arg) :
// check if improper style hybrid exists // check if improper style hybrid exists
improper = dynamic_cast<ImproperHybrid *>(force->improper_match("hybrid")); improper = dynamic_cast<ImproperHybrid *>(force->improper_match("hybrid"));
if (!improper) if (!improper) error->all(FLERR, "Improper style for compute improper command is not hybrid");
error->all(FLERR, "Improper style for compute improper command is not hybrid");
size_vector = nsub = improper->nstyles; size_vector = nsub = improper->nstyles;
emine = new double[nsub]; emine = new double[nsub];
@ -61,8 +58,7 @@ void ComputeImproper::init()
// recheck improper style in case it has been changed // recheck improper style in case it has been changed
improper = dynamic_cast<ImproperHybrid *>(force->improper_match("hybrid")); improper = dynamic_cast<ImproperHybrid *>(force->improper_match("hybrid"));
if (!improper) if (!improper) error->all(FLERR, "Improper style for compute improper command is not hybrid");
error->all(FLERR, "Improper style for compute improper command is not hybrid");
if (improper->nstyles != nsub) 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");
} }
@ -75,8 +71,7 @@ void ComputeImproper::compute_vector()
if (update->eflag_global != invoked_vector) 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++) for (int i = 0; i < nsub; i++) emine[i] = improper->styles[i]->energy;
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);
} }

View File

@ -1,4 +1,3 @@
// clang-format off
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories https://www.lammps.org/, Sandia National Laboratories
@ -13,16 +12,16 @@
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "fix_dummy.h" #include "fix_dummy.h"
#include <cstring>
#include "error.h" #include "error.h"
#include <cstring>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
using namespace FixConst; using namespace FixConst;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
FixDummy::FixDummy(LAMMPS *lmp, int narg, char **arg) : FixDummy::FixDummy(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
Fix(lmp, narg, arg)
{ {
// process optional args // process optional args
// customize here and in setmask() by adding a new keyword from fix.h // 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; int iarg = 3;
while (iarg < narg) { while (iarg < narg) {
if (strcmp(arg[iarg],"initial_integrate") == 0) initial_integrate_flag = 1; if (strcmp(arg[iarg], "initial_integrate") == 0)
else if (strcmp(arg[iarg],"final_integrate") == 0) final_integrate_flag = 1; initial_integrate_flag = 1;
else if (strcmp(arg[iarg],"pre_exchange") == 0) pre_exchange_flag = 1; else if (strcmp(arg[iarg], "final_integrate") == 0)
else if (strcmp(arg[iarg],"pre_neighbor") == 0) pre_neighbor_flag = 1; final_integrate_flag = 1;
else if (strcmp(arg[iarg],"pre_force") == 0) pre_force_flag = 1; else if (strcmp(arg[iarg], "pre_exchange") == 0)
else if (strcmp(arg[iarg],"post_force") == 0) post_force_flag = 1; pre_exchange_flag = 1;
else if (strcmp(arg[iarg],"end_of_step") == 0) end_of_step_flag = 1; else if (strcmp(arg[iarg], "pre_neighbor") == 0)
else error->all(FLERR,"Illegal fix DUMMY command"); 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++; iarg++;
} }
} }

View File

@ -1,4 +1,3 @@
// clang-format off
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories https://www.lammps.org/, Sandia National Laboratories
@ -24,8 +23,7 @@ using namespace FixConst;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
FixNVENoforce::FixNVENoforce(LAMMPS *lmp, int narg, char **arg) : FixNVENoforce::FixNVENoforce(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, 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");

View File

@ -1,4 +1,3 @@
// clang-format off
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories https://www.lammps.org/, Sandia National Laboratories
@ -23,19 +22,15 @@ using namespace FixConst;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
FixNVTSphere::FixNVTSphere(LAMMPS *lmp, int narg, char **arg) : FixNVTSphere::FixNVTSphere(LAMMPS *lmp, int narg, char **arg) : FixNHSphere(lmp, narg, arg)
FixNHSphere(lmp, narg, arg)
{ {
if (!tstat_flag) if (!tstat_flag) error->all(FLERR, "Temperature control must be used with fix nvt/sphere");
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 (pstat_flag)
error->all(FLERR,"Pressure control can not be used with fix nvt/sphere");
// create a new compute temp style // create a new compute temp style
// id = fix-ID + temp // id = fix-ID + temp
id_temp = utils::strdup(std::string(id) + "_temp"); id_temp = utils::strdup(std::string(id) + "_temp");
modify->add_compute(fmt::format("{} {} temp/sphere", modify->add_compute(fmt::format("{} {} temp/sphere", id_temp, group->names[igroup]));
id_temp,group->names[igroup]));
tcomputeflag = 1; tcomputeflag = 1;
} }

View File

@ -1,4 +1,3 @@
// clang-format off
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories https://www.lammps.org/, Sandia National Laboratories
@ -21,8 +20,7 @@ using namespace FixConst;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
FixWallHarmonic::FixWallHarmonic(LAMMPS *lmp, int narg, char **arg) : FixWallHarmonic::FixWallHarmonic(LAMMPS *lmp, int narg, char **arg) : FixWall(lmp, narg, arg)
FixWall(lmp, narg, arg)
{ {
dynamic_group_allow = 1; dynamic_group_allow = 1;
} }
@ -52,8 +50,10 @@ void FixWallHarmonic::wall_particle(int m, int which, double coord)
for (int i = 0; i < nlocal; i++) for (int i = 0; i < nlocal; i++)
if (mask[i] & groupbit) { if (mask[i] & groupbit) {
if (side < 0) delta = x[i][dim] - coord; if (side < 0)
else delta = coord - x[i][dim]; delta = x[i][dim] - coord;
else
delta = coord - x[i][dim];
if (delta >= cutoff[m]) continue; if (delta >= cutoff[m]) continue;
if (delta <= 0.0) { if (delta <= 0.0) {
onflag = 1; onflag = 1;
@ -66,8 +66,10 @@ void FixWallHarmonic::wall_particle(int m, int which, double coord)
ewall[m + 1] += fwall; ewall[m + 1] += fwall;
if (evflag) { if (evflag) {
if (side < 0) vn = -fwall*delta; if (side < 0)
else vn = fwall*delta; vn = -fwall * delta;
else
vn = fwall * delta;
v_tally(dim, i, vn); v_tally(dim, i, vn);
} }
} }

View File

@ -1,4 +1,3 @@
// clang-format off
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories https://www.lammps.org/, Sandia National Laboratories
@ -13,17 +12,17 @@
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "fix_wall_morse.h" #include "fix_wall_morse.h"
#include <cmath>
#include "atom.h" #include "atom.h"
#include "error.h" #include "error.h"
#include <cmath>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
using namespace FixConst; using namespace FixConst;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
FixWallMorse::FixWallMorse(LAMMPS *lmp, int narg, char **arg) : FixWallMorse::FixWallMorse(LAMMPS *lmp, int narg, char **arg) : FixWall(lmp, narg, arg)
FixWall(lmp, narg, arg)
{ {
dynamic_group_allow = 1; dynamic_group_allow = 1;
} }
@ -62,8 +61,10 @@ void FixWallMorse::wall_particle(int m, int which, double coord)
for (int i = 0; i < nlocal; i++) { for (int i = 0; i < nlocal; i++) {
if (mask[i] & groupbit) { if (mask[i] & groupbit) {
if (side < 0) delta = x[i][dim] - coord; if (side < 0)
else delta = coord - x[i][dim]; delta = x[i][dim] - coord;
else
delta = coord - x[i][dim];
if (delta >= cutoff[m]) continue; if (delta >= cutoff[m]) continue;
if (delta <= 0.0) { if (delta <= 0.0) {
onflag = 1; onflag = 1;
@ -77,8 +78,10 @@ void FixWallMorse::wall_particle(int m, int which, double coord)
ewall[m + 1] += fwall; ewall[m + 1] += fwall;
if (evflag) { if (evflag) {
if (side < 0) vn = -fwall*delta; if (side < 0)
else vn = fwall*delta; vn = -fwall * delta;
else
vn = fwall * delta;
v_tally(dim, i, vn); v_tally(dim, i, vn);
} }
} }

View File

@ -1,4 +1,3 @@
// clang-format off
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories https://www.lammps.org/, Sandia National Laboratories

View File

@ -1,4 +1,3 @@
// clang-format off
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories https://www.lammps.org/, Sandia National Laboratories
@ -85,8 +84,7 @@ void NPairFullBinAtomonly::build(NeighList *list)
firstneigh[i] = neighptr; firstneigh[i] = neighptr;
numneigh[i] = n; numneigh[i] = n;
ipage->vgot(n); ipage->vgot(n);
if (ipage->status()) if (ipage->status()) error->one(FLERR, "Neighbor list overflow, boost neigh_modify one");
error->one(FLERR,"Neighbor list overflow, boost neigh_modify one");
} }
list->inum = inum; list->inum = inum;

View File

@ -1,4 +1,3 @@
// clang-format off
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories https://www.lammps.org/, Sandia National Laboratories
@ -74,8 +73,7 @@ void NPairHalffullNewtoff::build(NeighList *list)
firstneigh[i] = neighptr; firstneigh[i] = neighptr;
numneigh[i] = n; numneigh[i] = n;
ipage->vgot(n); ipage->vgot(n);
if (ipage->status()) if (ipage->status()) error->one(FLERR, "Neighbor list overflow, boost neigh_modify one");
error->one(FLERR,"Neighbor list overflow, boost neigh_modify one");
} }
list->inum = inum; list->inum = inum;

View File

@ -1,4 +1,3 @@
// clang-format off
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories https://www.lammps.org/, Sandia National Laboratories
@ -80,8 +79,7 @@ void NPairSkipSize::build(NeighList *list)
firstneigh[i] = neighptr; firstneigh[i] = neighptr;
numneigh[i] = n; numneigh[i] = n;
ipage->vgot(n); ipage->vgot(n);
if (ipage->status()) if (ipage->status()) error->one(FLERR, "Neighbor list overflow, boost neigh_modify one");
error->one(FLERR,"Neighbor list overflow, boost neigh_modify one");
} }
list->inum = inum; list->inum = inum;

View File

@ -1,4 +1,3 @@
// clang-format off
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories https://www.lammps.org/, Sandia National Laboratories
@ -32,6 +31,5 @@ void NStencilFullBin2d::create()
for (j = -sy; j <= sy; j++) for (j = -sy; j <= sy; j++)
for (i = -sx; i <= sx; i++) for (i = -sx; i <= sx; i++)
if (bin_distance(i,j,0) < cutneighmaxsq) if (bin_distance(i, j, 0) < cutneighmaxsq) stencil[nstencil++] = j * mbinx + i;
stencil[nstencil++] = j*mbinx + i;
} }

View File

@ -1,4 +1,3 @@
// clang-format off
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories https://www.lammps.org/, Sandia National Laboratories

View File

@ -1,4 +1,3 @@
// clang-format off
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories https://www.lammps.org/, Sandia National Laboratories

View File

@ -1,4 +1,3 @@
// clang-format off
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories https://www.lammps.org/, Sandia National Laboratories

View File

@ -1,4 +1,3 @@
// clang-format off
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories https://www.lammps.org/, Sandia National Laboratories
@ -50,7 +49,6 @@ void NStencilFullMulti2d::create()
int n = ncollections; int n = ncollections;
double cutsq; double cutsq;
for (icollection = 0; icollection < n; icollection++) { for (icollection = 0; icollection < n; icollection++) {
for (jcollection = 0; jcollection < n; jcollection++) { for (jcollection = 0; jcollection < n; jcollection++) {
if (flag_skip_multi[icollection][jcollection]) { if (flag_skip_multi[icollection][jcollection]) {

View File

@ -1,4 +1,3 @@
// clang-format off
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories https://www.lammps.org/, Sandia National Laboratories

View File

@ -1,4 +1,3 @@
// clang-format off
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories https://www.lammps.org/, Sandia National Laboratories

View File

@ -1,4 +1,3 @@
// clang-format off
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories https://www.lammps.org/, Sandia National Laboratories
@ -33,6 +32,5 @@ void NStencilHalfBin2d::create()
for (j = 0; j <= sy; j++) for (j = 0; j <= sy; j++)
for (i = -sx; i <= sx; i++) for (i = -sx; i <= sx; i++)
if (j > 0 || (j == 0 && i > 0)) if (j > 0 || (j == 0 && i > 0))
if (bin_distance(i,j,0) < cutneighmaxsq) if (bin_distance(i, j, 0) < cutneighmaxsq) stencil[nstencil++] = j * mbinx + i;
stencil[nstencil++] = j*mbinx + i;
} }

View File

@ -1,4 +1,3 @@
// clang-format off
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories https://www.lammps.org/, Sandia National Laboratories
@ -18,8 +17,7 @@ using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
NStencilHalfBin2dTri::NStencilHalfBin2dTri(LAMMPS *lmp) : NStencilHalfBin2dTri::NStencilHalfBin2dTri(LAMMPS *lmp) : NStencil(lmp) {}
NStencil(lmp) {}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
create stencil based on bin geometry and cutoff create stencil based on bin geometry and cutoff
@ -33,6 +31,5 @@ void NStencilHalfBin2dTri::create()
for (j = 0; j <= sy; j++) for (j = 0; j <= sy; j++)
for (i = -sx; i <= sx; i++) for (i = -sx; i <= sx; i++)
if (bin_distance(i,j,0) < cutneighmaxsq) if (bin_distance(i, j, 0) < cutneighmaxsq) stencil[nstencil++] = j * mbinx + i;
stencil[nstencil++] = j*mbinx + i;
} }

View File

@ -1,4 +1,3 @@
// clang-format off
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories https://www.lammps.org/, Sandia National Laboratories

View File

@ -1,4 +1,3 @@
// clang-format off
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories https://www.lammps.org/, Sandia National Laboratories
@ -18,8 +17,7 @@ using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
NStencilHalfBin3dTri::NStencilHalfBin3dTri(LAMMPS *lmp) : NStencilHalfBin3dTri::NStencilHalfBin3dTri(LAMMPS *lmp) : NStencil(lmp) {}
NStencil(lmp) {}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
create stencil based on bin geometry and cutoff create stencil based on bin geometry and cutoff

View File

@ -1,4 +1,3 @@
// clang-format off
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories https://www.lammps.org/, Sandia National Laboratories
@ -19,8 +18,7 @@ using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
NStencilHalfMultiOld2d:: NStencilHalfMultiOld2d::NStencilHalfMultiOld2d(LAMMPS *lmp) : NStencil(lmp) {}
NStencilHalfMultiOld2d(LAMMPS *lmp) : NStencil(lmp) {}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
create stencil based on bin geometry and cutoff create stencil based on bin geometry and cutoff

View File

@ -1,4 +1,3 @@
// clang-format off
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories https://www.lammps.org/, Sandia National Laboratories
@ -19,8 +18,7 @@ using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
NStencilHalfMultiOld2dTri:: NStencilHalfMultiOld2dTri::NStencilHalfMultiOld2dTri(LAMMPS *lmp) : NStencil(lmp) {}
NStencilHalfMultiOld2dTri(LAMMPS *lmp) : NStencil(lmp) {}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
create stencil based on bin geometry and cutoff create stencil based on bin geometry and cutoff

View File

@ -1,4 +1,3 @@
// clang-format off
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories https://www.lammps.org/, Sandia National Laboratories
@ -19,8 +18,7 @@ using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
NStencilHalfMultiOld3d:: NStencilHalfMultiOld3d::NStencilHalfMultiOld3d(LAMMPS *lmp) : NStencil(lmp) {}
NStencilHalfMultiOld3d(LAMMPS *lmp) : NStencil(lmp) {}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
create stencil based on bin geometry and cutoff create stencil based on bin geometry and cutoff

View File

@ -1,4 +1,3 @@
// clang-format off
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories https://www.lammps.org/, Sandia National Laboratories
@ -19,8 +18,7 @@ using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
NStencilHalfMultiOld3dTri:: NStencilHalfMultiOld3dTri::NStencilHalfMultiOld3dTri(LAMMPS *lmp) : NStencil(lmp) {}
NStencilHalfMultiOld3dTri(LAMMPS *lmp) : NStencil(lmp) {}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
create stencil based on bin geometry and cutoff create stencil based on bin geometry and cutoff

View File

@ -1,4 +1,3 @@
// clang-format off
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories https://www.lammps.org/, Sandia National Laboratories
@ -15,14 +14,13 @@
#include "ntopo_bond_all.h" #include "ntopo_bond_all.h"
#include "atom.h" #include "atom.h"
#include "force.h"
#include "domain.h" #include "domain.h"
#include "update.h" #include "error.h"
#include "force.h"
#include "memory.h"
#include "output.h" #include "output.h"
#include "thermo.h" #include "thermo.h"
#include "memory.h" #include "update.h"
#include "error.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
@ -58,9 +56,10 @@ void NTopoBondAll::build()
if (atom1 == -1) { if (atom1 == -1) {
nmissing++; nmissing++;
if (lostbond == Thermo::ERROR) if (lostbond == Thermo::ERROR)
error->one(FLERR,"Bond atoms {} {} missing on " error->one(FLERR,
"proc {} at step {}",tag[i], "Bond atoms {} {} missing on "
bond_atom[i][m],me,update->ntimestep); "proc {} at step {}",
tag[i], bond_atom[i][m], me, update->ntimestep);
continue; continue;
} }
atom1 = domain->closest_image(i, atom1); atom1 = domain->closest_image(i, atom1);
@ -81,6 +80,5 @@ void NTopoBondAll::build()
int all; int all;
MPI_Allreduce(&nmissing, &all, 1, MPI_INT, MPI_SUM, world); MPI_Allreduce(&nmissing, &all, 1, MPI_INT, MPI_SUM, world);
if (all && (me == 0)) if (all && (me == 0)) error->warning(FLERR, "Bond atoms missing at step {}", update->ntimestep);
error->warning(FLERR,"Bond atoms missing at step {}",update->ntimestep);
} }

View File

@ -1,4 +1,3 @@
// clang-format off
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories https://www.lammps.org/, Sandia National Laboratories
@ -15,14 +14,13 @@
#include "ntopo_bond_partial.h" #include "ntopo_bond_partial.h"
#include "atom.h" #include "atom.h"
#include "force.h"
#include "domain.h" #include "domain.h"
#include "update.h" #include "error.h"
#include "force.h"
#include "memory.h"
#include "output.h" #include "output.h"
#include "thermo.h" #include "thermo.h"
#include "memory.h" #include "update.h"
#include "error.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
@ -59,9 +57,10 @@ void NTopoBondPartial::build()
if (atom1 == -1) { if (atom1 == -1) {
nmissing++; nmissing++;
if (lostbond == Thermo::ERROR) if (lostbond == Thermo::ERROR)
error->one(FLERR,"Bond atoms {} {} missing on " error->one(FLERR,
"proc {} at step {}",tag[i], "Bond atoms {} {} missing on "
bond_atom[i][m],me,update->ntimestep); "proc {} at step {}",
tag[i], bond_atom[i][m], me, update->ntimestep);
continue; continue;
} }
atom1 = domain->closest_image(i, atom1); atom1 = domain->closest_image(i, atom1);
@ -82,6 +81,5 @@ void NTopoBondPartial::build()
int all; int all;
MPI_Allreduce(&nmissing, &all, 1, MPI_INT, MPI_SUM, world); MPI_Allreduce(&nmissing, &all, 1, MPI_INT, MPI_SUM, world);
if (all && (me == 0)) if (all && (me == 0)) error->warning(FLERR, "Bond atoms missing at step {}", update->ntimestep);
error->warning(FLERR,"Bond atoms missing at step {}",update->ntimestep);
} }

View File

@ -1,4 +1,3 @@
// clang-format off
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories https://www.lammps.org/, Sandia National Laboratories
@ -64,8 +63,10 @@ void Reader::open_file(const std::string &file)
void Reader::close_file() void Reader::close_file()
{ {
if (fp == nullptr) return; if (fp == nullptr) return;
if (compressed) platform::pclose(fp); if (compressed)
else fclose(fp); platform::pclose(fp);
else
fclose(fp);
fp = nullptr; fp = nullptr;
} }
@ -75,6 +76,5 @@ void Reader::close_file()
void Reader::settings(int narg, char ** /*args*/) void Reader::settings(int narg, char ** /*args*/)
{ {
if (narg > 0) if (narg > 0) error->all(FLERR, "Illegal read_dump command");
error->all(FLERR,"Illegal read_dump command");
} }

View File

@ -1,4 +1,3 @@
// clang-format off
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories https://www.lammps.org/, Sandia National Laboratories
@ -61,11 +60,9 @@ void WriteDump::command(int narg, char **arg)
// write out one frame and then delete the dump again // write out one frame and then delete the dump again
// set multifile_override for DumpImage so that filename needs no "*" // set multifile_override for DumpImage so that filename needs no "*"
if (strcmp(arg[1],"image") == 0) if (strcmp(arg[1], "image") == 0) (dynamic_cast<DumpImage *>(dump))->multifile_override = 1;
(dynamic_cast<DumpImage *>( dump))->multifile_override = 1;
if (strcmp(arg[1],"cfg") == 0) if (strcmp(arg[1], "cfg") == 0) (dynamic_cast<DumpCFG *>(dump))->multifile_override = 1;
(dynamic_cast<DumpCFG *>( dump))->multifile_override = 1;
if ((update->first_update == 0) && (comm->me == 0)) 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.");