Fixed initialization of arrays in fixes

This commit is contained in:
Anders Hafreager 2016-08-25 15:20:12 +02:00 committed by Axel Kohlmeyer
parent fd05a1325e
commit 265cc14125
9 changed files with 19 additions and 21 deletions

View File

@ -37,7 +37,8 @@ enum{ISO,ANISO};
/* ---------------------------------------------------------------------- */
FixPressBerendsen::FixPressBerendsen(LAMMPS *lmp, int narg, char **arg) :
Fix(lmp, narg, arg)
Fix(lmp, narg, arg),
id_temp(NULL), id_press(NULL), tflag(0), pflag(0)
{
if (narg < 5) error->all(FLERR,"Illegal fix press/berendsen command");

View File

@ -28,7 +28,8 @@ using namespace FixConst;
/* ---------------------------------------------------------------------- */
FixPrint::FixPrint(LAMMPS *lmp, int narg, char **arg) :
Fix(lmp, narg, arg)
Fix(lmp, narg, arg),
fp(NULL), string(NULL), copy(NULL), work(NULL)
{
if (narg < 5) error->all(FLERR,"Illegal fix print command");
nevery = force->inumeric(FLERR,arg[3]);

View File

@ -29,7 +29,8 @@ enum{MOLECULE,CHARGE,RMASS,INTEGER,DOUBLE};
/* ---------------------------------------------------------------------- */
FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) :
Fix(lmp, narg, arg)
Fix(lmp, narg, arg),
nvalue(0), style(NULL), index(NULL), astyle(NULL)
{
if (narg < 4) error->all(FLERR,"Illegal fix property/atom command");

View File

@ -23,7 +23,8 @@ using namespace FixConst;
/* ---------------------------------------------------------------------- */
FixReadRestart::FixReadRestart(LAMMPS *lmp, int narg, char **arg) :
Fix(lmp, narg, arg)
Fix(lmp, narg, arg),
count(NULL), extra(NULL)
{
nextra = force->inumeric(FLERR,arg[3]);
int nfix = force->inumeric(FLERR,arg[4]);
@ -31,8 +32,6 @@ FixReadRestart::FixReadRestart(LAMMPS *lmp, int narg, char **arg) :
// perform initial allocation of atom-based array
// register with Atom class
count = NULL;
extra = NULL;
grow_arrays(atom->nmax);
atom->add_callback(0);

View File

@ -24,7 +24,8 @@ using namespace FixConst;
/* ---------------------------------------------------------------------- */
FixRespa::FixRespa(LAMMPS *lmp, int narg, char **arg) :
Fix(lmp, narg, arg)
Fix(lmp, narg, arg),
store_torque(0), f_level(NULL), t_level(NULL)
{
// nlevels = # of rRESPA levels

View File

@ -44,7 +44,8 @@ enum{BOND,ANGLE,DIHEDRAL};
/* ---------------------------------------------------------------------- */
FixRestrain::FixRestrain(LAMMPS *lmp, int narg, char **arg) :
Fix(lmp, narg, arg)
Fix(lmp, narg, arg),
rstyle(NULL), ids(NULL), kstart(NULL), kstop(NULL), target(NULL), cos_target(NULL), sin_target(NULL)
{
if (narg < 4) error->all(FLERR,"Illegal fix restrain command");
@ -57,10 +58,6 @@ FixRestrain::FixRestrain(LAMMPS *lmp, int narg, char **arg) :
// parse args
nrestrain = maxrestrain = 0;
rstyle = NULL;
ids = NULL;
kstart = kstop = NULL;
target = cos_target = sin_target = NULL;
int iarg = 3;
while (iarg < narg) {

View File

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

View File

@ -34,7 +34,8 @@ enum{NPARTNER,PERPARTNER};
/* ---------------------------------------------------------------------- */
FixShearHistory::FixShearHistory(LAMMPS *lmp, int narg, char **arg) :
Fix(lmp, narg, arg)
Fix(lmp, narg, arg),
npartner(NULL), partner(NULL), shearpartner(NULL), ipage(NULL), dpage(NULL)
{
if (narg != 4) error->all(FLERR,"Illegal fix SHEAR_HISTORY commmand");
@ -57,15 +58,10 @@ FixShearHistory::FixShearHistory(LAMMPS *lmp, int narg, char **arg) :
// perform initial allocation of atom-based arrays
// register with atom class
npartner = NULL;
partner = NULL;
shearpartner = NULL;
grow_arrays(atom->nmax);
atom->add_callback(0);
atom->add_callback(1);
ipage = NULL;
dpage = NULL;
pgsize = oneatom = 0;
// initialize npartner to 0 so neighbor list creation is OK the 1st time

View File

@ -37,7 +37,8 @@ enum{TETHER,COUPLE};
/* ---------------------------------------------------------------------- */
FixSpring::FixSpring(LAMMPS *lmp, int narg, char **arg) :
Fix(lmp, narg, arg)
Fix(lmp, narg, arg),
group2(NULL)
{
if (narg < 9) error->all(FLERR,"Illegal fix spring command");