diff --git a/src/fix_pair_tracker.cpp b/src/MISC/fix_pair_tracker.cpp old mode 100755 new mode 100644 similarity index 88% rename from src/fix_pair_tracker.cpp rename to src/MISC/fix_pair_tracker.cpp index 37d27009cc..884a3b8ebd --- a/src/fix_pair_tracker.cpp +++ b/src/MISC/fix_pair_tracker.cpp @@ -42,6 +42,7 @@ FixPairTracker::FixPairTracker(LAMMPS *lmp, int narg, char **arg) : nevery = utils::inumeric(FLERR,arg[3],false,lmp); if (nevery <= 0) error->all(FLERR,"Illegal fix pair/tracker command"); + local_freq = nevery; // If optional arguments included, this will be oversized nvalues = narg - 4; @@ -71,17 +72,17 @@ FixPairTracker::FixPairTracker(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg],"z") == 0) { pack_choice[nvalues++] = &FixPairTracker::pack_z; - } else if (strcmp(arg[iarg],"rmin") == 0) { + } else if (strcmp(arg[iarg],"r/min") == 0) { pack_choice[nvalues++] = &FixPairTracker::pack_rmin; - } else if (strcmp(arg[iarg],"rave") == 0) { + } else if (strcmp(arg[iarg],"r/ave") == 0) { pack_choice[nvalues++] = &FixPairTracker::pack_rave; - } else if (strcmp(arg[iarg],"tmin") == 0) { + } else if (strcmp(arg[iarg],"time/min") == 0) { if (iarg + 1 >= narg) error->all(FLERR, "Invalid keyword in fix pair/tracker command"); tmin = utils::numeric(FLERR,arg[iarg+1],false,lmp); iarg ++; - } else if (strcmp(arg[iarg],"filter") == 0) { + } else if (strcmp(arg[iarg],"type/include") == 0) { if (iarg + 1 >= narg) error->all(FLERR, "Invalid keyword in fix pair/tracker command"); int ntypes = atom->ntypes; @@ -173,16 +174,19 @@ void FixPairTracker::init() // Set size of array/vector ncount = 0; - if (ncount > nmax) { - reallocate(ncount);} + if (ncount > nmax) + reallocate(ncount); + size_local_rows = ncount; } /* ---------------------------------------------------------------------- */ -void FixPairTracker::lost_contact(int i, int j, double n, double rs, double rm) +void FixPairTracker::lost_contact(int i, int j, double nstep_tmp, double rsum_tmp, double time_tmp) { - if ((update->ntimestep-n) < tmin) return; + + double time = update->atime + (update->ntimestep-update->atimestep)*update->dt; + if ((time-time_tmp) < tmin) return; if (type_filter) { int *type = atom->type; @@ -198,9 +202,9 @@ void FixPairTracker::lost_contact(int i, int j, double n, double rs, double rm) index_i = i; index_j = j; - rmin = rm; - rsum = rs; - ntimestep = n; + rmin = rmin_tmp; + rsum = rsum_tmp; + time_initial = time_tmp; // fill vector or array with local values if (nvalues == 1) { @@ -233,10 +237,10 @@ void FixPairTracker::reallocate(int n) while (nmax <= n) nmax += DELTA; if (nvalues == 1) { - memory->grow(vector,nmax,"fix_broken_bonds:vector"); + memory->grow(vector,nmax,"fix_pair_tracker:vector"); vector_local = vector; } else { - memory->grow(array,nmax,nvalues,"fix_broken_bonds:array"); + memory->grow(array,nmax,nvalues,"fix_pair_tracker:array"); array_local = array; } } @@ -263,29 +267,31 @@ double FixPairTracker::memory_usage() void FixPairTracker::pack_time_created(int n) { if (nvalues == 1) - vector[ncount] = ntimestep; + vector[ncount] = time_initial; else - array[ncount][n] = ntimestep; + array[ncount][n] = time_initial; } /* ---------------------------------------------------------------------- */ void FixPairTracker::pack_time_broken(int n) { + double time = update->atime + (update->ntimestep-update->atimestep)*update->dt; if (nvalues == 1) - vector[ncount] = update->ntimestep; + vector[ncount] = time; else - array[ncount][n] = update->ntimestep; + array[ncount][n] = time; } /* ---------------------------------------------------------------------- */ void FixPairTracker::pack_time_total(int n) { + double time = update->atime + (update->ntimestep-update->atimestep)*update->dt; if (nvalues == 1) - vector[ncount] = update->ntimestep-ntimestep; + vector[ncount] = time-time_initial; else - array[ncount][n] = update->ntimestep-ntimestep; + array[ncount][n] = time-time_initial; } @@ -366,7 +372,7 @@ void FixPairTracker::pack_rmin(int n) void FixPairTracker::pack_rave(int n) { if (nvalues == 1) - vector[ncount] = rsum/(update->ntimestep-ntimestep); + vector[ncount] = rsum/(update->ntimestep-nstep_initial); else - array[ncount][n] = rsum/(update->ntimestep-ntimestep); + array[ncount][n] = rsum/(update->ntimestep-nstep_initial); } diff --git a/src/fix_pair_tracker.h b/src/MISC/fix_pair_tracker.h old mode 100755 new mode 100644 similarity index 98% rename from src/fix_pair_tracker.h rename to src/MISC/fix_pair_tracker.h index 7eb1161032..a5a282df8e --- a/src/fix_pair_tracker.h +++ b/src/MISC/fix_pair_tracker.h @@ -39,7 +39,7 @@ class FixPairTracker : public Fix { int nmax, tmin; int store_flag; int index_i, index_j; - double rmin, rsum, ntimestep; + double rmin, rsum, time_initial; double *vector; double **array; diff --git a/src/pair_tracker.cpp b/src/MISC/pair_tracker.cpp similarity index 95% rename from src/pair_tracker.cpp rename to src/MISC/pair_tracker.cpp index 8998d894fe..33154a7fb6 100644 --- a/src/pair_tracker.cpp +++ b/src/MISC/pair_tracker.cpp @@ -11,15 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -/* ---------------------------------------------------------------------- - Contributing authors: Leo Silbert (SNL), Gary Grest (SNL) -------------------------------------------------------------------------- */ - #include "pair_tracker.h" -#include -#include - #include "atom.h" #include "force.h" #include "update.h" @@ -28,7 +21,6 @@ #include "fix_dummy.h" #include "fix_neigh_history.h" #include "fix_pair_tracker.h" -#include "comm.h" #include "neighbor.h" #include "neigh_list.h" #include "neigh_request.h" @@ -39,17 +31,16 @@ using namespace LAMMPS_NS; #define RLARGE 100 - /* ---------------------------------------------------------------------- */ PairTracker::PairTracker(LAMMPS *lmp) : Pair(lmp) { single_enable = 1; no_virial_fdotr_compute = 1; - history = 1; - size_history = 3; neighprev = 0; + history = 1; + size_history = 3; nondefault_history_transfer = 1; finitecutflag = 0; @@ -58,7 +49,7 @@ PairTracker::PairTracker(LAMMPS *lmp) : Pair(lmp) // this is so final order of Modify:fix will conform to input script fix_history = nullptr; - modify->add_fix("NEIGH_HISTORY_TRACK_DUMMY all DUMMY"); + modify->add_fix("NEIGH_HISTORY_TRACK_DUMMY"); fix_dummy = (FixDummy *) modify->fix[modify->nfix-1]; } @@ -86,7 +77,7 @@ PairTracker::~PairTracker() void PairTracker::compute(int eflag, int vflag) { int i,j,ii,jj,inum,jnum,itype,jtype; - double xtmp,ytmp,ztmp,delx,dely,delz; + double xtmp,ytmp,ztmp,delx,dely,delz,time; double radi,radj,radsum,rsq,r; int *ilist,*jlist,*numneigh,**firstneigh; int *touch,**firsttouch; @@ -144,14 +135,15 @@ void PairTracker::compute(int eflag, int vflag) } touch[jj] = 0; data[0] = 0.0; // initial time - data[1] = 0.0; // sum of r + data[1] = 0.0; // sum of r, may overflow data[2] = 0.0; // min of r } else { data = &alldata[size_history*jj]; if (touch[jj] == 0) { - data[0] = update->ntimestep; + time = update->atime + (update->ntimestep-update->atimestep)*update->dt; + data[0] = time; data[1] = 0.0; data[2] = RLARGE; } @@ -173,14 +165,15 @@ void PairTracker::compute(int eflag, int vflag) } touch[jj] = 0; data[0] = 0.0; // initial time - data[1] = 0.0; // sum of r + data[1] = 0.0; // sum of r, may overflow data[2] = 0.0; // min of r } else { data = &alldata[size_history*jj]; if (touch[jj] == 0) { - data[0] = update->ntimestep; + time = update->atime + (update->ntimestep-update->atimestep)*update->dt; + data[0] = time; data[1] = 0.0; data[2] = RLARGE; } @@ -195,9 +188,6 @@ void PairTracker::compute(int eflag, int vflag) } } } - - if (vflag_fdotr) virial_fdotr_compute(); - } /* ---------------------------------------------------------------------- @@ -232,7 +222,7 @@ void PairTracker::settings(int narg, char **arg) if (narg != 0 && narg != 1) error->all(FLERR,"Illegal pair_style command"); if (narg == 1) { - if (strcmp(arg[0], "radius") == 0) finitecutflag = 1; + if (strcmp(arg[0], "finite") == 0) finitecutflag = 1; else error->all(FLERR,"Illegal pair_style command"); } } @@ -379,11 +369,10 @@ double PairTracker::init_one(int i, int j) } cut[j][i] = cut[i][j]; - - double cutoff; // if finite, cutoff = sum of max I,J radii for // dynamic/dynamic & dynamic/frozen interactions, but not frozen/frozen + double cutoff; if (finitecutflag) { cutoff = maxrad_dynamic[i]+maxrad_dynamic[j]; cutoff = MAX(cutoff,maxrad_frozen[i]+maxrad_dynamic[j]); diff --git a/src/pair_tracker.h b/src/MISC/pair_tracker.h similarity index 82% rename from src/pair_tracker.h rename to src/MISC/pair_tracker.h index f71a7d4eb6..dced79977d 100644 --- a/src/pair_tracker.h +++ b/src/MISC/pair_tracker.h @@ -76,26 +76,16 @@ E: Incorrect args for pair coefficients Self-explanatory. Check the input script or data file. -E: Pair granular requires atom attributes radius, rmass +E: Pair tracker requires atom attribute radius for finite cutoffs The atom style defined does not have these attributes. -E: Pair granular requires ghost atoms store velocity - -Use the comm_modify vel yes command to enable this. - E: Could not find pair fix neigh history ID -UNDOCUMENTED +The associated fix neigh/history is missing -U: Pair granular with shear history requires newton pair off +E: Cannot use pair tracker without fix pair/tracker -This is a current restriction of the implementation of pair -granular styles with history. - -U: Could not find pair fix ID - -A fix is created internally by the pair style to store shear -history information. You cannot delete it. +This pairstyle requires one to define a pair/tracker fix */