simplify deprecated styles

This commit is contained in:
Axel Kohlmeyer
2020-06-03 22:13:24 -04:00
parent c0fb794848
commit ef190962b8
10 changed files with 115 additions and 165 deletions

View File

@ -16,7 +16,7 @@
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "angle_deprecated.h" #include "angle_deprecated.h"
#include <cstring> #include <string>
#include "angle_hybrid.h" #include "angle_hybrid.h"
#include "comm.h" #include "comm.h"
#include "force.h" #include "force.h"
@ -25,21 +25,11 @@
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
static void writemsg(LAMMPS *lmp, const char *msg, int abend=1)
{
if (lmp->comm->me == 0) {
if (lmp->screen) fputs(msg,lmp->screen);
if (lmp->logfile) fputs(msg,lmp->logfile);
}
if (abend)
lmp->error->all(FLERR,"This angle style is no longer available");
}
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void AngleDeprecated::settings(int, char **) void AngleDeprecated::settings(int, char **)
{ {
const char *my_style = force->angle_style; std::string my_style = force->angle_style;
// 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
@ -49,10 +39,13 @@ void AngleDeprecated::settings(int, char **)
my_style = hybrid->keywords[hybrid->nstyles]; my_style = hybrid->keywords[hybrid->nstyles];
} }
if (strcmp(my_style,"DEPRECATED") == 0) { if (my_style == "DEPRECATED") {
writemsg(lmp,"\nAngle style 'DEPRECATED' is a dummy style\n\n",0); if (lmp->comm->me == 0)
utils::logmesg(lmp,"\nAngle style 'DEPRECATED' is a dummy style\n\n");
return;
} }
lmp->error->all(FLERR,"This angle style is no longer available");
} }

View File

@ -16,42 +16,36 @@
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "bond_deprecated.h" #include "bond_deprecated.h"
#include <cstring> #include <string>
#include "bond_hybrid.h" #include "bond_hybrid.h"
#include "comm.h" #include "comm.h"
#include "force.h" #include "force.h"
#include "error.h" #include "error.h"
#include "utils.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
static void writemsg(LAMMPS *lmp, const char *msg, int abend=1)
{
if (lmp->comm->me == 0) {
if (lmp->screen) fputs(msg,lmp->screen);
if (lmp->logfile) fputs(msg,lmp->logfile);
}
if (abend)
lmp->error->all(FLERR,"This bond style is no longer available");
}
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void BondDeprecated::settings(int, char **) void BondDeprecated::settings(int, char **)
{ {
const char *my_style = force->bond_style; std::string my_style = force->bond_style;
// 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 (strncmp(my_style,"hybrid",6) == 0) { if (utils::strmatch(my_style,"^hybrid")) {
BondHybrid *hybrid = (BondHybrid *)force->bond; BondHybrid *hybrid = (BondHybrid *)force->bond;
my_style = hybrid->keywords[hybrid->nstyles]; my_style = hybrid->keywords[hybrid->nstyles];
} }
if (strcmp(my_style,"DEPRECATED") == 0) { if (my_style == "DEPRECATED") {
writemsg(lmp,"\nBond style 'DEPRECATED' is a dummy style\n\n",0); if (lmp->comm->me == 0)
utils::logmesg(lmp,"\nBond style 'DEPRECATED' is a dummy style\n\n");
return;
} }
lmp->error->all(FLERR,"This bond style is no longer available");
} }

View File

@ -12,28 +12,25 @@
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "compute_deprecated.h" #include "compute_deprecated.h"
#include <cstring> #include <string>
#include "comm.h" #include "comm.h"
#include "error.h" #include "error.h"
#include "utils.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
static void writemsg(LAMMPS *lmp, const char *msg, int abend=1)
{
if (lmp->comm->me == 0) {
if (lmp->screen) fputs(msg,lmp->screen);
if (lmp->logfile) fputs(msg,lmp->logfile);
}
if (abend)
lmp->error->all(FLERR,"This compute style is no longer available");
}
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
ComputeDeprecated::ComputeDeprecated(LAMMPS *lmp, int narg, char **arg) : ComputeDeprecated::ComputeDeprecated(LAMMPS *lmp, int narg, char **arg) :
Compute(lmp, narg, arg) Compute(lmp, narg, arg)
{ {
if (strcmp(style,"DEPRECATED") == 0) { std::string my_style = style;
writemsg(lmp,"\nCompute style 'DEPRECATED' is a dummy style\n\n",0);
if (my_style == "DEPRECATED") {
if (lmp->comm->me == 0)
utils::logmesg(lmp,"\nCompute style 'DEPRECATED' is a dummy style\n\n");
return;
} }
lmp->error->all(FLERR,"This compute style is no longer available");
} }

View File

@ -16,42 +16,35 @@
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "dihedral_deprecated.h" #include "dihedral_deprecated.h"
#include <cstring> #include <string>
#include "dihedral_hybrid.h" #include "dihedral_hybrid.h"
#include "comm.h" #include "comm.h"
#include "force.h" #include "force.h"
#include "error.h" #include "error.h"
#include "utils.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
static void writemsg(LAMMPS *lmp, const char *msg, int abend=1)
{
if (lmp->comm->me == 0) {
if (lmp->screen) fputs(msg,lmp->screen);
if (lmp->logfile) fputs(msg,lmp->logfile);
}
if (abend)
lmp->error->all(FLERR,"This dihedral style is no longer available");
}
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void DihedralDeprecated::settings(int, char **) void DihedralDeprecated::settings(int, char **)
{ {
const char *my_style = force->dihedral_style; std::string my_style = force->dihedral_style;
// hybrid substyles are created in DihedralHybrid::settings(), so when this is // hybrid substyles are created in DihedralHybrid::settings(),
// called, our style was just added at the end of the list of substyles // so when this is called, our style was just added at the end
// of the list of substyles
if (strncmp(my_style,"hybrid",6) == 0) { if (utils::strmatch(my_style,"^hybrid")) {
DihedralHybrid *hybrid = (DihedralHybrid *)force->dihedral; DihedralHybrid *hybrid = (DihedralHybrid *)force->dihedral;
my_style = hybrid->keywords[hybrid->nstyles]; my_style = hybrid->keywords[hybrid->nstyles];
} }
if (strcmp(my_style,"DEPRECATED") == 0) { if (my_style == "DEPRECATED") {
writemsg(lmp,"\nDihedral style 'DEPRECATED' is a dummy style\n\n",0); if (lmp->comm->me == 0)
utils::logmesg(lmp,"\nDihedral style 'DEPRECATED' is a dummy style\n\n");
return;
} }
lmp->error->all(FLERR,"This dihedral style is no longer available");
} }

View File

@ -12,29 +12,25 @@
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "dump_deprecated.h" #include "dump_deprecated.h"
#include <cstring> #include <string>
#include "comm.h" #include "comm.h"
#include "error.h" #include "error.h"
#include "utils.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
static void writemsg(LAMMPS *lmp, const char *msg, int abend=1)
{
if (lmp->comm->me == 0) {
if (lmp->screen) fputs(msg,lmp->screen);
if (lmp->logfile) fputs(msg,lmp->logfile);
}
if (abend)
lmp->error->all(FLERR,"This dump style is no longer available");
}
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
DumpDeprecated::DumpDeprecated(LAMMPS *lmp, int narg, char **arg) : DumpDeprecated::DumpDeprecated(LAMMPS *lmp, int narg, char **arg) :
Dump(lmp, narg, arg) Dump(lmp, narg, arg)
{ {
if (strcmp(style,"DEPRECATED") == 0) { std::string my_style = style;
writemsg(lmp,"\nDump style 'DEPRECATED' is a dummy style\n\n",0);
if (my_style == "DEPRECATED") {
if (lmp->comm->me == 0)
utils::logmesg(lmp,"\nDump style 'DEPRECATED' is a dummy style\n\n");
return;
} }
lmp->error->all(FLERR,"This dump style is no longer available");
} }

View File

@ -12,39 +12,37 @@
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "fix_deprecated.h" #include "fix_deprecated.h"
#include <cstring> #include <string>
#include "comm.h" #include "comm.h"
#include "error.h" #include "error.h"
#include "utils.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
static void writemsg(LAMMPS *lmp, const char *msg, int abend=1)
{
if (lmp->comm->me == 0) {
if (lmp->screen) fputs(msg,lmp->screen);
if (lmp->logfile) fputs(msg,lmp->logfile);
}
if (abend)
lmp->error->all(FLERR,"This fix style is no longer available");
}
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
FixDeprecated::FixDeprecated(LAMMPS *lmp, int narg, char **arg) : FixDeprecated::FixDeprecated(LAMMPS *lmp, int narg, char **arg) :
Fix(lmp, narg, arg) Fix(lmp, narg, arg)
{ {
if (strcmp(style,"DEPRECATED") == 0) { std::string my_style = style;
writemsg(lmp,"\nFix style 'DEPRECATED' is a dummy style\n\n",0);
} else if (strncmp(style,"ave/spatial",11) == 0) { if (my_style == "DEPRECATED") {
writemsg(lmp,"\nFix styles 'ave/spatial' and 'ave/spatial/sphere' have " if (lmp->comm->me == 0)
"been replaced\nby the more general fix ave/chunk and compute " utils::logmesg(lmp,"\nFix style 'DEPRECATED' is a dummy style\n\n");
"chunk/atom commands.\nAll ave/spatial and ave/spatial/sphere " return;
"functionality is available in these\nnew commands. These " } else if (utils::strmatch(my_style,"^ave/spatial")) {
"ave/spatial keywords & options are part of fix ave/chunk:\n" if (lmp->comm->me == 0)
" Nevery, Nrepeat, Nfreq, input values, norm, ave, file, " utils::logmesg(lmp,"\nFix styles 'ave/spatial' and 'ave/spatial/sphere'"
"overwrite, title123\nThese ave/spatial keywords & options for " " have been replaced\nby the more general fix ave/chunk "
"binning are part of compute chunk/atom:\n dim, origin, delta," "and compute chunk/atom commands.\nAll ave/spatial and "
" region, bound, discard, units\n\n"); "ave/spatial/sphere functionality is available in these"
"\nnew commands. These ave/spatial keywords & options are"
" part of fix ave/chunk:\n Nevery, Nrepeat, Nfreq, input"
" values, norm, ave, file, overwrite, title123\nThese "
"ave/spatial keywords & options for binning are part of "
"compute chunk/atom:\n dim, origin, delta, region, "
"bound, discard, units\n\n");
} }
lmp->error->all(FLERR,"This fix style is no longer available");
} }

View File

@ -16,42 +16,37 @@
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "improper_deprecated.h" #include "improper_deprecated.h"
#include <cstring> #include <string>
#include "improper_hybrid.h" #include "improper_hybrid.h"
#include "comm.h" #include "comm.h"
#include "force.h" #include "force.h"
#include "error.h" #include "error.h"
#include "utils.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
static void writemsg(LAMMPS *lmp, const char *msg, int abend=1)
{
if (lmp->comm->me == 0) {
if (lmp->screen) fputs(msg,lmp->screen);
if (lmp->logfile) fputs(msg,lmp->logfile);
}
if (abend)
lmp->error->all(FLERR,"This improper style is no longer available");
}
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void ImproperDeprecated::settings(int, char **) void ImproperDeprecated::settings(int, char **)
{ {
const char *my_style = force->improper_style; std::string my_style = force->improper_style;
// hybrid substyles are created in ImproperHybrid::settings(), so when this is // hybrid substyles are created in ImproperHybrid::settings(),
// called, our style was just added at the end of the list of substyles // so when this is called, our style was just added at the end
// of the list of substyles
if (strncmp(my_style,"hybrid",6) == 0) { if (utils::strmatch(my_style,"^hybrid")) {
ImproperHybrid *hybrid = (ImproperHybrid *)force->improper; ImproperHybrid *hybrid = (ImproperHybrid *)force->improper;
my_style = hybrid->keywords[hybrid->nstyles]; my_style = hybrid->keywords[hybrid->nstyles];
} }
if (strcmp(my_style,"DEPRECATED") == 0) { if (my_style == "DEPRECATED") {
writemsg(lmp,"\nImproper style 'DEPRECATED' is a dummy style\n\n",0); if (lmp->comm->me == 0)
utils::logmesg(lmp,"\nImproper style 'DEPRECATED' is a dummy style\n\n");
return;
} }
lmp->error->all(FLERR,"This improper style is no longer available");
} }

View File

@ -16,33 +16,27 @@
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "kspace_deprecated.h" #include "kspace_deprecated.h"
#include <cstring> #include <string>
#include "comm.h" #include "comm.h"
#include "force.h" #include "force.h"
#include "error.h" #include "error.h"
#include "utils.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
static void writemsg(LAMMPS *lmp, const char *msg, int abend=1)
{
if (lmp->comm->me == 0) {
if (lmp->screen) fputs(msg,lmp->screen);
if (lmp->logfile) fputs(msg,lmp->logfile);
}
if (abend)
lmp->error->all(FLERR,"This kspace style is no longer available");
}
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void KSpaceDeprecated::settings(int, char **) void KSpaceDeprecated::settings(int, char **)
{ {
const char *my_style = force->kspace_style; std::string my_style = force->kspace_style;
if (strcmp(my_style,"DEPRECATED") == 0) {
writemsg(lmp,"\nKSpace style 'DEPRECATED' is a dummy style\n\n",0);
if (my_style == "DEPRECATED") {
if (lmp->comm->me == 0)
utils::logmesg(lmp,"\nKSpace style 'DEPRECATED' is a dummy style\n\n");
return;
} }
lmp->error->all(FLERR,"This kspace style is no longer available");
} }

View File

@ -16,45 +16,40 @@
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "pair_deprecated.h" #include "pair_deprecated.h"
#include <cstring> #include <string>
#include "pair_hybrid.h" #include "pair_hybrid.h"
#include "comm.h" #include "comm.h"
#include "force.h" #include "force.h"
#include "error.h" #include "error.h"
#include "utils.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
static void writemsg(LAMMPS *lmp, const char *msg, int abend=1)
{
if (lmp->comm->me == 0) {
if (lmp->screen) fputs(msg,lmp->screen);
if (lmp->logfile) fputs(msg,lmp->logfile);
}
if (abend)
lmp->error->all(FLERR,"This pair style is no longer available");
}
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void PairDeprecated::settings(int, char **) void PairDeprecated::settings(int, char **)
{ {
const char *my_style = force->pair_style; std::string my_style = force->pair_style;
// 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 (strncmp(my_style,"hybrid",6) == 0) { if (utils::strmatch(my_style,"^hybrid")) {
PairHybrid *hybrid = (PairHybrid *)force->pair; PairHybrid *hybrid = (PairHybrid *)force->pair;
my_style = hybrid->keywords[hybrid->nstyles]; my_style = hybrid->keywords[hybrid->nstyles];
} }
if (strcmp(my_style,"reax") == 0) { if (my_style == "DEPRECATED") {
writemsg(lmp,"\nPair style 'reax' has been removed from LAMMPS " if (lmp->comm->me == 0)
"after the 12 December 2018 version\n\n",1); utils::logmesg(lmp,"\nPair style 'DEPRECATED' is a dummy style\n\n");
return;
} }
if (strcmp(my_style,"DEPRECATED") == 0) { if (my_style == "reax") {
writemsg(lmp,"\nPair style 'DEPRECATED' is a dummy style\n\n",0); if (lmp->comm->me == 0)
utils::logmesg(lmp,"\nPair style 'reax' has been removed from LAMMPS "
"after the 12 December 2018 version\n\n");
} }
lmp->error->all(FLERR,"This pair style is no longer available");
} }

View File

@ -12,29 +12,24 @@
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "region_deprecated.h" #include "region_deprecated.h"
#include <cstring> #include <string>
#include "comm.h" #include "comm.h"
#include "error.h" #include "error.h"
#include "utils.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
static void writemsg(LAMMPS *lmp, const char *msg, int abend=1)
{
if (lmp->comm->me == 0) {
if (lmp->screen) fputs(msg,lmp->screen);
if (lmp->logfile) fputs(msg,lmp->logfile);
}
if (abend)
lmp->error->all(FLERR,"This region style is no longer available");
}
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
RegionDeprecated::RegionDeprecated(LAMMPS *lmp, int narg, char **arg) : RegionDeprecated::RegionDeprecated(LAMMPS *lmp, int narg, char **arg) :
Region(lmp, narg, arg) Region(lmp, narg, arg)
{ {
if (strcmp(style,"DEPRECATED") == 0) { std::string my_style = style;
writemsg(lmp,"\nRegion style 'DEPRECATED' is a dummy style\n\n",0);
if (my_style == "DEPRECATED") {
if (lmp->comm->me == 0)
utils::logmesg(lmp,"\nRegion style 'DEPRECATED' is a dummy style\n\n");
return;
} }
lmp->error->all(FLERR,"This region style is no longer available");
} }