replace references to fix ave/spatial with correct equivalents
This commit is contained in:
@ -120,14 +120,14 @@ int FixViscosity::setmask()
|
||||
|
||||
void FixViscosity::init()
|
||||
{
|
||||
// warn if any fix ave/spatial comes after this fix
|
||||
// warn if any fix ave/chunk comes after this fix
|
||||
// can cause glitch in averaging since ave will happen after swap
|
||||
|
||||
int foundme = 0;
|
||||
for (int i = 0; i < modify->nfix; i++) {
|
||||
if (modify->fix[i] == this) foundme = 1;
|
||||
if (foundme && strcmp(modify->fix[i]->style,"ave/spatial") == 0 && me == 0)
|
||||
error->warning(FLERR,"Fix viscosity comes before fix ave/spatial");
|
||||
for (const auto &ifix : modify->get_fix_list()) {
|
||||
if (ifix == this) foundme = 1;
|
||||
if (foundme && utils::strmatch(ifix->style,"^ave/chunk") && (me == 0))
|
||||
error->warning(FLERR,"Fix viscosity comes before fix ave/chunk");
|
||||
}
|
||||
|
||||
// set bounds of 2 slabs in pdim
|
||||
|
||||
@ -14,8 +14,6 @@
|
||||
|
||||
#include "fix_append_atoms.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
#include "atom.h"
|
||||
#include "atom_vec.h"
|
||||
#include "comm.h"
|
||||
@ -27,11 +25,13 @@
|
||||
#include "error.h"
|
||||
#include "force.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
using namespace FixConst;
|
||||
|
||||
#define BIG 1.0e30
|
||||
#define EPSILON 1.0e-6
|
||||
static constexpr double BIG = 1.0e30;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
@ -43,7 +43,7 @@ FixAppendAtoms::FixAppendAtoms(LAMMPS *lmp, int narg, char **arg) :
|
||||
next_reneighbor = -1;
|
||||
time_depend = 1;
|
||||
|
||||
if (narg < 4) error->all(FLERR,"Illegal fix append/atoms command");
|
||||
if (narg < 4) utils::missing_cmd_args(FLERR,"fix append/atoms", error);
|
||||
|
||||
// default settings
|
||||
|
||||
@ -121,8 +121,7 @@ FixAppendAtoms::FixAppendAtoms(LAMMPS *lmp, int narg, char **arg) :
|
||||
} else if (strcmp(arg[iarg],"spatial") == 0) {
|
||||
if (iarg+3 > narg) error->all(FLERR,"Illegal fix append/atoms command");
|
||||
if (strcmp(arg[iarg+1],"f_") == 0)
|
||||
error->all(FLERR,
|
||||
"Bad fix ID in fix append/atoms command");
|
||||
error->all(FLERR, "Bad fix ID in fix append/atoms command");
|
||||
spatflag = 1;
|
||||
spatialid = utils::strdup(arg[iarg+1]+2);
|
||||
spatlead = utils::numeric(FLERR,arg[iarg+2],false,lmp);
|
||||
@ -208,14 +207,14 @@ FixAppendAtoms::FixAppendAtoms(LAMMPS *lmp, int narg, char **arg) :
|
||||
|
||||
FixAppendAtoms::~FixAppendAtoms()
|
||||
{
|
||||
delete [] basistype;
|
||||
delete[] basistype;
|
||||
|
||||
if (ranflag) delete randomx;
|
||||
if (spatflag) delete[] spatialid;
|
||||
if (tempflag) {
|
||||
delete randomt;
|
||||
delete [] gfactor1;
|
||||
delete [] gfactor2;
|
||||
delete[] gfactor1;
|
||||
delete[] gfactor2;
|
||||
}
|
||||
}
|
||||
|
||||
@ -239,22 +238,30 @@ void FixAppendAtoms::initial_integrate(int /*vflag*/)
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void FixAppendAtoms::init()
|
||||
{
|
||||
if (spatflag) {
|
||||
Fix *ifix = modify->get_fix_by_id(spatialid);
|
||||
if (!ifix) error->all(FLERR,"Fix ID {} for fix ave/chunk does not exist", spatialid);
|
||||
if (!utils::strmatch(ifix->style, "^ave/chunk"))
|
||||
error->all(FLERR,"Fix {} for spatial keyword is not fix style ave/chunk", spatialid);}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void FixAppendAtoms::setup(int vflag)
|
||||
{
|
||||
/*** CALL TO CREATE GROUP? SEE POST_FORCE ***/
|
||||
post_force(vflag);
|
||||
}
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
int FixAppendAtoms::get_spatial()
|
||||
{
|
||||
if (update->ntimestep % freq == 0) {
|
||||
int ifix = modify->find_fix(spatialid);
|
||||
if (ifix < 0)
|
||||
error->all(FLERR,"Fix ID for fix ave/spatial does not exist");
|
||||
Fix *fix = modify->fix[ifix];
|
||||
Fix *fix = modify->get_fix_by_id(spatialid);
|
||||
if (!fix) error->all(FLERR,"Fix ID {} for fix ave/chunk does not exist", spatialid);
|
||||
|
||||
int failed = 0;
|
||||
int count = 0;
|
||||
@ -319,8 +326,8 @@ int FixAppendAtoms::get_spatial()
|
||||
|
||||
if (domain->boxhi[2] - shockfront_loc < spatlead) advance = 1;
|
||||
|
||||
delete [] pos;
|
||||
delete [] val;
|
||||
delete[] pos;
|
||||
delete[] val;
|
||||
}
|
||||
|
||||
advance_sum = 0;
|
||||
@ -433,22 +440,14 @@ void FixAppendAtoms::pre_exchange()
|
||||
xmin = ymin = zmin = BIG;
|
||||
xmax = ymax = zmax = -BIG;
|
||||
|
||||
domain->lattice->bbox(1,bboxlo[0],bboxlo[1],bboxlo[2],
|
||||
xmin,ymin,zmin,xmax,ymax,zmax);
|
||||
domain->lattice->bbox(1,bboxhi[0],bboxlo[1],bboxlo[2],
|
||||
xmin,ymin,zmin,xmax,ymax,zmax);
|
||||
domain->lattice->bbox(1,bboxlo[0],bboxhi[1],bboxlo[2],
|
||||
xmin,ymin,zmin,xmax,ymax,zmax);
|
||||
domain->lattice->bbox(1,bboxhi[0],bboxhi[1],bboxlo[2],
|
||||
xmin,ymin,zmin,xmax,ymax,zmax);
|
||||
domain->lattice->bbox(1,bboxlo[0],bboxlo[1],bboxhi[2],
|
||||
xmin,ymin,zmin,xmax,ymax,zmax);
|
||||
domain->lattice->bbox(1,bboxhi[0],bboxlo[1],bboxhi[2],
|
||||
xmin,ymin,zmin,xmax,ymax,zmax);
|
||||
domain->lattice->bbox(1,bboxlo[0],bboxhi[1],bboxhi[2],
|
||||
xmin,ymin,zmin,xmax,ymax,zmax);
|
||||
domain->lattice->bbox(1,bboxhi[0],bboxhi[1],bboxhi[2],
|
||||
xmin,ymin,zmin,xmax,ymax,zmax);
|
||||
domain->lattice->bbox(1,bboxlo[0],bboxlo[1],bboxlo[2],xmin,ymin,zmin,xmax,ymax,zmax);
|
||||
domain->lattice->bbox(1,bboxhi[0],bboxlo[1],bboxlo[2],xmin,ymin,zmin,xmax,ymax,zmax);
|
||||
domain->lattice->bbox(1,bboxlo[0],bboxhi[1],bboxlo[2],xmin,ymin,zmin,xmax,ymax,zmax);
|
||||
domain->lattice->bbox(1,bboxhi[0],bboxhi[1],bboxlo[2],xmin,ymin,zmin,xmax,ymax,zmax);
|
||||
domain->lattice->bbox(1,bboxlo[0],bboxlo[1],bboxhi[2],xmin,ymin,zmin,xmax,ymax,zmax);
|
||||
domain->lattice->bbox(1,bboxhi[0],bboxlo[1],bboxhi[2],xmin,ymin,zmin,xmax,ymax,zmax);
|
||||
domain->lattice->bbox(1,bboxlo[0],bboxhi[1],bboxhi[2],xmin,ymin,zmin,xmax,ymax,zmax);
|
||||
domain->lattice->bbox(1,bboxhi[0],bboxhi[1],bboxhi[2],xmin,ymin,zmin,xmax,ymax,zmax);
|
||||
|
||||
int ilo,ihi,jlo,jhi,klo,khi;
|
||||
ilo = static_cast<int> (xmin);
|
||||
|
||||
@ -29,6 +29,7 @@ class FixAppendAtoms : public Fix {
|
||||
FixAppendAtoms(class LAMMPS *, int, char **);
|
||||
~FixAppendAtoms() override;
|
||||
int setmask() override;
|
||||
void init() override;
|
||||
void setup(int) override;
|
||||
void pre_exchange() override;
|
||||
void initial_integrate(int) override;
|
||||
|
||||
@ -303,8 +303,8 @@ void ComputeCentroidStressAtom::compute_peratom()
|
||||
// add in per-atom contributions from relevant fixes
|
||||
// skip if vatom = nullptr
|
||||
// possible during setup phase if fix has not initialized its vatom yet
|
||||
// e.g. fix ave/spatial defined before fix shake,
|
||||
// and fix ave/spatial uses a per-atom stress from this compute as input
|
||||
// e.g. fix ave/chunk defined before fix shake,
|
||||
// and fix ave/chunk uses a per-atom stress from this compute as input
|
||||
// fix styles are CENTROID_SAME, CENTROID_AVAIL or CENTROID_NOTAVAIL
|
||||
|
||||
if (fixflag) {
|
||||
|
||||
@ -216,8 +216,8 @@ void ComputeStressAtom::compute_peratom()
|
||||
// add in per-atom contributions from relevant fixes
|
||||
// skip if vatom = nullptr
|
||||
// possible during setup phase if fix has not initialized its vatom yet
|
||||
// e.g. fix ave/spatial defined before fix shake,
|
||||
// and fix ave/spatial uses a per-atom stress from this compute as input
|
||||
// e.g. fix ave/chunk defined before fix shake,
|
||||
// and fix ave/chunk uses a per-atom stress from this compute as input
|
||||
|
||||
if (fixflag) {
|
||||
for (auto &ifix : modify->get_fix_list())
|
||||
|
||||
@ -485,7 +485,7 @@ void FixAveChunk::init()
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
only does averaging if nvalid = current timestep
|
||||
do not call setup_chunks(), even though fix ave/spatial called setup_bins()
|
||||
do not call setup_chunks(), even though fix ave/chunk called setup_bins()
|
||||
b/c could cause nchunk to change if Nfreq epoch crosses 2 runs
|
||||
does mean that if change_box is used between runs to change box size,
|
||||
that nchunk may not track it
|
||||
|
||||
@ -1081,17 +1081,17 @@ void FixAveTime::options(int iarg, int narg, char **arg)
|
||||
format = format_user;
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"title1") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/spatial command");
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/time command");
|
||||
delete[] title1;
|
||||
title1 = utils::strdup(arg[iarg+1]);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"title2") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/spatial command");
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/time command");
|
||||
delete[] title2;
|
||||
title2 = utils::strdup(arg[iarg+1]);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"title3") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/spatial command");
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/time command");
|
||||
delete[] title3;
|
||||
title3 = utils::strdup(arg[iarg+1]);
|
||||
iarg += 2;
|
||||
|
||||
Reference in New Issue
Block a user