Fixed initialization of arrays in fixes

This commit is contained in:
Anders Hafreager 2016-08-25 10:33:33 +02:00 committed by Axel Kohlmeyer
parent 0192d2e359
commit db077ef186
8 changed files with 21 additions and 15 deletions

View File

@ -31,7 +31,8 @@ int Fix::instance_total = 0;
/* ---------------------------------------------------------------------- */
Fix::Fix(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp)
Fix::Fix(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp),
id(NULL), style(NULL), eatom(NULL), vatom(NULL)
{
instance_me = instance_total++;
@ -92,8 +93,6 @@ Fix::Fix(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp)
// which may occur outside of timestepping
maxeatom = maxvatom = 0;
eatom = NULL;
vatom = NULL;
vflag_atom = 0;
// CUDA and KOKKOS per-fix data masks

View File

@ -40,7 +40,8 @@ enum{DIAMETER,CHARGE};
/* ---------------------------------------------------------------------- */
FixAdapt::FixAdapt(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
FixAdapt::FixAdapt(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg),
nadapt(0), id_fix_diam(NULL), id_fix_chg(NULL), adapt(NULL)
{
if (narg < 5) error->all(FLERR,"Illegal fix adapt command");
nevery = force->inumeric(FLERR,arg[3]);
@ -159,8 +160,6 @@ FixAdapt::FixAdapt(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
for (int m = 0; m < nadapt; m++)
if (adapt[m].which == PAIR)
memory->create(adapt[m].array_orig,n+1,n+1,"adapt:array_orig");
id_fix_diam = id_fix_chg = NULL;
}
/* ---------------------------------------------------------------------- */

View File

@ -36,7 +36,9 @@ enum{NONE,CONSTANT,EQUAL,ATOM};
/* ---------------------------------------------------------------------- */
FixAddForce::FixAddForce(LAMMPS *lmp, int narg, char **arg) :
Fix(lmp, narg, arg)
Fix(lmp, narg, arg),
xstr(NULL), ystr(NULL), zstr(NULL), estr(NULL), idregion(NULL), sforce(NULL)
{
if (narg < 6) error->all(FLERR,"Illegal fix addforce command");
@ -81,8 +83,6 @@ FixAddForce::FixAddForce(LAMMPS *lmp, int narg, char **arg) :
nevery = 1;
iregion = -1;
idregion = NULL;
estr = NULL;
int iarg = 6;
while (iarg < narg) {

View File

@ -35,7 +35,8 @@ enum{X,V,F,COMPUTE,FIX,VARIABLE};
/* ---------------------------------------------------------------------- */
FixAveAtom::FixAveAtom(LAMMPS *lmp, int narg, char **arg) :
Fix(lmp, narg, arg)
Fix(lmp, narg, arg),
nvalues(0), which(NULL), argindex(NULL), ids(NULL), value2index(NULL), array(NULL)
{
if (narg < 7) error->all(FLERR,"Illegal fix ave/atom command");
@ -192,7 +193,6 @@ FixAveAtom::FixAveAtom(LAMMPS *lmp, int narg, char **arg) :
// perform initial allocation of atom-based array
// register with Atom class
array = NULL;
grow_arrays(atom->nmax);
atom->add_callback(0);

View File

@ -44,7 +44,9 @@ enum{AUTO,UPPER,LOWER,AUTOUPPER,AUTOLOWER,FULL};
/* ---------------------------------------------------------------------- */
FixAveCorrelate::FixAveCorrelate(LAMMPS * lmp, int narg, char **arg):
Fix (lmp, narg, arg)
Fix (lmp, narg, arg),
nvalues(0), which(NULL), argindex(NULL), value2index(NULL), ids(NULL), fp(NULL),
count(NULL), values(NULL), corr(NULL), save_count(NULL), save_corr(NULL)
{
if (narg < 7) error->all(FLERR,"Illegal fix ave/correlate command");

View File

@ -45,7 +45,9 @@ enum{IGNORE,END,EXTRA};
/* ---------------------------------------------------------------------- */
FixAveHisto::FixAveHisto(LAMMPS *lmp, int narg, char **arg) :
Fix(lmp, narg, arg)
Fix(lmp, narg, arg),
nvalues(0), which(NULL), argindex(NULL), value2index(NULL), ids(NULL), fp(NULL), stats_list(NULL),
bin(NULL), bin_total(NULL), bin_all(NULL), bin_list(NULL), coord(NULL), vector(NULL)
{
if (narg < 10) error->all(FLERR,"Illegal fix ave/histo command");

View File

@ -42,7 +42,10 @@ enum{SCALAR,VECTOR};
/* ---------------------------------------------------------------------- */
FixAveTime::FixAveTime(LAMMPS *lmp, int narg, char **arg) :
Fix(lmp, narg, arg)
Fix(lmp, narg, arg),
nvalues(0), which(NULL), argindex(NULL), value2index(NULL), offcol(NULL), varlen(NULL), ids(NULL),
fp(NULL), offlist(NULL), format(NULL), format_user(NULL), vector(NULL), vector_total(NULL), vector_list(NULL),
column(NULL), array(NULL), array_total(NULL), array_list(NULL)
{
if (narg < 7) error->all(FLERR,"Illegal fix ave/time command");

View File

@ -34,7 +34,8 @@ enum{NONE,CONSTANT,EQUAL};
/* ---------------------------------------------------------------------- */
FixAveForce::FixAveForce(LAMMPS *lmp, int narg, char **arg) :
Fix(lmp, narg, arg)
Fix(lmp, narg, arg),
xstr(NULL), ystr(NULL), zstr(NULL), idregion(NULL)
{
if (narg < 6) error->all(FLERR,"Illegal fix aveforce command");