apply clang-format

This commit is contained in:
Axel Kohlmeyer
2024-07-22 23:58:10 -04:00
parent 70ee5495a2
commit b459d0c9b9
26 changed files with 69 additions and 80 deletions

View File

@ -1687,7 +1687,7 @@ void AtomVec::data_atom(double *coord, imageint imagetmp, const std::vector<std:
ivalue += cols;
continue;
}
for (m = 0; m < cols; m++) \
for (m = 0; m < cols; m++)
array[nlocal][m] = utils::numeric(FLERR, values[ivalue++], true, lmp);
}
} else if (datatype == Atom::INT) {

View File

@ -123,8 +123,7 @@ class AtomVec : protected Pointers {
virtual void create_atom(int, double *);
virtual void create_atom_post(int) {}
virtual void data_atom(double *, imageint, const std::vector<std::string> &,
std::string &);
virtual void data_atom(double *, imageint, const std::vector<std::string> &, std::string &);
virtual void data_atom_post(int) {}
virtual void data_atom_bonus(int, const std::vector<std::string> &) {}
virtual void data_body(int, int, int, int *, double *) {}

View File

@ -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

View File

@ -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");
}
/* ---------------------------------------------------------------------- */

View File

@ -14,8 +14,8 @@
#ifndef LMP_ERROR_H
#define LMP_ERROR_H
#include "pointers.h"
#include "exceptions.h"
#include "pointers.h"
namespace LAMMPS_NS {

View File

@ -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;

View File

@ -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;
}
}

View File

@ -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

View File

@ -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);

View File

@ -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;
};

View File

@ -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

View File

@ -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<value_t> 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

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -87,9 +87,9 @@ class LAMMPS {
static const char *git_descriptor();
using argv = std::vector<std::string>;
static std::vector<char*> argv_pointers(argv & args);
static std::vector<char *> argv_pointers(argv &args);
LAMMPS(argv & args, MPI_Comm);
LAMMPS(argv &args, MPI_Comm);
LAMMPS(int, char **, MPI_Comm);
~LAMMPS() noexcept(false);
void create();

View File

@ -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

View File

@ -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<Fix *> get_fix_by_style(const std::string &) const;
const std::vector<Fix *> &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];
}

View File

@ -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::vector<Fix *>fixchecklist; // 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<Fix *> fixchecklist; // which fixes to check
double triggersq; // trigger = build when atom moves this dist

View File

@ -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;

View File

@ -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;
}

View File

@ -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!"); }

View File

@ -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;

View File

@ -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;

View File

@ -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));
}

View File

@ -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<std::string> keyword, format, format_column_user, keyword_user;
@ -237,7 +237,6 @@ class Thermo : protected Pointers {
void compute_nbuild();
void compute_ndanger();
};
} // namespace LAMMPS_NS