Merge pull request #1148 from akohlmey/deprecated-styles

Implement dummy classes for deprecated and removed styles
This commit is contained in:
Axel Kohlmeyer 2018-10-23 10:34:58 -04:00 committed by GitHub
commit 4a5c14f60d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 934 additions and 21 deletions

57
src/angle_deprecated.cpp Normal file
View File

@ -0,0 +1,57 @@
/* ----------------------------------------------------------------------
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);
}
}

48
src/angle_deprecated.h Normal file
View File

@ -0,0 +1,48 @@
/* -*- 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
src/bond_deprecated.cpp Normal file
View File

@ -0,0 +1,57 @@
/* ----------------------------------------------------------------------
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);
}
}

48
src/bond_deprecated.h Normal file
View File

@ -0,0 +1,48 @@
/* -*- 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:
*/

View File

@ -0,0 +1,39 @@
/* ----------------------------------------------------------------------
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);
}
}

47
src/compute_deprecated.h Normal file
View File

@ -0,0 +1,47 @@
/* -*- 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 COMPUTE_CLASS
// list all deprecated and removed compute styles here
ComputeStyle(DEPRECATED,ComputeDeprecated)
#else
#ifndef LMP_COMPUTE_DEPRECATED_H
#define LMP_COMPUTE_DEPRECATED_H
#include "compute.h"
namespace LAMMPS_NS {
class ComputeDeprecated : public Compute {
public:
ComputeDeprecated(class LAMMPS *, int, char **);
~ComputeDeprecated() {}
void init() {}
};
}
#endif
#endif
/* ERROR/WARNING messages:
E: This compute command has been removed from LAMMPS
UNDOCUMENTED
*/

45
src/deprecated.cpp Normal file
View File

@ -0,0 +1,45 @@
/* ----------------------------------------------------------------------
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 authors: Axel Kohlmeyer (Temple U),
------------------------------------------------------------------------- */
#include <cstring>
#include "deprecated.h"
#include "comm.h"
#include "force.h"
#include "error.h"
#include "input.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 command is no longer available");
}
/* ---------------------------------------------------------------------- */
void Deprecated::command(int narg, char **arg)
{
if (strcmp(input->command,"DEPRECATED") == 0) {
writemsg(lmp,"\nCommand 'DEPRECATED' is a dummy command\n\n",0);
}
}

69
src/deprecated.h Normal file
View File

@ -0,0 +1,69 @@
/* -*- 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 COMMAND_CLASS
CommandStyle(DEPRECATED,Deprecated)
#else
#ifndef LMP_DEPRECATED_H
#define LMP_DEPRECATED_H
#include "pointers.h"
namespace LAMMPS_NS {
class Deprecated : protected Pointers {
public:
Deprecated(class LAMMPS *lmp) : Pointers(lmp) {};
void command(int, char **);
};
}
#endif
#endif
/* ERROR/WARNING messages:
W: Ignoring unknown or incorrect info command flag
Self-explanatory. An unknown argument was given to the info command.
Compare your input with the documentation.
E: Unknown name for info package category
Self-explanatory.
E: Unknown name for info newton category
Self-explanatory.
E: Unknown name for info pair category
Self-explanatory.
E: Unknown category for info is_active()
Self-explanatory.
E: Unknown category for info is_available()
Self-explanatory.
E: Unknown category for info is_defined()
Self-explanatory.
*/

View File

@ -0,0 +1,57 @@
/* ----------------------------------------------------------------------
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 "dihedral_deprecated.h"
#include "dihedral_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 dihedral style is no longer available");
}
/* ---------------------------------------------------------------------- */
void DihedralDeprecated::settings(int, char **)
{
const char *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
if (strncmp(my_style,"hybrid",6) == 0) {
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);
}
}

46
src/dihedral_deprecated.h Normal file
View File

@ -0,0 +1,46 @@
/* -*- 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 DIHEDRAL_CLASS
DihedralStyle(DEPRECATED,DihedralDeprecated)
#else
#ifndef LMP_DIHEDRAL_DEPRECATED_H
#define LMP_DIHEDRAL_DEPRECATED_H
#include "dihedral.h"
namespace LAMMPS_NS {
class DihedralDeprecated : public Dihedral {
public:
DihedralDeprecated(class LAMMPS *lmp) : Dihedral(lmp) {}
virtual ~DihedralDeprecated() {}
virtual void compute(int, int) {}
virtual void settings(int, char **);
virtual void coeff(int, char **) {}
virtual void write_restart(FILE *) {}
virtual void read_restart(FILE *) {}
};
}
#endif
#endif
/* ERROR/WARNING messages:
*/

40
src/dump_deprecated.cpp Normal file
View File

@ -0,0 +1,40 @@
/* ----------------------------------------------------------------------
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 "dump_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 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);
}
}

50
src/dump_deprecated.h Normal file
View File

@ -0,0 +1,50 @@
/* -*- 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 DUMP_CLASS
// list all deprecated and removed dump styles here
DumpStyle(DEPRECATED,DumpDeprecated)
#else
#ifndef LMP_DUMP_DEPRECATED_H
#define LMP_DUMP_DEPRECATED_H
#include "dump.h"
namespace LAMMPS_NS {
class DumpDeprecated : public Dump {
public:
DumpDeprecated(class LAMMPS *, int, char **);
~DumpDeprecated() {}
virtual void init_style() {}
virtual void write_header(bigint) {}
virtual void pack(tagint *) {}
virtual void write_data(int, double *) {}
};
}
#endif
#endif
/* ERROR/WARNING messages:
E: This dump style has been removed from LAMMPS
UNDOCUMENTED
*/

View File

@ -18,25 +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 (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 (strcmp(style,"DEPRECATED") == 0) {
writemsg(lmp,"\nFix style 'DEPRECATED' is a dummy style\n\n",0);
if (comm->me == 0) {
if (screen) fputs(message,screen);
if (logfile) fputs(message,logfile);
}
} 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");
}

View File

@ -15,6 +15,7 @@
// list all deprecated and removed fix styles here
FixStyle(DEPRECATED,FixDeprecated)
FixStyle(ave/spatial,FixDeprecated)
FixStyle(ave/spatial/sphere,FixDeprecated)

View File

@ -0,0 +1,57 @@
/* ----------------------------------------------------------------------
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 "improper_deprecated.h"
#include "improper_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 improper style is no longer available");
}
/* ---------------------------------------------------------------------- */
void ImproperDeprecated::settings(int, char **)
{
const char *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
if (strncmp(my_style,"hybrid",6) == 0) {
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);
}
}

46
src/improper_deprecated.h Normal file
View File

@ -0,0 +1,46 @@
/* -*- 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 IMPROPER_CLASS
ImproperStyle(DEPRECATED,ImproperDeprecated)
#else
#ifndef LMP_IMPROPER_DEPRECATED_H
#define LMP_IMPROPER_DEPRECATED_H
#include "improper.h"
namespace LAMMPS_NS {
class ImproperDeprecated : public Improper {
public:
ImproperDeprecated(class LAMMPS *lmp) : Improper(lmp) {}
virtual ~ImproperDeprecated() {}
virtual void compute(int, int) {}
virtual void settings(int, char **);
virtual void coeff(int, char **) {}
virtual void write_restart(FILE *) {}
virtual void read_restart(FILE *) {}
};
}
#endif
#endif
/* ERROR/WARNING messages:
*/

View File

@ -24,6 +24,8 @@ namespace LAMMPS_NS {
class Input : protected Pointers {
friend class Info;
friend class Error;
friend class Deprecated;
public:
int narg; // # of command args
char **arg; // parsed args for command
@ -38,9 +40,11 @@ class Input : protected Pointers {
// substitute for variables in a string
int expand_args(int, char **, int, char **&); // expand args due to wildcard
protected:
char *command; // ptr to current command
private:
int me; // proc ID
char *command; // ptr to current command
int maxarg; // max # of args in arg
char *line,*copy,*work; // input line & copy and work string
int maxline,maxcopy,maxwork; // max lengths of char strings

View File

@ -785,16 +785,17 @@ void Modify::add_fix(int narg, char **arg, int trysuffix)
// but can't think of better way
// too late if instantiate fix, then check flag set in fix constructor,
// since some fixes access domain settings in their constructor
// MUST change NEXCEPT above when add new fix to this list
// NULL must be last entry in this list
const char *exceptions[NEXCEPT] =
{"GPU","OMP","INTEL","property/atom","cmap","cmap3","rx"};
const char *exceptions[] =
{"GPU", "OMP", "INTEL", "property/atom", "cmap", "cmap3", "rx",
"deprecated", NULL};
if (domain->box_exist == 0) {
int m;
for (m = 0; m < NEXCEPT; m++)
for (m = 0; exceptions[m] != NULL; m++)
if (strcmp(arg[2],exceptions[m]) == 0) break;
if (m == NEXCEPT)
if (exceptions[m] == NULL)
error->all(FLERR,"Fix command before simulation box is defined");
}

57
src/pair_deprecated.cpp Normal file
View File

@ -0,0 +1,57 @@
/* ----------------------------------------------------------------------
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 "pair_deprecated.h"
#include "pair_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 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 style\n\n",0);
}
}

45
src/pair_deprecated.h Normal file
View File

@ -0,0 +1,45 @@
/* -*- 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 PAIR_CLASS
PairStyle(DEPRECATED,PairDeprecated)
#else
#ifndef LMP_PAIR_DEPRECATED_H
#define LMP_PAIR_DEPRECATED_H
#include "pair.h"
namespace LAMMPS_NS {
class PairDeprecated : public Pair {
public:
PairDeprecated(class LAMMPS *lmp) : Pair(lmp) {}
virtual ~PairDeprecated() {}
virtual void compute(int, int) {}
virtual void settings(int, char **);
virtual void coeff(int, char **) {}
};
}
#endif
#endif
/* ERROR/WARNING messages:
*/

View File

@ -281,7 +281,7 @@ void PairHybrid::settings(int narg, char **arg)
iarg = 0;
nstyles = 0;
while (iarg < narg) {
if (strcmp(arg[iarg],"hybrid") == 0)
if (strncmp(arg[iarg],"hybrid",6) == 0)
error->all(FLERR,"Pair style hybrid cannot have hybrid as an argument");
if (strcmp(arg[iarg],"none") == 0)
error->all(FLERR,"Pair style hybrid cannot have none as an argument");

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();

40
src/region_deprecated.cpp Normal file
View File

@ -0,0 +1,40 @@
/* ----------------------------------------------------------------------
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 "region_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 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);
}
}

50
src/region_deprecated.h Normal file
View File

@ -0,0 +1,50 @@
/* -*- 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 REGION_CLASS
// list all deprecated and removed region styles here
RegionStyle(DEPRECATED,RegionDeprecated)
#else
#ifndef LMP_REGION_DEPRECATED_H
#define LMP_REGION_DEPRECATED_H
#include "region.h"
namespace LAMMPS_NS {
class RegionDeprecated : public Region {
public:
RegionDeprecated(class LAMMPS *, int, char **);
~RegionDeprecated() {}
virtual void init() {}
virtual int inside(double, double, double) { return 0; }
virtual int surface_interior(double *, double) { return 0; }
virtual int surface_exterior(double *, double) { return 0; }
};
}
#endif
#endif
/* ERROR/WARNING messages:
E: This region command has been removed from LAMMPS
UNDOCUMENTED
*/