Unverified Commit 4a5c14f6 authored by Axel Kohlmeyer's avatar Axel Kohlmeyer Committed by GitHub
Browse files

Merge pull request #1148 from akohlmey/deprecated-styles

Implement dummy classes for deprecated and removed styles
parents 527ec615 7bb5821b
Loading
Loading
Loading
Loading
+57 −0
Original line number Diff line number Diff line
/* ----------------------------------------------------------------------
   LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
   http://lammps.sandia.gov, Sandia National Laboratories
   Steve Plimpton, sjplimp@sandia.gov

   Copyright (2003) Sandia Corporation.  Under the terms of Contract
   DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
   certain rights in this software.  This software is distributed under
   the GNU General Public License.

   See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */

/* ----------------------------------------------------------------------
   Contributing author: Axel Kohlmeyer (Temple U)
------------------------------------------------------------------------- */

#include <cstring>
#include "angle_deprecated.h"
#include "angle_hybrid.h"
#include "comm.h"
#include "force.h"
#include "error.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 angle style is no longer available");
}

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

void AngleDeprecated::settings(int, char **)
{
  const char *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

  if (strncmp(my_style,"hybrid",6) == 0) {
    AngleHybrid *hybrid = (AngleHybrid *)force->angle;
    my_style = hybrid->keywords[hybrid->nstyles];
  }

  if (strcmp(my_style,"DEPRECATED") == 0) {
    writemsg(lmp,"\nAngle style 'DEPRECATED' is a dummy style\n\n",0);

  }
}  

src/angle_deprecated.h

0 → 100644
+48 −0
Original line number Diff line number Diff line
/* -*- c++ -*- ----------------------------------------------------------
   LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
   http://lammps.sandia.gov, Sandia National Laboratories
   Steve Plimpton, sjplimp@sandia.gov

   Copyright (2003) Sandia Corporation.  Under the terms of Contract
   DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
   certain rights in this software.  This software is distributed under
   the GNU General Public License.

   See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */

#ifdef ANGLE_CLASS

AngleStyle(DEPRECATED,AngleDeprecated)

#else

#ifndef LMP_ANGLE_DEPRECATED_H
#define LMP_ANGLE_DEPRECATED_H

#include "angle.h"

namespace LAMMPS_NS {

class AngleDeprecated : public Angle {
 public:
  AngleDeprecated(class LAMMPS *lmp) : Angle(lmp) {}
  virtual ~AngleDeprecated() {}

  virtual void compute(int, int) {}
  virtual void settings(int, char **);
  virtual void coeff(int, char **) {}
  virtual double equilibrium_angle(int) { return 0.0; }
  virtual void write_restart(FILE *) {}
  virtual void read_restart(FILE *) {}
  virtual double single(int, int, int, int) { return 0.0; }
};

}

#endif
#endif

/* ERROR/WARNING messages:

*/
+57 −0
Original line number Diff line number Diff line
/* ----------------------------------------------------------------------
   LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
   http://lammps.sandia.gov, Sandia National Laboratories
   Steve Plimpton, sjplimp@sandia.gov

   Copyright (2003) Sandia Corporation.  Under the terms of Contract
   DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
   certain rights in this software.  This software is distributed under
   the GNU General Public License.

   See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */

/* ----------------------------------------------------------------------
   Contributing author: Axel Kohlmeyer (Temple U)
------------------------------------------------------------------------- */

#include <cstring>
#include "bond_deprecated.h"
#include "bond_hybrid.h"
#include "comm.h"
#include "force.h"
#include "error.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;

  // 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) {
    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);

  }
}  

src/bond_deprecated.h

0 → 100644
+48 −0
Original line number Diff line number Diff line
/* -*- c++ -*- ----------------------------------------------------------
   LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
   http://lammps.sandia.gov, Sandia National Laboratories
   Steve Plimpton, sjplimp@sandia.gov

   Copyright (2003) Sandia Corporation.  Under the terms of Contract
   DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
   certain rights in this software.  This software is distributed under
   the GNU General Public License.

   See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */

#ifdef BOND_CLASS

BondStyle(DEPRECATED,BondDeprecated)

#else

#ifndef LMP_BOND_DEPRECATED_H
#define LMP_BOND_DEPRECATED_H

#include "bond.h"

namespace LAMMPS_NS {

class BondDeprecated : public Bond {
 public:
  BondDeprecated(class LAMMPS *lmp) : Bond(lmp) {}
  virtual ~BondDeprecated() {}

  virtual void compute(int, int) {}
  virtual void settings(int, char **);
  virtual void coeff(int, char **) {}
  virtual double equilibrium_distance(int) { return 0.0; }
  virtual void write_restart(FILE *) {}
  virtual void read_restart(FILE *) {}
  virtual double single(int, double, int, int, double &) { return 0.0; }
};

}

#endif
#endif

/* ERROR/WARNING messages:

*/
+39 −0
Original line number Diff line number Diff line
/* ----------------------------------------------------------------------
   LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
   http://lammps.sandia.gov, Sandia National Laboratories
   Steve Plimpton, sjplimp@sandia.gov

   Copyright (2003) Sandia Corporation.  Under the terms of Contract
   DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
   certain rights in this software.  This software is distributed under
   the GNU General Public License.

   See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */

#include <cstring>
#include "compute_deprecated.h"
#include "comm.h"
#include "error.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);
  }
}
Loading