restrict choice of weight factors and guarantee that weights are >= 0.001
This commit is contained in:
@ -24,10 +24,11 @@
|
||||
#include "update.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
#define SMALL 0.001
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
||||
ImbalanceVar::ImbalanceVar(LAMMPS *lmp) : Imbalance(lmp), name(0) {}
|
||||
ImbalanceVar::ImbalanceVar(LAMMPS *lmp) : Imbalance(lmp), name(0), id(0) {}
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
||||
@ -75,7 +76,10 @@ void ImbalanceVar::compute(double *weight)
|
||||
memory->create(values,nlocal,"imbalance:values");
|
||||
|
||||
input->variable->compute_atom(id,all,values,1,0);
|
||||
for (int i = 0; i < nlocal; ++i) weight[i] *= values[i];
|
||||
for (int i = 0; i < nlocal; ++i) {
|
||||
weight[i] *= values[i];
|
||||
if (weight[i] < SMALL) weight[i] = SMALL;
|
||||
}
|
||||
|
||||
memory->destroy(values);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user