apply clang-format
This commit is contained in:
@ -319,8 +319,7 @@ void BondBPM::write_restart(FILE *fp)
|
||||
|
||||
void BondBPM::read_restart(FILE *fp)
|
||||
{
|
||||
if (comm->me == 0)
|
||||
utils::sfread(FLERR, &overlay_flag, sizeof(int), 1, fp, nullptr, error);
|
||||
if (comm->me == 0) utils::sfread(FLERR, &overlay_flag, sizeof(int), 1, fp, nullptr, error);
|
||||
MPI_Bcast(&overlay_flag, 1, MPI_INT, 0, world);
|
||||
}
|
||||
|
||||
|
||||
@ -43,8 +43,8 @@ class BondBPMRotational : public BondBPM {
|
||||
double *Fcr, *Fcs, *Tct, *Tcb;
|
||||
int smooth_flag;
|
||||
|
||||
double elastic_forces(int, int, int, double, double, double, double *, double *,
|
||||
double *, double *, double *, double *);
|
||||
double elastic_forces(int, int, int, double, double, double, double *, double *, double *,
|
||||
double *, double *, double *);
|
||||
void damping_forces(int, int, int, double *, double *, double *, double *, double *);
|
||||
|
||||
void allocate();
|
||||
|
||||
@ -356,8 +356,7 @@ void BondBPMSpring::write_restart_settings(FILE *fp)
|
||||
|
||||
void BondBPMSpring::read_restart_settings(FILE *fp)
|
||||
{
|
||||
if (comm->me == 0)
|
||||
utils::sfread(FLERR, &smooth_flag, sizeof(int), 1, fp, nullptr, error);
|
||||
if (comm->me == 0) utils::sfread(FLERR, &smooth_flag, sizeof(int), 1, fp, nullptr, error);
|
||||
MPI_Bcast(&smooth_flag, 1, MPI_INT, 0, world);
|
||||
}
|
||||
|
||||
|
||||
@ -37,13 +37,13 @@ using namespace MathConst;
|
||||
*/
|
||||
SlabDipole::SlabDipole(LAMMPS *lmp) : BoundaryCorrection(lmp){};
|
||||
|
||||
void SlabDipole::compute_corr(double qsum, double slab_volfactor, int eflag_atom,
|
||||
int eflag_global, double &energy, double *eatom)
|
||||
void SlabDipole::compute_corr(double qsum, double slab_volfactor, int eflag_atom, int eflag_global,
|
||||
double &energy, double *eatom)
|
||||
{
|
||||
// compute local contribution to global dipole moment
|
||||
double *q = atom->q;
|
||||
double **x = atom->x;
|
||||
double zprd_slab = domain->zprd*slab_volfactor;
|
||||
double zprd_slab = domain->zprd * slab_volfactor;
|
||||
int nlocal = atom->nlocal;
|
||||
double dipole = 0.0;
|
||||
for (int i = 0; i < nlocal; i++) dipole += q[i] * x[i][2];
|
||||
@ -65,7 +65,8 @@ void SlabDipole::compute_corr(double qsum, double slab_volfactor, int eflag_atom
|
||||
|
||||
// compute corrections
|
||||
double const e_slabcorr = MY_2PI *
|
||||
(dipole_all * dipole_all - qsum * dipole_r2 - qsum * qsum * zprd_slab * zprd_slab / 12.0) / volume;
|
||||
(dipole_all * dipole_all - qsum * dipole_r2 - qsum * qsum * zprd_slab * zprd_slab / 12.0) /
|
||||
volume;
|
||||
double const qscale = qqrd2e * scale;
|
||||
if (eflag_global) energy += qscale * e_slabcorr;
|
||||
|
||||
|
||||
@ -15,7 +15,6 @@
|
||||
Contributing author: Rodrigo Canales (RWTH Aachen University)
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
#ifdef PAIR_CLASS
|
||||
// clang-format off
|
||||
PairStyle(buck/coul/cut/intel,PairBuckCoulCutIntel);
|
||||
|
||||
@ -47,7 +47,7 @@ class FixLatte : public Fix {
|
||||
int coulomb, pbcflag, pe_peratom, virial_global, virial_peratom, neighflag;
|
||||
int exclude, excludebit;
|
||||
int eflag_caller;
|
||||
char *id_pe,*id_exclude;
|
||||
char *id_pe, *id_exclude;
|
||||
int *exclusion_group_ptr;
|
||||
int setupflag, newsystem;
|
||||
bigint natoms_last;
|
||||
|
||||
@ -172,7 +172,8 @@ void PairList::compute(int eflag, int vflag)
|
||||
const double dexp = exp(-par.param.morse.alpha * dr);
|
||||
fpair = 2.0 * par.param.morse.d0 * par.param.morse.alpha * (dexp * dexp - dexp) / r;
|
||||
|
||||
if (eflag_either) epair = par.param.morse.d0 * (dexp * dexp - 2.0 * dexp + 1.0) - par.offset;
|
||||
if (eflag_either)
|
||||
epair = par.param.morse.d0 * (dexp * dexp - 2.0 * dexp + 1.0) - par.offset;
|
||||
|
||||
} else if (par.style == LJ126) {
|
||||
|
||||
|
||||
@ -53,7 +53,6 @@ class PairList : public Pair {
|
||||
double k, b1, b2;
|
||||
};
|
||||
|
||||
|
||||
union param_u {
|
||||
harm_p harm;
|
||||
morse_p morse;
|
||||
|
||||
@ -32,8 +32,7 @@ class PairLJCutCoulCutDielectricOMP : public PairLJCutCoulCutDielectric, public
|
||||
void compute(int, int) override;
|
||||
|
||||
protected:
|
||||
template <int EVFLAG, int EFLAG>
|
||||
void eval(int ifrom, int ito, ThrData *const thr);
|
||||
template <int EVFLAG, int EFLAG> void eval(int ifrom, int ito, ThrData *const thr);
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
@ -32,8 +32,7 @@ class PairLJCutCoulDebyeDielectricOMP : public PairLJCutCoulDebyeDielectric, pub
|
||||
void compute(int, int) override;
|
||||
|
||||
protected:
|
||||
template <int EVFLAG, int EFLAG>
|
||||
void eval(int ifrom, int ito, ThrData *const thr);
|
||||
template <int EVFLAG, int EFLAG> void eval(int ifrom, int ito, ThrData *const thr);
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
@ -33,8 +33,7 @@ class PairLJCutCoulLongDielectricOMP : public PairLJCutCoulLongDielectric, publi
|
||||
void compute(int, int) override;
|
||||
|
||||
protected:
|
||||
template <int EVFLAG, int EFLAG>
|
||||
void eval(int ifrom, int ito, ThrData *const thr);
|
||||
template <int EVFLAG, int EFLAG> void eval(int ifrom, int ito, ThrData *const thr);
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
@ -255,11 +255,10 @@ void Bond::ev_tally(int i, int j, int nlocal, int newton_bond, double ebond, dou
|
||||
for virial, have delx,dely,delz and fx,fy,fz
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void Bond::ev_tally_xyz(int i, int j, int nlocal, int newton_bond,
|
||||
double ebond, double fx, double fy, double fz,
|
||||
double delx, double dely, double delz)
|
||||
void Bond::ev_tally_xyz(int i, int j, int nlocal, int newton_bond, double ebond, double fx,
|
||||
double fy, double fz, double delx, double dely, double delz)
|
||||
{
|
||||
double ebondhalf,v[6];
|
||||
double ebondhalf, v[6];
|
||||
|
||||
if (eflag_either) {
|
||||
if (eflag_global) {
|
||||
|
||||
@ -257,10 +257,9 @@ void BondHybrid::flags()
|
||||
// set comm_forward, comm_reverse, comm_reverse_off to max of any sub-style
|
||||
|
||||
for (m = 0; m < nstyles; m++) {
|
||||
if (styles[m]) comm_forward = MAX(comm_forward,styles[m]->comm_forward);
|
||||
if (styles[m]) comm_reverse = MAX(comm_reverse,styles[m]->comm_reverse);
|
||||
if (styles[m]) comm_reverse_off = MAX(comm_reverse_off,
|
||||
styles[m]->comm_reverse_off);
|
||||
if (styles[m]) comm_forward = MAX(comm_forward, styles[m]->comm_forward);
|
||||
if (styles[m]) comm_reverse = MAX(comm_reverse, styles[m]->comm_reverse);
|
||||
if (styles[m]) comm_reverse_off = MAX(comm_reverse_off, styles[m]->comm_reverse_off);
|
||||
}
|
||||
|
||||
init_svector();
|
||||
@ -276,8 +275,7 @@ void BondHybrid::init_svector()
|
||||
// allocate svector
|
||||
|
||||
single_extra = 0;
|
||||
for (int m = 0; m < nstyles; m++)
|
||||
single_extra = MAX(single_extra,styles[m]->single_extra);
|
||||
for (int m = 0; m < nstyles; m++) single_extra = MAX(single_extra, styles[m]->single_extra);
|
||||
|
||||
if (single_extra) {
|
||||
delete[] svector;
|
||||
@ -415,14 +413,12 @@ double BondHybrid::single(int type, double rsq, int i, int j, double &fforce)
|
||||
|
||||
void BondHybrid::copy_svector(int type)
|
||||
{
|
||||
memset(svector,0,single_extra*sizeof(double));
|
||||
memset(svector, 0, single_extra * sizeof(double));
|
||||
|
||||
// there is only one style in bond style hybrid for a bond type
|
||||
Bond *this_style = styles[map[type]];
|
||||
|
||||
for (int l = 0; this_style->single_extra; ++l) {
|
||||
svector[l] = this_style->svector[l];
|
||||
}
|
||||
for (int l = 0; this_style->single_extra; ++l) { svector[l] = this_style->svector[l]; }
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
||||
20
src/dump.h
20
src/dump.h
@ -45,9 +45,15 @@ class Dump : protected Pointers {
|
||||
void init();
|
||||
virtual void write();
|
||||
|
||||
virtual int pack_forward_comm(int, int *, double *, int, int *) { return 0; }
|
||||
virtual int pack_forward_comm(int, int *, double *, int, int *)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
virtual void unpack_forward_comm(int, int, double *) {}
|
||||
virtual int pack_reverse_comm(int, int, double *) { return 0; }
|
||||
virtual int pack_reverse_comm(int, int, double *)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
virtual void unpack_reverse_comm(int, int *, double *) {}
|
||||
|
||||
void modify_params(int, char **);
|
||||
@ -151,11 +157,17 @@ class Dump : protected Pointers {
|
||||
|
||||
virtual void init_style() = 0;
|
||||
virtual void openfile();
|
||||
virtual int modify_param(int, char **) { return 0; }
|
||||
virtual int modify_param(int, char **)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
virtual void write_header(bigint) = 0;
|
||||
virtual int count();
|
||||
virtual void pack(tagint *) = 0;
|
||||
virtual int convert_string(int, double *) { return 0; }
|
||||
virtual int convert_string(int, double *)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
virtual void write_data(int, double *) = 0;
|
||||
virtual void write_footer() {}
|
||||
|
||||
|
||||
@ -87,8 +87,8 @@ void FixBondHistory::post_constructor()
|
||||
|
||||
id_fix = utils::strdup(id + std::string("_FIX_PROP_ATOM"));
|
||||
id_array = utils::strdup(std::string("d2_") + id);
|
||||
modify->add_fix(fmt::format("{} {} property/atom {} {} writedata no", id_fix, group->names[igroup], id_array,
|
||||
nbond * ndata));
|
||||
modify->add_fix(fmt::format("{} {} property/atom {} {} writedata no", id_fix,
|
||||
group->names[igroup], id_array, nbond * ndata));
|
||||
int tmp1, tmp2;
|
||||
index = atom->find_custom(&id_array[3], tmp1, tmp2);
|
||||
}
|
||||
|
||||
@ -46,10 +46,10 @@ class FixPair : public Fix {
|
||||
double memory_usage() override;
|
||||
|
||||
private:
|
||||
int nevery,nfield,ncols;
|
||||
int nevery, nfield, ncols;
|
||||
bigint lasttime;
|
||||
char *pairname;
|
||||
char **fieldname,**triggername;
|
||||
char **fieldname, **triggername;
|
||||
int *trigger;
|
||||
int **triggerptr;
|
||||
|
||||
|
||||
@ -154,8 +154,8 @@ FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) :
|
||||
border = utils::logical(FLERR, arg[iarg + 1], false, lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg], "writedata") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix property/atom command");
|
||||
wd_section = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
if (iarg + 2 > narg) error->all(FLERR, "Illegal fix property/atom command");
|
||||
wd_section = utils::logical(FLERR, arg[iarg + 1], false, lmp);
|
||||
iarg += 2;
|
||||
} else
|
||||
error->all(FLERR, "Illegal fix property/atom command");
|
||||
|
||||
@ -54,7 +54,7 @@ void FixUpdateSpecialBonds::setup(int /*vflag*/)
|
||||
// error if more than one fix update/special/bonds
|
||||
|
||||
if (modify->get_fix_by_style("UPDATE_SPECIAL_BONDS").size() > 1)
|
||||
error->all(FLERR,"More than one fix update/special/bonds");
|
||||
error->all(FLERR, "More than one fix update/special/bonds");
|
||||
|
||||
// Require atoms know about all of their bonds and if they break
|
||||
if (force->newton_bond) error->all(FLERR, "Fix update/special/bonds requires Newton bond off");
|
||||
@ -131,14 +131,14 @@ void FixUpdateSpecialBonds::pre_exchange()
|
||||
// ignore n2, n3 since 1-3, 1-4 special factors required to be 1.0
|
||||
n1 = nspecial[i][0];
|
||||
if (n1 >= atom->maxspecial)
|
||||
error->one(FLERR,"Special list size exceeded in fix update/special/bond");
|
||||
error->one(FLERR, "Special list size exceeded in fix update/special/bond");
|
||||
special[i][n1] = tagj;
|
||||
nspecial[i][0] += 1;
|
||||
nspecial[i][1] = nspecial[i][2] = nspecial[i][0];
|
||||
|
||||
n1 = nspecial[j][0];
|
||||
if (n1 >= atom->maxspecial)
|
||||
error->one(FLERR,"Special list size exceeded in fix update/special/bond");
|
||||
error->one(FLERR, "Special list size exceeded in fix update/special/bond");
|
||||
special[j][n1] = tagi;
|
||||
nspecial[j][0] += 1;
|
||||
nspecial[j][1] = nspecial[j][2] = nspecial[j][0];
|
||||
|
||||
@ -47,8 +47,7 @@ FixVector::FixVector(LAMMPS *lmp, int narg, char **arg) :
|
||||
val.id = argi.get_name();
|
||||
val.val.c = nullptr;
|
||||
|
||||
if ((val.which == ArgInfo::UNKNOWN) || (val.which == ArgInfo::NONE) ||
|
||||
(argi.get_dim() > 1))
|
||||
if ((val.which == ArgInfo::UNKNOWN) || (val.which == ArgInfo::NONE) || (argi.get_dim() > 1))
|
||||
error->all(FLERR, "Invalid fix vector argument: {}", arg[iarg]);
|
||||
|
||||
values.push_back(val);
|
||||
|
||||
@ -3020,10 +3020,11 @@ Below is a brief C code demonstrating accessing this collected bond information.
|
||||
|
||||
.. code-block:: c
|
||||
|
||||
#include "library.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include "library.h"
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
|
||||
21
src/memory.h
21
src/memory.h
@ -1,3 +1,4 @@
|
||||
// clang-format off
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
@ -647,16 +648,15 @@ class Memory : protected Pointers {
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
template <typename TYPE>
|
||||
TYPE ****create4d_offset_last(TYPE ****&array, int n1lo, int n1hi,
|
||||
int n2lo, int n2hi, int n3lo, int n3hi, int n4,
|
||||
const char *name)
|
||||
TYPE ****create4d_offset_last(TYPE ****&array, int n1lo, int n1hi, int n2lo, int n2hi, int n3lo,
|
||||
int n3hi, int n4, const char *name)
|
||||
{
|
||||
if (n1lo > n1hi || n2lo > n2hi || n3lo > n3hi || n4 <= 0) return nullptr;
|
||||
|
||||
int n1 = n1hi - n1lo + 1;
|
||||
int n2 = n2hi - n2lo + 1;
|
||||
int n3 = n3hi - n3lo + 1;
|
||||
create(array,n1,n2,n3,n4,name);
|
||||
create(array, n1, n2, n3, n4, name);
|
||||
|
||||
bigint m = ((bigint) n1) * n2;
|
||||
for (bigint i = 0; i < m; i++) array[0][i] -= n3lo;
|
||||
@ -666,19 +666,20 @@ class Memory : protected Pointers {
|
||||
}
|
||||
|
||||
template <typename TYPE>
|
||||
TYPE ****create4d_offset_last(TYPE *****& /*array*/, int /*n1lo*/, int /*n1hi*/,
|
||||
int /*n2lo*/, int /*n2hi*/,
|
||||
int /*n3lo*/, int /*n3hi*/, int /*n4*/,
|
||||
TYPE ****create4d_offset_last(TYPE *****& /*array*/, int /*n1lo*/, int /*n1hi*/, int /*n2lo*/,
|
||||
int /*n2hi*/, int /*n3lo*/, int /*n3hi*/, int /*n4*/,
|
||||
const char *name)
|
||||
{fail(name); return nullptr;}
|
||||
{
|
||||
fail(name);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
free a 4d array with indices 1,2,3 offset
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
template <typename TYPE>
|
||||
void destroy4d_offset_last(TYPE ****&array,
|
||||
int n1_offset, int n2_offset, int n3_offset)
|
||||
void destroy4d_offset_last(TYPE ****&array, int n1_offset, int n2_offset, int n3_offset)
|
||||
{
|
||||
if (array == nullptr) return;
|
||||
sfree(&array[n1_offset][n2_offset][n3_offset][0]);
|
||||
|
||||
@ -806,10 +806,12 @@ Fix *Modify::add_fix(int narg, char **arg, int trysuffix)
|
||||
// since some fixes access domain settings in their constructor
|
||||
// nullptr must be last entry in this list
|
||||
|
||||
// clang-format off
|
||||
const char *exceptions[] =
|
||||
{"GPU", "OMP", "INTEL", "property/atom", "cmap", "cmap3", "rx",
|
||||
"deprecated", "STORE/KIM", "amoeba/pitorsion", "amoeba/bitorsion",
|
||||
nullptr};
|
||||
// clang-format on
|
||||
|
||||
if (domain->box_exist == 0) {
|
||||
int m;
|
||||
|
||||
Reference in New Issue
Block a user