mirror of https://github.com/lammps/lammps.git
Fixed initialization of arrays in fixes
This commit is contained in:
parent
2c7241bfe2
commit
b5a562788b
|
@ -37,7 +37,8 @@ enum{CONSTANT,EQUAL};
|
|||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
FixGravity::FixGravity(LAMMPS *lmp, int narg, char **arg) :
|
||||
Fix(lmp, narg, arg)
|
||||
Fix(lmp, narg, arg),
|
||||
mstr(NULL), vstr(NULL), pstr(NULL), tstr(NULL), xstr(NULL), ystr(NULL), zstr(NULL)
|
||||
{
|
||||
if (narg < 5) error->all(FLERR,"Illegal fix gravity command");
|
||||
|
||||
|
|
|
@ -31,7 +31,8 @@ using namespace FixConst;
|
|||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
FixGroup::FixGroup(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
|
||||
FixGroup::FixGroup(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg),
|
||||
idregion(NULL), idvar(NULL)
|
||||
{
|
||||
// dgroupbit = bitmask of dynamic group
|
||||
// group ID is last part of fix ID
|
||||
|
@ -46,9 +47,7 @@ FixGroup::FixGroup(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
|
|||
// process optional args
|
||||
|
||||
regionflag = 0;
|
||||
idregion = NULL;
|
||||
varflag = 0;
|
||||
idvar = NULL;
|
||||
nevery = 1;
|
||||
|
||||
int iarg = 3;
|
||||
|
|
|
@ -38,7 +38,8 @@ enum{CONSTANT,EQUAL,ATOM};
|
|||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
FixHeat::FixHeat(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
|
||||
FixHeat::FixHeat(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg),
|
||||
idregion(NULL), hstr(NULL), vheat(NULL), vscale(NULL)
|
||||
{
|
||||
if (narg < 4) error->all(FLERR,"Illegal fix heat command");
|
||||
|
||||
|
@ -63,8 +64,7 @@ FixHeat::FixHeat(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
|
|||
// optional args
|
||||
|
||||
iregion = -1;
|
||||
idregion = NULL;
|
||||
|
||||
|
||||
int iarg = 5;
|
||||
while (iarg < narg) {
|
||||
if (strcmp(arg[iarg],"region") == 0) {
|
||||
|
@ -82,8 +82,6 @@ FixHeat::FixHeat(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
|
|||
scale = 1.0;
|
||||
|
||||
maxatom = 0;
|
||||
vheat = NULL;
|
||||
vscale = NULL;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
|
|
@ -40,7 +40,8 @@ enum{INSIDE,OUTSIDE};
|
|||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
FixIndent::FixIndent(LAMMPS *lmp, int narg, char **arg) :
|
||||
Fix(lmp, narg, arg)
|
||||
Fix(lmp, narg, arg),
|
||||
xstr(NULL), ystr(NULL), zstr(NULL), rstr(NULL), pstr(NULL)
|
||||
{
|
||||
if (narg < 4) error->all(FLERR,"Illegal fix indent command");
|
||||
|
||||
|
|
|
@ -51,7 +51,9 @@ enum{CONSTANT,EQUAL,ATOM};
|
|||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
FixLangevin::FixLangevin(LAMMPS *lmp, int narg, char **arg) :
|
||||
Fix(lmp, narg, arg)
|
||||
Fix(lmp, narg, arg),
|
||||
gjfflag(0), gfactor1(NULL), gfactor2(NULL), ratio(NULL), tstr(NULL),
|
||||
flangevin(NULL), tforce(NULL), franprev(NULL), id_temp(NULL), random(NULL)
|
||||
{
|
||||
if (narg < 7) error->all(FLERR,"Illegal fix langevin command");
|
||||
|
||||
|
@ -61,7 +63,6 @@ FixLangevin::FixLangevin(LAMMPS *lmp, int narg, char **arg) :
|
|||
extscalar = 1;
|
||||
nevery = 1;
|
||||
|
||||
tstr = NULL;
|
||||
if (strstr(arg[3],"v_") == arg[3]) {
|
||||
int n = strlen(&arg[3][2]) + 1;
|
||||
tstr = new char[n];
|
||||
|
|
|
@ -24,12 +24,9 @@ using namespace FixConst;
|
|||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
FixMinimize::FixMinimize(LAMMPS *lmp, int narg, char **arg) :
|
||||
Fix(lmp, narg, arg)
|
||||
Fix(lmp, narg, arg),
|
||||
nvector(0), peratom(NULL), vectors(NULL)
|
||||
{
|
||||
nvector = 0;
|
||||
peratom = NULL;
|
||||
vectors = NULL;
|
||||
|
||||
// register callback to this fix from Atom class
|
||||
// don't perform initial allocation here, must wait until add_vector()
|
||||
|
||||
|
|
Loading…
Reference in New Issue