pair style deprecated now functional and compatible with hybrid pair styles

This commit is contained in:
Axel Kohlmeyer
2018-10-04 12:18:28 +02:00
parent c3abf13af1
commit a1a9f34c18
3 changed files with 38 additions and 29 deletions

View File

@ -23,31 +23,39 @@
using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */
PairDeprecated::PairDeprecated(LAMMPS *lmp) : Pair(lmp)
static void writemsg(LAMMPS *lmp, const char *msg, int abend=1)
{
if (strcmp(force->pair_style,"deprecated") == 0) {
const char *message = "\n"
"NOTE: The pair style 'deprecated' is a dummy fix style that was added to\n"
"LAMMPS in order to print suitable error messages for deleted features.\n\n";
if (comm->me == 0) {
if (screen) fputs(message,screen);
if (logfile) fputs(message,logfile);
}
if (lmp->comm->me == 0) {
if (lmp->screen) fputs(msg,lmp->screen);
if (lmp->logfile) fputs(msg,lmp->logfile);
}
if (strncmp(force->pair_style,"reax",11) == 0) {
const char *message = "\n"
"NOTE: The pair style 'reax' has been removed from LAMMPS after the\n"
"## November 2018 stable release. Its functionality has long before\n"
"been superseded by pair styles 'reax/c' and 'reax/c/kk'\n\n";
if (comm->me == 0) {
if (screen) fputs(message,screen);
if (logfile) fputs(message,logfile);
}
}
error->all(FLERR,"This pair_style command has been removed from LAMMPS");
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;
// 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) {
PairHybrid *hybrid = (PairHybrid *)force->pair;
my_style = hybrid->keywords[hybrid->nstyles];
}
if (strcmp(my_style,"deprecated") == 0) {
writemsg(lmp,"\nPair style 'deprecated' is a dummy pair style\n\n",0);
} else if (strcmp(my_style,"reax") == 0) {
writemsg(lmp, "\nPair style 'reax' has been removed from LAMMPS "
"after the\n## November 2018 stable release. Its "
"functionality has long before\nbeen superseded by pair "
"styles 'reax/c' and 'reax/c/kk'\n\n");
}
}

View File

@ -26,12 +26,12 @@ namespace LAMMPS_NS {
class PairDeprecated : public Pair {
public:
PairDeprecated(class LAMMPS *);
virtual ~PairDeprecated() {};
PairDeprecated(class LAMMPS *lmp) : Pair(lmp) {}
virtual ~PairDeprecated() {}
virtual void compute(int, int) {};
virtual void settings(int, char **) {};
virtual void coeff(int, char **) {};
virtual void compute(int, int) {}
virtual void settings(int, char **);
virtual void coeff(int, char **) {}
};

View File

@ -32,6 +32,7 @@ class PairHybrid : public Pair {
friend class Force;
friend class Respa;
friend class Info;
friend class PairDeprecated;
public:
PairHybrid(class LAMMPS *);
virtual ~PairHybrid();