Commit b71f530b authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

make default style name for deprecated styles uppercase, so it is considered internal

also consolidate the writeout message across styles into a single convenience function
parent 43ae9656
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -38,11 +38,8 @@ static void writemsg(LAMMPS *lmp, const char *msg, int abend=1)

void Deprecated::command(int narg, char **arg)
{
  if (strcmp(input->command,"deprecated") == 0) {
    writemsg(lmp,"\nCommand 'deprecated' is a dummy command\n\n",0);
  if (strcmp(input->command,"DEPRECATED") == 0) {
    writemsg(lmp,"\nCommand 'DEPRECATED' is a dummy command\n\n",0);

  } else if (strcmp(input->command,"XXX") == 0) {
    writemsg(lmp, "\nCommand 'XXX' has been removed from LAMMPS "
             "after the\n## XXX 20## stable release.\n\n");
  }
}
+1 −2
Original line number Diff line number Diff line
@@ -13,8 +13,7 @@

#ifdef COMMAND_CLASS

CommandStyle(deprecated,Deprecated)
CommandStyle(XXX,Deprecated)
CommandStyle(DEPRECATED,Deprecated)

#else

+23 −25
Original line number Diff line number Diff line
@@ -18,35 +18,33 @@

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) {
    const char *message = "\n"
    "NOTE: The fix 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 (strncmp(style,"ave/spatial",11) == 0) {
    const char *message = "\n"
    "NOTE: The fix styles 'ave/spatial' and 'ave/spatial/sphere' have been replaced\n"
    "by the more general fix ave/chunk and compute chunk/atom commands.\n"
    "All ave/spatial and ave/spatial/sphere functionality is available in these\n"
    "new commands. These ave/spatial keywords & options are part of fix ave/chunk:\n"
    "  Nevery, Nrepeat, Nfreq, input values, norm, ave, file, overwrite, title123\n"
    "These ave/spatial keywords & options for binning are part of compute chunk/atom:\n"
    "  dim, origin, delta, region, bound, discard, units\n\n";

    if (comm->me == 0) {
      if (screen) fputs(message,screen);
      if (logfile) fputs(message,logfile);
    }
  if (strcmp(style,"DEPRECATED") == 0) {
    writemsg(lmp,"\nFix style 'DEPRECATED' is a dummy style\n\n",0);

  } 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");
  }
  error->all(FLERR,"This fix command has been removed from LAMMPS");
}
+1 −1
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@

// list all deprecated and removed fix styles here

FixStyle(deprecated,FixDeprecated)
FixStyle(DEPRECATED,FixDeprecated)
FixStyle(ave/spatial,FixDeprecated)
FixStyle(ave/spatial/sphere,FixDeprecated)

+4 −8
Original line number Diff line number Diff line
@@ -31,10 +31,9 @@ static void writemsg(LAMMPS *lmp, const char *msg, int abend=1)
    if (lmp->logfile) fputs(msg,lmp->logfile);
  }
  if (abend)
    lmp->error->all(FLERR,"This pair_style is no longer available");
    lmp->error->all(FLERR,"This pair style is no longer available");
}


/* ---------------------------------------------------------------------- */

void PairDeprecated::settings(int, char **)
@@ -43,18 +42,15 @@ void PairDeprecated::settings(int, char **)

  // 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);
  if (strcmp(my_style,"DEPRECATED") == 0) {
    writemsg(lmp,"\nPair style 'DEPRECATED' is a dummy 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\nbeen superseded by pair style 'reax/c'.\n\n");
  }
}  

Loading