simplify deprecated styles

This commit is contained in:
Axel Kohlmeyer 2020-06-03 22:13:24 -04:00
parent c0fb794848
commit ef190962b8
No known key found for this signature in database
GPG Key ID: D9B44E93BF0C375A
10 changed files with 115 additions and 165 deletions

View File

@ -16,7 +16,7 @@
------------------------------------------------------------------------- */
#include "angle_deprecated.h"
#include <cstring>
#include <string>
#include "angle_hybrid.h"
#include "comm.h"
#include "force.h"
@ -25,21 +25,11 @@
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 **)
{
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
// 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];
}
if (strcmp(my_style,"DEPRECATED") == 0) {
writemsg(lmp,"\nAngle style 'DEPRECATED' is a dummy style\n\n",0);
if (my_style == "DEPRECATED") {
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 <cstring>
#include <string>
#include "bond_hybrid.h"
#include "comm.h"
#include "force.h"
#include "error.h"
#include "utils.h"
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 **)
{
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
// 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;
my_style = hybrid->keywords[hybrid->nstyles];
}
if (strcmp(my_style,"DEPRECATED") == 0) {
writemsg(lmp,"\nBond style 'DEPRECATED' is a dummy style\n\n",0);
if (my_style == "DEPRECATED") {
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 <cstring>
#include <string>
#include "comm.h"
#include "error.h"
#include "utils.h"
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) :
Compute(lmp, narg, arg)
{
if (strcmp(style,"DEPRECATED") == 0) {
writemsg(lmp,"\nCompute style 'DEPRECATED' is a dummy style\n\n",0);
std::string my_style = style;
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 <cstring>
#include <string>
#include "dihedral_hybrid.h"
#include "comm.h"
#include "force.h"
#include "error.h"
#include "utils.h"
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 **)
{
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
// called, our style was just added at the end of the list of substyles
// hybrid substyles are created in DihedralHybrid::settings(),
// 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;
my_style = hybrid->keywords[hybrid->nstyles];
}
if (strcmp(my_style,"DEPRECATED") == 0) {
writemsg(lmp,"\nDihedral style 'DEPRECATED' is a dummy style\n\n",0);
if (my_style == "DEPRECATED") {
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 <cstring>
#include <string>
#include "comm.h"
#include "error.h"
#include "utils.h"
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) :
Dump(lmp, narg, arg)
{
if (strcmp(style,"DEPRECATED") == 0) {
writemsg(lmp,"\nDump style 'DEPRECATED' is a dummy style\n\n",0);
std::string my_style = style;
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 <cstring>
#include <string>
#include "comm.h"
#include "error.h"
#include "utils.h"
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) :
Fix(lmp, narg, arg)
{
if (strcmp(style,"DEPRECATED") == 0) {
writemsg(lmp,"\nFix style 'DEPRECATED' is a dummy style\n\n",0);
std::string my_style = style;
} else if (strncmp(style,"ave/spatial",11) == 0) {
writemsg(lmp,"\nFix styles 'ave/spatial' and 'ave/spatial/sphere' have "
"been replaced\nby the more general fix ave/chunk and compute "
"chunk/atom commands.\nAll ave/spatial and 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");
if (my_style == "DEPRECATED") {
if (lmp->comm->me == 0)
utils::logmesg(lmp,"\nFix style 'DEPRECATED' is a dummy style\n\n");
return;
} else if (utils::strmatch(my_style,"^ave/spatial")) {
if (lmp->comm->me == 0)
utils::logmesg(lmp,"\nFix styles 'ave/spatial' and 'ave/spatial/sphere'"
" have been replaced\nby the more general fix ave/chunk "
"and compute chunk/atom commands.\nAll ave/spatial and "
"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 <cstring>
#include <string>
#include "improper_hybrid.h"
#include "comm.h"
#include "force.h"
#include "error.h"
#include "utils.h"
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 **)
{
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
// called, our style was just added at the end of the list of substyles
// hybrid substyles are created in ImproperHybrid::settings(),
// 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;
my_style = hybrid->keywords[hybrid->nstyles];
}
if (strcmp(my_style,"DEPRECATED") == 0) {
writemsg(lmp,"\nImproper style 'DEPRECATED' is a dummy style\n\n",0);
if (my_style == "DEPRECATED") {
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 <cstring>
#include <string>
#include "comm.h"
#include "force.h"
#include "error.h"
#include "utils.h"
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 **)
{
const char *my_style = force->kspace_style;
if (strcmp(my_style,"DEPRECATED") == 0) {
writemsg(lmp,"\nKSpace style 'DEPRECATED' is a dummy style\n\n",0);
std::string my_style = force->kspace_style;
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 <cstring>
#include <string>
#include "pair_hybrid.h"
#include "comm.h"
#include "force.h"
#include "error.h"
#include "utils.h"
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 **)
{
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
// 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;
my_style = hybrid->keywords[hybrid->nstyles];
}
if (strcmp(my_style,"reax") == 0) {
writemsg(lmp,"\nPair style 'reax' has been removed from LAMMPS "
"after the 12 December 2018 version\n\n",1);
if (my_style == "DEPRECATED") {
if (lmp->comm->me == 0)
utils::logmesg(lmp,"\nPair style 'DEPRECATED' is a dummy style\n\n");
return;
}
if (strcmp(my_style,"DEPRECATED") == 0) {
writemsg(lmp,"\nPair style 'DEPRECATED' is a dummy style\n\n",0);
if (my_style == "reax") {
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 <cstring>
#include <string>
#include "comm.h"
#include "error.h"
#include "utils.h"
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) :
Region(lmp, narg, arg)
{
if (strcmp(style,"DEPRECATED") == 0) {
writemsg(lmp,"\nRegion style 'DEPRECATED' is a dummy style\n\n",0);
std::string my_style = style;
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");
}