Fixed initialization of arrays in computes

This commit is contained in:
Anders Hafreager
2016-08-24 17:06:58 +02:00
committed by Axel Kohlmeyer
parent 5e811f16e8
commit 7d43f349e6
9 changed files with 19 additions and 23 deletions

View File

@ -41,7 +41,7 @@ int Compute::instance_total = 0;
Compute::Compute(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp),
id(NULL), style(NULL),
vector(NULL), array(NULL), vector_atom(NULL), array_atom(NULL), vector_local(NULL), array_local(NULL),
tlist(NULL)
tlist(NULL), vbiasall(NULL)
{
instance_me = instance_total++;

View File

@ -36,7 +36,8 @@ enum{NOBIAS,BIAS};
/* ---------------------------------------------------------------------- */
ComputeStressAtom::ComputeStressAtom(LAMMPS *lmp, int narg, char **arg) :
Compute(lmp, narg, arg)
Compute(lmp, narg, arg),
id_temp(NULL), stress(NULL)
{
if (narg < 4) error->all(FLERR,"Illegal compute stress/atom command");
@ -98,7 +99,6 @@ ComputeStressAtom::ComputeStressAtom(LAMMPS *lmp, int narg, char **arg) :
}
nmax = 0;
stress = NULL;
}
/* ---------------------------------------------------------------------- */

View File

@ -29,7 +29,9 @@ enum{TEMP,KECOM,INTERNAL};
/* ---------------------------------------------------------------------- */
ComputeTempChunk::ComputeTempChunk(LAMMPS *lmp, int narg, char **arg) :
Compute(lmp, narg, arg)
Compute(lmp, narg, arg),
which(NULL), idchunk(NULL), id_bias(NULL), sum(NULL), sumall(NULL), count(NULL),
countall(NULL), massproc(NULL), masstotal(NULL), vcm(NULL), vcmall(NULL)
{
if (narg < 4) error->all(FLERR,"Illegal compute temp/chunk command");
@ -129,11 +131,6 @@ ComputeTempChunk::ComputeTempChunk(LAMMPS *lmp, int narg, char **arg) :
nchunk = 1;
maxchunk = 0;
sum = sumall = NULL;
count = countall = NULL;
massproc = masstotal = NULL;
vcm = vcmall = NULL;
array = NULL;
if (nvalues) {
array_flag = 1;

View File

@ -31,7 +31,8 @@ enum{TENSOR,BIN};
/* ---------------------------------------------------------------------- */
ComputeTempProfile::ComputeTempProfile(LAMMPS *lmp, int narg, char **arg) :
Compute(lmp, narg, arg)
Compute(lmp, narg, arg),
bin(NULL), vbin(NULL), binave(NULL), tbin(NULL), tbinall(NULL)
{
if (narg < 7) error->all(FLERR,"Illegal compute temp/profile command");
@ -138,7 +139,6 @@ ComputeTempProfile::ComputeTempProfile(LAMMPS *lmp, int narg, char **arg) :
}
maxatom = 0;
bin = NULL;
}
/* ---------------------------------------------------------------------- */

View File

@ -28,7 +28,8 @@ using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */
ComputeTempRegion::ComputeTempRegion(LAMMPS *lmp, int narg, char **arg) :
Compute(lmp, narg, arg)
Compute(lmp, narg, arg),
idregion(NULL)
{
if (narg != 4) error->all(FLERR,"Illegal compute temp/region command");

View File

@ -33,7 +33,8 @@ enum{ROTATE,ALL};
/* ---------------------------------------------------------------------- */
ComputeTempSphere::ComputeTempSphere(LAMMPS *lmp, int narg, char **arg) :
Compute(lmp, narg, arg)
Compute(lmp, narg, arg),
id_bias(NULL)
{
if (narg < 3) error->all(FLERR,"Illegal compute temp/sphere command");
@ -44,7 +45,6 @@ ComputeTempSphere::ComputeTempSphere(LAMMPS *lmp, int narg, char **arg) :
tempflag = 1;
tempbias = 0;
id_bias = NULL;
mode = ALL;
int iarg = 3;

View File

@ -26,7 +26,8 @@ using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */
ComputeTorqueChunk::ComputeTorqueChunk(LAMMPS *lmp, int narg, char **arg) :
Compute(lmp, narg, arg)
Compute(lmp, narg, arg),
idchunk(NULL), massproc(NULL), masstotal(NULL), com(NULL), comall(NULL), torque(NULL), torqueall(NULL)
{
if (narg != 4) error->all(FLERR,"Illegal compute torque/chunk command");
@ -48,9 +49,6 @@ ComputeTorqueChunk::ComputeTorqueChunk(LAMMPS *lmp, int narg, char **arg) :
nchunk = 1;
maxchunk = 0;
massproc = masstotal = NULL;
com = comall = NULL;
torque = torqueall = NULL;
allocate();
}

View File

@ -25,7 +25,8 @@ using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */
ComputeVACF::ComputeVACF(LAMMPS *lmp, int narg, char **arg) :
Compute(lmp, narg, arg)
Compute(lmp, narg, arg),
id_fix(NULL)
{
if (narg < 3) error->all(FLERR,"Illegal compute vacf command");

View File

@ -28,7 +28,8 @@ enum{ONCE,NFREQ,EVERY};
/* ---------------------------------------------------------------------- */
ComputeVCMChunk::ComputeVCMChunk(LAMMPS *lmp, int narg, char **arg) :
Compute(lmp, narg, arg)
Compute(lmp, narg, arg),
idchunk(NULL), massproc(NULL), masstotal(NULL), vcm(NULL), vcmall(NULL)
{
if (narg != 4) error->all(FLERR,"Illegal compute vcm/chunk command");
@ -50,8 +51,6 @@ ComputeVCMChunk::ComputeVCMChunk(LAMMPS *lmp, int narg, char **arg) :
nchunk = 1;
maxchunk = 0;
massproc = masstotal = NULL;
vcm = vcmall = NULL;
allocate();
firstflag = massneed = 1;