update .clang-format file from src and update files

This commit is contained in:
Axel Kohlmeyer
2021-05-11 22:48:06 -04:00
parent 68160e3f22
commit 824dff8181
9 changed files with 34 additions and 70 deletions

View File

@ -16,7 +16,7 @@ BraceWrapping:
BreakBeforeBraces: Custom BreakBeforeBraces: Custom
BreakConstructorInitializers: AfterColon BreakConstructorInitializers: AfterColon
BreakInheritanceList: AfterColon BreakInheritanceList: AfterColon
ColumnLimit: 80 ColumnLimit: 100
IndentCaseLabels: true IndentCaseLabels: true
IndentWidth: 2 IndentWidth: 2
NamespaceIndentation: Inner NamespaceIndentation: Inner

View File

@ -53,8 +53,7 @@ void AngleZero2::compute(int eflag, int vflag)
void AngleZero2::settings(int narg, char **arg) void AngleZero2::settings(int narg, char **arg)
{ {
if ((narg != 0) && (narg != 1)) if ((narg != 0) && (narg != 1)) error->all(FLERR, "Illegal angle_style command");
error->all(FLERR, "Illegal angle_style command");
if (narg == 1) { if (narg == 1) {
if (strcmp("nocoeff", arg[0]) == 0) if (strcmp("nocoeff", arg[0]) == 0)
@ -91,8 +90,7 @@ void AngleZero2::coeff(int narg, char **arg)
utils::bounds(FLERR, arg[0], 1, atom->nangletypes, ilo, ihi, error); utils::bounds(FLERR, arg[0], 1, atom->nangletypes, ilo, ihi, error);
double theta0_one = 0.0; double theta0_one = 0.0;
if (coeffflag && (narg == 2)) if (coeffflag && (narg == 2)) theta0_one = utils::numeric(FLERR, arg[1], false, lmp);
theta0_one = utils::numeric(FLERR, arg[1], false, lmp);
// convert theta0 from degrees to radians // convert theta0 from degrees to radians
@ -131,8 +129,7 @@ void AngleZero2::read_restart(FILE *fp)
allocate(); allocate();
if (comm->me == 0) { if (comm->me == 0) {
utils::sfread(FLERR, &theta0[1], sizeof(double), atom->nangletypes, fp, utils::sfread(FLERR, &theta0[1], sizeof(double), atom->nangletypes, fp, nullptr, error);
nullptr, error);
} }
MPI_Bcast(&theta0[1], atom->nangletypes, MPI_DOUBLE, 0, world); MPI_Bcast(&theta0[1], atom->nangletypes, MPI_DOUBLE, 0, world);
@ -144,8 +141,7 @@ void AngleZero2::read_restart(FILE *fp)
void AngleZero2::write_data(FILE *fp) void AngleZero2::write_data(FILE *fp)
{ {
for (int i = 1; i <= atom->nangletypes; i++) for (int i = 1; i <= atom->nangletypes; i++) fprintf(fp, "%d %g\n", i, theta0[i] / MY_PI * 180.0);
fprintf(fp, "%d %g\n", i, theta0[i] / MY_PI * 180.0);
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */

View File

@ -51,8 +51,7 @@ void BondZero2::compute(int eflag, int vflag)
void BondZero2::settings(int narg, char **arg) void BondZero2::settings(int narg, char **arg)
{ {
if ((narg != 0) && (narg != 1)) if ((narg != 0) && (narg != 1)) error->all(FLERR, "Illegal bond_style command");
error->all(FLERR, "Illegal bond_style command");
if (narg == 1) { if (narg == 1) {
if (strcmp("nocoeff", arg[0]) == 0) if (strcmp("nocoeff", arg[0]) == 0)
@ -89,8 +88,7 @@ void BondZero2::coeff(int narg, char **arg)
utils::bounds(FLERR, arg[0], 1, atom->nbondtypes, ilo, ihi, error); utils::bounds(FLERR, arg[0], 1, atom->nbondtypes, ilo, ihi, error);
double r0_one = 0.0; double r0_one = 0.0;
if (coeffflag && (narg == 2)) if (coeffflag && (narg == 2)) r0_one = utils::numeric(FLERR, arg[1], false, lmp);
r0_one = utils::numeric(FLERR, arg[1], false, lmp);
int count = 0; int count = 0;
for (int i = ilo; i <= ihi; i++) { for (int i = ilo; i <= ihi; i++) {
@ -129,8 +127,7 @@ void BondZero2::read_restart(FILE *fp)
allocate(); allocate();
if (comm->me == 0) { if (comm->me == 0) {
utils::sfread(FLERR, &r0[1], sizeof(double), atom->nbondtypes, fp, nullptr, utils::sfread(FLERR, &r0[1], sizeof(double), atom->nbondtypes, fp, nullptr, error);
error);
} }
MPI_Bcast(&r0[1], atom->nbondtypes, MPI_DOUBLE, 0, world); MPI_Bcast(&r0[1], atom->nbondtypes, MPI_DOUBLE, 0, world);
@ -148,8 +145,7 @@ void BondZero2::write_data(FILE *fp)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
double BondZero2::single(int /*type*/, double /*rsq*/, int /*i*/, int /*j*/, double BondZero2::single(int /*type*/, double /*rsq*/, int /*i*/, int /*j*/, double & /*fforce*/)
double & /*fforce*/)
{ {
return 0.0; return 0.0;
} }

View File

@ -50,8 +50,7 @@ void DihedralZero2::compute(int eflag, int vflag)
void DihedralZero2::settings(int narg, char **arg) void DihedralZero2::settings(int narg, char **arg)
{ {
if ((narg != 0) && (narg != 1)) if ((narg != 0) && (narg != 1)) error->all(FLERR, "Illegal dihedral_style command");
error->all(FLERR, "Illegal dihedral_style command");
if (narg == 1) { if (narg == 1) {
if (strcmp("nocoeff", arg[0]) == 0) if (strcmp("nocoeff", arg[0]) == 0)

View File

@ -26,8 +26,7 @@ using namespace FixConst;
FixNVE2::FixNVE2(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) FixNVE2::FixNVE2(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
{ {
if (strcmp(style, "nve/sphere") != 0 && narg < 3) if (strcmp(style, "nve/sphere") != 0 && narg < 3) error->all(FLERR, "Illegal fix nve command");
error->all(FLERR, "Illegal fix nve command");
dynamic_group_allow = 1; dynamic_group_allow = 1;
time_integrate = 1; time_integrate = 1;
@ -52,8 +51,7 @@ void FixNVE2::init()
dtv = update->dt; dtv = update->dt;
dtf = 0.5 * update->dt * force->ftm2v; dtf = 0.5 * update->dt * force->ftm2v;
if (strstr(update->integrate_style, "respa")) if (strstr(update->integrate_style, "respa")) step_respa = ((Respa *) update->integrate)->step;
step_respa = ((Respa *) update->integrate)->step;
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------

View File

@ -50,8 +50,7 @@ void ImproperZero2::compute(int eflag, int vflag)
void ImproperZero2::settings(int narg, char **arg) void ImproperZero2::settings(int narg, char **arg)
{ {
if ((narg != 0) && (narg != 1)) if ((narg != 0) && (narg != 1)) error->all(FLERR, "Illegal improper_style command");
error->all(FLERR, "Illegal improper_style command");
if (narg == 1) { if (narg == 1) {
if (strcmp("nocoeff", arg[0]) == 0) if (strcmp("nocoeff", arg[0]) == 0)

View File

@ -110,14 +110,11 @@ void PairMorse2::compute(int eflag, int vflag)
} }
if (eflag) { if (eflag) {
evdwl = d0[itype][jtype] * (dexp * dexp - 2.0 * dexp) - evdwl = d0[itype][jtype] * (dexp * dexp - 2.0 * dexp) - offset[itype][jtype];
offset[itype][jtype];
evdwl *= factor_lj; evdwl *= factor_lj;
} }
if (evflag) if (evflag) ev_tally(i, j, nlocal, newton_pair, evdwl, 0.0, fpair, delx, dely, delz);
ev_tally(i, j, nlocal, newton_pair, evdwl, 0.0, fpair, delx, dely,
delz);
} }
} }
} }
@ -174,8 +171,7 @@ void PairMorse2::settings(int narg, char **arg)
void PairMorse2::coeff(int narg, char **arg) void PairMorse2::coeff(int narg, char **arg)
{ {
if (narg < 5 || narg > 6) if (narg < 5 || narg > 6) error->all(FLERR, "Incorrect args for pair coefficients");
error->all(FLERR, "Incorrect args for pair coefficients");
if (!allocated) allocate(); if (!allocated) allocate();
int ilo, ihi, jlo, jhi; int ilo, ihi, jlo, jhi;
@ -264,20 +260,14 @@ void PairMorse2::read_restart(FILE *fp)
int me = comm->me; int me = comm->me;
for (i = 1; i <= atom->ntypes; i++) for (i = 1; i <= atom->ntypes; i++)
for (j = i; j <= atom->ntypes; j++) { for (j = i; j <= atom->ntypes; j++) {
if (me == 0) if (me == 0) utils::sfread(FLERR, &setflag[i][j], sizeof(int), 1, fp, nullptr, error);
utils::sfread(FLERR, &setflag[i][j], sizeof(int), 1, fp, nullptr,
error);
MPI_Bcast(&setflag[i][j], 1, MPI_INT, 0, world); MPI_Bcast(&setflag[i][j], 1, MPI_INT, 0, world);
if (setflag[i][j]) { if (setflag[i][j]) {
if (me == 0) { if (me == 0) {
utils::sfread(FLERR, &d0[i][j], sizeof(double), 1, fp, nullptr, utils::sfread(FLERR, &d0[i][j], sizeof(double), 1, fp, nullptr, error);
error); utils::sfread(FLERR, &alpha[i][j], sizeof(double), 1, fp, nullptr, error);
utils::sfread(FLERR, &alpha[i][j], sizeof(double), 1, fp, nullptr, utils::sfread(FLERR, &r0[i][j], sizeof(double), 1, fp, nullptr, error);
error); utils::sfread(FLERR, &cut[i][j], sizeof(double), 1, fp, nullptr, error);
utils::sfread(FLERR, &r0[i][j], sizeof(double), 1, fp, nullptr,
error);
utils::sfread(FLERR, &cut[i][j], sizeof(double), 1, fp, nullptr,
error);
} }
MPI_Bcast(&d0[i][j], 1, MPI_DOUBLE, 0, world); MPI_Bcast(&d0[i][j], 1, MPI_DOUBLE, 0, world);
MPI_Bcast(&alpha[i][j], 1, MPI_DOUBLE, 0, world); MPI_Bcast(&alpha[i][j], 1, MPI_DOUBLE, 0, world);
@ -332,15 +322,13 @@ void PairMorse2::write_data_all(FILE *fp)
{ {
for (int i = 1; i <= atom->ntypes; i++) for (int i = 1; i <= atom->ntypes; i++)
for (int j = i; j <= atom->ntypes; j++) for (int j = i; j <= atom->ntypes; j++)
fprintf(fp, "%d %d %g %g %g %g\n", i, j, d0[i][j], alpha[i][j], r0[i][j], fprintf(fp, "%d %d %g %g %g %g\n", i, j, d0[i][j], alpha[i][j], r0[i][j], cut[i][j]);
cut[i][j]);
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
double PairMorse2::single(int /*i*/, int /*j*/, int itype, int jtype, double PairMorse2::single(int /*i*/, int /*j*/, int itype, int jtype, double rsq,
double rsq, double /*factor_coul*/, double factor_lj, double /*factor_coul*/, double factor_lj, double &fforce)
double &fforce)
{ {
double r, dr, dexp, phi; double r, dr, dexp, phi;

View File

@ -27,8 +27,7 @@ using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
PairMorse2OMP::PairMorse2OMP(LAMMPS *lmp) : PairMorse2OMP::PairMorse2OMP(LAMMPS *lmp) : PairMorse2(lmp), ThrOMP(lmp, THR_PAIR)
PairMorse2(lmp), ThrOMP(lmp, THR_PAIR)
{ {
suffix_flag |= Suffix::OMP; suffix_flag |= Suffix::OMP;
respa_enable = 0; respa_enable = 0;
@ -140,14 +139,12 @@ void PairMorse2OMP::eval(int iifrom, int iito, ThrData *const thr)
} }
if (EFLAG) { if (EFLAG) {
evdwl = d0[itype][jtype] * (dexp * dexp - 2.0 * dexp) - evdwl = d0[itype][jtype] * (dexp * dexp - 2.0 * dexp) - offset[itype][jtype];
offset[itype][jtype];
evdwl *= factor_lj; evdwl *= factor_lj;
} }
if (EVFLAG) if (EVFLAG)
ev_tally_thr(this, i, j, nlocal, NEWTON_PAIR, evdwl, 0.0, fpair, delx, ev_tally_thr(this, i, j, nlocal, NEWTON_PAIR, evdwl, 0.0, fpair, delx, dely, delz, thr);
dely, delz, thr);
} }
} }
f[i].x += fxtmp; f[i].x += fxtmp;

View File

@ -85,8 +85,7 @@ void PairZero2::allocate()
void PairZero2::settings(int narg, char **arg) void PairZero2::settings(int narg, char **arg)
{ {
if ((narg != 1) && (narg != 2)) if ((narg != 1) && (narg != 2)) error->all(FLERR, "Illegal pair_style command");
error->all(FLERR, "Illegal pair_style command");
cut_global = utils::numeric(FLERR, arg[0], false, lmp); cut_global = utils::numeric(FLERR, arg[0], false, lmp);
if (narg == 2) { if (narg == 2) {
@ -121,8 +120,7 @@ void PairZero2::coeff(int narg, char **arg)
utils::bounds(FLERR, arg[1], 1, atom->ntypes, jlo, jhi, error); utils::bounds(FLERR, arg[1], 1, atom->ntypes, jlo, jhi, error);
double cut_one = cut_global; double cut_one = cut_global;
if (coeffflag && (narg == 3)) if (coeffflag && (narg == 3)) cut_one = utils::numeric(FLERR, arg[2], false, lmp);
cut_one = utils::numeric(FLERR, arg[2], false, lmp);
int count = 0; int count = 0;
for (int i = ilo; i <= ihi; i++) { for (int i = ilo; i <= ihi; i++) {
@ -176,15 +174,10 @@ void PairZero2::read_restart(FILE *fp)
int me = comm->me; int me = comm->me;
for (i = 1; i <= atom->ntypes; i++) for (i = 1; i <= atom->ntypes; i++)
for (j = i; j <= atom->ntypes; j++) { for (j = i; j <= atom->ntypes; j++) {
if (me == 0) if (me == 0) utils::sfread(FLERR, &setflag[i][j], sizeof(int), 1, fp, nullptr, error);
utils::sfread(FLERR, &setflag[i][j], sizeof(int), 1, fp, nullptr,
error);
MPI_Bcast(&setflag[i][j], 1, MPI_INT, 0, world); MPI_Bcast(&setflag[i][j], 1, MPI_INT, 0, world);
if (setflag[i][j]) { if (setflag[i][j]) {
if (me == 0) { if (me == 0) { utils::sfread(FLERR, &cut[i][j], sizeof(double), 1, fp, nullptr, error); }
utils::sfread(FLERR, &cut[i][j], sizeof(double), 1, fp, nullptr,
error);
}
MPI_Bcast(&cut[i][j], 1, MPI_DOUBLE, 0, world); MPI_Bcast(&cut[i][j], 1, MPI_DOUBLE, 0, world);
} }
} }
@ -231,15 +224,13 @@ void PairZero2::write_data(FILE *fp)
void PairZero2::write_data_all(FILE *fp) void PairZero2::write_data_all(FILE *fp)
{ {
for (int i = 1; i <= atom->ntypes; i++) for (int i = 1; i <= atom->ntypes; i++)
for (int j = i; j <= atom->ntypes; j++) for (int j = i; j <= atom->ntypes; j++) fprintf(fp, "%d %d %g\n", i, j, cut[i][j]);
fprintf(fp, "%d %d %g\n", i, j, cut[i][j]);
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
double PairZero2::single(int /*i*/, int /*j*/, int /* itype */, int /* jtype */, double PairZero2::single(int /*i*/, int /*j*/, int /* itype */, int /* jtype */, double /* rsq */,
double /* rsq */, double /*factor_coul*/, double /*factor_coul*/, double /* factor_lj */, double &fforce)
double /* factor_lj */, double &fforce)
{ {
fforce = 0.0; fforce = 0.0;
return 0.0; return 0.0;