apply clang-format

This commit is contained in:
Axel Kohlmeyer
2022-10-14 09:22:54 -04:00
parent 9a52019b69
commit aa0bd180d1
23 changed files with 77 additions and 72 deletions

View File

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

View File

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

View File

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

View File

@ -37,8 +37,8 @@ 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;
@ -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;

View File

@ -15,7 +15,6 @@
Contributing author: Rodrigo Canales (RWTH Aachen University)
------------------------------------------------------------------------- */
#ifdef PAIR_CLASS
// clang-format off
PairStyle(buck/coul/cut/intel,PairBuckCoulCutIntel);

View File

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

View File

@ -53,7 +53,6 @@ class PairList : public Pair {
double k, b1, b2;
};
union param_u {
harm_p harm;
morse_p morse;

View File

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

View File

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

View File

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

View File

@ -255,9 +255,8 @@ 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];

View File

@ -259,8 +259,7 @@ void BondHybrid::flags()
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_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;
@ -420,9 +418,7 @@ void BondHybrid::copy_svector(int type)
// 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]; }
}
/* ----------------------------------------------------------------------

View File

@ -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() {}

View File

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

View File

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

View File

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

View File

@ -1,3 +1,4 @@
// clang-format off
/* -*- c++ -*- ----------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories
@ -647,9 +648,8 @@ 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;
@ -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]);

View File

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