git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@8306 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
@ -49,13 +49,8 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) :
|
||||
if (!atom->sphere_flag)
|
||||
error->all(FLERR,"Fix wall/gran requires atom style sphere");
|
||||
|
||||
// set time_depend so that history will be preserved correctly
|
||||
// across multiple runs via laststep setting in granular pair styles
|
||||
// same as fix shear/history
|
||||
|
||||
restart_peratom = 1;
|
||||
create_attribute = 1;
|
||||
time_depend = 1;
|
||||
|
||||
// wall/particle coefficients
|
||||
|
||||
@ -184,7 +179,6 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) :
|
||||
shear[i][0] = shear[i][1] = shear[i][2] = 0.0;
|
||||
|
||||
time_origin = update->ntimestep;
|
||||
laststep = -1;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
@ -289,8 +283,8 @@ void FixWallGran::post_force(int vflag)
|
||||
int *mask = atom->mask;
|
||||
int nlocal = atom->nlocal;
|
||||
|
||||
if (update->ntimestep > laststep) shearupdate = 1;
|
||||
else shearupdate = 0;
|
||||
int shearupdate = 1;
|
||||
if (update->setupflag) shearupdate = 0;
|
||||
|
||||
for (int i = 0; i < nlocal; i++) {
|
||||
if (mask[i] & groupbit) {
|
||||
@ -348,8 +342,6 @@ void FixWallGran::post_force(int vflag)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
laststep = update->ntimestep;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
@ -55,7 +55,6 @@ class FixWallGran : public Fix {
|
||||
int nlevels_respa;
|
||||
int time_origin;
|
||||
|
||||
bigint laststep;
|
||||
int *touch;
|
||||
double **shear;
|
||||
int shearupdate;
|
||||
|
||||
@ -53,8 +53,9 @@ void PairGranHertzHistory::compute(int eflag, int vflag)
|
||||
if (eflag || vflag) ev_setup(eflag,vflag);
|
||||
else evflag = vflag_fdotr = 0;
|
||||
|
||||
int shearupdate = 0;
|
||||
if (update->ntimestep > laststep) shearupdate = 1;
|
||||
computeflag = 1;
|
||||
int shearupdate = 1;
|
||||
if (update->setupflag) shearupdate = 0;
|
||||
|
||||
double **x = atom->x;
|
||||
double **v = atom->v;
|
||||
@ -243,8 +244,6 @@ void PairGranHertzHistory::compute(int eflag, int vflag)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
laststep = update->ntimestep;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
||||
@ -51,7 +51,7 @@ PairGranHookeHistory::PairGranHookeHistory(LAMMPS *lmp) : Pair(lmp)
|
||||
single_extra = 4;
|
||||
svector = new double[4];
|
||||
|
||||
laststep = -1;
|
||||
computeflag = 0;
|
||||
neighprev = 0;
|
||||
}
|
||||
|
||||
@ -94,8 +94,9 @@ void PairGranHookeHistory::compute(int eflag, int vflag)
|
||||
if (eflag || vflag) ev_setup(eflag,vflag);
|
||||
else evflag = vflag_fdotr = 0;
|
||||
|
||||
int shearupdate = 0;
|
||||
if (update->ntimestep > laststep) shearupdate = 1;
|
||||
computeflag = 1;
|
||||
int shearupdate = 1;
|
||||
if (update->setupflag) shearupdate = 0;
|
||||
|
||||
double **x = atom->x;
|
||||
double **v = atom->v;
|
||||
@ -283,8 +284,6 @@ void PairGranHookeHistory::compute(int eflag, int vflag)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
laststep = update->ntimestep;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
@ -393,7 +392,8 @@ void PairGranHookeHistory::init_style()
|
||||
// if first init, create Fix needed for storing shear history
|
||||
|
||||
if (history && force->newton_pair == 1)
|
||||
error->all(FLERR,"Pair granular with shear history requires newton pair off");
|
||||
error->all(FLERR,
|
||||
"Pair granular with shear history requires newton pair off");
|
||||
|
||||
if (history && fix_history == NULL) {
|
||||
char **fixarg = new char*[3];
|
||||
|
||||
@ -26,6 +26,8 @@ namespace LAMMPS_NS {
|
||||
|
||||
class PairGranHookeHistory : public Pair {
|
||||
public:
|
||||
int computeflag;
|
||||
|
||||
PairGranHookeHistory(class LAMMPS *);
|
||||
virtual ~PairGranHookeHistory();
|
||||
virtual void compute(int, int);
|
||||
@ -48,15 +50,12 @@ class PairGranHookeHistory : public Pair {
|
||||
int freeze_group_bit;
|
||||
int history;
|
||||
|
||||
bigint laststep;
|
||||
class FixShearHistory *fix_history;
|
||||
|
||||
char *suffix;
|
||||
|
||||
int neighprev;
|
||||
double *onerad_dynamic,*onerad_frozen;
|
||||
double *maxrad_dynamic,*maxrad_frozen;
|
||||
|
||||
int neighprev;
|
||||
class FixShearHistory *fix_history;
|
||||
|
||||
void allocate();
|
||||
};
|
||||
|
||||
@ -117,6 +117,7 @@ class Fix : protected Pointers {
|
||||
virtual void post_force_respa(int, int, int) {}
|
||||
virtual void final_integrate_respa(int, int) {}
|
||||
|
||||
virtual void min_setup_pre_exchange() {}
|
||||
virtual void min_setup_pre_force(int) {}
|
||||
virtual void min_pre_exchange() {}
|
||||
virtual void min_pre_force(int) {}
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
#include "neighbor.h"
|
||||
#include "neigh_list.h"
|
||||
#include "force.h"
|
||||
#include "pair.h"
|
||||
#include "pair_gran_hooke_history.h"
|
||||
#include "update.h"
|
||||
#include "modify.h"
|
||||
#include "memory.h"
|
||||
@ -34,12 +34,8 @@ using namespace FixConst;
|
||||
FixShearHistory::FixShearHistory(LAMMPS *lmp, int narg, char **arg) :
|
||||
Fix(lmp, narg, arg)
|
||||
{
|
||||
// set time_depend so that history will be preserved correctly
|
||||
// across multiple runs via laststep setting in granular pair styles
|
||||
|
||||
restart_peratom = 1;
|
||||
create_attribute = 1;
|
||||
time_depend = 1;
|
||||
|
||||
// perform initial allocation of atom-based arrays
|
||||
// register with atom class
|
||||
@ -79,6 +75,7 @@ int FixShearHistory::setmask()
|
||||
{
|
||||
int mask = 0;
|
||||
mask |= PRE_EXCHANGE;
|
||||
mask |= MIN_PRE_EXCHANGE;
|
||||
return mask;
|
||||
}
|
||||
|
||||
@ -91,16 +88,30 @@ void FixShearHistory::init()
|
||||
"Pair style granular with history requires atoms have IDs");
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
/* ----------------------------------------------------------------------
|
||||
called by setup of run or minimize
|
||||
called by write_restart as input script command
|
||||
only invoke pre_exchange() if neigh list stores more current history info
|
||||
than npartner/partner arrays in this fix
|
||||
that will only be case if pair->compute() has been invoked since
|
||||
upate of npartner/npartner
|
||||
this logic avoids 2 problems:
|
||||
run 100; write_restart; run 100
|
||||
setup_pre_exchange is called twice (by write_restart and 2nd run setup)
|
||||
w/out a neighbor list being created in between
|
||||
read_restart; run 100
|
||||
setup_pre_exchange called by run setup whacks restart shear history info
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void FixShearHistory::setup_pre_exchange()
|
||||
{
|
||||
pre_exchange();
|
||||
if (pair->computeflag) pre_exchange();
|
||||
pair->computeflag = 0;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
copy shear partner info from neighbor lists to atom arrays
|
||||
so can be exchanged with atoms
|
||||
so can be migrated or stored with atoms
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void FixShearHistory::pre_exchange()
|
||||
@ -111,23 +122,14 @@ void FixShearHistory::pre_exchange()
|
||||
double *shear,*allshear,**firstshear;
|
||||
|
||||
// zero npartner for all current atoms
|
||||
// do not do this if inum = 0, since will wipe out npartner counts
|
||||
// inum is 0 when pre_exchange() is called from integrate->setup()
|
||||
// before first run when no neighbor lists yet exist
|
||||
// partner info may have just been read from restart file
|
||||
// and won't be used until granular neighbor lists are built
|
||||
// if nothing read from restart file, constructor sets npartner = 0
|
||||
|
||||
NeighList *list = pair->list;
|
||||
int nlocal = atom->nlocal;
|
||||
|
||||
if (list->inum)
|
||||
for (i = 0; i < nlocal; i++)
|
||||
npartner[i] = 0;
|
||||
for (i = 0; i < nlocal; i++) npartner[i] = 0;
|
||||
|
||||
// copy shear info from neighbor list atoms to atom arrays
|
||||
|
||||
int *tag = atom->tag;
|
||||
NeighList *list = pair->list;
|
||||
inum = list->inum;
|
||||
ilist = list->ilist;
|
||||
numneigh = list->numneigh;
|
||||
@ -180,6 +182,21 @@ void FixShearHistory::pre_exchange()
|
||||
error->all(FLERR,"Too many touching neighbors - boost MAXTOUCH");
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void FixShearHistory::min_setup_pre_exchange()
|
||||
{
|
||||
if (pair->computeflag) pre_exchange();
|
||||
pair->computeflag = 0;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void FixShearHistory::min_pre_exchange()
|
||||
{
|
||||
pre_exchange();
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
memory usage of local atom-based arrays
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
@ -36,6 +36,8 @@ class FixShearHistory : public Fix {
|
||||
void init();
|
||||
void setup_pre_exchange();
|
||||
virtual void pre_exchange();
|
||||
void min_setup_pre_exchange();
|
||||
void min_pre_exchange();
|
||||
|
||||
double memory_usage();
|
||||
void grow_arrays(int);
|
||||
@ -53,7 +55,7 @@ class FixShearHistory : public Fix {
|
||||
int **partner; // tags for the partners
|
||||
double ***shearpartner; // 3 shear values with the partner
|
||||
|
||||
class Pair *pair;
|
||||
class PairGranHookeHistory *pair;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@ -189,6 +189,8 @@ void Min::setup()
|
||||
{
|
||||
if (comm->me == 0 && screen) fprintf(screen,"Setting up minimization ...\n");
|
||||
|
||||
update->setupflag = 1;
|
||||
|
||||
// setup extra global dof due to fixes
|
||||
// cannot be done in init() b/c update init() is before modify init()
|
||||
|
||||
@ -222,6 +224,7 @@ void Min::setup()
|
||||
// build neighbor lists
|
||||
|
||||
atom->setup();
|
||||
modify->setup_pre_exchange();
|
||||
if (triclinic) domain->x2lamda(atom->nlocal);
|
||||
domain->pbc();
|
||||
domain->reset_box();
|
||||
@ -279,6 +282,7 @@ void Min::setup()
|
||||
|
||||
modify->setup(vflag);
|
||||
output->setup();
|
||||
update->setupflag = 0;
|
||||
|
||||
// stats for Finish to print
|
||||
|
||||
@ -299,11 +303,14 @@ void Min::setup()
|
||||
|
||||
void Min::setup_minimal(int flag)
|
||||
{
|
||||
update->setupflag = 1;
|
||||
|
||||
// setup domain, communication and neighboring
|
||||
// acquire ghosts
|
||||
// build neighbor lists
|
||||
|
||||
if (flag) {
|
||||
modify->setup_pre_exchange();
|
||||
if (triclinic) domain->x2lamda(atom->nlocal);
|
||||
domain->pbc();
|
||||
domain->reset_box();
|
||||
@ -351,6 +358,7 @@ void Min::setup_minimal(int flag)
|
||||
requestor[m]->min_xf_get(m);
|
||||
|
||||
modify->setup(vflag);
|
||||
update->setupflag = 0;
|
||||
|
||||
// stats for Finish to print
|
||||
|
||||
|
||||
@ -235,8 +235,12 @@ void Modify::setup(int vflag)
|
||||
|
||||
void Modify::setup_pre_exchange()
|
||||
{
|
||||
for (int i = 0; i < n_pre_exchange; i++)
|
||||
fix[list_pre_exchange[i]]->setup_pre_exchange();
|
||||
if (update->whichflag == 1)
|
||||
for (int i = 0; i < n_pre_exchange; i++)
|
||||
fix[list_pre_exchange[i]]->setup_pre_exchange();
|
||||
else if (update->whichflag == 2)
|
||||
for (int i = 0; i < n_min_pre_exchange; i++)
|
||||
fix[list_min_pre_exchange[i]]->min_setup_pre_exchange();
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
||||
@ -64,7 +64,6 @@ class Modify : protected Pointers {
|
||||
void post_force_respa(int, int, int);
|
||||
void final_integrate_respa(int, int);
|
||||
|
||||
void setup_min_pre_force(int);
|
||||
void min_pre_exchange();
|
||||
void min_pre_force(int);
|
||||
void min_post_force(int);
|
||||
|
||||
@ -418,6 +418,7 @@ void Respa::setup_minimal(int flag)
|
||||
// build neighbor lists
|
||||
|
||||
if (flag) {
|
||||
modify->setup_pre_exchange();
|
||||
if (triclinic) domain->x2lamda(atom->nlocal);
|
||||
domain->pbc();
|
||||
domain->reset_box();
|
||||
|
||||
@ -158,6 +158,7 @@ void Verlet::setup_minimal(int flag)
|
||||
// build neighbor lists
|
||||
|
||||
if (flag) {
|
||||
modify->setup_pre_exchange();
|
||||
if (triclinic) domain->x2lamda(atom->nlocal);
|
||||
domain->pbc();
|
||||
domain->reset_box();
|
||||
|
||||
@ -95,12 +95,11 @@ void WriteRestart::command(int narg, char **arg)
|
||||
lmp->init();
|
||||
|
||||
// move atoms to new processors before writing file
|
||||
// do pre_exchange so FixShearHistory will store
|
||||
// current neigh info with atoms
|
||||
// do setup_pre_exchange to force update of per-atom info if needed
|
||||
// enforce PBC in case atoms are outside box
|
||||
// call borders() to rebuild atom map since exchange() destroys map
|
||||
|
||||
if (modify->n_pre_exchange) modify->pre_exchange();
|
||||
modify->setup_pre_exchange();
|
||||
if (domain->triclinic) domain->x2lamda(atom->nlocal);
|
||||
domain->pbc();
|
||||
domain->reset_box();
|
||||
|
||||
Reference in New Issue
Block a user