Unverified Commit ef190962 authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

simplify deprecated styles

parent c0fb7948
Loading
Loading
Loading
Loading
+8 −15
Original line number Diff line number Diff line
@@ -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");
}

+10 −16
Original line number Diff line number Diff line
@@ -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");
}

+10 −13
Original line number Diff line number Diff line
@@ -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");
}
+13 −20
Original line number Diff line number Diff line
@@ -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");
}
+9 −13
Original line number Diff line number Diff line
@@ -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");
}
Loading