add pair_style deprecated and some tweaks for fix style

This commit is contained in:
Axel Kohlmeyer
2018-10-02 16:26:20 +02:00
parent dba8f9c62b
commit b481af51d6
5 changed files with 154 additions and 5 deletions

View File

@ -23,6 +23,16 @@ using namespace LAMMPS_NS;
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"

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

@ -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");
}

53
src/pair_deprecated.cpp Normal file
View File

@ -0,0 +1,53 @@
/* ----------------------------------------------------------------------
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 "pair_deprecated.h"
#include "pair_hybrid.h"
#include "comm.h"
#include "force.h"
#include "error.h"
using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */
PairDeprecated::PairDeprecated(LAMMPS *lmp) : Pair(lmp)
{
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 (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");
}

84
src/pair_deprecated.h Normal file
View File

@ -0,0 +1,84 @@
/* -*- 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 *);
virtual ~PairDeprecated() {};
virtual void compute(int, int) {};
virtual void settings(int, char **) {};
virtual void coeff(int, char **) {};
};
}
#endif
#endif
/* ERROR/WARNING messages:
E: Not all pairs processed in pair_style list
Not all interacting pairs for which coefficients were found. This can be intentional
and then you need to set the 'nocheck' option. If not, it usually means that the
communication cutoff is too small. This can be ameliorated by either increasing
the cutoff in the pair_style command or the communication cutoff.
E: Illegal ... command
Self-explanatory. Check the input script syntax and compare to the
documentation for the command. You can use -echo screen as a
command-line option when running LAMMPS to see the offending line.
E: Cannot open pair list file
Self-explanatory. The file with the list of pairs cannot be open for reading.
Check the path and permissions.
E: Incorrectly formatted ...
Self-explanatory. The content of the pair list file does not match the documented
format. Please re-read the documentation and carefully compare it to your file.
E: Unknown pair list potential style
Self-explanatory. You requested a potential type that is not yet implemented or have a typo.
E: Incorrect args for pair coefficients
Self-explanatory. Check the input script or data file.
E: Pair style list requires atom IDs
Self-explanatory. The pairs in the list are identified via atom IDs, so they need to be present.
E: Pair style list requires an atom map
Self-explanatory. Atoms are looked up via an atom map. Create one using the atom_style map command.
*/