apply clang-format
This commit is contained in:
@ -319,8 +319,7 @@ void BondBPM::write_restart(FILE *fp)
|
|||||||
|
|
||||||
void BondBPM::read_restart(FILE *fp)
|
void BondBPM::read_restart(FILE *fp)
|
||||||
{
|
{
|
||||||
if (comm->me == 0)
|
if (comm->me == 0) utils::sfread(FLERR, &overlay_flag, sizeof(int), 1, fp, nullptr, error);
|
||||||
utils::sfread(FLERR, &overlay_flag, sizeof(int), 1, fp, nullptr, error);
|
|
||||||
MPI_Bcast(&overlay_flag, 1, MPI_INT, 0, world);
|
MPI_Bcast(&overlay_flag, 1, MPI_INT, 0, world);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -43,8 +43,8 @@ class BondBPMRotational : public BondBPM {
|
|||||||
double *Fcr, *Fcs, *Tct, *Tcb;
|
double *Fcr, *Fcs, *Tct, *Tcb;
|
||||||
int smooth_flag;
|
int smooth_flag;
|
||||||
|
|
||||||
double elastic_forces(int, int, int, double, double, double, double *, double *,
|
double elastic_forces(int, int, int, double, double, double, double *, double *, double *,
|
||||||
double *, double *, double *, double *);
|
double *, double *, double *);
|
||||||
void damping_forces(int, int, int, double *, double *, double *, double *, double *);
|
void damping_forces(int, int, int, double *, double *, double *, double *, double *);
|
||||||
|
|
||||||
void allocate();
|
void allocate();
|
||||||
|
|||||||
@ -356,8 +356,7 @@ void BondBPMSpring::write_restart_settings(FILE *fp)
|
|||||||
|
|
||||||
void BondBPMSpring::read_restart_settings(FILE *fp)
|
void BondBPMSpring::read_restart_settings(FILE *fp)
|
||||||
{
|
{
|
||||||
if (comm->me == 0)
|
if (comm->me == 0) utils::sfread(FLERR, &smooth_flag, sizeof(int), 1, fp, nullptr, error);
|
||||||
utils::sfread(FLERR, &smooth_flag, sizeof(int), 1, fp, nullptr, error);
|
|
||||||
MPI_Bcast(&smooth_flag, 1, MPI_INT, 0, world);
|
MPI_Bcast(&smooth_flag, 1, MPI_INT, 0, world);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -37,8 +37,8 @@ using namespace MathConst;
|
|||||||
*/
|
*/
|
||||||
SlabDipole::SlabDipole(LAMMPS *lmp) : BoundaryCorrection(lmp){};
|
SlabDipole::SlabDipole(LAMMPS *lmp) : BoundaryCorrection(lmp){};
|
||||||
|
|
||||||
void SlabDipole::compute_corr(double qsum, double slab_volfactor, int eflag_atom,
|
void SlabDipole::compute_corr(double qsum, double slab_volfactor, int eflag_atom, int eflag_global,
|
||||||
int eflag_global, double &energy, double *eatom)
|
double &energy, double *eatom)
|
||||||
{
|
{
|
||||||
// compute local contribution to global dipole moment
|
// compute local contribution to global dipole moment
|
||||||
double *q = atom->q;
|
double *q = atom->q;
|
||||||
@ -65,7 +65,8 @@ void SlabDipole::compute_corr(double qsum, double slab_volfactor, int eflag_atom
|
|||||||
|
|
||||||
// compute corrections
|
// compute corrections
|
||||||
double const e_slabcorr = MY_2PI *
|
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;
|
double const qscale = qqrd2e * scale;
|
||||||
if (eflag_global) energy += qscale * e_slabcorr;
|
if (eflag_global) energy += qscale * e_slabcorr;
|
||||||
|
|
||||||
|
|||||||
@ -15,7 +15,6 @@
|
|||||||
Contributing author: Rodrigo Canales (RWTH Aachen University)
|
Contributing author: Rodrigo Canales (RWTH Aachen University)
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
#ifdef PAIR_CLASS
|
#ifdef PAIR_CLASS
|
||||||
// clang-format off
|
// clang-format off
|
||||||
PairStyle(buck/coul/cut/intel,PairBuckCoulCutIntel);
|
PairStyle(buck/coul/cut/intel,PairBuckCoulCutIntel);
|
||||||
|
|||||||
@ -172,7 +172,8 @@ void PairList::compute(int eflag, int vflag)
|
|||||||
const double dexp = exp(-par.param.morse.alpha * dr);
|
const double dexp = exp(-par.param.morse.alpha * dr);
|
||||||
fpair = 2.0 * par.param.morse.d0 * par.param.morse.alpha * (dexp * dexp - dexp) / r;
|
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) {
|
} else if (par.style == LJ126) {
|
||||||
|
|
||||||
|
|||||||
@ -53,7 +53,6 @@ class PairList : public Pair {
|
|||||||
double k, b1, b2;
|
double k, b1, b2;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
union param_u {
|
union param_u {
|
||||||
harm_p harm;
|
harm_p harm;
|
||||||
morse_p morse;
|
morse_p morse;
|
||||||
|
|||||||
@ -32,8 +32,7 @@ class PairLJCutCoulCutDielectricOMP : public PairLJCutCoulCutDielectric, public
|
|||||||
void compute(int, int) override;
|
void compute(int, int) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
template <int EVFLAG, int EFLAG>
|
template <int EVFLAG, int EFLAG> void eval(int ifrom, int ito, ThrData *const thr);
|
||||||
void eval(int ifrom, int ito, ThrData *const thr);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace LAMMPS_NS
|
} // namespace LAMMPS_NS
|
||||||
|
|||||||
@ -32,8 +32,7 @@ class PairLJCutCoulDebyeDielectricOMP : public PairLJCutCoulDebyeDielectric, pub
|
|||||||
void compute(int, int) override;
|
void compute(int, int) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
template <int EVFLAG, int EFLAG>
|
template <int EVFLAG, int EFLAG> void eval(int ifrom, int ito, ThrData *const thr);
|
||||||
void eval(int ifrom, int ito, ThrData *const thr);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace LAMMPS_NS
|
} // namespace LAMMPS_NS
|
||||||
|
|||||||
@ -33,8 +33,7 @@ class PairLJCutCoulLongDielectricOMP : public PairLJCutCoulLongDielectric, publi
|
|||||||
void compute(int, int) override;
|
void compute(int, int) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
template <int EVFLAG, int EFLAG>
|
template <int EVFLAG, int EFLAG> void eval(int ifrom, int ito, ThrData *const thr);
|
||||||
void eval(int ifrom, int ito, ThrData *const thr);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace LAMMPS_NS
|
} // namespace LAMMPS_NS
|
||||||
|
|||||||
@ -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
|
for virial, have delx,dely,delz and fx,fy,fz
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void Bond::ev_tally_xyz(int i, int j, int nlocal, int newton_bond,
|
void Bond::ev_tally_xyz(int i, int j, int nlocal, int newton_bond, double ebond, double fx,
|
||||||
double ebond, double fx, double fy, double fz,
|
double fy, double fz, double delx, double dely, double delz)
|
||||||
double delx, double dely, double delz)
|
|
||||||
{
|
{
|
||||||
double ebondhalf, v[6];
|
double ebondhalf, v[6];
|
||||||
|
|
||||||
|
|||||||
@ -259,8 +259,7 @@ void BondHybrid::flags()
|
|||||||
for (m = 0; m < nstyles; m++) {
|
for (m = 0; m < nstyles; m++) {
|
||||||
if (styles[m]) comm_forward = MAX(comm_forward, styles[m]->comm_forward);
|
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 = MAX(comm_reverse, styles[m]->comm_reverse);
|
||||||
if (styles[m]) comm_reverse_off = MAX(comm_reverse_off,
|
if (styles[m]) comm_reverse_off = MAX(comm_reverse_off, styles[m]->comm_reverse_off);
|
||||||
styles[m]->comm_reverse_off);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
init_svector();
|
init_svector();
|
||||||
@ -276,8 +275,7 @@ void BondHybrid::init_svector()
|
|||||||
// allocate svector
|
// allocate svector
|
||||||
|
|
||||||
single_extra = 0;
|
single_extra = 0;
|
||||||
for (int m = 0; m < nstyles; m++)
|
for (int m = 0; m < nstyles; m++) single_extra = MAX(single_extra, styles[m]->single_extra);
|
||||||
single_extra = MAX(single_extra,styles[m]->single_extra);
|
|
||||||
|
|
||||||
if (single_extra) {
|
if (single_extra) {
|
||||||
delete[] svector;
|
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
|
// there is only one style in bond style hybrid for a bond type
|
||||||
Bond *this_style = styles[map[type]];
|
Bond *this_style = styles[map[type]];
|
||||||
|
|
||||||
for (int l = 0; this_style->single_extra; ++l) {
|
for (int l = 0; this_style->single_extra; ++l) { svector[l] = this_style->svector[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();
|
void init();
|
||||||
virtual void write();
|
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 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 *) {}
|
virtual void unpack_reverse_comm(int, int *, double *) {}
|
||||||
|
|
||||||
void modify_params(int, char **);
|
void modify_params(int, char **);
|
||||||
@ -151,11 +157,17 @@ class Dump : protected Pointers {
|
|||||||
|
|
||||||
virtual void init_style() = 0;
|
virtual void init_style() = 0;
|
||||||
virtual void openfile();
|
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 void write_header(bigint) = 0;
|
||||||
virtual int count();
|
virtual int count();
|
||||||
virtual void pack(tagint *) = 0;
|
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_data(int, double *) = 0;
|
||||||
virtual void write_footer() {}
|
virtual void write_footer() {}
|
||||||
|
|
||||||
|
|||||||
@ -87,8 +87,8 @@ void FixBondHistory::post_constructor()
|
|||||||
|
|
||||||
id_fix = utils::strdup(id + std::string("_FIX_PROP_ATOM"));
|
id_fix = utils::strdup(id + std::string("_FIX_PROP_ATOM"));
|
||||||
id_array = utils::strdup(std::string("d2_") + id);
|
id_array = utils::strdup(std::string("d2_") + id);
|
||||||
modify->add_fix(fmt::format("{} {} property/atom {} {} writedata no", id_fix, group->names[igroup], id_array,
|
modify->add_fix(fmt::format("{} {} property/atom {} {} writedata no", id_fix,
|
||||||
nbond * ndata));
|
group->names[igroup], id_array, nbond * ndata));
|
||||||
int tmp1, tmp2;
|
int tmp1, tmp2;
|
||||||
index = atom->find_custom(&id_array[3], tmp1, tmp2);
|
index = atom->find_custom(&id_array[3], tmp1, tmp2);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -47,8 +47,7 @@ FixVector::FixVector(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
val.id = argi.get_name();
|
val.id = argi.get_name();
|
||||||
val.val.c = nullptr;
|
val.val.c = nullptr;
|
||||||
|
|
||||||
if ((val.which == ArgInfo::UNKNOWN) || (val.which == ArgInfo::NONE) ||
|
if ((val.which == ArgInfo::UNKNOWN) || (val.which == ArgInfo::NONE) || (argi.get_dim() > 1))
|
||||||
(argi.get_dim() > 1))
|
|
||||||
error->all(FLERR, "Invalid fix vector argument: {}", arg[iarg]);
|
error->all(FLERR, "Invalid fix vector argument: {}", arg[iarg]);
|
||||||
|
|
||||||
values.push_back(val);
|
values.push_back(val);
|
||||||
|
|||||||
@ -3020,10 +3020,11 @@ Below is a brief C code demonstrating accessing this collected bond information.
|
|||||||
|
|
||||||
.. code-block:: c
|
.. code-block:: c
|
||||||
|
|
||||||
|
#include "library.h"
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdint.h>
|
|
||||||
#include "library.h"
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
|||||||
19
src/memory.h
19
src/memory.h
@ -1,3 +1,4 @@
|
|||||||
|
// clang-format off
|
||||||
/* -*- c++ -*- ----------------------------------------------------------
|
/* -*- c++ -*- ----------------------------------------------------------
|
||||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
https://www.lammps.org/, Sandia National Laboratories
|
https://www.lammps.org/, Sandia National Laboratories
|
||||||
@ -647,9 +648,8 @@ class Memory : protected Pointers {
|
|||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
template <typename TYPE>
|
template <typename TYPE>
|
||||||
TYPE ****create4d_offset_last(TYPE ****&array, int n1lo, int n1hi,
|
TYPE ****create4d_offset_last(TYPE ****&array, int n1lo, int n1hi, int n2lo, int n2hi, int n3lo,
|
||||||
int n2lo, int n2hi, int n3lo, int n3hi, int n4,
|
int n3hi, int n4, const char *name)
|
||||||
const char *name)
|
|
||||||
{
|
{
|
||||||
if (n1lo > n1hi || n2lo > n2hi || n3lo > n3hi || n4 <= 0) return nullptr;
|
if (n1lo > n1hi || n2lo > n2hi || n3lo > n3hi || n4 <= 0) return nullptr;
|
||||||
|
|
||||||
@ -666,19 +666,20 @@ class Memory : protected Pointers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename TYPE>
|
template <typename TYPE>
|
||||||
TYPE ****create4d_offset_last(TYPE *****& /*array*/, int /*n1lo*/, int /*n1hi*/,
|
TYPE ****create4d_offset_last(TYPE *****& /*array*/, int /*n1lo*/, int /*n1hi*/, int /*n2lo*/,
|
||||||
int /*n2lo*/, int /*n2hi*/,
|
int /*n2hi*/, int /*n3lo*/, int /*n3hi*/, int /*n4*/,
|
||||||
int /*n3lo*/, int /*n3hi*/, int /*n4*/,
|
|
||||||
const char *name)
|
const char *name)
|
||||||
{fail(name); return nullptr;}
|
{
|
||||||
|
fail(name);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
free a 4d array with indices 1,2,3 offset
|
free a 4d array with indices 1,2,3 offset
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
template <typename TYPE>
|
template <typename TYPE>
|
||||||
void destroy4d_offset_last(TYPE ****&array,
|
void destroy4d_offset_last(TYPE ****&array, int n1_offset, int n2_offset, int n3_offset)
|
||||||
int n1_offset, int n2_offset, int n3_offset)
|
|
||||||
{
|
{
|
||||||
if (array == nullptr) return;
|
if (array == nullptr) return;
|
||||||
sfree(&array[n1_offset][n2_offset][n3_offset][0]);
|
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
|
// since some fixes access domain settings in their constructor
|
||||||
// nullptr must be last entry in this list
|
// nullptr must be last entry in this list
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
const char *exceptions[] =
|
const char *exceptions[] =
|
||||||
{"GPU", "OMP", "INTEL", "property/atom", "cmap", "cmap3", "rx",
|
{"GPU", "OMP", "INTEL", "property/atom", "cmap", "cmap3", "rx",
|
||||||
"deprecated", "STORE/KIM", "amoeba/pitorsion", "amoeba/bitorsion",
|
"deprecated", "STORE/KIM", "amoeba/pitorsion", "amoeba/bitorsion",
|
||||||
nullptr};
|
nullptr};
|
||||||
|
// clang-format on
|
||||||
|
|
||||||
if (domain->box_exist == 0) {
|
if (domain->box_exist == 0) {
|
||||||
int m;
|
int m;
|
||||||
|
|||||||
Reference in New Issue
Block a user