Commit d8ef5f69 authored by Steve Plimpton's avatar Steve Plimpton
Browse files

added internal fix dummy command to enable more control of fix ordering

parent cf251eb8
Loading
Loading
Loading
Loading
+21 −4
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@
#include "update.h"
#include "modify.h"
#include "fix.h"
#include "fix_dummy.h"
#include "fix_neigh_history.h"
#include "comm.h"
#include "neighbor.h"
@@ -43,7 +44,6 @@ PairGranHookeHistory::PairGranHookeHistory(LAMMPS *lmp) : Pair(lmp)
  no_virial_fdotr_compute = 1;
  history = 1;
  size_history = 3;
  fix_history = NULL;

  single_extra = 10;
  svector = new double[10];
@@ -60,6 +60,19 @@ PairGranHookeHistory::PairGranHookeHistory(LAMMPS *lmp) : Pair(lmp)
  // keep default behavior of history[i][j] = -history[j][i]

  nondefault_history_transfer = 0;

  // create dummy fix as placeholder for FixNeighHistory
  // this is so final order of Modify:fix will conform to input script

  fix_history = NULL;

  char **fixarg = new char*[3];
  fixarg[0] = (char *) "NEIGH_HISTORY_DUMMY";
  fixarg[1] = (char *) "all";
  fixarg[2] = (char *) "DUMMY";
  modify->add_fix(3,fixarg,1);
  delete [] fixarg;
  fix_dummy = (FixDummy *) modify->fix[modify->nfix-1];
}

/* ---------------------------------------------------------------------- */
@@ -69,7 +82,9 @@ PairGranHookeHistory::~PairGranHookeHistory()
  if (copymode) return;

  delete [] svector;
  if (fix_history) modify->delete_fix("NEIGH_HISTORY");

  if (!fix_history) modify->delete_fix("NEIGH_HISTORY_DUMMY");
  else modify->delete_fix("NEIGH_HISTORY");

  if (allocated) {
    memory->destroy(setflag);
@@ -412,7 +427,9 @@ void PairGranHookeHistory::init_style()

  dt = update->dt;

  // if first init, create Fix needed for storing shear history
  // if history is stored and first init, create Fix to store history
  // it replaces FixDummy, created in the constructor
  // this is so its order in the fix list is preserved

  if (history && fix_history == NULL) {
    char dnumstr[16];
@@ -422,7 +439,7 @@ void PairGranHookeHistory::init_style()
    fixarg[1] = (char *) "all";
    fixarg[2] = (char *) "NEIGH_HISTORY";
    fixarg[3] = dnumstr;
    modify->add_fix(4,fixarg,1);
    modify->replace_fix("NEIGH_HISTORY_DUMMY",4,fixarg,1);
    delete [] fixarg;
    fix_history = (FixNeighHistory *) modify->fix[modify->nfix-1];
    fix_history->pair = this;
+1 −0
Original line number Diff line number Diff line
@@ -56,6 +56,7 @@ class PairGranHookeHistory : public Pair {

  int size_history;

  class FixDummy *fix_dummy;
  class FixNeighHistory *fix_history;

  // storage of rigid body masses for use in granular interactions
+29 −12
Original line number Diff line number Diff line
/* ----------------------------------------------------------------------
   LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
   http://lammps.sandia.gov, Sandia National Laboratories
   Steve Plimpton, sjplimp@sandia.gov

@@ -25,6 +26,7 @@ See the README file in the top-level LAMMPS directory.
#include "update.h"
#include "modify.h"
#include "fix.h"
#include "fix_dummy.h"
#include "fix_neigh_history.h"
#include "comm.h"
#include "neighbor.h"
@@ -62,7 +64,6 @@ PairGranular::PairGranular(LAMMPS *lmp) : Pair(lmp)
{
  single_enable = 1;
  no_virial_fdotr_compute = 1;
  fix_history = NULL;

  single_extra = 12;
  svector = new double[single_extra];
@@ -90,6 +91,19 @@ PairGranular::PairGranular(LAMMPS *lmp) : Pair(lmp)
  nondefault_history_transfer = 0;
  tangential_history_index = 0;
  roll_history_index = twist_history_index = 0;

  // create dummy fix as placeholder for FixNeighHistory
  // this is so final order of Modify:fix will conform to input script

  fix_history = NULL;

  char **fixarg = new char*[3];
  fixarg[0] = (char *) "NEIGH_HISTORY_DUMMY";
  fixarg[1] = (char *) "all";
  fixarg[2] = (char *) "DUMMY";
  modify->add_fix(3,fixarg,1);
  delete [] fixarg;
  fix_dummy = (FixDummy *) modify->fix[modify->nfix-1];
}

/* ---------------------------------------------------------------------- */
@@ -97,7 +111,9 @@ PairGranular::PairGranular(LAMMPS *lmp) : Pair(lmp)
PairGranular::~PairGranular()
{
  delete [] svector;
  if (fix_history) modify->delete_fix("NEIGH_HISTORY");

  if (!fix_history) modify->delete_fix("NEIGH_HISTORY_DUMMY");
  else modify->delete_fix("NEIGH_HISTORY");

  if (allocated) {
    memory->destroy(setflag);
@@ -1021,8 +1037,9 @@ void PairGranular::init_style()

  dt = update->dt;

  // if history is stored:
  // if first init, create Fix needed for storing history
  // if history is stored and first init, create Fix to store history
  // it replaces FixDummy, created in the constructor
  // this is so its order in the fix list is preserved

  if (use_history && fix_history == NULL) {
    char dnumstr[16];
@@ -1032,7 +1049,7 @@ void PairGranular::init_style()
    fixarg[1] = (char *) "all";
    fixarg[2] = (char *) "NEIGH_HISTORY";
    fixarg[3] = dnumstr;
    modify->add_fix(4,fixarg,1);
    modify->replace_fix("NEIGH_HISTORY_DUMMY",4,fixarg,1);
    delete [] fixarg;
    fix_history = (FixNeighHistory *) modify->fix[modify->nfix-1];
    fix_history->pair = this;
+2 −1
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ class PairGranular : public Pair {
  double *maxrad_dynamic,*maxrad_frozen;
  double **cut;

  class FixDummy *fix_dummy;
  class FixNeighHistory *fix_history;

  // storage of rigid body masses for use in granular interactions
+2 −2
Original line number Diff line number Diff line
@@ -302,10 +302,10 @@ FixBocs::FixBocs(LAMMPS *lmp, int narg, char **arg) :
    // pre_exchange only required if flips can occur due to shape changes

    if (flipflag && (p_flag[3] || p_flag[4] || p_flag[5]))
      pre_exchange_flag = 1;
      pre_exchange_flag = pre_exchange_migrate = 1;
    if (flipflag && (domain->yz != 0.0 || domain->xz != 0.0 ||
                     domain->xy != 0.0))
      pre_exchange_flag = 1;
      pre_exchange_flag = pre_exchange_migrate = 1;
  }

  // convert input periods to frequencies
Loading