forked from lijiext/lammps
Fixed initialization of arrays in fixes
This commit is contained in:
parent
425142ba2e
commit
36e085e393
|
@ -113,7 +113,8 @@ double FixTempCSVR::resamplekin(double ekin_old, double ekin_new){
|
|||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
FixTempCSVR::FixTempCSVR(LAMMPS *lmp, int narg, char **arg) :
|
||||
Fix(lmp, narg, arg)
|
||||
Fix(lmp, narg, arg),
|
||||
tstr(NULL), id_temp(NULL), random(NULL)
|
||||
{
|
||||
if (narg != 7) error->all(FLERR,"Illegal fix temp/csvr command");
|
||||
|
||||
|
|
|
@ -37,7 +37,8 @@ enum{CONSTANT,EQUAL};
|
|||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
FixTempRescale::FixTempRescale(LAMMPS *lmp, int narg, char **arg) :
|
||||
Fix(lmp, narg, arg)
|
||||
Fix(lmp, narg, arg),
|
||||
tstr(NULL), id_temp(NULL), tflag(0)
|
||||
{
|
||||
if (narg < 8) error->all(FLERR,"Illegal fix temp/rescale command");
|
||||
|
||||
|
|
|
@ -39,7 +39,8 @@ using namespace FixConst;
|
|||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
FixTMD::FixTMD(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
|
||||
FixTMD::FixTMD(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg),
|
||||
nfileevery(0), fp(NULL), xf(NULL), xold(NULL)
|
||||
{
|
||||
if (narg < 6) error->all(FLERR,"Illegal fix tmd command");
|
||||
|
||||
|
@ -54,8 +55,6 @@ FixTMD::FixTMD(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
|
|||
// perform initial allocation of atom-based arrays
|
||||
// register with Atom class
|
||||
|
||||
xf = NULL;
|
||||
xold = NULL;
|
||||
grow_arrays(atom->nmax);
|
||||
atom->add_callback(0);
|
||||
|
||||
|
|
|
@ -37,7 +37,8 @@ enum{SCALAR,VECTOR};
|
|||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
FixVector::FixVector(LAMMPS *lmp, int narg, char **arg) :
|
||||
Fix(lmp, narg, arg)
|
||||
Fix(lmp, narg, arg),
|
||||
nvalues(0), which(NULL), argindex(NULL), value2index(NULL), ids(NULL), vector(NULL), array(NULL)
|
||||
{
|
||||
if (narg < 5) error->all(FLERR,"Illegal fix vector command");
|
||||
|
||||
|
@ -294,8 +295,8 @@ void FixVector::end_of_step()
|
|||
|
||||
// evaluate equal-style or vector-style variable
|
||||
|
||||
} else if (which[i] == VARIABLE)
|
||||
if (argindex[i] == 0)
|
||||
} else if (which[i] == VARIABLE) {
|
||||
if (argindex[i] == 0)
|
||||
result[i] = input->variable->compute_equal(m);
|
||||
else {
|
||||
double *varvec;
|
||||
|
@ -304,6 +305,7 @@ void FixVector::end_of_step()
|
|||
if (nvec < index) result[i] = 0.0;
|
||||
else result[i] = varvec[index-1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// trigger computes on next needed step
|
||||
|
|
|
@ -27,7 +27,8 @@ using namespace FixConst;
|
|||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
FixViscous::FixViscous(LAMMPS *lmp, int narg, char **arg) :
|
||||
Fix(lmp, narg, arg)
|
||||
Fix(lmp, narg, arg),
|
||||
gamma(NULL)
|
||||
{
|
||||
if (narg < 4) error->all(FLERR,"Illegal fix viscous command");
|
||||
|
||||
|
|
Loading…
Reference in New Issue