From 1091ba11319820a762c3a110e7567f5ba3af45d8 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Fri, 6 Feb 2015 16:19:34 +0000 Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@13069 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/fix_shear_history.cpp | 40 ++++++++++++++------------------------- src/fix_shear_history.h | 3 +-- src/write_restart.cpp | 9 +++++++-- 3 files changed, 22 insertions(+), 30 deletions(-) diff --git a/src/fix_shear_history.cpp b/src/fix_shear_history.cpp index 3f6353dd11..ddfe2224d9 100644 --- a/src/fix_shear_history.cpp +++ b/src/fix_shear_history.cpp @@ -128,30 +128,19 @@ void FixShearHistory::allocate_pages() } } -/* ---------------------------------------------------------------------- - 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 - update of npartner/partner - 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() -{ - if (*computeflag) pre_exchange(); - *computeflag = 0; -} - /* ---------------------------------------------------------------------- copy shear partner info from neighbor lists to atom arrays - so can be migrated or stored with atoms + should be called whenever neighbor list stores current history info + and need to have atoms store the info + e.g. so atoms can migrate to new procs or between runs + when atoms may be added or deleted (neighbor list becomes out-of-date) + the next granular neigh list build will put this info back into neigh list + called during run before atom exchanges + called at end of run via post_run() + do not call during setup of run (setup_pre_exchange) + b/c there is no guarantee of a current neigh list (even on continued run) + if run command does a 2nd run with pre = no, then no neigh list + will be built, but old neigh list will still have the info ------------------------------------------------------------------------- */ void FixShearHistory::pre_exchange() @@ -262,15 +251,14 @@ void FixShearHistory::pre_exchange() /* ---------------------------------------------------------------------- */ -void FixShearHistory::min_setup_pre_exchange() +void FixShearHistory::min_pre_exchange() { - if (*computeflag) pre_exchange(); - *computeflag = 0; + pre_exchange(); } /* ---------------------------------------------------------------------- */ -void FixShearHistory::min_pre_exchange() +void FixShearHistory::post_run() { pre_exchange(); } diff --git a/src/fix_shear_history.h b/src/fix_shear_history.h index 347049872f..8b32f3fec7 100644 --- a/src/fix_shear_history.h +++ b/src/fix_shear_history.h @@ -34,10 +34,9 @@ class FixShearHistory : public Fix { ~FixShearHistory(); int setmask(); void init(); - void setup_pre_exchange(); virtual void pre_exchange(); - void min_setup_pre_exchange(); void min_pre_exchange(); + void post_run(); double memory_usage(); void grow_arrays(int); diff --git a/src/write_restart.cpp b/src/write_restart.cpp index 553294b865..83edc522fe 100644 --- a/src/write_restart.cpp +++ b/src/write_restart.cpp @@ -113,11 +113,16 @@ void WriteRestart::command(int narg, char **arg) lmp->init(); // move atoms to new processors before writing file - // 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 + // NOTE: removed call to setup_pre_exchange + // used to be needed by fixShearHistory for granular + // to move history info from neigh list to atoms between runs + // but now that is done via FIx::post_run() + // don't think any other fix needs this or should do it + // e.g. fix evaporate should not delete more atoms - modify->setup_pre_exchange(); + // modify->setup_pre_exchange(); if (domain->triclinic) domain->x2lamda(atom->nlocal); domain->pbc(); domain->reset_box();