implement deprecated styles for bond, angle, dihedral, and improper

This commit is contained in:
Axel Kohlmeyer 2018-10-17 16:26:20 -04:00
parent 65ebbdada3
commit 2b0e474729
9 changed files with 416 additions and 39 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,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:
*/

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

@ -42,43 +42,4 @@ class PairDeprecated : public Pair {
/* 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.
*/