refactor group access, enable and apply clang-format

This commit is contained in:
Axel Kohlmeyer
2022-04-14 22:01:48 -04:00
parent 4b400fb4a6
commit 69d9c5187e
187 changed files with 3016 additions and 2927 deletions

View File

@ -134,10 +134,10 @@ void DumpAtomADIOS::write()
// Now we know the global size and the local subset size and offset
// of the atoms table
auto nAtomsGlobal = static_cast<size_t>(ntotal);
auto startRow = static_cast<size_t>(atomOffset);
auto nAtomsLocal = static_cast<size_t>(nme);
auto nColumns = static_cast<size_t>(size_one);
auto nAtomsGlobal = static_cast<size_t>(ntotal);
auto startRow = static_cast<size_t>(atomOffset);
auto nAtomsLocal = static_cast<size_t>(nme);
auto nColumns = static_cast<size_t>(size_one);
internal->varAtoms.SetShape({nAtomsGlobal, nColumns});
internal->varAtoms.SetSelection({{startRow, 0}, {nAtomsLocal, nColumns}});
@ -238,7 +238,7 @@ void DumpAtomADIOS::init_style()
columnNames = {"id", "type", "xs", "ys", "zs", "ix", "iy", "iz"};
}
for (int icol = 0; icol < (int)columnNames.size(); ++icol)
for (int icol = 0; icol < (int) columnNames.size(); ++icol)
if (keyword_user[icol].size()) columnNames[icol] = keyword_user[icol];
// setup function ptrs
@ -296,7 +296,7 @@ void DumpAtomADIOS::init_style()
int *boundaryptr = reinterpret_cast<int *>(domain->boundary);
internal->io.DefineAttribute<int>("boundary", boundaryptr, 6);
auto nColumns = static_cast<size_t>(size_one);
auto nColumns = static_cast<size_t>(size_one);
internal->io.DefineAttribute<std::string>("columns", columnNames.data(), nColumns);
internal->io.DefineAttribute<std::string>("columnstr", columns);
internal->io.DefineAttribute<std::string>("boundarystr", boundstr);

View File

@ -146,10 +146,10 @@ void DumpCustomADIOS::write()
// Now we know the global size and the local subset size and offset
// of the atoms table
auto nAtomsGlobal = static_cast<size_t>(ntotal);
auto startRow = static_cast<size_t>(atomOffset);
auto nAtomsLocal = static_cast<size_t>(nme);
auto nColumns = static_cast<size_t>(size_one);
auto nAtomsGlobal = static_cast<size_t>(ntotal);
auto startRow = static_cast<size_t>(atomOffset);
auto nAtomsLocal = static_cast<size_t>(nme);
auto nColumns = static_cast<size_t>(size_one);
internal->varAtoms.SetShape({nAtomsGlobal, nColumns});
internal->varAtoms.SetSelection({{startRow, 0}, {nAtomsLocal, nColumns}});
@ -221,8 +221,10 @@ void DumpCustomADIOS::init_style()
int icol = 0;
for (auto item : utils::split_words(columns_default)) {
if (combined.size()) combined += " ";
if (keyword_user[icol].size()) combined += keyword_user[icol];
else combined += item;
if (keyword_user[icol].size())
combined += keyword_user[icol];
else
combined += item;
++icol;
}
columns = utils::strdup(combined);
@ -249,34 +251,30 @@ void DumpCustomADIOS::init_style()
*/
// find current ptr for each compute,fix,variable
// check that fix frequency is acceptable
int icompute;
for (int i = 0; i < ncompute; i++) {
icompute = modify->find_compute(id_compute[i]);
if (icompute < 0) error->all(FLERR, "Could not find dump custom compute ID");
compute[i] = modify->compute[icompute];
compute[i] = modify->get_compute_by_id(id_compute[i]);
if (!compute[i])
error->all(FLERR, "Could not find dump custom/adios compute ID {}", id_compute[i]);
}
int ifix;
for (int i = 0; i < nfix; i++) {
ifix = modify->find_fix(id_fix[i]);
if (ifix < 0) error->all(FLERR, "Could not find dump custom fix ID");
fix[i] = modify->fix[ifix];
if (nevery % modify->fix[ifix]->peratom_freq)
error->all(FLERR, "Dump custom and fix not computed at compatible times");
fix[i] = modify->get_fix_by_id(id_fix[i]);
if (!fix[i]) error->all(FLERR, "Could not find dump custom/adios fix ID {}", id_fix[i]);
if (nevery % fix[i]->peratom_freq)
error->all(FLERR, "dump custom/adios and fix {} with ID {} not computed at compatible times",
fix[i]->style, id_fix[i]);
}
int ivariable;
for (int i = 0; i < nvariable; i++) {
ivariable = input->variable->find(id_variable[i]);
if (ivariable < 0) error->all(FLERR, "Could not find dump custom variable name");
if (ivariable < 0) error->all(FLERR, "Could not find dump custom/adios variable name");
variable[i] = ivariable;
}
// set index and check validity of region
if (iregion >= 0) {
iregion = domain->find_region(idregion);
if (iregion == -1) error->all(FLERR, "Region ID for dump custom does not exist");
}
if (idregion && !domain->find_region(idregion))
error->all(FLERR, "Region {} for dump custom/adios does not exist", idregion);
/* Define the group of variables for the atom style here since it's a fixed
* set */
@ -316,7 +314,7 @@ void DumpCustomADIOS::init_style()
int *boundaryptr = reinterpret_cast<int *>(domain->boundary);
internal->io.DefineAttribute<int>("boundary", boundaryptr, 6);
auto nColumns = static_cast<size_t>(size_one);
auto nColumns = static_cast<size_t>(size_one);
internal->io.DefineAttribute<std::string>("columns", internal->columnNames.data(), nColumns);
internal->io.DefineAttribute<std::string>("columnstr", columns);
internal->io.DefineAttribute<std::string>("boundarystr", boundstr);

View File

@ -221,7 +221,7 @@ bigint ReaderADIOS::read_header(double box[3][3], int &boxinfo, int &triclinic,
uint64_t rem = nAtomsTotal % comm->nprocs;
nAtoms = nAtomsTotal / comm->nprocs;
atomOffset = comm->me * nAtoms;
if (comm->me < (int)rem) {
if (comm->me < (int) rem) {
++nAtoms;
atomOffset += comm->me;
} else {
@ -421,7 +421,7 @@ void ReaderADIOS::read_atoms(int n, int nfield, double **fields)
adios2::Variable<double> varAtoms = internal->io.InquireVariable<double>("atoms");
if ((uint64_t)n != nAtoms)
if ((uint64_t) n != nAtoms)
error->one(FLERR,
"ReaderADIOS::read_atoms() expects 'n={}' equal to the number of "
"atoms (={}) for process {} in ADIOS file {}.",

View File

@ -40,8 +40,8 @@ class ReaderADIOS : public Reader {
int read_time(bigint &) override;
void skip() override;
bigint read_header(double[3][3], int &, int &, int, int, int *, char **, int, int, int &,
int &, int &, int &) override;
bigint read_header(double[3][3], int &, int &, int, int, int *, char **, int, int, int &, int &,
int &, int &) override;
void read_atoms(int, int, double **) override;
void open_file(const std::string &) override;

View File

@ -317,10 +317,10 @@ void PairRESquared::coeff(int narg, char **arg)
void PairRESquared::init_style()
{
avec = dynamic_cast<AtomVecEllipsoid *>( atom->style_match("ellipsoid"));
avec = dynamic_cast<AtomVecEllipsoid *>(atom->style_match("ellipsoid"));
if (!avec) error->all(FLERR, "Pair resquared requires atom style ellipsoid");
neighbor->add_request(this,NeighConst::REQ_DEFAULT);
neighbor->add_request(this, NeighConst::REQ_DEFAULT);
// per-type shape precalculations
// require that atom shapes are identical within each type

View File

@ -30,7 +30,7 @@ namespace LAMMPS_NS {
class FixBocs : public Fix {
public:
FixBocs(class LAMMPS *, int, char **); // MRD NJD
~FixBocs() override; // MRD NJD
~FixBocs() override; // MRD NJD
int setmask() override;
void init() override;
void setup(int) override;

View File

@ -29,7 +29,8 @@ using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */
BondBPMSpring::BondBPMSpring(LAMMPS *_lmp) : BondBPM(_lmp), k(nullptr), ecrit(nullptr), gamma(nullptr)
BondBPMSpring::BondBPMSpring(LAMMPS *_lmp) :
BondBPM(_lmp), k(nullptr), ecrit(nullptr), gamma(nullptr)
{
partial_flag = 1;
smooth_flag = 1;

View File

@ -56,7 +56,7 @@ FixBrownianAsphere::FixBrownianAsphere(LAMMPS *lmp, int narg, char **arg) :
void FixBrownianAsphere::init()
{
avec = dynamic_cast<AtomVecEllipsoid *>( atom->style_match("ellipsoid"));
avec = dynamic_cast<AtomVecEllipsoid *>(atom->style_match("ellipsoid"));
if (!avec) error->all(FLERR, "Compute brownian/asphere requires atom style ellipsoid");
// check that all particles are finite-size ellipsoids

View File

@ -48,9 +48,9 @@ class FixBrownianBase : public Fix {
int noise_flag; // 0/1 for noise off/on
int gaussian_noise_flag; // 0/1 for uniform/gaussian noise
double temp; // temperature
double rot_temp; // temperature
double g1, g2; // prefactors in time stepping
double temp; // temperature
double rot_temp; // temperature
double g1, g2; // prefactors in time stepping
class RanMars *rng;
};

View File

@ -100,7 +100,7 @@ void FixPropelSelf::init()
error->all(FLERR, "Fix propel/self requires atom attribute mu with option dipole");
if (mode == QUAT) {
avec = dynamic_cast<AtomVecEllipsoid *>( atom->style_match("ellipsoid"));
avec = dynamic_cast<AtomVecEllipsoid *>(atom->style_match("ellipsoid"));
if (!avec) error->all(FLERR, "Fix propel/self requires atom style ellipsoid with option quat");
// check that all particles are finite-size ellipsoids

View File

@ -145,16 +145,16 @@ void BondOxdnaFene::ev_tally_xyz(int i, int j, int nlocal, int newton_bond, doub
------------------------------------------------------------------------- */
void BondOxdnaFene::compute(int eflag, int vflag)
{
int a,b,in,type;
double delf[3],delta[3],deltb[3]; // force, torque increment;;
double delr[3],ebond,fbond;
double rsq,Deltasq,rlogarg;
double r,rr0,rr0sq;
int a, b, in, type;
double delf[3], delta[3], deltb[3]; // force, torque increment;;
double delr[3], ebond, fbond;
double rsq, Deltasq, rlogarg;
double r, rr0, rr0sq;
// vectors COM-backbone site in lab frame
double ra_cs[3],rb_cs[3];
double ra_cs[3], rb_cs[3];
// Cartesian unit vectors in lab frame
double ax[3],ay[3],az[3];
double bx[3],by[3],bz[3];
double ax[3], ay[3], az[3];
double bx[3], by[3], bz[3];
double **x = atom->x;
double **f = atom->f;
@ -170,9 +170,9 @@ void BondOxdnaFene::compute(int eflag, int vflag)
// n(x/y/z)_xtrct = extracted local unit vectors in lab frame from oxdna_excv
int dim;
nx_xtrct = (double **) force->pair->extract("nx",dim);
ny_xtrct = (double **) force->pair->extract("ny",dim);
nz_xtrct = (double **) force->pair->extract("nz",dim);
nx_xtrct = (double **) force->pair->extract("nx", dim);
ny_xtrct = (double **) force->pair->extract("ny", dim);
nz_xtrct = (double **) force->pair->extract("nz", dim);
// loop over FENE bonds

View File

@ -39,8 +39,8 @@ class BondOxdnaFene : public Bond {
double single(int, double, int, int, double &) override;
protected:
double *k, *Delta, *r0; // FENE
double **nx_xtrct, **ny_xtrct, **nz_xtrct; // per-atom arrays for local unit vectors
double *k, *Delta, *r0; // FENE
double **nx_xtrct, **ny_xtrct, **nz_xtrct; // per-atom arrays for local unit vectors
void allocate();
void ev_tally_xyz(int, int, int, int, double, double, double, double, double, double, double);

View File

@ -55,7 +55,7 @@ class PairOxdna2Coaxstk : public Pair {
double **a_cxst6, **theta_cxst6_0, **dtheta_cxst6_ast;
double **b_cxst6, **dtheta_cxst6_c;
double **AA_cxst1, **BB_cxst1;
double **nx_xtrct, **nz_xtrct; // per-atom arrays for local unit vectors
double **nx_xtrct, **nz_xtrct; // per-atom arrays for local unit vectors
virtual void allocate();
};

View File

@ -45,7 +45,7 @@ class PairOxdna2Dh : public Pair {
protected:
double **qeff_dh_pf, **kappa_dh;
double **b_dh, **cut_dh_ast, **cutsq_dh_ast, **cut_dh_c, **cutsq_dh_c;
double **nx_xtrct, **ny_xtrct, **nz_xtrct; // per-atom arrays for local unit vectors
double **nx_xtrct, **ny_xtrct, **nz_xtrct; // per-atom arrays for local unit vectors
virtual void allocate();
};

View File

@ -57,7 +57,7 @@ class PairOxdnaCoaxstk : public Pair {
double **b_cxst6, **dtheta_cxst6_c;
double **a_cxst3p, **cosphi_cxst3p_ast, **b_cxst3p, **cosphi_cxst3p_c;
double **a_cxst4p, **cosphi_cxst4p_ast, **b_cxst4p, **cosphi_cxst4p_c;
double **nx_xtrct, **ny_xtrct, **nz_xtrct; // per-atom arrays for local unit vectors
double **nx_xtrct, **ny_xtrct, **nz_xtrct; // per-atom arrays for local unit vectors
virtual void allocate();
};

View File

@ -54,7 +54,7 @@ class PairOxdnaExcv : public Pair {
double **lj1_sb, **lj2_sb, **b_sb, **cut_sb_c, **cutsq_sb_c;
double **epsilon_bb, **sigma_bb, **cut_bb_ast, **cutsq_bb_ast;
double **lj1_bb, **lj2_bb, **b_bb, **cut_bb_c, **cutsq_bb_c;
double **nx, **ny, **nz; // per-atom arrays for local unit vectors
double **nx, **ny, **nz; // per-atom arrays for local unit vectors
virtual void allocate();
};

View File

@ -60,7 +60,7 @@ class PairOxdnaHbond : public Pair {
double **b_hb7, **dtheta_hb7_c;
double **a_hb8, **theta_hb8_0, **dtheta_hb8_ast;
double **b_hb8, **dtheta_hb8_c;
double **nx_xtrct, **ny_xtrct, **nz_xtrct; // per-atom arrays for local unit vectors
double **nx_xtrct, **ny_xtrct, **nz_xtrct; // per-atom arrays for local unit vectors
int seqdepflag;
virtual void allocate();

View File

@ -59,7 +59,7 @@ class PairOxdnaStk : public Pair {
double **b_st6, **dtheta_st6_c;
double **a_st1, **cosphi_st1_ast, **b_st1, **cosphi_st1_c;
double **a_st2, **cosphi_st2_ast, **b_st2, **cosphi_st2_c;
double **nx_xtrct, **ny_xtrct, **nz_xtrct; // per-atom arrays for local unit vectors
double **nx_xtrct, **ny_xtrct, **nz_xtrct; // per-atom arrays for local unit vectors
int seqdepflag;
virtual void allocate();

View File

@ -59,7 +59,7 @@ class PairOxdnaXstk : public Pair {
double **b_xst7, **dtheta_xst7_c;
double **a_xst8, **theta_xst8_0, **dtheta_xst8_ast;
double **b_xst8, **dtheta_xst8_c;
double **nx_xtrct, **ny_xtrct, **nz_xtrct; // per-atom arrays for local unit vectors
double **nx_xtrct, **ny_xtrct, **nz_xtrct; // per-atom arrays for local unit vectors
virtual void allocate();
};

View File

@ -60,7 +60,7 @@ class PairOxrna2Stk : public Pair {
double **b_st10, **dtheta_st10_c;
double **a_st1, **cosphi_st1_ast, **b_st1, **cosphi_st1_c;
double **a_st2, **cosphi_st2_ast, **b_st2, **cosphi_st2_c;
double **nx_xtrct, **ny_xtrct, **nz_xtrct; // per-atom arrays for local unit vectors
double **nx_xtrct, **ny_xtrct, **nz_xtrct; // per-atom arrays for local unit vectors
int seqdepflag;
virtual void allocate();

View File

@ -56,7 +56,7 @@ class PairOxrna2Xstk : public Pair {
double **b_xst7, **dtheta_xst7_c;
double **a_xst8, **theta_xst8_0, **dtheta_xst8_ast;
double **b_xst8, **dtheta_xst8_c;
double **nx_xtrct, **nz_xtrct; // per-atom arrays for local unit vectors
double **nx_xtrct, **nz_xtrct; // per-atom arrays for local unit vectors
virtual void allocate();
};

View File

@ -484,7 +484,7 @@ void PairLJClass2::init_style()
int list_style = NeighConst::REQ_DEFAULT;
if (update->whichflag == 1 && utils::strmatch(update->integrate_style, "^respa")) {
auto respa = dynamic_cast<Respa *>( update->integrate);
auto respa = dynamic_cast<Respa *>(update->integrate);
if (respa->level_inner >= 0) list_style = NeighConst::REQ_RESPA_INOUT;
if (respa->level_middle >= 0) list_style = NeighConst::REQ_RESPA_ALL;
}
@ -493,8 +493,8 @@ void PairLJClass2::init_style()
// set rRESPA cutoffs
if (utils::strmatch(update->integrate_style, "^respa") &&
(dynamic_cast<Respa *>( update->integrate))->level_inner >= 0)
cut_respa = (dynamic_cast<Respa *>( update->integrate))->cutoff;
(dynamic_cast<Respa *>(update->integrate))->level_inner >= 0)
cut_respa = (dynamic_cast<Respa *>(update->integrate))->cutoff;
else
cut_respa = nullptr;
}

View File

@ -672,7 +672,7 @@ void PairLJClass2CoulLong::init_style()
int list_style = NeighConst::REQ_DEFAULT;
if (update->whichflag == 1 && utils::strmatch(update->integrate_style, "^respa")) {
auto respa = dynamic_cast<Respa *>( update->integrate);
auto respa = dynamic_cast<Respa *>(update->integrate);
if (respa->level_inner >= 0) list_style = NeighConst::REQ_RESPA_INOUT;
if (respa->level_middle >= 0) list_style = NeighConst::REQ_RESPA_ALL;
}
@ -683,8 +683,8 @@ void PairLJClass2CoulLong::init_style()
// set rRESPA cutoffs
if (utils::strmatch(update->integrate_style, "^respa") &&
(dynamic_cast<Respa *>( update->integrate))->level_inner >= 0)
cut_respa = (dynamic_cast<Respa *>( update->integrate))->cutoff;
(dynamic_cast<Respa *>(update->integrate))->level_inner >= 0)
cut_respa = (dynamic_cast<Respa *>(update->integrate))->cutoff;
else
cut_respa = nullptr;

View File

@ -494,7 +494,7 @@ void PairBrownian::init_style()
else if (strstr(modify->fix[i]->style, "wall") != nullptr) {
if (flagwall) error->all(FLERR, "Cannot use multiple fix wall commands with pair brownian");
flagwall = 1; // Walls exist
wallfix = dynamic_cast<FixWall *>( modify->fix[i]);
wallfix = dynamic_cast<FixWall *>(modify->fix[i]);
if (wallfix->xflag) flagwall = 2; // Moving walls exist
}
}

View File

@ -101,7 +101,8 @@ class colvarproxy_lammps : public colvarproxy {
void log(std::string const &message) override;
void error(std::string const &message) override;
cvm::rvector position_distance(cvm::atom_pos const &pos1, cvm::atom_pos const &pos2) const override;
cvm::rvector position_distance(cvm::atom_pos const &pos1,
cvm::atom_pos const &pos2) const override;
int backup_file(char const *filename) override;

View File

@ -91,8 +91,10 @@ void DumpCFGGZ::write_header(bigint n)
// so molecules are not split across periodic box boundaries
double scale = 1.0;
if (atom->peri_flag) scale = atom->pdscale;
else if (unwrapflag == 1) scale = UNWRAPEXPAND;
if (atom->peri_flag)
scale = atom->pdscale;
else if (unwrapflag == 1)
scale = UNWRAPEXPAND;
std::string header = fmt::format("Number of particles = {}\n", n);
header += fmt::format("A = {:g} Angstrom (basic length-scale)\n", scale);

View File

@ -66,12 +66,12 @@ using namespace MathConst;
/* ---------------------------------------------------------------------- */
FixPolarizeBEMGMRES::FixPolarizeBEMGMRES(LAMMPS *lmp, int narg, char **arg) :
Fix(lmp, narg, arg), q_backup(nullptr), c(nullptr), g(nullptr), h(nullptr), r(nullptr), s(nullptr), v(nullptr),
y(nullptr)
Fix(lmp, narg, arg), q_backup(nullptr), c(nullptr), g(nullptr), h(nullptr), r(nullptr),
s(nullptr), v(nullptr), y(nullptr)
{
if (narg < 5) error->all(FLERR, "Illegal fix polarize/bem/gmres command");
avec = dynamic_cast<AtomVecDielectric *>( atom->style_match("dielectric"));
avec = dynamic_cast<AtomVecDielectric *>(atom->style_match("dielectric"));
if (!avec) error->all(FLERR, "Fix polarize requires atom style dielectric");
// parse required arguments
@ -248,28 +248,28 @@ void FixPolarizeBEMGMRES::setup(int /*vflag*/)
// check if the pair styles in use are compatible
if (strcmp(force->pair_style, "lj/cut/coul/long/dielectric") == 0)
efield_pair = (dynamic_cast<PairLJCutCoulLongDielectric *>( force->pair))->efield;
efield_pair = (dynamic_cast<PairLJCutCoulLongDielectric *>(force->pair))->efield;
else if (strcmp(force->pair_style, "lj/cut/coul/long/dielectric/omp") == 0)
efield_pair = (dynamic_cast<PairLJCutCoulLongDielectric *>( force->pair))->efield;
efield_pair = (dynamic_cast<PairLJCutCoulLongDielectric *>(force->pair))->efield;
else if (strcmp(force->pair_style, "lj/cut/coul/msm/dielectric") == 0)
efield_pair = (dynamic_cast<PairLJCutCoulMSMDielectric *>( force->pair))->efield;
efield_pair = (dynamic_cast<PairLJCutCoulMSMDielectric *>(force->pair))->efield;
else if (strcmp(force->pair_style, "lj/cut/coul/cut/dielectric") == 0)
efield_pair = (dynamic_cast<PairLJCutCoulCutDielectric *>( force->pair))->efield;
efield_pair = (dynamic_cast<PairLJCutCoulCutDielectric *>(force->pair))->efield;
else if (strcmp(force->pair_style, "lj/cut/coul/cut/dielectric/omp") == 0)
efield_pair = (dynamic_cast<PairLJCutCoulCutDielectric *>( force->pair))->efield;
efield_pair = (dynamic_cast<PairLJCutCoulCutDielectric *>(force->pair))->efield;
else if (strcmp(force->pair_style, "coul/long/dielectric") == 0)
efield_pair = (dynamic_cast<PairCoulLongDielectric *>( force->pair))->efield;
efield_pair = (dynamic_cast<PairCoulLongDielectric *>(force->pair))->efield;
else if (strcmp(force->pair_style, "coul/cut/dielectric") == 0)
efield_pair = (dynamic_cast<PairCoulCutDielectric *>( force->pair))->efield;
efield_pair = (dynamic_cast<PairCoulCutDielectric *>(force->pair))->efield;
else
error->all(FLERR, "Pair style not compatible with fix polarize");
if (kspaceflag) {
if (force->kspace) {
if (strcmp(force->kspace_style, "pppm/dielectric") == 0)
efield_kspace = (dynamic_cast<PPPMDielectric *>( force->kspace))->efield;
efield_kspace = (dynamic_cast<PPPMDielectric *>(force->kspace))->efield;
else if (strcmp(force->kspace_style, "msm/dielectric") == 0)
efield_kspace = (dynamic_cast<MSMDielectric *>( force->kspace))->efield;
efield_kspace = (dynamic_cast<MSMDielectric *>(force->kspace))->efield;
else
error->all(FLERR, "Kspace style not compatible with fix polarize/bem/gmres");
} else

View File

@ -58,7 +58,7 @@ FixPolarizeBEMICC::FixPolarizeBEMICC(LAMMPS *lmp, int narg, char **arg) : Fix(lm
{
if (narg < 5) error->all(FLERR, "Illegal fix polarize/bem/icc command");
avec = dynamic_cast<AtomVecDielectric *>( atom->style_match("dielectric"));
avec = dynamic_cast<AtomVecDielectric *>(atom->style_match("dielectric"));
if (!avec) error->all(FLERR, "Fix polarize requires atom style dielectric");
// parse required arguments
@ -146,19 +146,19 @@ void FixPolarizeBEMICC::setup(int /*vflag*/)
// check if the pair styles in use are compatible
if (strcmp(force->pair_style, "lj/cut/coul/long/dielectric") == 0)
efield_pair = (dynamic_cast<PairLJCutCoulLongDielectric *>( force->pair))->efield;
efield_pair = (dynamic_cast<PairLJCutCoulLongDielectric *>(force->pair))->efield;
else if (strcmp(force->pair_style, "lj/cut/coul/long/dielectric/omp") == 0)
efield_pair = (dynamic_cast<PairLJCutCoulLongDielectric *>( force->pair))->efield;
efield_pair = (dynamic_cast<PairLJCutCoulLongDielectric *>(force->pair))->efield;
else if (strcmp(force->pair_style, "lj/cut/coul/msm/dielectric") == 0)
efield_pair = (dynamic_cast<PairLJCutCoulMSMDielectric *>( force->pair))->efield;
efield_pair = (dynamic_cast<PairLJCutCoulMSMDielectric *>(force->pair))->efield;
else if (strcmp(force->pair_style, "lj/cut/coul/cut/dielectric") == 0)
efield_pair = (dynamic_cast<PairLJCutCoulCutDielectric *>( force->pair))->efield;
efield_pair = (dynamic_cast<PairLJCutCoulCutDielectric *>(force->pair))->efield;
else if (strcmp(force->pair_style, "lj/cut/coul/cut/dielectric/omp") == 0)
efield_pair = (dynamic_cast<PairLJCutCoulCutDielectric *>( force->pair))->efield;
efield_pair = (dynamic_cast<PairLJCutCoulCutDielectric *>(force->pair))->efield;
else if (strcmp(force->pair_style, "coul/long/dielectric") == 0)
efield_pair = (dynamic_cast<PairCoulLongDielectric *>( force->pair))->efield;
efield_pair = (dynamic_cast<PairCoulLongDielectric *>(force->pair))->efield;
else if (strcmp(force->pair_style, "coul/cut/dielectric") == 0)
efield_pair = (dynamic_cast<PairCoulCutDielectric *>( force->pair))->efield;
efield_pair = (dynamic_cast<PairCoulCutDielectric *>(force->pair))->efield;
else
error->all(FLERR, "Pair style not compatible with fix polarize/bem/icc");
@ -168,9 +168,9 @@ void FixPolarizeBEMICC::setup(int /*vflag*/)
kspaceflag = 1;
if (strcmp(force->kspace_style, "pppm/dielectric") == 0)
efield_kspace = (dynamic_cast<PPPMDielectric *>( force->kspace))->efield;
efield_kspace = (dynamic_cast<PPPMDielectric *>(force->kspace))->efield;
else if (strcmp(force->kspace_style, "msm/dielectric") == 0)
efield_kspace = (dynamic_cast<MSMDielectric *>( force->kspace))->efield;
efield_kspace = (dynamic_cast<MSMDielectric *>(force->kspace))->efield;
else
error->all(FLERR, "Kspace style not compatible with fix polarize/bem/icc");

View File

@ -71,7 +71,7 @@ FixPolarizeFunctional::FixPolarizeFunctional(LAMMPS *lmp, int narg, char **arg)
{
if (narg < 4) error->all(FLERR, "Illegal fix polarize/functional command");
avec = dynamic_cast<AtomVecDielectric *>( atom->style_match("dielectric"));
avec = dynamic_cast<AtomVecDielectric *>(atom->style_match("dielectric"));
if (!avec) error->all(FLERR, "Fix polarize/functional requires atom style dielectric");
nevery = utils::inumeric(FLERR, arg[3], false, lmp);
@ -290,19 +290,19 @@ void FixPolarizeFunctional::setup(int /*vflag*/)
// check if the pair styles in use are compatible
if (strcmp(force->pair_style, "lj/cut/coul/long/dielectric") == 0)
efield_pair = (dynamic_cast<PairLJCutCoulLongDielectric *>( force->pair))->efield;
efield_pair = (dynamic_cast<PairLJCutCoulLongDielectric *>(force->pair))->efield;
else if (strcmp(force->pair_style, "lj/cut/coul/long/dielectric/omp") == 0)
efield_pair = (dynamic_cast<PairLJCutCoulLongDielectric *>( force->pair))->efield;
efield_pair = (dynamic_cast<PairLJCutCoulLongDielectric *>(force->pair))->efield;
else if (strcmp(force->pair_style, "lj/cut/coul/msm/dielectric") == 0)
efield_pair = (dynamic_cast<PairLJCutCoulMSMDielectric *>( force->pair))->efield;
efield_pair = (dynamic_cast<PairLJCutCoulMSMDielectric *>(force->pair))->efield;
else if (strcmp(force->pair_style, "lj/cut/coul/cut/dielectric") == 0)
efield_pair = (dynamic_cast<PairLJCutCoulCutDielectric *>( force->pair))->efield;
efield_pair = (dynamic_cast<PairLJCutCoulCutDielectric *>(force->pair))->efield;
else if (strcmp(force->pair_style, "lj/cut/coul/cut/dielectric/omp") == 0)
efield_pair = (dynamic_cast<PairLJCutCoulCutDielectric *>( force->pair))->efield;
efield_pair = (dynamic_cast<PairLJCutCoulCutDielectric *>(force->pair))->efield;
else if (strcmp(force->pair_style, "coul/long/dielectric") == 0)
efield_pair = (dynamic_cast<PairCoulLongDielectric *>( force->pair))->efield;
efield_pair = (dynamic_cast<PairCoulLongDielectric *>(force->pair))->efield;
else if (strcmp(force->pair_style, "coul/cut/dielectric") == 0)
efield_pair = (dynamic_cast<PairCoulCutDielectric *>( force->pair))->efield;
efield_pair = (dynamic_cast<PairCoulCutDielectric *>(force->pair))->efield;
else
error->all(FLERR, "Pair style not compatible with fix polarize/functional");
@ -310,9 +310,9 @@ void FixPolarizeFunctional::setup(int /*vflag*/)
kspaceflag = 1;
if (strcmp(force->kspace_style, "pppm/dielectric") == 0)
efield_kspace = (dynamic_cast<PPPMDielectric *>( force->kspace))->efield;
efield_kspace = (dynamic_cast<PPPMDielectric *>(force->kspace))->efield;
else if (strcmp(force->kspace_style, "msm/dielectric") == 0)
efield_kspace = (dynamic_cast<MSMDielectric *>( force->kspace))->efield;
efield_kspace = (dynamic_cast<MSMDielectric *>(force->kspace))->efield;
else
error->all(FLERR, "Kspace style not compatible with fix polarize/functional");

View File

@ -162,7 +162,7 @@ void PairCoulCutDielectric::compute(int eflag, int vflag)
void PairCoulCutDielectric::init_style()
{
avec = dynamic_cast<AtomVecDielectric *>( atom->style_match("dielectric"));
avec = dynamic_cast<AtomVecDielectric *>(atom->style_match("dielectric"));
if (!avec) error->all(FLERR, "Pair coul/cut/dielectric requires atom style dielectric");
neighbor->add_request(this, NeighConst::REQ_FULL);

View File

@ -207,7 +207,7 @@ void PairCoulLongDielectric::compute(int eflag, int vflag)
void PairCoulLongDielectric::init_style()
{
avec = dynamic_cast<AtomVecDielectric *>( atom->style_match("dielectric"));
avec = dynamic_cast<AtomVecDielectric *>(atom->style_match("dielectric"));
if (!avec) error->all(FLERR, "Pair coul/long/dielectric requires atom style dielectric");
neighbor->add_request(this, NeighConst::REQ_FULL);

View File

@ -190,7 +190,7 @@ void PairLJCutCoulCutDielectric::compute(int eflag, int vflag)
void PairLJCutCoulCutDielectric::init_style()
{
avec = dynamic_cast<AtomVecDielectric *>( atom->style_match("dielectric"));
avec = dynamic_cast<AtomVecDielectric *>(atom->style_match("dielectric"));
if (!avec) error->all(FLERR, "Pair lj/cut/coul/cut/dielectric requires atom style dielectric");
neighbor->add_request(this, NeighConst::REQ_FULL);

View File

@ -194,7 +194,7 @@ void PairLJCutCoulDebyeDielectric::compute(int eflag, int vflag)
void PairLJCutCoulDebyeDielectric::init_style()
{
avec = dynamic_cast<AtomVecDielectric *>( atom->style_match("dielectric"));
avec = dynamic_cast<AtomVecDielectric *>(atom->style_match("dielectric"));
if (!avec) error->all(FLERR, "Pair lj/cut/coul/debye/dielectric requires atom style dielectric");
neighbor->add_request(this, NeighConst::REQ_FULL);

View File

@ -244,7 +244,7 @@ void PairLJCutCoulLongDielectric::compute(int eflag, int vflag)
void PairLJCutCoulLongDielectric::init_style()
{
avec = dynamic_cast<AtomVecDielectric *>( atom->style_match("dielectric"));
avec = dynamic_cast<AtomVecDielectric *>(atom->style_match("dielectric"));
if (!avec) error->all(FLERR, "Pair lj/cut/coul/long/dielectric requires atom style dielectric");
neighbor->add_request(this, NeighConst::REQ_FULL);

View File

@ -352,7 +352,7 @@ double PairLJCutCoulMSMDielectric::single(int i, int j, int itype, int jtype, do
void PairLJCutCoulMSMDielectric::init_style()
{
avec = dynamic_cast<AtomVecDielectric *>( atom->style_match("dielectric"));
avec = dynamic_cast<AtomVecDielectric *>(atom->style_match("dielectric"));
if (!avec) error->all(FLERR, "Pair lj/cut/coul/msm/dielectric requires atom style dielectric");
neighbor->add_request(this, NeighConst::REQ_FULL);

View File

@ -71,7 +71,7 @@ void PairLJLongCoulLongDielectric::init_style()
{
PairLJLongCoulLong::init_style();
avec = dynamic_cast<AtomVecDielectric *>( atom->style_match("dielectric"));
avec = dynamic_cast<AtomVecDielectric *>(atom->style_match("dielectric"));
if (!avec) error->all(FLERR, "Pair lj/long/coul/long/dielectric requires atom style dielectric");
neighbor->add_request(this, NeighConst::REQ_FULL);

View File

@ -26,7 +26,7 @@ namespace LAMMPS_NS {
class PairLJSFDipoleSF : public Pair {
public:
PairLJSFDipoleSF(class LAMMPS *_lmp) : Pair(_lmp) {};
PairLJSFDipoleSF(class LAMMPS *_lmp) : Pair(_lmp){};
~PairLJSFDipoleSF() override;
void compute(int, int) override;
void settings(int, char **) override;

View File

@ -25,7 +25,7 @@ FixStyle(drude/transform/inverse,FixDrudeTransform<true>);
namespace LAMMPS_NS {
template <bool inverse> class FixDrudeTransform: public Fix {
template <bool inverse> class FixDrudeTransform : public Fix {
public:
FixDrudeTransform(class LAMMPS *, int, char **);
~FixDrudeTransform() override;

View File

@ -30,14 +30,12 @@
using namespace LAMMPS_NS;
using namespace MathConst;
/* ---------------------------------------------------------------------- */
ComputeAveSphereAtom::ComputeAveSphereAtom(LAMMPS *lmp, int narg, char **arg) :
Compute(lmp, narg, arg),
result(nullptr)
Compute(lmp, narg, arg), result(nullptr)
{
if (narg < 3 || narg > 5) error->all(FLERR,"Illegal compute ave/sphere/atom command");
if (narg < 3 || narg > 5) error->all(FLERR, "Illegal compute ave/sphere/atom command");
// process optional args
@ -45,12 +43,13 @@ ComputeAveSphereAtom::ComputeAveSphereAtom(LAMMPS *lmp, int narg, char **arg) :
int iarg = 3;
while (iarg < narg) {
if (strcmp(arg[iarg],"cutoff") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal compute ave/sphere/atom command");
cutoff = utils::numeric(FLERR,arg[iarg+1],false,lmp);
if (cutoff <= 0.0) error->all(FLERR,"Illegal compute ave/sphere/atom command");
if (strcmp(arg[iarg], "cutoff") == 0) {
if (iarg + 2 > narg) error->all(FLERR, "Illegal compute ave/sphere/atom command");
cutoff = utils::numeric(FLERR, arg[iarg + 1], false, lmp);
if (cutoff <= 0.0) error->all(FLERR, "Illegal compute ave/sphere/atom command");
iarg += 2;
} else error->all(FLERR,"Illegal compute ave/sphere/atom command");
} else
error->all(FLERR, "Illegal compute ave/sphere/atom command");
}
peratom_flag = 1;
@ -74,32 +73,32 @@ ComputeAveSphereAtom::~ComputeAveSphereAtom()
void ComputeAveSphereAtom::init()
{
if (!force->pair && cutoff == 0.0)
error->all(FLERR,"Compute ave/sphere/atom requires a cutoff be specified "
error->all(FLERR,
"Compute ave/sphere/atom requires a cutoff be specified "
"or a pair style be defined");
double skin = neighbor->skin;
if (cutoff != 0.0) {
double cutghost; // as computed by Neighbor and Comm
double cutghost; // as computed by Neighbor and Comm
if (force->pair)
cutghost = MAX(force->pair->cutforce+skin,comm->cutghostuser);
cutghost = MAX(force->pair->cutforce + skin, comm->cutghostuser);
else
cutghost = comm->cutghostuser;
if (cutoff > cutghost)
error->all(FLERR,"Compute ave/sphere/atom cutoff exceeds ghost atom range - "
error->all(FLERR,
"Compute ave/sphere/atom cutoff exceeds ghost atom range - "
"use comm_modify cutoff command");
}
int cutflag = 1;
if (force->pair) {
if (cutoff == 0.0) {
cutoff = force->pair->cutforce;
}
if (cutoff <= force->pair->cutforce+skin) cutflag = 0;
if (cutoff == 0.0) { cutoff = force->pair->cutforce; }
if (cutoff <= force->pair->cutforce + skin) cutflag = 0;
}
cutsq = cutoff*cutoff;
sphere_vol = 4.0/3.0*MY_PI*cutsq*cutoff;
cutsq = cutoff * cutoff;
sphere_vol = 4.0 / 3.0 * MY_PI * cutsq * cutoff;
// need an occasional full neighbor list
@ -118,11 +117,11 @@ void ComputeAveSphereAtom::init_list(int /*id*/, NeighList *ptr)
void ComputeAveSphereAtom::compute_peratom()
{
int i,j,ii,jj,inum,jnum;
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
int *ilist,*jlist,*numneigh,**firstneigh;
int i, j, ii, jj, inum, jnum;
double xtmp, ytmp, ztmp, delx, dely, delz, rsq;
int *ilist, *jlist, *numneigh, **firstneigh;
int count;
double vsum[3],vavg[3],vnet[3];
double vsum[3], vavg[3], vnet[3];
invoked_peratom = update->ntimestep;
@ -131,7 +130,7 @@ void ComputeAveSphereAtom::compute_peratom()
if (atom->nmax > nmax) {
memory->destroy(result);
nmax = atom->nmax;
memory->create(result,nmax,2,"ave/sphere/atom:result");
memory->create(result, nmax, 2, "ave/sphere/atom:result");
array_atom = result;
}
@ -179,7 +178,7 @@ void ComputeAveSphereAtom::compute_peratom()
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 < cutsq) {
count++;
vsum[0] += v[j][0];
@ -188,9 +187,9 @@ void ComputeAveSphereAtom::compute_peratom()
}
}
vavg[0] = vsum[0]/count;
vavg[1] = vsum[1]/count;
vavg[2] = vsum[2]/count;
vavg[0] = vsum[0] / count;
vavg[1] = vsum[1] / count;
vavg[2] = vsum[2] / count;
// i atom contribution
@ -198,7 +197,7 @@ void ComputeAveSphereAtom::compute_peratom()
vnet[0] = v[i][0] - vavg[0];
vnet[1] = v[i][1] - vavg[1];
vnet[2] = v[i][2] - vavg[2];
double ke_sum = vnet[0]*vnet[0] + vnet[1]*vnet[1] + vnet[2]*vnet[2];
double ke_sum = vnet[0] * vnet[0] + vnet[1] * vnet[1] + vnet[2] * vnet[2];
for (jj = 0; jj < jnum; jj++) {
j = jlist[jj];
@ -207,17 +206,17 @@ void ComputeAveSphereAtom::compute_peratom()
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 < cutsq) {
count++;
vnet[0] = v[j][0] - vavg[0];
vnet[1] = v[j][1] - vavg[1];
vnet[2] = v[j][2] - vavg[2];
ke_sum += vnet[0]*vnet[0] + vnet[1]*vnet[1] + vnet[2]*vnet[2];
ke_sum += vnet[0] * vnet[0] + vnet[1] * vnet[1] + vnet[2] * vnet[2];
}
}
double density = count/sphere_vol;
double temp = ke_sum/3.0/count;
double density = count / sphere_vol;
double temp = ke_sum / 3.0 / count;
result[i][0] = density;
result[i][1] = temp;
}
@ -226,12 +225,12 @@ void ComputeAveSphereAtom::compute_peratom()
/* ---------------------------------------------------------------------- */
int ComputeAveSphereAtom::pack_forward_comm(int n, int *list, double *buf,
int /*pbc_flag*/, int * /*pbc*/)
int ComputeAveSphereAtom::pack_forward_comm(int n, int *list, double *buf, int /*pbc_flag*/,
int * /*pbc*/)
{
double **v = atom->v;
int i,m=0;
int i, m = 0;
for (i = 0; i < n; ++i) {
buf[m++] = v[list[i]][0];
buf[m++] = v[list[i]][1];
@ -247,7 +246,7 @@ void ComputeAveSphereAtom::unpack_forward_comm(int n, int first, double *buf)
{
double **v = atom->v;
int i,last,m=0;
int i, last, m = 0;
last = first + n;
for (i = first; i < last; ++i) {
v[i][0] = buf[m++];
@ -262,6 +261,6 @@ void ComputeAveSphereAtom::unpack_forward_comm(int n, int first, double *buf)
double ComputeAveSphereAtom::memory_usage()
{
double bytes = (double)2*nmax * sizeof(double);
double bytes = (double) 2 * nmax * sizeof(double);
return bytes;
}

View File

@ -12,9 +12,9 @@
------------------------------------------------------------------------- */
#ifdef COMPUTE_CLASS
ComputeStyle(ave/sphere/atom,ComputeAveSphereAtom)
// clang-format off
ComputeStyle(ave/sphere/atom,ComputeAveSphereAtom);
// clang-format on
#else
#ifndef LMP_COMPUTE_AVE_SPHERE_ATOM_H
@ -37,18 +37,18 @@ class ComputeAveSphereAtom : public Compute {
protected:
int nmax;
double cutoff,cutsq,sphere_vol;
double cutoff, cutsq, sphere_vol;
class NeighList *list;
double **result;
};
}
} // namespace LAMMPS_NS
#endif
#endif
/* ERROR/WARNING messages:
/* ERROR/WARNING messages:
E: Illegal ... command

View File

@ -452,7 +452,8 @@ void ComputeStressCartesian::compute_pressure_1d(double fpair, double xi, double
}
void ComputeStressCartesian::compute_pressure_2d(double fpair, double xi, double yi, double /*xj*/,
double /*yj*/, double delx, double dely, double delz)
double /*yj*/, double delx, double dely,
double delz)
{
int bin1, bin2, next_bin1, next_bin2;
double la = 0.0, lb = 0.0, l_sum = 0.0;

View File

@ -28,7 +28,7 @@ class DumpYAML : public DumpCustom {
public:
DumpYAML(class LAMMPS *, int, char **);
protected:
protected:
bool thermo;
void init_style() override;

View File

@ -59,8 +59,8 @@ extern "C" {
typedef int bool_t;
#if defined(_WIN32) || defined(__APPLE__) || defined(__FreeBSD__) || \
defined(__DragonFly__) || defined(__OpenBSD__) || defined(__NetBSD__)
#if defined(_WIN32) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__DragonFly__) || \
defined(__OpenBSD__) || defined(__NetBSD__)
typedef char *caddr_t;
typedef unsigned int u_int;
#endif

View File

@ -41,7 +41,8 @@ using namespace FixConst;
/* ---------------------------------------------------------------------- */
FixNumDiff::FixNumDiff(LAMMPS *lmp, int narg, char **arg) :
Fix(lmp, narg, arg), id_pe(nullptr), pe(nullptr), numdiff_forces(nullptr), temp_x(nullptr), temp_f(nullptr)
Fix(lmp, narg, arg), id_pe(nullptr), pe(nullptr), numdiff_forces(nullptr), temp_x(nullptr),
temp_f(nullptr)
{
if (narg < 5) error->all(FLERR, "Illegal fix numdiff command");
@ -122,7 +123,7 @@ void FixNumDiff::init()
kspace_compute_flag = 0;
if (utils::strmatch(update->integrate_style, "^respa")) {
ilevel_respa = (dynamic_cast<Respa *>( update->integrate))->nlevels - 1;
ilevel_respa = (dynamic_cast<Respa *>(update->integrate))->nlevels - 1;
if (respa_level >= 0) ilevel_respa = MIN(respa_level, ilevel_respa);
}
}
@ -134,9 +135,9 @@ void FixNumDiff::setup(int vflag)
if (utils::strmatch(update->integrate_style, "^verlet"))
post_force(vflag);
else {
(dynamic_cast<Respa *>( update->integrate))->copy_flevel_f(ilevel_respa);
(dynamic_cast<Respa *>(update->integrate))->copy_flevel_f(ilevel_respa);
post_force_respa(vflag, ilevel_respa, 0);
(dynamic_cast<Respa *>( update->integrate))->copy_f_flevel(ilevel_respa);
(dynamic_cast<Respa *>(update->integrate))->copy_f_flevel(ilevel_respa);
}
}

View File

@ -132,7 +132,7 @@ void FixNumDiffVirial::init()
kspace_compute_flag = 0;
if (utils::strmatch(update->integrate_style, "^respa")) {
ilevel_respa = (dynamic_cast<Respa *>( update->integrate))->nlevels - 1;
ilevel_respa = (dynamic_cast<Respa *>(update->integrate))->nlevels - 1;
if (respa_level >= 0) ilevel_respa = MIN(respa_level, ilevel_respa);
}
}
@ -144,9 +144,9 @@ void FixNumDiffVirial::setup(int vflag)
if (utils::strmatch(update->integrate_style, "^verlet"))
post_force(vflag);
else {
(dynamic_cast<Respa *>( update->integrate))->copy_flevel_f(ilevel_respa);
(dynamic_cast<Respa *>(update->integrate))->copy_flevel_f(ilevel_respa);
post_force_respa(vflag, ilevel_respa, 0);
(dynamic_cast<Respa *>( update->integrate))->copy_f_flevel(ilevel_respa);
(dynamic_cast<Respa *>(update->integrate))->copy_f_flevel(ilevel_respa);
}
}

View File

@ -297,7 +297,7 @@ void FixTTMGrid::read_electron_temperatures(const std::string &filename)
try {
ValueTokenizer values(utils::trim_comment(line));
if (values.count() == 0) {
; // ignore comment only lines
; // ignore comment only lines
} else if (values.count() == 4) {
++nread;
@ -306,18 +306,18 @@ void FixTTMGrid::read_electron_temperatures(const std::string &filename)
int iz = values.next_int();
if (ix < 0 || ix >= nxgrid || iy < 0 || iy >= nygrid || iz < 0 || iz >= nzgrid)
throw TokenizerException("Fix ttm/grid invalid grid index in input","");
throw TokenizerException("Fix ttm/grid invalid grid index in input", "");
if (ix >= nxlo_in && ix <= nxhi_in && iy >= nylo_in && iy <= nyhi_in
&& iz >= nzlo_in && iz <= nzhi_in) {
if (ix >= nxlo_in && ix <= nxhi_in && iy >= nylo_in && iy <= nyhi_in && iz >= nzlo_in &&
iz <= nzhi_in) {
T_electron[iz][iy][ix] = values.next_double();
T_initial_set[iz][iy][ix] = 1;
}
} else {
throw TokenizerException("Incorrect format in fix ttm electron grid file","");
throw TokenizerException("Incorrect format in fix ttm electron grid file", "");
}
} catch (std::exception &e) {
error->one(FLERR,e.what());
error->one(FLERR, e.what());
}
}
}
@ -356,9 +356,11 @@ void FixTTMGrid::write_electron_temperatures(const std::string &filename)
FPout = fopen(filename.c_str(), "w");
if (!FPout) error->one(FLERR, "Fix ttm/grid could not open output file");
fmt::print(FPout,"# DATE: {} UNITS: {} COMMENT: Electron temperature "
"{}x{}x{} grid at step {}. Created by fix {}\n", utils::current_date(),
update->unit_style, nxgrid, nygrid, nzgrid, update->ntimestep, style);
fmt::print(FPout,
"# DATE: {} UNITS: {} COMMENT: Electron temperature "
"{}x{}x{} grid at step {}. Created by fix {}\n",
utils::current_date(), update->unit_style, nxgrid, nygrid, nzgrid, update->ntimestep,
style);
}
gc->gather(GridComm::FIX, this, 1, sizeof(double), 1, nullptr, MPI_DOUBLE);

View File

@ -48,16 +48,16 @@ class FixTTMGrid : public FixTTM {
double memory_usage() override;
private:
int ngridmine,ngridout;
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;
double delxinv,delyinv,delzinv;
int ngridmine, ngridout;
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;
double delxinv, delyinv, delzinv;
double skin_original;
FILE *FPout;
class GridComm *gc;
int ngc_buf1,ngc_buf2;
double *gc_buf1,*gc_buf2;
int ngc_buf1, ngc_buf2;
double *gc_buf1, *gc_buf2;
void allocate_grid() override;
void deallocate_grid() override;

View File

@ -114,7 +114,7 @@ void FixViscousSphere::init()
int max_respa = 0;
if (utils::strmatch(update->integrate_style, "^respa")) {
ilevel_respa = max_respa = (dynamic_cast<Respa *>( update->integrate))->nlevels - 1;
ilevel_respa = max_respa = (dynamic_cast<Respa *>(update->integrate))->nlevels - 1;
if (respa_level >= 0) ilevel_respa = MIN(respa_level, max_respa);
}
@ -135,9 +135,9 @@ void FixViscousSphere::setup(int vflag)
if (utils::strmatch(update->integrate_style, "^verlet"))
post_force(vflag);
else {
(dynamic_cast<Respa *>( update->integrate))->copy_flevel_f(ilevel_respa);
(dynamic_cast<Respa *>(update->integrate))->copy_flevel_f(ilevel_respa);
post_force_respa(vflag, ilevel_respa, 0);
(dynamic_cast<Respa *>( update->integrate))->copy_f_flevel(ilevel_respa);
(dynamic_cast<Respa *>(update->integrate))->copy_f_flevel(ilevel_respa);
}
}

View File

@ -89,7 +89,7 @@ void BondFENENM::compute(int eflag, int vflag)
fbond = -k[type] / rlogarg;
// force from n-m term
if (rsq < sigma[type]*sigma[type]) {
if (rsq < sigma[type] * sigma[type]) {
r = sqrt(rsq);
fbond += epsilon[type] * (nn[type] * mm[type] / (nn[type] - mm[type])) *
(pow(sigma[type] / r, nn[type]) - pow(sigma[type] / r, mm[type])) / rsq;
@ -99,7 +99,7 @@ void BondFENENM::compute(int eflag, int vflag)
if (eflag) {
ebond = -0.5 * k[type] * r0sq * log(rlogarg);
if (rsq < sigma[type]*sigma[type])
if (rsq < sigma[type] * sigma[type])
ebond += (epsilon[type] / (nn[type] - mm[type])) *
(mm[type] * pow(sigma[type] / r, nn[type]) - nn[type] * pow(sigma[type] / r, mm[type]));
}
@ -257,7 +257,7 @@ double BondFENENM::single(int type, double rsq, int /*i*/, int /*j*/, double &ff
double eng = -0.5 * k[type] * r0sq * log(rlogarg);
fforce = -k[type] / rlogarg;
if (rsq < sigma[type]*sigma[type]) {
if (rsq < sigma[type] * sigma[type]) {
r = sqrt(rsq);
fforce += epsilon[type] * (nn[type] * mm[type] / (nn[type] - mm[type])) *
(pow(sigma[type] / r, nn[type]) - pow(sigma[type] / r, mm[type])) / rsq;

View File

@ -99,7 +99,7 @@ void PairE3B::compute(int eflag, int vflag)
ev_init(eflag, vflag);
//clear sumExp array
memset(sumExp, 0, sizeof(double)*maxID);
memset(sumExp, 0, sizeof(double) * maxID);
evdwl = 0.0;
pvector[0] = pvector[1] = pvector[2] = pvector[3] = 0.0;

View File

@ -49,8 +49,8 @@ class PairE3B : public Pair {
int pairmax, pairPerAtom; // size of pair list
int **pairO, ***pairH; // pair lists
double ***exps, ****del3, ***fpair3, *sumExp;
int maxID; //size of global sumExp array
int natoms; //to make sure number of atoms is constant
int maxID; //size of global sumExp array
int natoms; //to make sure number of atoms is constant
virtual void allocate();
void allocateE3B();

View File

@ -38,7 +38,8 @@ class PairLJSmoothLinear : public Pair {
void write_restart_settings(FILE *) override;
void read_restart_settings(FILE *) override;
double single(int, int, int, int, double, double, double, double &) override;
double single_hessian(int, int, int, int, double, double[3], double, double, double &, double[6]) override;
double single_hessian(int, int, int, int, double, double[3], double, double, double &,
double[6]) override;
protected:
double cut_global;

View File

@ -213,7 +213,7 @@ void ComputeFEP::init()
if ((strcmp(force->pair_style, "hybrid") == 0 ||
strcmp(force->pair_style, "hybrid/overlay") == 0)) {
auto pair = dynamic_cast<PairHybrid *>( force->pair);
auto pair = dynamic_cast<PairHybrid *>(force->pair);
for (i = pert->ilo; i <= pert->ihi; i++)
for (j = MAX(pert->jlo, i); j <= pert->jhi; j++)
if (!pair->check_ijtype(i, j, pert->pstyle))

View File

@ -30,7 +30,7 @@ namespace LAMMPS_NS {
class ComputeFEPTA : public Compute {
public:
ComputeFEPTA(class LAMMPS *, int, char **); // compute ID groupID fep/ta temp xy/xz/yz scale_factor
ComputeFEPTA(class LAMMPS *, int, char **);
~ComputeFEPTA() override;
void init() override;
void compute_vector() override;

View File

@ -78,10 +78,12 @@ inline void check_flag(int error_flag, LAMMPS_NS::Error *error, MPI_Comm &world)
else if (all_success == -13)
error->all(FLERR, "Invalid device configuration.");
else if (all_success == -15)
error->all(FLERR, "PPPM was compiled for double precision floating point "
error->all(FLERR,
"PPPM was compiled for double precision floating point "
"but GPU device supports single precision only.");
else if (all_success == -16)
error->all(FLERR, "GPU library was compiled for double or mixed precision "
error->all(FLERR,
"GPU library was compiled for double or mixed precision "
"floating point but GPU device supports single precision only.");
else
error->all(FLERR, "Unknown error in GPU library");

View File

@ -145,7 +145,7 @@ void PairGayBerneGPU::compute(int eflag, int vflag)
void PairGayBerneGPU::init_style()
{
avec = dynamic_cast<AtomVecEllipsoid *>( atom->style_match("ellipsoid"));
avec = dynamic_cast<AtomVecEllipsoid *>(atom->style_match("ellipsoid"));
if (!avec) error->all(FLERR, "Pair gayberne/gpu requires atom style ellipsoid");
if (!atom->ellipsoid_flag) error->all(FLERR, "Pair gayberne/gpu requires atom style ellipsoid");

View File

@ -59,7 +59,7 @@ enum { SPHERE_SPHERE, SPHERE_ELLIPSE, ELLIPSE_SPHERE, ELLIPSE_ELLIPSE };
PairRESquaredGPU::PairRESquaredGPU(LAMMPS *lmp) : PairRESquared(lmp), gpu_mode(GPU_FORCE)
{
reinitflag = 0;
avec = dynamic_cast<AtomVecEllipsoid *>( atom->style_match("ellipsoid"));
avec = dynamic_cast<AtomVecEllipsoid *>(atom->style_match("ellipsoid"));
if (!avec) error->all(FLERR, "Pair resquared/gpu requires atom style ellipsoid");
quat_nmax = 0;
quat = nullptr;

View File

@ -115,7 +115,7 @@ void FixDampingCundall::init()
int max_respa = 0;
if (utils::strmatch(update->integrate_style, "^respa")) {
ilevel_respa = max_respa = (dynamic_cast<Respa *>( update->integrate))->nlevels - 1;
ilevel_respa = max_respa = (dynamic_cast<Respa *>(update->integrate))->nlevels - 1;
if (respa_level >= 0) ilevel_respa = MIN(respa_level, max_respa);
}
@ -143,9 +143,9 @@ void FixDampingCundall::setup(int vflag)
if (utils::strmatch(update->integrate_style, "^verlet"))
post_force(vflag);
else {
(dynamic_cast<Respa *>( update->integrate))->copy_flevel_f(ilevel_respa);
(dynamic_cast<Respa *>(update->integrate))->copy_flevel_f(ilevel_respa);
post_force_respa(vflag, ilevel_respa, 0);
(dynamic_cast<Respa *>( update->integrate))->copy_f_flevel(ilevel_respa);
(dynamic_cast<Respa *>(update->integrate))->copy_f_flevel(ilevel_respa);
}
}

View File

@ -67,8 +67,8 @@ PairGranHookeHistory::PairGranHookeHistory(LAMMPS *lmp) : Pair(lmp)
// this is so final order of Modify:fix will conform to input script
fix_history = nullptr;
fix_dummy = dynamic_cast<FixDummy *>( modify->add_fix("NEIGH_HISTORY_HH_DUMMY" + std::to_string(instance_me) +
" all DUMMY"));
fix_dummy = dynamic_cast<FixDummy *>(
modify->add_fix("NEIGH_HISTORY_HH_DUMMY" + std::to_string(instance_me) + " all DUMMY"));
}
/* ---------------------------------------------------------------------- */
@ -443,8 +443,10 @@ void PairGranHookeHistory::init_style()
// need a granular neighbor list
if (history) neighbor->add_request(this, NeighConst::REQ_SIZE|NeighConst::REQ_HISTORY);
else neighbor->add_request(this, NeighConst::REQ_SIZE);
if (history)
neighbor->add_request(this, NeighConst::REQ_SIZE | NeighConst::REQ_HISTORY);
else
neighbor->add_request(this, NeighConst::REQ_SIZE);
dt = update->dt;
@ -454,8 +456,8 @@ void PairGranHookeHistory::init_style()
if (history && (fix_history == nullptr)) {
auto cmd = fmt::format("NEIGH_HISTORY_HH{} all NEIGH_HISTORY {}", instance_me, size_history);
fix_history = dynamic_cast<FixNeighHistory *>( modify->replace_fix(
"NEIGH_HISTORY_HH_DUMMY" + std::to_string(instance_me), cmd, 1));
fix_history = dynamic_cast<FixNeighHistory *>(
modify->replace_fix("NEIGH_HISTORY_HH_DUMMY" + std::to_string(instance_me), cmd, 1));
fix_history->pair = this;
}
@ -476,7 +478,8 @@ void PairGranHookeHistory::init_style()
if (ifix->rigid_flag) {
if (fix_rigid)
error->all(FLERR, "Only one fix rigid command at a time allowed");
else fix_rigid = ifix;
else
fix_rigid = ifix;
}
}
@ -521,8 +524,9 @@ void PairGranHookeHistory::init_style()
// set fix which stores history info
if (history) {
fix_history = dynamic_cast<FixNeighHistory *>( modify->get_fix_by_id("NEIGH_HISTORY_HH" + std::to_string(instance_me)));
if (!fix_history) error->all(FLERR,"Could not find pair fix neigh history ID");
fix_history = dynamic_cast<FixNeighHistory *>(
modify->get_fix_by_id("NEIGH_HISTORY_HH" + std::to_string(instance_me)));
if (!fix_history) error->all(FLERR, "Could not find pair fix neigh history ID");
}
}

View File

@ -141,7 +141,8 @@ void PairKolmogorovCrespiFull::settings(int narg, char **arg)
{
if (narg < 1 || narg > 2) error->all(FLERR, "Illegal pair_style command");
if (!utils::strmatch(force->pair_style, "^hybrid/overlay"))
error->all(FLERR, "Pair style kolmogorov/crespi/full must be used as sub-style with hybrid/overlay");
error->all(FLERR,
"Pair style kolmogorov/crespi/full must be used as sub-style with hybrid/overlay");
cut_global = utils::numeric(FLERR, arg[0], false, lmp);
if (narg == 2) tap_flag = utils::numeric(FLERR, arg[1], false, lmp);

View File

@ -251,9 +251,10 @@ void KimInit::determine_model_type_and_units(char *model_name, char *user_units,
return;
} else if (unit_conversion_mode) {
KIM_Model_Destroy(&pkim);
const char * unit_systems[] = {"metal", "real", "si", "cgs", "electron"};
const char *unit_systems[] = {"metal", "real", "si", "cgs", "electron"};
for (auto units : unit_systems) {
get_kim_unit_names(units, lengthUnit, energyUnit, chargeUnit, temperatureUnit, timeUnit, error);
get_kim_unit_names(units, lengthUnit, energyUnit, chargeUnit, temperatureUnit, timeUnit,
error);
kim_error = KIM_Model_Create(KIM_NUMBERING_zeroBased, lengthUnit, energyUnit, chargeUnit,
temperatureUnit, timeUnit, model_name, &units_accepted, &pkim);
if (units_accepted) {
@ -316,7 +317,7 @@ void KimInit::do_init(char *model_name, char *user_units, char *model_units, KIM
modify->add_fix("KIM_MODEL_STORE all STORE/KIM");
ifix = modify->find_fix("KIM_MODEL_STORE");
auto fix_store = dynamic_cast<FixStoreKIM *>( modify->fix[ifix]);
auto fix_store = dynamic_cast<FixStoreKIM *>(modify->fix[ifix]);
fix_store->setptr("model_name", (void *) model_name);
fix_store->setptr("user_units", (void *) user_units);
fix_store->setptr("model_units", (void *) model_units);

View File

@ -82,7 +82,7 @@ class KimInit : protected Pointers {
void do_init(char *, char *, char *, KIM_Model *&);
void do_variables(const std::string &, const std::string &);
void print_dirs(struct KIM_Collections * const collections) const;
void print_dirs(struct KIM_Collections *const collections) const;
};
} // namespace LAMMPS_NS

View File

@ -87,9 +87,7 @@ void FixSetForceKokkos<DeviceType>::post_force(int /*vflag*/)
// update region if necessary
region = nullptr;
if (iregion >= 0) {
region = domain->regions[iregion];
if (region) {
region->prematch();
DAT::tdual_int_1d k_match = DAT::tdual_int_1d("setforce:k_match",nlocal);
KokkosBase* regionKKBase = dynamic_cast<KokkosBase*>(region);

View File

@ -81,8 +81,6 @@ class FixSetForceKokkos : public FixSetForce {
typename AT::t_x_array_randomread x;
typename AT::t_f_array f;
typename AT::t_int_1d_randomread mask;
class Region* region;
};
}

View File

@ -14,7 +14,7 @@
#ifndef LMP_FFT3D_WRAP_H
#define LMP_FFT3D_WRAP_H
#include "fft3d.h" // IWYU pragma: export
#include "fft3d.h" // IWYU pragma: export
#include "pointers.h"
namespace LAMMPS_NS {

View File

@ -31,8 +31,8 @@ class PPPMDispTIP4P : public PPPMDisp {
void init() override;
protected:
void particle_map_c(double, double, double, double, int **, int, int, int, int, int, int,
int, int) override;
void particle_map_c(double, double, double, double, int **, int, int, int, int, int, int, int,
int) override;
void make_rho_c() override;
void fieldforce_c_ik() override;
void fieldforce_c_ad() override;

View File

@ -2387,8 +2387,8 @@ void FixLbFluid::dump(const bigint step)
" </DataItem>\n"
" </Attribute>\n\n",
dm_lb / (dx_lb * dx_lb * dx_lb), fluid_global_n0[2], fluid_global_n0[1],
fluid_global_n0[0], sizeof(double), offset, fluid_global_n0[2],
fluid_global_n0[1], fluid_global_n0[0], dump_file_name_raw.c_str());
fluid_global_n0[0], sizeof(double), offset, fluid_global_n0[2], fluid_global_n0[1],
fluid_global_n0[0], dump_file_name_raw.c_str());
fmt::print(dump_file_handle_xdmf,
" <Attribute Name=\"velocity\" AttributeType=\"Vector\">\n"
" <DataItem ItemType=\"Function\" Function=\"$0 * {:f}\" "

View File

@ -111,7 +111,7 @@ class FixLbFluid : public Fix {
int step;
int n_stencil; // Number of points for spread/interpolate stencil
int n_stencil; // Number of points for spread/interpolate stencil
double bodyforcex, bodyforcey, bodyforcez; // Body Forces acting on the fluid (default=0)
double vwtp, vwbt; // Velocities of the z walls in the y

View File

@ -37,6 +37,7 @@ namespace user_manifold {
int nparams() override { return NPARAMS; }
void post_param_init() override;
private:
void init_domains();

View File

@ -369,7 +369,7 @@ void PairEDIP::compute(int eflag, int vflag)
directorCos_ik_z = invR_ik * dr_ik[2];
cosTeta = directorCos_ij_x * directorCos_ik_x + directorCos_ij_y * directorCos_ik_y +
directorCos_ij_z * directorCos_ik_z;
directorCos_ij_z * directorCos_ik_z;
cosTetaDiff = cosTeta + tauFunction;
cosTetaDiffCosTetaDiff = cosTetaDiff * cosTetaDiff;
@ -377,33 +377,33 @@ void PairEDIP::compute(int eflag, int vflag)
expMinusQFunctionCosTetaDiffCosTetaDiff = exp(-qFunctionCosTetaDiffCosTetaDiff);
potentia3B_factor = lambda *
((1.0 - expMinusQFunctionCosTetaDiffCosTetaDiff) +
eta * qFunctionCosTetaDiffCosTetaDiff);
((1.0 - expMinusQFunctionCosTetaDiffCosTetaDiff) +
eta * qFunctionCosTetaDiffCosTetaDiff);
exp3B_ik = preExp3B_ij[neighbor_k];
exp3BDerived_ik = preExp3BDerived_ij[neighbor_k];
forceMod3B_factor1_ij = -exp3BDerived_ij * exp3B_ik * potentia3B_factor;
forceMod3B_factor2 = 2.0 * lambda * exp3B_ij * exp3B_ik * qFunction * cosTetaDiff *
(eta + expMinusQFunctionCosTetaDiffCosTetaDiff);
(eta + expMinusQFunctionCosTetaDiffCosTetaDiff);
forceMod3B_factor2_ij = forceMod3B_factor2 * invR_ij;
f_ij[0] = forceMod3B_factor1_ij * directorCos_ij_x +
forceMod3B_factor2_ij * (cosTeta * directorCos_ij_x - directorCos_ik_x);
forceMod3B_factor2_ij * (cosTeta * directorCos_ij_x - directorCos_ik_x);
f_ij[1] = forceMod3B_factor1_ij * directorCos_ij_y +
forceMod3B_factor2_ij * (cosTeta * directorCos_ij_y - directorCos_ik_y);
forceMod3B_factor2_ij * (cosTeta * directorCos_ij_y - directorCos_ik_y);
f_ij[2] = forceMod3B_factor1_ij * directorCos_ij_z +
forceMod3B_factor2_ij * (cosTeta * directorCos_ij_z - directorCos_ik_z);
forceMod3B_factor2_ij * (cosTeta * directorCos_ij_z - directorCos_ik_z);
forceMod3B_factor1_ik = -exp3BDerived_ik * exp3B_ij * potentia3B_factor;
forceMod3B_factor2_ik = forceMod3B_factor2 * invR_ik;
f_ik[0] = forceMod3B_factor1_ik * directorCos_ik_x +
forceMod3B_factor2_ik * (cosTeta * directorCos_ik_x - directorCos_ij_x);
forceMod3B_factor2_ik * (cosTeta * directorCos_ik_x - directorCos_ij_x);
f_ik[1] = forceMod3B_factor1_ik * directorCos_ik_y +
forceMod3B_factor2_ik * (cosTeta * directorCos_ik_y - directorCos_ij_y);
forceMod3B_factor2_ik * (cosTeta * directorCos_ik_y - directorCos_ij_y);
f_ik[2] = forceMod3B_factor1_ik * directorCos_ik_z +
forceMod3B_factor2_ik * (cosTeta * directorCos_ik_z - directorCos_ij_z);
forceMod3B_factor2_ik * (cosTeta * directorCos_ik_z - directorCos_ij_z);
forceModCoord += (forceMod3B_factor2 * (tauFunctionDerived - 0.5 * mu * cosTetaDiff));
@ -800,13 +800,12 @@ void PairEDIP::read_file(char *file)
if (nparams == maxparam) {
maxparam += DELTA;
params = (Param *) memory->srealloc(params,maxparam*sizeof(Param),
"pair:params");
params = (Param *) memory->srealloc(params, maxparam * sizeof(Param), "pair:params");
// make certain all addional allocated storage is initialized
// to avoid false positives when checking with valgrind
memset(params + nparams, 0, DELTA*sizeof(Param));
memset(params + nparams, 0, DELTA * sizeof(Param));
}
params[nparams].ielement = ielement;
@ -847,9 +846,9 @@ void PairEDIP::read_file(char *file)
MPI_Bcast(&maxparam, 1, MPI_INT, 0, world);
if (comm->me != 0)
params = (Param *) memory->srealloc(params,maxparam*sizeof(Param), "pair:params");
params = (Param *) memory->srealloc(params, maxparam * sizeof(Param), "pair:params");
MPI_Bcast(params, maxparam*sizeof(Param), MPI_BYTE, 0, world);
MPI_Bcast(params, maxparam * sizeof(Param), MPI_BYTE, 0, world);
}
/* ---------------------------------------------------------------------- */

View File

@ -50,7 +50,7 @@ class PairEDIP : public Pair {
double mu, Q0; // coefficients for function Q(Z)
double u1, u2, u3, u4; // coefficients for function tau(Z)
double cutsq;
int ielement, jelement, kelement, dummy; // dummy added for better alignment
int ielement, jelement, kelement, dummy; // dummy added for better alignment
};
double *preInvR_ij;

View File

@ -50,7 +50,7 @@ class PairEDIPMulti : public Pair {
double mu, Q0; // coefficients for function Q(Z)
double u1, u2, u3, u4; // coefficients for function tau(Z)
double cutsq;
int ielement, jelement, kelement, dummy; // dummy added for better alignment
int ielement, jelement, kelement, dummy; // dummy added for better alignment
};
double *preForceCoord;

View File

@ -58,8 +58,8 @@ class PairSW : public Pair {
void read_file(char *);
virtual void setup_params();
void twobody(Param *, double, double &, int, double &);
virtual void threebody(Param *, Param *, Param *, double, double, double *, double *, double *, double *,
int, double &);
virtual void threebody(Param *, Param *, Param *, double, double, double *, double *, double *,
double *, int, double &);
};
} // namespace LAMMPS_NS

View File

@ -40,8 +40,8 @@ class FixAtomSwap : public Fix {
private:
int nevery, seed;
int ke_flag; // yes = conserve ke, no = do not conserve ke
int semi_grand_flag; // yes = semi-grand canonical, no = constant composition
int ke_flag; // yes = conserve ke, no = do not conserve ke
int semi_grand_flag; // yes = semi-grand canonical, no = constant composition
int ncycles;
int niswap, njswap; // # of i,j swap atoms on all procs
int niswap_local, njswap_local; // # of swap atoms on this proc

View File

@ -42,21 +42,21 @@ class FixMolSwap : public Fix {
int itype, jtype;
double temperature;
int ke_flag; // 1 if kinetic energy is also swapped
double i2j_vscale; // scale factors for velocity to keep KE constant
int ke_flag; // 1 if kinetic energy is also swapped
double i2j_vscale; // scale factors for velocity to keep KE constant
double j2i_vscale;
int qflag; // 1 if charge is also swapped
double iq,jq; // charge values for all itype,jtype atoms
int qflag; // 1 if charge is also swapped
double iq, jq; // charge values for all itype,jtype atoms
bool unequal_cutoffs; // 1 if itype and jtype have any different cutoffs
tagint minmol,maxmol; // range of mol IDs selected for swaps
bool unequal_cutoffs; // 1 if itype and jtype have any different cutoffs
tagint minmol, maxmol; // range of mol IDs selected for swaps
double nswap_attempt; // cummulative stats on MC attempts and accepts
double nswap_attempt; // cummulative stats on MC attempts and accepts
double nswap_accept;
double beta; // 1/kT
double energy_stored; // energy of current state as swaps are accepted
double beta; // 1/kT
double energy_stored; // energy of current state as swaps are accepted
class RanPark *random;
class Compute *c_pe;

View File

@ -890,8 +890,8 @@ void PairMesoCNT::read_file(const char *file)
MPI_Bcast(uinf_data, uinf_points, MPI_DOUBLE, 0, world);
MPI_Bcast(gamma_data, gamma_points, MPI_DOUBLE, 0, world);
MPI_Bcast(&phi_data[0][0], phi_points*phi_points, MPI_DOUBLE, 0, world);
MPI_Bcast(&usemi_data[0][0], usemi_points*usemi_points, MPI_DOUBLE, 0, world);
MPI_Bcast(&phi_data[0][0], phi_points * phi_points, MPI_DOUBLE, 0, world);
MPI_Bcast(&usemi_data[0][0], usemi_points * usemi_points, MPI_DOUBLE, 0, world);
}
/* ----------------------------------------------------------------------

View File

@ -64,8 +64,7 @@ class PairMesoCNT : public Pair {
void sort(int *, int);
void read_file(const char *);
void read_data(PotentialFileReader &, double *, double &, double &, int);
void read_data(PotentialFileReader &, double **, double &, double &, double &, double &,
int);
void read_data(PotentialFileReader &, double **, double &, double &, double &, double &, int);
void spline_coeff(double *, double **, double, int);
void spline_coeff(double **, double ****, double, double, int);

View File

@ -57,18 +57,18 @@ class PairList : public Pair {
};
struct list_param {
int style; // potential style indicator
tagint id1, id2; // global atom ids
double cutsq; // cutoff**2 for this pair
double offset; // energy offset
union param_u param; // parameters for style
int style; // potential style indicator
tagint id1, id2; // global atom ids
double cutsq; // cutoff**2 for this pair
double offset; // energy offset
union param_u param; // parameters for style
};
protected:
double cut_global; // global cutoff distance
list_param *params; // lisf of pair interaction parameters
int npairs; // # of atom pairs in global list
int check_flag; // 1 if checking for missing pairs
double cut_global; // global cutoff distance
list_param *params; // lisf of pair interaction parameters
int npairs; // # of atom pairs in global list
int check_flag; // 1 if checking for missing pairs
};
} // namespace LAMMPS_NS

View File

@ -416,7 +416,7 @@ void MLIAPDescriptorSNAP::read_paramfile(char *paramfilename)
if ((keywd == "elems") || (keywd == "radelems") || (keywd == "welems") ||
(keywd == "rinnerelems") || (keywd == "drinnerelems")) {
if ((nelementsflag == 0) || ((int)words.count() != nelements + 1))
if ((nelementsflag == 0) || ((int) words.count() != nelements + 1))
error->all(FLERR, "Incorrect SNAP parameter file");
if (comm->me == 0) utils::logmesg(lmp, "SNAP keyword {} \n", utils::trim(line));

View File

@ -42,8 +42,8 @@ class MLIAPDescriptorSNAP : public MLIAPDescriptor {
int switchinnerflag;
double rfac0, rmin0;
double* rinnerelem;
double* drinnerelem;
double *rinnerelem;
double *drinnerelem;
};
} // namespace LAMMPS_NS

View File

@ -125,7 +125,7 @@ void MLIAPDescriptorSO3::read_paramfile(char *paramfilename)
// check for keywords with one value per element
if ((skeywd == "elems") || (skeywd == "radelems") || (skeywd == "welems")) {
if ((skeywd == "elems") || (skeywd == "radelems") || (skeywd == "welems")) {
if (nelementsflag == 0 || nwords != nelements + 1)
error->all(FLERR, "Incorrect SO3 parameter file");
@ -137,7 +137,7 @@ void MLIAPDescriptorSO3::read_paramfile(char *paramfilename)
}
elementsflag = 1;
} else if (skeywd == "radelems") {
} else if (skeywd == "radelems") {
for (int ielem = 0; ielem < nelements; ielem++) {
radelem[ielem] = utils::numeric(FLERR, skeyval, false, lmp);
if (ielem < nelements - 1) skeyval = p.next();

View File

@ -62,7 +62,9 @@ MLIAPModelPython::MLIAPModelPython(LAMMPS *lmp, char *coefffilename) :
// if LAMMPS_POTENTIALS environment variable is set, add it to PYTHONPATH as well
const char *potentials_path = getenv("LAMMPS_POTENTIALS");
if (potentials_path != nullptr) { PyList_Append(py_path, PY_STRING_FROM_STRING(potentials_path)); }
if (potentials_path != nullptr) {
PyList_Append(py_path, PY_STRING_FROM_STRING(potentials_path));
}
PyGILState_Release(gstate);
if (coefffilename) read_coeffs(coefffilename);

View File

@ -221,7 +221,7 @@ void PairPACE::compute(int eflag, int vflag)
// tally energy contribution
if (eflag) {
// evdwl = energy of atom I
evdwl = scale[itype][itype]*aceimpl->ace->e_atom;
evdwl = scale[itype][itype] * aceimpl->ace->e_atom;
ev_tally_full(i, 2.0 * evdwl, 0.0, 0.0, 0.0, 0.0, 0.0);
}
}

View File

@ -46,7 +46,8 @@ namespace RANN {
void allocate() override;
void compute_fingerprint(double *, double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *, double *,
bool *, int, int, double *, double *, double *, int *, int, int *) override;
bool *, int, int, double *, double *, double *, int *, int,
int *) override;
void do3bodyfeatureset_doubleneighborloop(double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *,
double *, double *, double *, double *, bool *, int,

View File

@ -43,9 +43,9 @@ namespace RANN {
void write_values(FILE *) override;
void init(int *, int) override;
void allocate() override;
void compute_fingerprint(double *, double *, double *, double *, double *, double *,
double *, int, int, double *, double *, double *, int *, int,
int *) override; //spin
void compute_fingerprint(double *, double *, double *, double *, double *, double *, double *,
int, int, double *, double *, double *, int *, int,
int *) override; //spin
void do3bodyfeatureset_doubleneighborloop(double *, double *, double *, double *, double *,
double *, double *, int, int, double *, double *,
double *, int *, int, int *);

View File

@ -43,10 +43,10 @@ namespace RANN {
void write_values(FILE *) override;
void init(int *, int) override;
void allocate() override;
void compute_fingerprint(double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *,
double *, double *, bool *, int, int, double *, double *,
double *, int *, int, int *) override; //spin,screen
void compute_fingerprint(double *, double *, double *, double *, double *, double *, double *,
double *, double *, double *, double *, double *, double *, double *,
bool *, int, int, double *, double *, double *, int *, int,
int *) override; //spin,screen
int get_length() override;
double *radialtable;

View File

@ -692,7 +692,7 @@ void PairSNAP::read_files(char *coefffilename, char *paramfilename)
if (keywd == "rinner" || keywd == "drinner") {
if (words.size() != nelements+1)
if ((int)words.size() != nelements+1)
error->all(FLERR,"Incorrect SNAP parameter file");
if (comm->me == 0)

View File

@ -62,7 +62,7 @@ class PairSNAP : public Pair {
int switchinnerflag; // inner cutoff switch
double *rinnerelem; // element inner cutoff
double *drinnerelem; // element inner cutoff range
int chunksize,parallel_thresh;
int chunksize, parallel_thresh;
double rfac0, rmin0, wj1, wj2;
int rcutfacflag, twojmaxflag; // flags for required parameters
int beta_max; // length of beta

View File

@ -71,21 +71,21 @@ class SNA : protected Pointers {
// short neighbor list data
void grow_rij(int);
int nmax; // allocated size of short lists
int nmax; // allocated size of short lists
double **rij; // short rij list
int *inside; // short neighbor list
double *wj; // short weight list
double *rcutij; // short cutoff list
double **rij; // short rij list
int *inside; // short neighbor list
double *wj; // short weight list
double *rcutij; // short cutoff list
// only allocated for switch_inner_flag=1
double *rinnerij; // short inner cutoff list
double *drinnerij;// short inner range list
double *rinnerij; // short inner cutoff list
double *drinnerij; // short inner range list
// only allocated for chem_flag=1
int *element; // short element list [0,nelements)
int *element; // short element list [0,nelements)
private:
double rmin0, rfac0;
@ -100,7 +100,7 @@ class SNA : protected Pointers {
int ***idxcg_block;
double *ulisttot_r, *ulisttot_i;
double **ulist_r_ij, **ulist_i_ij; // short u list
double **ulist_r_ij, **ulist_i_ij; // short u list
int *idxu_block;
double *zlist_r, *zlist_i;
@ -124,8 +124,7 @@ class SNA : protected Pointers {
void compute_uarray(double, double, double, double, double, int);
double deltacg(int, int, int);
void compute_ncoeff();
void compute_duarray(double, double, double, double, double, double,
double, double, int);
void compute_duarray(double, double, double, double, double, double, double, double, int);
// Sets the style for the switching function
// 0 = none

View File

@ -350,7 +350,7 @@ void DihedralCharmm::coeff(int narg, char **arg)
void DihedralCharmm::init_style()
{
if (utils::strmatch(update->integrate_style, "^respa")) {
auto r = dynamic_cast<Respa *>( update->integrate);
auto r = dynamic_cast<Respa *>(update->integrate);
if (r->level_pair >= 0 && (r->level_pair != r->level_dihedral))
error->all(FLERR, "Dihedral style charmm must be set to same r-RESPA level as 'pair'");
if (r->level_outer >= 0 && (r->level_outer != r->level_dihedral))

View File

@ -369,7 +369,7 @@ void DihedralCharmmfsw::coeff(int narg, char **arg)
void DihedralCharmmfsw::init_style()
{
if (utils::strmatch(update->integrate_style, "^respa")) {
auto r = dynamic_cast<Respa *>( update->integrate);
auto r = dynamic_cast<Respa *>(update->integrate);
if (r->level_pair >= 0 && (r->level_pair != r->level_dihedral))
error->all(FLERR, "Dihedral style charmmfsw must be set to same r-RESPA level as 'pair'");
if (r->level_outer >= 0 && (r->level_outer != r->level_dihedral))

View File

@ -35,8 +35,8 @@ class ReaderMolfile : public Reader {
int read_time(bigint &) override;
void skip() override;
bigint read_header(double[3][3], int &, int &, int, int, int *, char **, int, int, int &,
int &, int &, int &) override;
bigint read_header(double[3][3], int &, int &, int, int, int *, char **, int, int, int &, int &,
int &, int &) override;
void read_atoms(int, int, double **) override;
void open_file(const std::string &) override;

View File

@ -38,11 +38,10 @@ using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */
DumpAtomMPIIO::DumpAtomMPIIO(LAMMPS *lmp, int narg, char **arg)
: DumpAtom(lmp, narg, arg)
DumpAtomMPIIO::DumpAtomMPIIO(LAMMPS *lmp, int narg, char **arg) : DumpAtom(lmp, narg, arg)
{
if (me == 0)
error->warning(FLERR,"MPI-IO output is unmaintained and unreliable. Use with caution.");
error->warning(FLERR, "MPI-IO output is unmaintained and unreliable. Use with caution.");
}
/* ---------------------------------------------------------------------- */
@ -86,8 +85,8 @@ void DumpAtomMPIIO::openfile()
}
if (append_flag) { // append open
int err = MPI_File_open(world, filecurrent, MPI_MODE_CREATE | MPI_MODE_APPEND |
MPI_MODE_WRONLY, MPI_INFO_NULL, &mpifh);
int err = MPI_File_open(world, filecurrent, MPI_MODE_CREATE | MPI_MODE_APPEND | MPI_MODE_WRONLY,
MPI_INFO_NULL, &mpifh);
if (err != MPI_SUCCESS)
error->one(FLERR, "Cannot open dump file {}: {}", filecurrent, utils::getsyserror());
@ -100,8 +99,8 @@ void DumpAtomMPIIO::openfile()
} else { // replace open
int err = MPI_File_open(world, filecurrent, MPI_MODE_CREATE | MPI_MODE_WRONLY,
MPI_INFO_NULL, &mpifh);
int err =
MPI_File_open(world, filecurrent, MPI_MODE_CREATE | MPI_MODE_WRONLY, MPI_INFO_NULL, &mpifh);
if (err != MPI_SUCCESS)
error->one(FLERR, "Cannot open dump file {}: {}", filecurrent, utils::getsyserror());
@ -214,8 +213,10 @@ void DumpAtomMPIIO::init_style()
if (format_line_user) {
format = utils::strdup(std::string(format_line_user) + "\n");
} else {
if (image_flag == 0) format = utils::strdup(TAGINT_FORMAT " %d %g %g %g\n");
else format = utils::strdup(TAGINT_FORMAT " %d %g %g %g %d %d %d\n");
if (image_flag == 0)
format = utils::strdup(TAGINT_FORMAT " %d %g %g %g\n");
else
format = utils::strdup(TAGINT_FORMAT " %d %g %g %g %d %d %d\n");
}
// setup boundary string
@ -239,8 +240,10 @@ void DumpAtomMPIIO::init_style()
columns.clear();
for (auto item : utils::split_words(default_columns)) {
if (columns.size()) columns += " ";
if (keyword_user[icol].size()) columns += keyword_user[icol];
else columns += item;
if (keyword_user[icol].size())
columns += keyword_user[icol];
else
columns += item;
++icol;
}

View File

@ -41,11 +41,10 @@ using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */
DumpCustomMPIIO::DumpCustomMPIIO(LAMMPS *lmp, int narg, char **arg)
: DumpCustom(lmp, narg, arg)
DumpCustomMPIIO::DumpCustomMPIIO(LAMMPS *lmp, int narg, char **arg) : DumpCustom(lmp, narg, arg)
{
if (me == 0)
error->warning(FLERR,"MPI-IO output is unmaintained and unreliable. Use with caution.");
error->warning(FLERR, "MPI-IO output is unmaintained and unreliable. Use with caution.");
}
/* ---------------------------------------------------------------------- */
@ -59,7 +58,7 @@ DumpCustomMPIIO::~DumpCustomMPIIO()
void DumpCustomMPIIO::openfile()
{
if (singlefile_opened) { // single file already opened, so just return after resetting filesize
if (singlefile_opened) { // single file already opened, so just return after resetting filesize
mpifo = currentFileSize;
MPI_File_set_size(mpifh, mpifo + headerSize + sumFileSize);
currentFileSize = mpifo + headerSize + sumFileSize;
@ -212,8 +211,10 @@ void DumpCustomMPIIO::init_style()
int icol = 0;
for (auto item : utils::split_words(columns_default)) {
if (combined.size()) combined += " ";
if (keyword_user[icol].size()) combined += keyword_user[icol];
else combined += item;
if (keyword_user[icol].size())
combined += keyword_user[icol];
else
combined += item;
++icol;
}
columns = utils::strdup(combined);
@ -221,8 +222,10 @@ void DumpCustomMPIIO::init_style()
// format = copy of default or user-specified line format
delete[] format;
if (format_line_user) format = utils::strdup(format_line_user);
else format = utils::strdup(format_default);
if (format_line_user)
format = utils::strdup(format_line_user);
else
format = utils::strdup(format_default);
// tokenize the format string and add space at end of each format element
// if user-specified int/float format exists, use it instead
@ -230,10 +233,9 @@ void DumpCustomMPIIO::init_style()
// lo priority = line, medium priority = int/float, hi priority = column
auto words = utils::split_words(format);
if ((int) words.size() < nfield)
error->all(FLERR,"Dump_modify format line is too short");
if ((int) words.size() < nfield) error->all(FLERR, "Dump_modify format line is too short");
int i=0;
int i = 0;
for (const auto &word : words) {
delete[] vformat[i];
@ -245,10 +247,11 @@ void DumpCustomMPIIO::init_style()
vformat[i] = utils::strdup(std::string(format_float_user) + " ");
else if (vtype[i] == Dump::BIGINT && format_bigint_user)
vformat[i] = utils::strdup(std::string(format_bigint_user) + " ");
else vformat[i] = utils::strdup(word + " ");
else
vformat[i] = utils::strdup(word + " ");
// remove trailing blank on last column's format
if (i == nfield-1) vformat[i][strlen(vformat[i])-1] = '\0';
if (i == nfield - 1) vformat[i][strlen(vformat[i]) - 1] = '\0';
++i;
}
@ -278,29 +281,28 @@ void DumpCustomMPIIO::init_style()
for (i = 0; i < ncompute; i++) {
compute[i] = modify->get_compute_by_id(id_compute[i]);
if (!compute[i]) error->all(FLERR,"Could not find dump custom compute ID {}",id_compute[i]);
if (!compute[i])
error->all(FLERR, "Could not find dump custom/mpiio compute ID {}", id_compute[i]);
}
for (i = 0; i < nfix; i++) {
fix[i] = modify->get_fix_by_id(id_fix[i]);
if (!fix[i]) error->all(FLERR,"Could not find dump custom fix ID {}", id_fix[i]);
if (!fix[i]) error->all(FLERR, "Could not find dump custom/mpiio fix ID {}", id_fix[i]);
if (nevery % fix[i]->peratom_freq)
error->all(FLERR,"Dump custom and fix not computed at compatible times");
error->all(FLERR, "dump custom/mpiio and fix not computed at compatible times");
}
for (i = 0; i < nvariable; i++) {
int ivariable = input->variable->find(id_variable[i]);
if (ivariable < 0)
error->all(FLERR,"Could not find dump custom variable name {}", id_variable[i]);
error->all(FLERR, "Could not find dump custom/mpiio variable name {}", id_variable[i]);
variable[i] = ivariable;
}
// set index and check validity of region
if (iregion >= 0) {
iregion = domain->find_region(idregion);
if (iregion == -1) error->all(FLERR, "Region ID for dump custom does not exist");
}
if (idregion && !domain->get_region_by_id(idregion))
error->all(FLERR, "Region {} for dump custom/mpiio does not exist", idregion);
}
/* ---------------------------------------------------------------------- */

View File

@ -47,7 +47,7 @@ void DomainOMP::pbc()
// verify owned atoms have valid numerical coords
// may not if computed pairwise force between 2 atoms at same location
const double *_noalias const coord = atom->x[0]; // NOLINT
const double *_noalias const coord = atom->x[0]; // NOLINT
const int n3 = 3 * nlocal;
int flag = 0;
#if defined(_OPENMP) // clang-format off

View File

@ -49,13 +49,13 @@ void FixQEQCombOMP::init()
if (nullptr != force->pair_match("comb3", 0))
error->all(FLERR, "No support for comb3 currently available in OPENMP");
comb = dynamic_cast<PairComb *>( force->pair_match("comb/omp", 1));
if (comb == nullptr) comb = dynamic_cast<PairComb *>( force->pair_match("comb", 1));
comb = dynamic_cast<PairComb *>(force->pair_match("comb/omp", 1));
if (comb == nullptr) comb = dynamic_cast<PairComb *>(force->pair_match("comb", 1));
if (comb == nullptr)
error->all(FLERR, "Must use pair_style comb or comb/omp with fix qeq/comb/omp");
if (utils::strmatch(update->integrate_style, "^respa")) {
ilevel_respa = (dynamic_cast<Respa *>( update->integrate))->nlevels - 1;
ilevel_respa = (dynamic_cast<Respa *>(update->integrate))->nlevels - 1;
if (respa_level >= 0) ilevel_respa = MIN(respa_level, ilevel_respa);
}

View File

@ -22,7 +22,7 @@ PairStyle(reax/c/omp,PairReaxFFOMP);
#define LMP_PAIR_REAXFF_OMP_H
#include "pair_reaxff.h"
#include "thr_omp.h" // IWYU pragma: export
#include "thr_omp.h" // IWYU pragma: export
namespace LAMMPS_NS {

View File

@ -37,8 +37,8 @@ class PPPMDispOMP : public PPPMDisp, public ThrOMP {
virtual void compute_gf();
virtual void compute_gf_6();
void particle_map(double, double, double, double, int **, int, int, int, int, int, int,
int, int) override;
void particle_map(double, double, double, double, int **, int, int, int, int, int, int, int,
int) override;
void fieldforce_c_ik() override;
void fieldforce_c_ad() override;

View File

@ -38,10 +38,10 @@ class PPPMDispTIP4POMP : public PPPMDispTIP4P, public ThrOMP {
void compute(int, int) override;
void particle_map(double, double, double, double, int **, int, int, int, int, int, int,
int, int) override;
void particle_map_c(double, double, double, double, int **, int, int, int, int, int, int,
int, int) override;
void particle_map(double, double, double, double, int **, int, int, int, int, int, int, int,
int) override;
void particle_map_c(double, double, double, double, int **, int, int, int, int, int, int, int,
int) override;
void make_rho_c() override; // XXX: not (yet) multi-threaded
void make_rho_g() override;
void make_rho_a() override;

View File

@ -70,7 +70,8 @@ class FixOrientBCC : public Fix {
bool use_xismooth;
static constexpr int half_bcc_nn = 4;
double Rxi[half_bcc_nn][3] = {}, Rchi[half_bcc_nn][3] = {}, half_xi_chi_vec[2][half_bcc_nn][3] = {};
double Rxi[half_bcc_nn][3] = {}, Rchi[half_bcc_nn][3] = {},
half_xi_chi_vec[2][half_bcc_nn][3] = {};
double xiid, xi0, xi1, xicutoffsq, cutsq, added_energy;
int nmax; // expose 2 per-atom quantities

Some files were not shown because too many files have changed in this diff Show More