Commit 02bfa898 authored by Steve Plimpton's avatar Steve Plimpton
Browse files

adjustments to balancing weights and factors, also XOR op for formulas, if, dump_modify thresh

parent 030df745
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ fix 2 all wall/lj93 xlo 0.0 1 1 2.5 xhi $x 1 1 2.5
fix             3 all wall/lj93 ylo 0.0 1 1 2.5 yhi $y 1 1 2.5

comm_style      tiled
comm_modify     cutoff 7.5
comm_modify     cutoff 10.0   # because bonds stretch a long ways
fix             10 all balance 50 0.9 rcb

#compute         1 all property/atom proc
+0 −1
Original line number Diff line number Diff line
@@ -52,4 +52,3 @@ fix 0 all balance 50 1.0 shift x 5 1.0 &
                weight neigh 0.5 weight time 0.66 weight store WEIGHT
run             500
run             500
+4 −3
Original line number Diff line number Diff line
@@ -272,7 +272,7 @@ void Balance::command(int narg, char **arg)
  // imbinit = initial imbalance

  double maxinit;
  init_imbalance();
  init_imbalance(0);
  set_weights();
  double imbinit = imbalance_factor(maxinit);

@@ -543,12 +543,13 @@ void Balance::weight_storage(char *prefix)

/* ----------------------------------------------------------------------
   invoke init() for each Imbalance class
   flag = 0 for call from Balance, 1 for call from FixBalance
------------------------------------------------------------------------- */

void Balance::init_imbalance()
void Balance::init_imbalance(int flag)
{
  if (!wtflag) return;
  for (int n = 0; n < nimbalance; n++) imbalances[n]->init();
  for (int n = 0; n < nimbalance; n++) imbalances[n]->init(flag);
}

/* ----------------------------------------------------------------------
+1 −1
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@ class Balance : protected Pointers {
  void command(int, char **);
  void options(int, int, char **);
  void weight_storage(char *);
  void init_imbalance();
  void init_imbalance(int);
  void set_weights();
  double imbalance_factor(double &);
  void shift_setup(char *, int, double);
+17 −3
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@
#include "modify.h"
#include "fix_store.h"
#include "rcb.h"
#include "timer.h"
#include "error.h"

using namespace LAMMPS_NS;
@@ -113,6 +114,7 @@ FixBalance::FixBalance(LAMMPS *lmp, int narg, char **arg) :
  // only force reneighboring if nevery > 0

  if (nevery) force_reneighbor = 1;
  lastbalance = -1;
  
  // compute initial outputs

@@ -153,7 +155,7 @@ void FixBalance::init()
  if (force->kspace) kspace_flag = 1;
  else kspace_flag = 0;

  balance->init_imbalance();
  balance->init_imbalance(1);
}

/* ---------------------------------------------------------------------- */
@@ -170,6 +172,12 @@ void FixBalance::setup(int vflag)

void FixBalance::setup_pre_exchange()
{
  // do not allow rebalancing twice on same timestep
  // even if wanted to, can mess up elapsed time in ImbalanceTime

  if (update->ntimestep == lastbalance) return;
  lastbalance = update->ntimestep;

  // insure atoms are in current box & update box via shrink-wrap
  // has to be be done before rebalance() invokes Irregular::migrate_atoms()
  //   since it requires atoms be inside simulation box
@@ -202,6 +210,12 @@ void FixBalance::pre_exchange()

  if (nevery && update->ntimestep < next_reneighbor) return;

  // do not allow rebalancing twice on same timestep
  // even if wanted to, can mess up elapsed time in ImbalanceTime

  if (update->ntimestep == lastbalance) return;
  lastbalance = update->ntimestep;

  // insure atoms are in current box & update box via shrink-wrap
  // no exchange() since doesn't matter if atoms are assigned to correct procs

@@ -284,7 +298,7 @@ void FixBalance::rebalance()
  if (kspace_flag) force->kspace->setup_grid();

  // pending triggers pre_neighbor() to compute final imbalance factor
  // can only be done after atoms migrate in caller's comm->exchange()
  // can only be done after atoms migrate in comm->exchange()

  pending = 1;
}
Loading