Commit 0e7ce194 authored by Anders Hafreager's avatar Anders Hafreager Committed by Axel Kohlmeyer
Browse files

Fixed initialization of arrays in computes

parent e27196e9
Loading
Loading
Loading
Loading
+6 −9
Original line number Diff line number Diff line
@@ -38,7 +38,10 @@ int Compute::instance_total = 0;

/* ---------------------------------------------------------------------- */

Compute::Compute(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp)
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)
{
  instance_me = instance_total++;
  
@@ -93,7 +96,6 @@ Compute::Compute(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp)
  // setup list of timesteps

  ntime = maxtime = 0;
  tlist = NULL;
  
  // data masks

@@ -105,11 +107,6 @@ Compute::Compute(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp)
  datamask_modify = ALL_MASK;

  copymode = 0;

  // force init to zero in case these are used as logicals

  vector = vector_atom = vector_local = NULL;
  array = array_atom = array_local = NULL;
}

/* ---------------------------------------------------------------------- */
+2 −1
Original line number Diff line number Diff line
@@ -24,7 +24,8 @@ using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */

ComputeAngle::ComputeAngle(LAMMPS *lmp, int narg, char **arg) :
  Compute(lmp, narg, arg)
  Compute(lmp, narg, arg),
  emine(NULL)
{
  if (narg != 3) error->all(FLERR,"Illegal compute angle command");

+2 −3
Original line number Diff line number Diff line
@@ -33,7 +33,8 @@ using namespace MathConst;
/* ---------------------------------------------------------------------- */

ComputeAngleLocal::ComputeAngleLocal(LAMMPS *lmp, int narg, char **arg) :
  Compute(lmp, narg, arg)
  Compute(lmp, narg, arg),
  vector(NULL), array(NULL)
{
  if (narg < 4) error->all(FLERR,"Illegal compute angle/local command");

@@ -55,8 +56,6 @@ ComputeAngleLocal::ComputeAngleLocal(LAMMPS *lmp, int narg, char **arg) :
  }

  nmax = 0;
  vector = NULL;
  array = NULL;
}

/* ---------------------------------------------------------------------- */
+2 −4
Original line number Diff line number Diff line
@@ -26,7 +26,8 @@ using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */

ComputeAngmomChunk::ComputeAngmomChunk(LAMMPS *lmp, int narg, char **arg) :
  Compute(lmp, narg, arg)
  Compute(lmp, narg, arg),
  idchunk(NULL), massproc(NULL), masstotal(NULL), com(NULL), comall(NULL), angmom(NULL), angmomall(NULL)
{
  if (narg != 4) error->all(FLERR,"Illegal compute angmom/chunk command");

@@ -48,9 +49,6 @@ ComputeAngmomChunk::ComputeAngmomChunk(LAMMPS *lmp, int narg, char **arg) :

  nchunk = 1;
  maxchunk = 0;
  massproc = masstotal = NULL;
  com = comall = NULL;
  angmom = angmomall = NULL;
  allocate();
}

+2 −1
Original line number Diff line number Diff line
@@ -24,7 +24,8 @@ using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */

ComputeBond::ComputeBond(LAMMPS *lmp, int narg, char **arg) :
  Compute(lmp, narg, arg)
  Compute(lmp, narg, arg),
  emine(NULL)
{
  if (narg != 3) error->all(FLERR,"Illegal compute bond command");

Loading