diff --git a/doc/src/compute_viscosity_cos.rst b/doc/src/compute_viscosity_cos.rst index 7c0d130a7a..37b51416c0 100644 --- a/doc/src/compute_viscosity_cos.rst +++ b/doc/src/compute_viscosity_cos.rst @@ -137,6 +137,8 @@ Restrictions """""""""""" This command is only available when LAMMPS was built with the USER-MISC package. +This this depends on :doc:`fix accelerate/cos ` which can +only work for 3d systems, this compute cannot be used for 2d systems. Related commands """""""""""""""" diff --git a/doc/src/fix_accelerate_cos.rst b/doc/src/fix_accelerate_cos.rst index e1047dd455..b8d1cca59c 100644 --- a/doc/src/fix_accelerate_cos.rst +++ b/doc/src/fix_accelerate_cos.rst @@ -86,6 +86,7 @@ Restrictions """""""""""" This command is only available when LAMMPS was built with the USER-MISC package. +Since this fix depends on the z-coordinate of atoms, it cannot be used in 2d simulations. Related commands """""""""""""""" diff --git a/src/USER-MISC/fix_accelerate_cos.cpp b/src/USER-MISC/fix_accelerate_cos.cpp index 73a154255a..0d3b66d3f5 100644 --- a/src/USER-MISC/fix_accelerate_cos.cpp +++ b/src/USER-MISC/fix_accelerate_cos.cpp @@ -38,11 +38,8 @@ FixAccelerateCos::FixAccelerateCos(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) { if (narg < 4) error->all(FLERR, "Illegal fix accelerate/cos command"); acceleration = force->numeric(FLERR, arg[3]); -} - -/* ---------------------------------------------------------------------- */ - -FixAccelerateCos::~FixAccelerateCos() { + if (domain->dimension == 2) + error->all(FLERR,"Fix accelerate/cos cannot be used with 2d systems"); } /* ---------------------------------------------------------------------- */ @@ -55,11 +52,6 @@ int FixAccelerateCos::setmask() { /* ---------------------------------------------------------------------- */ -void FixAccelerateCos::init() { -} - -/* ---------------------------------------------------------------------- */ - void FixAccelerateCos::setup(int vflag) { post_force(vflag); } diff --git a/src/USER-MISC/fix_accelerate_cos.h b/src/USER-MISC/fix_accelerate_cos.h index c1355d737c..e1e6c9f1b9 100644 --- a/src/USER-MISC/fix_accelerate_cos.h +++ b/src/USER-MISC/fix_accelerate_cos.h @@ -31,9 +31,9 @@ namespace LAMMPS_NS { class FixAccelerateCos: public Fix { public: FixAccelerateCos(class LAMMPS *, int, char **); - virtual ~FixAccelerateCos(); + virtual ~FixAccelerateCos() {}; int setmask(); - virtual void init(); + virtual void init() {}; void setup(int); virtual void post_force(int); @@ -54,4 +54,8 @@ 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: Fix accelerate/cos cannot be used with 2d systems + +Self-explanatory. + */