enable and apply clang-format

This commit is contained in:
Axel Kohlmeyer
2022-05-22 03:29:33 -04:00
parent b407b2f239
commit 9a973e67fa
23 changed files with 196 additions and 267 deletions

View File

@ -1,4 +1,3 @@
// clang-format off
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
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
@ -19,8 +18,8 @@
#include "angle_deprecated.h" #include "angle_deprecated.h"
#include "angle_hybrid.h" #include "angle_hybrid.h"
#include "comm.h" #include "comm.h"
#include "force.h"
#include "error.h" #include "error.h"
#include "force.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
@ -33,17 +32,14 @@ void AngleDeprecated::settings(int, char **)
// hybrid substyles are created in AngleHybrid::settings(), so when this is // hybrid substyles are created in AngleHybrid::settings(), so when this is
// called, our style was just added at the end of the list of substyles // called, our style was just added at the end of the list of substyles
if (utils::strmatch(my_style,"^hybrid")) { if (utils::strmatch(my_style, "^hybrid")) {
auto hybrid = dynamic_cast<AngleHybrid *>(force->angle); auto hybrid = dynamic_cast<AngleHybrid *>(force->angle);
my_style = hybrid->keywords[hybrid->nstyles]; my_style = hybrid->keywords[hybrid->nstyles];
} }
if (my_style == "DEPRECATED") { if (my_style == "DEPRECATED") {
if (lmp->comm->me == 0) if (lmp->comm->me == 0) utils::logmesg(lmp, "\nAngle style 'DEPRECATED' is a dummy style\n\n");
utils::logmesg(lmp,"\nAngle style 'DEPRECATED' is a dummy style\n\n");
return; return;
} }
error->all(FLERR,"This angle style is no longer available"); error->all(FLERR, "This angle style is no longer available");
} }

View File

@ -1,4 +1,3 @@
// clang-format off
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
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
@ -29,5 +28,5 @@ Body::Body(LAMMPS *lmp, int /*narg*/, char **arg) : Pointers(lmp)
Body::~Body() Body::~Body()
{ {
delete [] style; delete[] style;
} }

View File

@ -1,4 +1,3 @@
// clang-format off
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
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
@ -34,17 +33,14 @@ void BondDeprecated::settings(int, char **)
// hybrid substyles are created in BondHybrid::settings(), so when this is // hybrid substyles are created in BondHybrid::settings(), so when this is
// called, our style was just added at the end of the list of substyles // called, our style was just added at the end of the list of substyles
if (utils::strmatch(my_style,"^hybrid")) { if (utils::strmatch(my_style, "^hybrid")) {
auto hybrid = dynamic_cast<BondHybrid *>(force->bond); auto hybrid = dynamic_cast<BondHybrid *>(force->bond);
my_style = hybrid->keywords[hybrid->nstyles]; my_style = hybrid->keywords[hybrid->nstyles];
} }
if (my_style == "DEPRECATED") { if (my_style == "DEPRECATED") {
if (lmp->comm->me == 0) if (lmp->comm->me == 0) utils::logmesg(lmp, "\nBond style 'DEPRECATED' is a dummy style\n\n");
utils::logmesg(lmp,"\nBond style 'DEPRECATED' is a dummy style\n\n");
return; return;
} }
error->all(FLERR,"This bond style is no longer available"); error->all(FLERR, "This bond style is no longer available");
} }

View File

@ -1,4 +1,3 @@
// clang-format off
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
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
@ -25,10 +24,9 @@ using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
ComputeAngle::ComputeAngle(LAMMPS *lmp, int narg, char **arg) : ComputeAngle::ComputeAngle(LAMMPS *lmp, int narg, char **arg) :
Compute(lmp, narg, arg), Compute(lmp, narg, arg), emine(nullptr)
emine(nullptr)
{ {
if (narg != 3) error->all(FLERR,"Illegal compute angle command"); if (narg != 3) error->all(FLERR, "Illegal compute angle command");
vector_flag = 1; vector_flag = 1;
extvector = 1; extvector = 1;
@ -37,9 +35,8 @@ ComputeAngle::ComputeAngle(LAMMPS *lmp, int narg, char **arg) :
// check if bond style hybrid exists // check if bond style hybrid exists
angle = dynamic_cast<AngleHybrid *>( force->angle_match("hybrid")); angle = dynamic_cast<AngleHybrid *>(force->angle_match("hybrid"));
if (!angle) if (!angle) error->all(FLERR, "Angle style for compute angle command is not hybrid");
error->all(FLERR,"Angle style for compute angle command is not hybrid");
size_vector = nsub = angle->nstyles; size_vector = nsub = angle->nstyles;
emine = new double[nsub]; emine = new double[nsub];
@ -50,8 +47,8 @@ ComputeAngle::ComputeAngle(LAMMPS *lmp, int narg, char **arg) :
ComputeAngle::~ComputeAngle() ComputeAngle::~ComputeAngle()
{ {
delete [] emine; delete[] emine;
delete [] vector; delete[] vector;
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -60,11 +57,10 @@ void ComputeAngle::init()
{ {
// recheck angle style in case it has been changed // recheck angle style in case it has been changed
angle = dynamic_cast<AngleHybrid *>( force->angle_match("hybrid")); angle = dynamic_cast<AngleHybrid *>(force->angle_match("hybrid"));
if (!angle) if (!angle) error->all(FLERR, "Angle style for compute angle command is not hybrid");
error->all(FLERR,"Angle style for compute angle command is not hybrid");
if (angle->nstyles != nsub) if (angle->nstyles != nsub)
error->all(FLERR,"Angle style for compute angle command has changed"); error->all(FLERR, "Angle style for compute angle command has changed");
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -73,10 +69,9 @@ void ComputeAngle::compute_vector()
{ {
invoked_vector = update->ntimestep; invoked_vector = update->ntimestep;
if (update->eflag_global != invoked_vector) if (update->eflag_global != invoked_vector)
error->all(FLERR,"Energy was not tallied on needed timestep"); error->all(FLERR, "Energy was not tallied on needed timestep");
for (int i = 0; i < nsub; i++) for (int i = 0; i < nsub; i++) emine[i] = angle->styles[i]->energy;
emine[i] = angle->styles[i]->energy;
MPI_Allreduce(emine,vector,nsub,MPI_DOUBLE,MPI_SUM,world); MPI_Allreduce(emine, vector, nsub, MPI_DOUBLE, MPI_SUM, world);
} }

View File

@ -1,4 +1,3 @@
// clang-format off
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
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
@ -25,10 +24,9 @@ using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
ComputeBond::ComputeBond(LAMMPS *lmp, int narg, char **arg) : ComputeBond::ComputeBond(LAMMPS *lmp, int narg, char **arg) :
Compute(lmp, narg, arg), Compute(lmp, narg, arg), emine(nullptr)
emine(nullptr)
{ {
if (narg != 3) error->all(FLERR,"Illegal compute bond command"); if (narg != 3) error->all(FLERR, "Illegal compute bond command");
vector_flag = 1; vector_flag = 1;
extvector = 1; extvector = 1;
@ -37,9 +35,8 @@ ComputeBond::ComputeBond(LAMMPS *lmp, int narg, char **arg) :
// check if bond style hybrid exists // check if bond style hybrid exists
bond = dynamic_cast<BondHybrid *>( force->bond_match("hybrid")); bond = dynamic_cast<BondHybrid *>(force->bond_match("hybrid"));
if (!bond) if (!bond) error->all(FLERR, "Bond style for compute bond command is not hybrid");
error->all(FLERR,"Bond style for compute bond command is not hybrid");
size_vector = nsub = bond->nstyles; size_vector = nsub = bond->nstyles;
emine = new double[nsub]; emine = new double[nsub];
@ -50,8 +47,8 @@ ComputeBond::ComputeBond(LAMMPS *lmp, int narg, char **arg) :
ComputeBond::~ComputeBond() ComputeBond::~ComputeBond()
{ {
delete [] emine; delete[] emine;
delete [] vector; delete[] vector;
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -60,11 +57,9 @@ void ComputeBond::init()
{ {
// recheck bond style in case it has been changed // recheck bond style in case it has been changed
bond = dynamic_cast<BondHybrid *>( force->bond_match("hybrid")); bond = dynamic_cast<BondHybrid *>(force->bond_match("hybrid"));
if (!bond) if (!bond) error->all(FLERR, "Bond style for compute bond command is not hybrid");
error->all(FLERR,"Bond style for compute bond command is not hybrid"); if (bond->nstyles != nsub) error->all(FLERR, "Bond style for compute bond command has changed");
if (bond->nstyles != nsub)
error->all(FLERR,"Bond style for compute bond command has changed");
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -73,10 +68,9 @@ void ComputeBond::compute_vector()
{ {
invoked_vector = update->ntimestep; invoked_vector = update->ntimestep;
if (update->eflag_global != invoked_vector) if (update->eflag_global != invoked_vector)
error->all(FLERR,"Energy was not tallied on needed timestep"); error->all(FLERR, "Energy was not tallied on needed timestep");
for (int i = 0; i < nsub; i++) for (int i = 0; i < nsub; i++) emine[i] = bond->styles[i]->energy;
emine[i] = bond->styles[i]->energy;
MPI_Allreduce(emine,vector,nsub,MPI_DOUBLE,MPI_SUM,world); MPI_Allreduce(emine, vector, nsub, MPI_DOUBLE, MPI_SUM, world);
} }

View File

@ -1,4 +1,3 @@
// clang-format off
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
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
@ -13,18 +12,17 @@
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "compute_com.h" #include "compute_com.h"
#include "update.h"
#include "group.h"
#include "error.h" #include "error.h"
#include "group.h"
#include "update.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
ComputeCOM::ComputeCOM(LAMMPS *lmp, int narg, char **arg) : ComputeCOM::ComputeCOM(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg)
Compute(lmp, narg, arg)
{ {
if (narg != 3) error->all(FLERR,"Illegal compute com command"); if (narg != 3) error->all(FLERR, "Illegal compute com command");
vector_flag = 1; vector_flag = 1;
size_vector = 3; size_vector = 3;
@ -37,7 +35,7 @@ ComputeCOM::ComputeCOM(LAMMPS *lmp, int narg, char **arg) :
ComputeCOM::~ComputeCOM() ComputeCOM::~ComputeCOM()
{ {
delete [] vector; delete[] vector;
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -54,5 +52,5 @@ void ComputeCOM::compute_vector()
invoked_vector = update->ntimestep; invoked_vector = update->ntimestep;
if (group->dynamic[igroup]) masstotal = group->mass(igroup); if (group->dynamic[igroup]) masstotal = group->mass(igroup);
group->xcm(igroup,masstotal,vector); group->xcm(igroup, masstotal, vector);
} }

View File

@ -1,4 +1,3 @@
// clang-format off
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
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
@ -21,15 +20,14 @@ using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
ComputeDeprecated::ComputeDeprecated(LAMMPS *lmp, int narg, char **arg) : ComputeDeprecated::ComputeDeprecated(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg)
Compute(lmp, narg, arg)
{ {
std::string my_style = style; std::string my_style = style;
if (my_style == "DEPRECATED") { if (my_style == "DEPRECATED") {
if (lmp->comm->me == 0) if (lmp->comm->me == 0)
utils::logmesg(lmp,"\nCompute style 'DEPRECATED' is a dummy style\n\n"); utils::logmesg(lmp, "\nCompute style 'DEPRECATED' is a dummy style\n\n");
return; return;
} }
error->all(FLERR,"This compute style is no longer available"); error->all(FLERR, "This compute style is no longer available");
} }

View File

@ -1,4 +1,3 @@
// clang-format off
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
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
@ -21,22 +20,21 @@
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
#define INERTIA 0.4 // moment of inertia prefactor for sphere #define INERTIA 0.4 // moment of inertia prefactor for sphere
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
ComputeERotateSphere::ComputeERotateSphere(LAMMPS *lmp, int narg, char **arg) : ComputeERotateSphere::ComputeERotateSphere(LAMMPS *lmp, int narg, char **arg) :
Compute(lmp, narg, arg) Compute(lmp, narg, arg)
{ {
if (narg != 3) error->all(FLERR,"Illegal compute erotate/sphere command"); if (narg != 3) error->all(FLERR, "Illegal compute erotate/sphere command");
scalar_flag = 1; scalar_flag = 1;
extscalar = 1; extscalar = 1;
// error check // error check
if (!atom->sphere_flag) if (!atom->sphere_flag) error->all(FLERR, "Compute erotate/sphere requires atom style sphere");
error->all(FLERR,"Compute erotate/sphere requires atom style sphere");
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -64,10 +62,11 @@ double ComputeERotateSphere::compute_scalar()
double erotate = 0.0; double erotate = 0.0;
for (int i = 0; i < nlocal; i++) for (int i = 0; i < nlocal; i++)
if (mask[i] & groupbit) if (mask[i] & groupbit)
erotate += (omega[i][0]*omega[i][0] + omega[i][1]*omega[i][1] + erotate +=
omega[i][2]*omega[i][2]) * radius[i]*radius[i]*rmass[i]; (omega[i][0] * omega[i][0] + omega[i][1] * omega[i][1] + omega[i][2] * omega[i][2]) *
radius[i] * radius[i] * rmass[i];
MPI_Allreduce(&erotate,&scalar,1,MPI_DOUBLE,MPI_SUM,world); MPI_Allreduce(&erotate, &scalar, 1, MPI_DOUBLE, MPI_SUM, world);
scalar *= pfactor; scalar *= pfactor;
return scalar; return scalar;
} }

View File

@ -1,4 +1,3 @@
// clang-format off
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
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
@ -15,18 +14,17 @@
#include "compute_ke.h" #include "compute_ke.h"
#include "atom.h" #include "atom.h"
#include "update.h"
#include "force.h"
#include "error.h" #include "error.h"
#include "force.h"
#include "update.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
ComputeKE::ComputeKE(LAMMPS *lmp, int narg, char **arg) : ComputeKE::ComputeKE(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg)
Compute(lmp, narg, arg)
{ {
if (narg != 3) error->all(FLERR,"Illegal compute ke command"); if (narg != 3) error->all(FLERR, "Illegal compute ke command");
scalar_flag = 1; scalar_flag = 1;
extscalar = 1; extscalar = 1;
@ -57,15 +55,14 @@ double ComputeKE::compute_scalar()
if (rmass) { if (rmass) {
for (int i = 0; i < nlocal; i++) for (int i = 0; i < nlocal; i++)
if (mask[i] & groupbit) if (mask[i] & groupbit)
ke += rmass[i] * (v[i][0]*v[i][0] + v[i][1]*v[i][1] + v[i][2]*v[i][2]); ke += rmass[i] * (v[i][0] * v[i][0] + v[i][1] * v[i][1] + v[i][2] * v[i][2]);
} else { } else {
for (int i = 0; i < nlocal; i++) for (int i = 0; i < nlocal; i++)
if (mask[i] & groupbit) if (mask[i] & groupbit)
ke += mass[type[i]] * ke += mass[type[i]] * (v[i][0] * v[i][0] + v[i][1] * v[i][1] + v[i][2] * v[i][2]);
(v[i][0]*v[i][0] + v[i][1]*v[i][1] + v[i][2]*v[i][2]);
} }
MPI_Allreduce(&ke,&scalar,1,MPI_DOUBLE,MPI_SUM,world); MPI_Allreduce(&ke, &scalar, 1, MPI_DOUBLE, MPI_SUM, world);
scalar *= pfactor; scalar *= pfactor;
return scalar; return scalar;
} }

View File

@ -1,4 +1,3 @@
// clang-format off
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
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
@ -33,15 +32,14 @@
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
enum{NOBIAS,BIAS}; enum { NOBIAS, BIAS };
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
ComputeStressAtom::ComputeStressAtom(LAMMPS *lmp, int narg, char **arg) : ComputeStressAtom::ComputeStressAtom(LAMMPS *lmp, int narg, char **arg) :
Compute(lmp, narg, arg), Compute(lmp, narg, arg), id_temp(nullptr), stress(nullptr)
id_temp(nullptr), stress(nullptr)
{ {
if (narg < 4) error->all(FLERR,"Illegal compute stress/atom command"); if (narg < 4) error->all(FLERR, "Illegal compute stress/atom command");
peratom_flag = 1; peratom_flag = 1;
size_peratom_cols = 6; size_peratom_cols = 6;
@ -52,17 +50,15 @@ ComputeStressAtom::ComputeStressAtom(LAMMPS *lmp, int narg, char **arg) :
// store temperature ID used by stress computation // store temperature ID used by stress computation
// insure it is valid for temperature computation // insure it is valid for temperature computation
if (strcmp(arg[3],"NULL") == 0) id_temp = nullptr; if (strcmp(arg[3], "NULL") == 0)
id_temp = nullptr;
else { else {
id_temp = utils::strdup(arg[3]); id_temp = utils::strdup(arg[3]);
int icompute = modify->find_compute(id_temp); int icompute = modify->find_compute(id_temp);
if (icompute < 0) if (icompute < 0) error->all(FLERR, "Could not find compute stress/atom temperature ID");
error->all(FLERR,"Could not find compute stress/atom temperature ID");
if (modify->compute[icompute]->tempflag == 0) if (modify->compute[icompute]->tempflag == 0)
error->all(FLERR, error->all(FLERR, "Compute stress/atom temperature ID does not compute temperature");
"Compute stress/atom temperature ID does not "
"compute temperature");
} }
// process optional args // process optional args
@ -81,19 +77,28 @@ ComputeStressAtom::ComputeStressAtom(LAMMPS *lmp, int narg, char **arg) :
fixflag = 0; fixflag = 0;
int iarg = 4; int iarg = 4;
while (iarg < narg) { while (iarg < narg) {
if (strcmp(arg[iarg],"ke") == 0) keflag = 1; if (strcmp(arg[iarg], "ke") == 0)
else if (strcmp(arg[iarg],"pair") == 0) pairflag = 1; keflag = 1;
else if (strcmp(arg[iarg],"bond") == 0) bondflag = 1; else if (strcmp(arg[iarg], "pair") == 0)
else if (strcmp(arg[iarg],"angle") == 0) angleflag = 1; pairflag = 1;
else if (strcmp(arg[iarg],"dihedral") == 0) dihedralflag = 1; else if (strcmp(arg[iarg], "bond") == 0)
else if (strcmp(arg[iarg],"improper") == 0) improperflag = 1; bondflag = 1;
else if (strcmp(arg[iarg],"kspace") == 0) kspaceflag = 1; else if (strcmp(arg[iarg], "angle") == 0)
else if (strcmp(arg[iarg],"fix") == 0) fixflag = 1; angleflag = 1;
else if (strcmp(arg[iarg],"virial") == 0) { else if (strcmp(arg[iarg], "dihedral") == 0)
dihedralflag = 1;
else if (strcmp(arg[iarg], "improper") == 0)
improperflag = 1;
else if (strcmp(arg[iarg], "kspace") == 0)
kspaceflag = 1;
else if (strcmp(arg[iarg], "fix") == 0)
fixflag = 1;
else if (strcmp(arg[iarg], "virial") == 0) {
pairflag = 1; pairflag = 1;
bondflag = angleflag = dihedralflag = improperflag = 1; bondflag = angleflag = dihedralflag = improperflag = 1;
kspaceflag = fixflag = 1; kspaceflag = fixflag = 1;
} else error->all(FLERR,"Illegal compute stress/atom command"); } else
error->all(FLERR, "Illegal compute stress/atom command");
iarg++; iarg++;
} }
} }
@ -105,7 +110,7 @@ ComputeStressAtom::ComputeStressAtom(LAMMPS *lmp, int narg, char **arg) :
ComputeStressAtom::~ComputeStressAtom() ComputeStressAtom::~ComputeStressAtom()
{ {
delete [] id_temp; delete[] id_temp;
memory->destroy(stress); memory->destroy(stress);
} }
@ -118,24 +123,26 @@ void ComputeStressAtom::init()
if (id_temp) { if (id_temp) {
int icompute = modify->find_compute(id_temp); int icompute = modify->find_compute(id_temp);
if (icompute < 0) if (icompute < 0) error->all(FLERR, "Could not find compute stress/atom temperature ID");
error->all(FLERR,"Could not find compute stress/atom temperature ID");
temperature = modify->compute[icompute]; temperature = modify->compute[icompute];
if (temperature->tempbias) biasflag = BIAS; if (temperature->tempbias)
else biasflag = NOBIAS; biasflag = BIAS;
} else biasflag = NOBIAS; else
biasflag = NOBIAS;
} else
biasflag = NOBIAS;
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void ComputeStressAtom::compute_peratom() void ComputeStressAtom::compute_peratom()
{ {
int i,j; int i, j;
double onemass; double onemass;
invoked_peratom = update->ntimestep; invoked_peratom = update->ntimestep;
if (update->vflag_atom != invoked_peratom) if (update->vflag_atom != invoked_peratom)
error->all(FLERR,"Per-atom virial was not tallied on needed timestep"); error->all(FLERR, "Per-atom virial was not tallied on needed timestep");
// grow local stress array if necessary // grow local stress array if necessary
// needs to be atom->nmax in length // needs to be atom->nmax in length
@ -143,7 +150,7 @@ void ComputeStressAtom::compute_peratom()
if (atom->nmax > nmax) { if (atom->nmax > nmax) {
memory->destroy(stress); memory->destroy(stress);
nmax = atom->nmax; nmax = atom->nmax;
memory->create(stress,nmax,6,"stress/atom:stress"); memory->create(stress, nmax, 6, "stress/atom:stress");
array_atom = stress; array_atom = stress;
} }
@ -166,51 +173,44 @@ void ComputeStressAtom::compute_peratom()
// clear local stress array // clear local stress array
for (i = 0; i < ntotal; i++) for (i = 0; i < ntotal; i++)
for (j = 0; j < 6; j++) for (j = 0; j < 6; j++) stress[i][j] = 0.0;
stress[i][j] = 0.0;
// add in per-atom contributions from each force // add in per-atom contributions from each force
if (pairflag && force->pair && force->pair->compute_flag) { if (pairflag && force->pair && force->pair->compute_flag) {
double **vatom = force->pair->vatom; double **vatom = force->pair->vatom;
for (i = 0; i < npair; i++) for (i = 0; i < npair; i++)
for (j = 0; j < 6; j++) for (j = 0; j < 6; j++) stress[i][j] += vatom[i][j];
stress[i][j] += vatom[i][j];
} }
if (bondflag && force->bond) { if (bondflag && force->bond) {
double **vatom = force->bond->vatom; double **vatom = force->bond->vatom;
for (i = 0; i < nbond; i++) for (i = 0; i < nbond; i++)
for (j = 0; j < 6; j++) for (j = 0; j < 6; j++) stress[i][j] += vatom[i][j];
stress[i][j] += vatom[i][j];
} }
if (angleflag && force->angle) { if (angleflag && force->angle) {
double **vatom = force->angle->vatom; double **vatom = force->angle->vatom;
for (i = 0; i < nbond; i++) for (i = 0; i < nbond; i++)
for (j = 0; j < 6; j++) for (j = 0; j < 6; j++) stress[i][j] += vatom[i][j];
stress[i][j] += vatom[i][j];
} }
if (dihedralflag && force->dihedral) { if (dihedralflag && force->dihedral) {
double **vatom = force->dihedral->vatom; double **vatom = force->dihedral->vatom;
for (i = 0; i < nbond; i++) for (i = 0; i < nbond; i++)
for (j = 0; j < 6; j++) for (j = 0; j < 6; j++) stress[i][j] += vatom[i][j];
stress[i][j] += vatom[i][j];
} }
if (improperflag && force->improper) { if (improperflag && force->improper) {
double **vatom = force->improper->vatom; double **vatom = force->improper->vatom;
for (i = 0; i < nbond; i++) for (i = 0; i < nbond; i++)
for (j = 0; j < 6; j++) for (j = 0; j < 6; j++) stress[i][j] += vatom[i][j];
stress[i][j] += vatom[i][j];
} }
if (kspaceflag && force->kspace && force->kspace->compute_flag) { if (kspaceflag && force->kspace && force->kspace->compute_flag) {
double **vatom = force->kspace->vatom; double **vatom = force->kspace->vatom;
for (i = 0; i < nkspace; i++) for (i = 0; i < nkspace; i++)
for (j = 0; j < 6; j++) for (j = 0; j < 6; j++) stress[i][j] += vatom[i][j];
stress[i][j] += vatom[i][j];
} }
// add in per-atom contributions from relevant fixes // add in per-atom contributions from relevant fixes
@ -225,15 +225,13 @@ void ComputeStressAtom::compute_peratom()
double **vatom = ifix->vatom; double **vatom = ifix->vatom;
if (vatom) if (vatom)
for (i = 0; i < nlocal; i++) for (i = 0; i < nlocal; i++)
for (j = 0; j < 6; j++) for (j = 0; j < 6; j++) stress[i][j] += vatom[i][j];
stress[i][j] += vatom[i][j];
} }
} }
// communicate ghost virials between neighbor procs // communicate ghost virials between neighbor procs
if (force->newton || (force->kspace && force->kspace->tip4pflag)) if (force->newton || (force->kspace && force->kspace->tip4pflag)) comm->reverse_comm(this);
comm->reverse_comm(this);
// zero virial of atoms not in group // zero virial of atoms not in group
// only do this after comm since ghost contributions must be included // only do this after comm since ghost contributions must be included
@ -266,24 +264,24 @@ void ComputeStressAtom::compute_peratom()
for (i = 0; i < nlocal; i++) for (i = 0; i < nlocal; i++)
if (mask[i] & groupbit) { if (mask[i] & groupbit) {
onemass = mvv2e * rmass[i]; onemass = mvv2e * rmass[i];
stress[i][0] += onemass*v[i][0]*v[i][0]; stress[i][0] += onemass * v[i][0] * v[i][0];
stress[i][1] += onemass*v[i][1]*v[i][1]; stress[i][1] += onemass * v[i][1] * v[i][1];
stress[i][2] += onemass*v[i][2]*v[i][2]; stress[i][2] += onemass * v[i][2] * v[i][2];
stress[i][3] += onemass*v[i][0]*v[i][1]; stress[i][3] += onemass * v[i][0] * v[i][1];
stress[i][4] += onemass*v[i][0]*v[i][2]; stress[i][4] += onemass * v[i][0] * v[i][2];
stress[i][5] += onemass*v[i][1]*v[i][2]; stress[i][5] += onemass * v[i][1] * v[i][2];
} }
} else { } else {
for (i = 0; i < nlocal; i++) for (i = 0; i < nlocal; i++)
if (mask[i] & groupbit) { if (mask[i] & groupbit) {
onemass = mvv2e * mass[type[i]]; onemass = mvv2e * mass[type[i]];
stress[i][0] += onemass*v[i][0]*v[i][0]; stress[i][0] += onemass * v[i][0] * v[i][0];
stress[i][1] += onemass*v[i][1]*v[i][1]; stress[i][1] += onemass * v[i][1] * v[i][1];
stress[i][2] += onemass*v[i][2]*v[i][2]; stress[i][2] += onemass * v[i][2] * v[i][2];
stress[i][3] += onemass*v[i][0]*v[i][1]; stress[i][3] += onemass * v[i][0] * v[i][1];
stress[i][4] += onemass*v[i][0]*v[i][2]; stress[i][4] += onemass * v[i][0] * v[i][2];
stress[i][5] += onemass*v[i][1]*v[i][2]; stress[i][5] += onemass * v[i][1] * v[i][2];
} }
} }
@ -292,35 +290,34 @@ void ComputeStressAtom::compute_peratom()
// invoke temperature if it hasn't been already // invoke temperature if it hasn't been already
// this insures bias factor is pre-computed // this insures bias factor is pre-computed
if (keflag && temperature->invoked_scalar != update->ntimestep) if (keflag && temperature->invoked_scalar != update->ntimestep) temperature->compute_scalar();
temperature->compute_scalar();
if (rmass) { if (rmass) {
for (i = 0; i < nlocal; i++) for (i = 0; i < nlocal; i++)
if (mask[i] & groupbit) { if (mask[i] & groupbit) {
temperature->remove_bias(i,v[i]); temperature->remove_bias(i, v[i]);
onemass = mvv2e * rmass[i]; onemass = mvv2e * rmass[i];
stress[i][0] += onemass*v[i][0]*v[i][0]; stress[i][0] += onemass * v[i][0] * v[i][0];
stress[i][1] += onemass*v[i][1]*v[i][1]; stress[i][1] += onemass * v[i][1] * v[i][1];
stress[i][2] += onemass*v[i][2]*v[i][2]; stress[i][2] += onemass * v[i][2] * v[i][2];
stress[i][3] += onemass*v[i][0]*v[i][1]; stress[i][3] += onemass * v[i][0] * v[i][1];
stress[i][4] += onemass*v[i][0]*v[i][2]; stress[i][4] += onemass * v[i][0] * v[i][2];
stress[i][5] += onemass*v[i][1]*v[i][2]; stress[i][5] += onemass * v[i][1] * v[i][2];
temperature->restore_bias(i,v[i]); temperature->restore_bias(i, v[i]);
} }
} else { } else {
for (i = 0; i < nlocal; i++) for (i = 0; i < nlocal; i++)
if (mask[i] & groupbit) { if (mask[i] & groupbit) {
temperature->remove_bias(i,v[i]); temperature->remove_bias(i, v[i]);
onemass = mvv2e * mass[type[i]]; onemass = mvv2e * mass[type[i]];
stress[i][0] += onemass*v[i][0]*v[i][0]; stress[i][0] += onemass * v[i][0] * v[i][0];
stress[i][1] += onemass*v[i][1]*v[i][1]; stress[i][1] += onemass * v[i][1] * v[i][1];
stress[i][2] += onemass*v[i][2]*v[i][2]; stress[i][2] += onemass * v[i][2] * v[i][2];
stress[i][3] += onemass*v[i][0]*v[i][1]; stress[i][3] += onemass * v[i][0] * v[i][1];
stress[i][4] += onemass*v[i][0]*v[i][2]; stress[i][4] += onemass * v[i][0] * v[i][2];
stress[i][5] += onemass*v[i][1]*v[i][2]; stress[i][5] += onemass * v[i][1] * v[i][2];
temperature->restore_bias(i,v[i]); temperature->restore_bias(i, v[i]);
} }
} }
} }
@ -344,7 +341,7 @@ void ComputeStressAtom::compute_peratom()
int ComputeStressAtom::pack_reverse_comm(int n, int first, double *buf) int ComputeStressAtom::pack_reverse_comm(int n, int first, double *buf)
{ {
int i,m,last; int i, m, last;
m = 0; m = 0;
last = first + n; last = first + n;
@ -363,7 +360,7 @@ int ComputeStressAtom::pack_reverse_comm(int n, int first, double *buf)
void ComputeStressAtom::unpack_reverse_comm(int n, int *list, double *buf) void ComputeStressAtom::unpack_reverse_comm(int n, int *list, double *buf)
{ {
int i,j,m; int i, j, m;
m = 0; m = 0;
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
@ -383,6 +380,6 @@ void ComputeStressAtom::unpack_reverse_comm(int n, int *list, double *buf)
double ComputeStressAtom::memory_usage() double ComputeStressAtom::memory_usage()
{ {
double bytes = (double)nmax*6 * sizeof(double); double bytes = (double) nmax * 6 * sizeof(double);
return bytes; return bytes;
} }

View File

@ -1,4 +1,3 @@
// clang-format off
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
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
@ -23,7 +22,6 @@
#include "error.h" #include "error.h"
#include "force.h" #include "force.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -36,15 +34,15 @@ void DihedralDeprecated::settings(int, char **)
// so when this is called, our style was just added at the end // so when this is called, our style was just added at the end
// of the list of substyles // of the list of substyles
if (utils::strmatch(my_style,"^hybrid")) { if (utils::strmatch(my_style, "^hybrid")) {
auto hybrid = dynamic_cast<DihedralHybrid *>(force->dihedral); auto hybrid = dynamic_cast<DihedralHybrid *>(force->dihedral);
my_style = hybrid->keywords[hybrid->nstyles]; my_style = hybrid->keywords[hybrid->nstyles];
} }
if (my_style == "DEPRECATED") { if (my_style == "DEPRECATED") {
if (lmp->comm->me == 0) if (lmp->comm->me == 0)
utils::logmesg(lmp,"\nDihedral style 'DEPRECATED' is a dummy style\n\n"); utils::logmesg(lmp, "\nDihedral style 'DEPRECATED' is a dummy style\n\n");
return; return;
} }
error->all(FLERR,"This dihedral style is no longer available"); error->all(FLERR, "This dihedral style is no longer available");
} }

View File

@ -1,4 +1,3 @@
// clang-format off
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
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
@ -21,15 +20,13 @@ using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
DumpDeprecated::DumpDeprecated(LAMMPS *lmp, int narg, char **arg) : DumpDeprecated::DumpDeprecated(LAMMPS *lmp, int narg, char **arg) : Dump(lmp, narg, arg)
Dump(lmp, narg, arg)
{ {
std::string my_style = style; std::string my_style = style;
if (my_style == "DEPRECATED") { if (my_style == "DEPRECATED") {
if (lmp->comm->me == 0) if (lmp->comm->me == 0) utils::logmesg(lmp, "\nDump style 'DEPRECATED' is a dummy style\n\n");
utils::logmesg(lmp,"\nDump style 'DEPRECATED' is a dummy style\n\n");
return; return;
} }
error->all(FLERR,"This dump style is no longer available"); error->all(FLERR, "This dump style is no longer available");
} }

View File

@ -1,4 +1,3 @@
// clang-format off
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
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
@ -17,23 +16,21 @@
#include "comm.h" #include "comm.h"
#include "error.h" #include "error.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
FixDeprecated::FixDeprecated(LAMMPS *lmp, int narg, char **arg) : FixDeprecated::FixDeprecated(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
Fix(lmp, narg, arg)
{ {
std::string my_style = style; std::string my_style = style;
if (my_style == "DEPRECATED") { if (my_style == "DEPRECATED") {
if (lmp->comm->me == 0) if (lmp->comm->me == 0) utils::logmesg(lmp, "\nFix style 'DEPRECATED' is a dummy style\n\n");
utils::logmesg(lmp,"\nFix style 'DEPRECATED' is a dummy style\n\n");
return; return;
} else if (utils::strmatch(my_style,"^ave/spatial")) { } else if (utils::strmatch(my_style, "^ave/spatial")) {
if (lmp->comm->me == 0) if (lmp->comm->me == 0)
utils::logmesg(lmp,"\nFix styles 'ave/spatial' and 'ave/spatial/sphere'" utils::logmesg(lmp,
"\nFix styles 'ave/spatial' and 'ave/spatial/sphere'"
" have been replaced\nby the more general fix ave/chunk " " have been replaced\nby the more general fix ave/chunk "
"and compute chunk/atom commands.\nAll ave/spatial and " "and compute chunk/atom commands.\nAll ave/spatial and "
"ave/spatial/sphere functionality is available in these" "ave/spatial/sphere functionality is available in these"
@ -44,14 +41,16 @@ FixDeprecated::FixDeprecated(LAMMPS *lmp, int narg, char **arg) :
"compute chunk/atom:\n dim, origin, delta, region, " "compute chunk/atom:\n dim, origin, delta, region, "
"bound, discard, units\n\n"); "bound, discard, units\n\n");
} else if (my_style == "lb/pc") { } else if (my_style == "lb/pc") {
utils::logmesg(lmp,"\nFix style 'lb/pc' has been removed from the LATBOLTZ" utils::logmesg(lmp,
" package; 'fix nve' can be used in its place.\n\n"); "\nFix style 'lb/pc' has been removed from the LATBOLTZ"
" package; 'fix nve' can be used in its place.\n\n");
} else if (my_style == "lb/rigid/pc/sphere") { } else if (my_style == "lb/rigid/pc/sphere") {
utils::logmesg(lmp,"\nFix style 'lb/rigid/pc/sphere' has been removed from" utils::logmesg(lmp,
"\nFix style 'lb/rigid/pc/sphere' has been removed from"
" the LATBOLTZ package; 'fix rigid' can be used in its place.\n\n"); " the LATBOLTZ package; 'fix rigid' can be used in its place.\n\n");
} else if (my_style == "client/md") { } else if (my_style == "client/md") {
if (lmp->comm->me == 0) if (lmp->comm->me == 0)
utils::logmesg(lmp, "\nThe MESSAGE package has been replaced by the MDI package.\n\n"); utils::logmesg(lmp, "\nThe MESSAGE package has been replaced by the MDI package.\n\n");
} }
error->all(FLERR,"This fix style is no longer available"); error->all(FLERR, "This fix style is no longer available");
} }

View File

@ -1,4 +1,3 @@
// clang-format off
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
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
@ -22,13 +21,10 @@ using namespace FixConst;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
FixNPH::FixNPH(LAMMPS *lmp, int narg, char **arg) : FixNPH::FixNPH(LAMMPS *lmp, int narg, char **arg) : FixNH(lmp, narg, arg)
FixNH(lmp, narg, arg)
{ {
if (tstat_flag) if (tstat_flag) error->all(FLERR, "Temperature control can not be used with fix nph");
error->all(FLERR,"Temperature control can not be used with fix nph"); if (!pstat_flag) error->all(FLERR, "Pressure control must be used with fix nph");
if (!pstat_flag)
error->all(FLERR,"Pressure control must be used with fix nph");
// create a new compute temp style // create a new compute temp style
// id = fix-ID + temp // id = fix-ID + temp
@ -36,7 +32,7 @@ FixNPH::FixNPH(LAMMPS *lmp, int narg, char **arg) :
// and thus its KE/temperature contribution should use group all // and thus its KE/temperature contribution should use group all
id_temp = utils::strdup(std::string(id) + "_temp"); id_temp = utils::strdup(std::string(id) + "_temp");
modify->add_compute(fmt::format("{} all temp",id_temp)); modify->add_compute(fmt::format("{} all temp", id_temp));
tcomputeflag = 1; tcomputeflag = 1;
// create a new compute pressure style // create a new compute pressure style
@ -44,6 +40,6 @@ FixNPH::FixNPH(LAMMPS *lmp, int narg, char **arg) :
// pass id_temp as 4th arg to pressure constructor // pass id_temp as 4th arg to pressure constructor
id_press = utils::strdup(std::string(id) + "_press"); id_press = utils::strdup(std::string(id) + "_press");
modify->add_compute(fmt::format("{} all pressure {}",id_press, id_temp)); modify->add_compute(fmt::format("{} all pressure {}", id_press, id_temp));
pcomputeflag = 1; pcomputeflag = 1;
} }

View File

@ -1,4 +1,3 @@
// clang-format off
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
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
@ -22,13 +21,10 @@ using namespace FixConst;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
FixNPHSphere::FixNPHSphere(LAMMPS *lmp, int narg, char **arg) : FixNPHSphere::FixNPHSphere(LAMMPS *lmp, int narg, char **arg) : FixNHSphere(lmp, narg, arg)
FixNHSphere(lmp, narg, arg)
{ {
if (tstat_flag) if (tstat_flag) error->all(FLERR, "Temperature control can not be used with fix nph/sphere");
error->all(FLERR,"Temperature control can not be used with fix nph/sphere"); if (!pstat_flag) error->all(FLERR, "Pressure control must be used with fix nph/sphere");
if (!pstat_flag)
error->all(FLERR,"Pressure control must be used with fix nph/sphere");
// create a new compute temp style // create a new compute temp style
// id = fix-ID + temp // id = fix-ID + temp
@ -36,7 +32,7 @@ FixNPHSphere::FixNPHSphere(LAMMPS *lmp, int narg, char **arg) :
// and thus its KE/temperature contribution should use group all // and thus its KE/temperature contribution should use group all
id_temp = utils::strdup(std::string(id) + "_temp"); id_temp = utils::strdup(std::string(id) + "_temp");
modify->add_compute(fmt::format("{} all temp/sphere",id_temp)); modify->add_compute(fmt::format("{} all temp/sphere", id_temp));
tcomputeflag = 1; tcomputeflag = 1;
// create a new compute pressure style // create a new compute pressure style
@ -44,6 +40,6 @@ FixNPHSphere::FixNPHSphere(LAMMPS *lmp, int narg, char **arg) :
// pass id_temp as 4th arg to pressure constructor // pass id_temp as 4th arg to pressure constructor
id_press = utils::strdup(std::string(id) + "_press"); id_press = utils::strdup(std::string(id) + "_press");
modify->add_compute(fmt::format("{} all pressure {}",id_press, id_temp)); modify->add_compute(fmt::format("{} all pressure {}", id_press, id_temp));
pcomputeflag = 1; pcomputeflag = 1;
} }

View File

@ -1,4 +1,3 @@
// clang-format off
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
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
@ -22,13 +21,10 @@ using namespace FixConst;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
FixNPT::FixNPT(LAMMPS *lmp, int narg, char **arg) : FixNPT::FixNPT(LAMMPS *lmp, int narg, char **arg) : FixNH(lmp, narg, arg)
FixNH(lmp, narg, arg)
{ {
if (!tstat_flag) if (!tstat_flag) error->all(FLERR, "Temperature control must be used with fix npt");
error->all(FLERR,"Temperature control must be used with fix npt"); if (!pstat_flag) error->all(FLERR, "Pressure control must be used with fix npt");
if (!pstat_flag)
error->all(FLERR,"Pressure control must be used with fix npt");
// create a new compute temp style // create a new compute temp style
// id = fix-ID + temp // id = fix-ID + temp
@ -36,7 +32,7 @@ FixNPT::FixNPT(LAMMPS *lmp, int narg, char **arg) :
// and thus its KE/temperature contribution should use group all // and thus its KE/temperature contribution should use group all
id_temp = utils::strdup(std::string(id) + "_temp"); id_temp = utils::strdup(std::string(id) + "_temp");
modify->add_compute(fmt::format("{} all temp",id_temp)); modify->add_compute(fmt::format("{} all temp", id_temp));
tcomputeflag = 1; tcomputeflag = 1;
// create a new compute pressure style // create a new compute pressure style
@ -44,6 +40,6 @@ FixNPT::FixNPT(LAMMPS *lmp, int narg, char **arg) :
// pass id_temp as 4th arg to pressure constructor // pass id_temp as 4th arg to pressure constructor
id_press = utils::strdup(std::string(id) + "_press"); id_press = utils::strdup(std::string(id) + "_press");
modify->add_compute(fmt::format("{} all pressure {}",id_press, id_temp)); modify->add_compute(fmt::format("{} all pressure {}", id_press, id_temp));
pcomputeflag = 1; pcomputeflag = 1;
} }

View File

@ -1,4 +1,3 @@
// clang-format off
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
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
@ -22,13 +21,10 @@ using namespace FixConst;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
FixNPTSphere::FixNPTSphere(LAMMPS *lmp, int narg, char **arg) : FixNPTSphere::FixNPTSphere(LAMMPS *lmp, int narg, char **arg) : FixNHSphere(lmp, narg, arg)
FixNHSphere(lmp, narg, arg)
{ {
if (!tstat_flag) if (!tstat_flag) error->all(FLERR, "Temperature control must be used with fix npt/sphere");
error->all(FLERR,"Temperature control must be used with fix npt/sphere"); if (!pstat_flag) error->all(FLERR, "Pressure control must be used with fix npt/sphere");
if (!pstat_flag)
error->all(FLERR,"Pressure control must be used with fix npt/sphere");
// create a new compute temp style // create a new compute temp style
// id = fix-ID + temp // id = fix-ID + temp
@ -36,7 +32,7 @@ FixNPTSphere::FixNPTSphere(LAMMPS *lmp, int narg, char **arg) :
// and thus its KE/temperature contribution should use group all // and thus its KE/temperature contribution should use group all
id_temp = utils::strdup(std::string(id) + "_temp"); id_temp = utils::strdup(std::string(id) + "_temp");
modify->add_compute(fmt::format("{} all temp/sphere",id_temp)); modify->add_compute(fmt::format("{} all temp/sphere", id_temp));
tcomputeflag = 1; tcomputeflag = 1;
// create a new compute pressure style // create a new compute pressure style
@ -44,6 +40,6 @@ FixNPTSphere::FixNPTSphere(LAMMPS *lmp, int narg, char **arg) :
// pass id_temp as 4th arg to pressure constructor // pass id_temp as 4th arg to pressure constructor
id_press = utils::strdup(std::string(id) + "_press"); id_press = utils::strdup(std::string(id) + "_press");
modify->add_compute(fmt::format("{} all pressure {}",id_press, id_temp)); modify->add_compute(fmt::format("{} all pressure {}", id_press, id_temp));
pcomputeflag = 1; pcomputeflag = 1;
} }

View File

@ -1,4 +1,3 @@
// clang-format off
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
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
@ -23,18 +22,15 @@ using namespace FixConst;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
FixNVT::FixNVT(LAMMPS *lmp, int narg, char **arg) : FixNVT::FixNVT(LAMMPS *lmp, int narg, char **arg) : FixNH(lmp, narg, arg)
FixNH(lmp, narg, arg)
{ {
if (!tstat_flag) if (!tstat_flag) error->all(FLERR, "Temperature control must be used with fix nvt");
error->all(FLERR,"Temperature control must be used with fix nvt"); if (pstat_flag) error->all(FLERR, "Pressure control can not be used with fix nvt");
if (pstat_flag)
error->all(FLERR,"Pressure control can not be used with fix nvt");
// create a new compute temp style // create a new compute temp style
// id = fix-ID + temp // id = fix-ID + temp
id_temp = utils::strdup(std::string(id) + "_temp"); id_temp = utils::strdup(std::string(id) + "_temp");
modify->add_compute(fmt::format("{} {} temp",id_temp,group->names[igroup])); modify->add_compute(fmt::format("{} {} temp", id_temp, group->names[igroup]));
tcomputeflag = 1; tcomputeflag = 1;
} }

View File

@ -1,4 +1,3 @@
// clang-format off
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
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

View File

@ -1,4 +1,3 @@
// clang-format off
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
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
@ -19,8 +18,8 @@
#include "kspace_deprecated.h" #include "kspace_deprecated.h"
#include "comm.h" #include "comm.h"
#include "force.h"
#include "error.h" #include "error.h"
#include "force.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
@ -31,11 +30,8 @@ void KSpaceDeprecated::settings(int, char **)
std::string my_style = force->kspace_style; std::string my_style = force->kspace_style;
if (my_style == "DEPRECATED") { if (my_style == "DEPRECATED") {
if (lmp->comm->me == 0) if (lmp->comm->me == 0) utils::logmesg(lmp, "\nKSpace style 'DEPRECATED' is a dummy style\n\n");
utils::logmesg(lmp,"\nKSpace style 'DEPRECATED' is a dummy style\n\n");
return; return;
} }
error->all(FLERR,"This kspace style is no longer available"); error->all(FLERR, "This kspace style is no longer available");
} }

View File

@ -1,4 +1,3 @@
// clang-format off
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
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
@ -32,28 +31,26 @@ Minimize::Minimize(LAMMPS *lmp) : Command(lmp) {}
void Minimize::command(int narg, char **arg) void Minimize::command(int narg, char **arg)
{ {
if (narg != 4) error->all(FLERR,"Illegal minimize command"); if (narg != 4) error->all(FLERR, "Illegal minimize command");
if (domain->box_exist == 0) if (domain->box_exist == 0)
error->all(FLERR,"Minimize command before simulation box is defined"); error->all(FLERR, "Minimize command before simulation box is defined");
// ignore minimize command, if walltime limit was already reached // ignore minimize command, if walltime limit was already reached
if (timer->is_timeout()) return; if (timer->is_timeout()) return;
update->etol = utils::numeric(FLERR,arg[0],false,lmp); update->etol = utils::numeric(FLERR, arg[0], false, lmp);
update->ftol = utils::numeric(FLERR,arg[1],false,lmp); update->ftol = utils::numeric(FLERR, arg[1], false, lmp);
update->nsteps = utils::inumeric(FLERR,arg[2],false,lmp); update->nsteps = utils::inumeric(FLERR, arg[2], false, lmp);
update->max_eval = utils::inumeric(FLERR,arg[3],false,lmp); update->max_eval = utils::inumeric(FLERR, arg[3], false, lmp);
if (update->etol < 0.0 || update->ftol < 0.0) if (update->etol < 0.0 || update->ftol < 0.0) error->all(FLERR, "Illegal minimize command");
error->all(FLERR,"Illegal minimize command");
if (lmp->citeme) lmp->citeme->flush(); if (lmp->citeme) lmp->citeme->flush();
update->whichflag = 2; update->whichflag = 2;
update->beginstep = update->firststep = update->ntimestep; update->beginstep = update->firststep = update->ntimestep;
update->endstep = update->laststep = update->firststep + update->nsteps; update->endstep = update->laststep = update->firststep + update->nsteps;
if (update->laststep < 0) if (update->laststep < 0) error->all(FLERR, "Too many iterations");
error->all(FLERR,"Too many iterations");
lmp->init(); lmp->init();
timer->init_timeout(); timer->init_timeout();

View File

@ -1,4 +1,3 @@
// clang-format off
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
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
@ -18,11 +17,10 @@
#include "pair_deprecated.h" #include "pair_deprecated.h"
#include "pair_hybrid.h"
#include "comm.h" #include "comm.h"
#include "force.h"
#include "error.h" #include "error.h"
#include "force.h"
#include "pair_hybrid.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
@ -35,21 +33,21 @@ void PairDeprecated::settings(int, char **)
// hybrid substyles are created in PairHybrid::settings(), so when this is // hybrid substyles are created in PairHybrid::settings(), so when this is
// called, our style was just added at the end of the list of substyles // called, our style was just added at the end of the list of substyles
if (utils::strmatch(my_style,"^hybrid")) { if (utils::strmatch(my_style, "^hybrid")) {
auto hybrid = dynamic_cast<PairHybrid *>(force->pair); auto hybrid = dynamic_cast<PairHybrid *>(force->pair);
my_style = hybrid->keywords[hybrid->nstyles]; my_style = hybrid->keywords[hybrid->nstyles];
} }
if (my_style == "DEPRECATED") { if (my_style == "DEPRECATED") {
if (lmp->comm->me == 0) if (lmp->comm->me == 0) utils::logmesg(lmp, "\nPair style 'DEPRECATED' is a dummy style\n\n");
utils::logmesg(lmp,"\nPair style 'DEPRECATED' is a dummy style\n\n");
return; return;
} }
if (my_style == "reax") { if (my_style == "reax") {
if (lmp->comm->me == 0) if (lmp->comm->me == 0)
utils::logmesg(lmp,"\nPair style 'reax' has been removed from LAMMPS " utils::logmesg(lmp,
"\nPair style 'reax' has been removed from LAMMPS "
"after the 12 December 2018 version\n\n"); "after the 12 December 2018 version\n\n");
} }
error->all(FLERR,"This pair style is no longer available"); error->all(FLERR, "This pair style is no longer available");
} }

View File

@ -1,4 +1,3 @@
// clang-format off
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
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
@ -17,20 +16,17 @@
#include "comm.h" #include "comm.h"
#include "error.h" #include "error.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
RegionDeprecated::RegionDeprecated(LAMMPS *lmp, int narg, char **arg) : RegionDeprecated::RegionDeprecated(LAMMPS *lmp, int narg, char **arg) : Region(lmp, narg, arg)
Region(lmp, narg, arg)
{ {
std::string my_style = style; std::string my_style = style;
if (my_style == "DEPRECATED") { if (my_style == "DEPRECATED") {
if (lmp->comm->me == 0) if (lmp->comm->me == 0) utils::logmesg(lmp, "\nRegion style 'DEPRECATED' is a dummy style\n\n");
utils::logmesg(lmp,"\nRegion style 'DEPRECATED' is a dummy style\n\n");
return; return;
} }
error->all(FLERR,"This region style is no longer available"); error->all(FLERR, "This region style is no longer available");
} }