From 7cd7cda2d4b7abc1b5ff34baa2c17fda74825a6c Mon Sep 17 00:00:00 2001
From: Anders Hafreager <andershaf@gmail.com>
Date: Mon, 7 Nov 2016 20:22:04 +0100
Subject: [PATCH] Initialize pointers in RIGID and SHOCK

---
 src/RIGID/compute_erotate_rigid.cpp |  2 +-
 src/RIGID/compute_ke_rigid.cpp      |  2 +-
 src/RIGID/compute_rigid_local.cpp   |  3 +--
 src/RIGID/fix_ehex.cpp              |  7 ++++---
 src/RIGID/fix_ehex.h                | 14 +++++++-------
 src/RIGID/fix_rigid.cpp             | 11 ++++++++++-
 src/RIGID/fix_rigid_nh.cpp          |  7 ++++++-
 src/RIGID/fix_rigid_nh_small.cpp    |  7 ++++++-
 src/RIGID/fix_rigid_small.cpp       |  7 ++++++-
 src/RIGID/fix_shake.cpp             | 11 ++++++++++-
 src/SHOCK/fix_append_atoms.cpp      |  3 ++-
 src/SHOCK/fix_msst.cpp              |  4 +++-
 src/SHOCK/fix_nphug.cpp             |  2 +-
 src/SHOCK/fix_wall_piston.cpp       |  2 +-
 14 files changed, 59 insertions(+), 23 deletions(-)

diff --git a/src/RIGID/compute_erotate_rigid.cpp b/src/RIGID/compute_erotate_rigid.cpp
index 1659231ffb..e31565cb60 100644
--- a/src/RIGID/compute_erotate_rigid.cpp
+++ b/src/RIGID/compute_erotate_rigid.cpp
@@ -27,7 +27,7 @@ using namespace LAMMPS_NS;
 /* ---------------------------------------------------------------------- */
 
 ComputeERotateRigid::ComputeERotateRigid(LAMMPS *lmp, int narg, char **arg) :
-  Compute(lmp, narg, arg)
+  Compute(lmp, narg, arg), rfix(NULL)
 {
   if (narg != 4) error->all(FLERR,"Illegal compute erotate/rigid command");
 
diff --git a/src/RIGID/compute_ke_rigid.cpp b/src/RIGID/compute_ke_rigid.cpp
index f278b7c96d..2db756140f 100644
--- a/src/RIGID/compute_ke_rigid.cpp
+++ b/src/RIGID/compute_ke_rigid.cpp
@@ -27,7 +27,7 @@ using namespace LAMMPS_NS;
 /* ---------------------------------------------------------------------- */
 
 ComputeKERigid::ComputeKERigid(LAMMPS *lmp, int narg, char **arg) :
-  Compute(lmp, narg, arg)
+  Compute(lmp, narg, arg), rfix(NULL)
 {
   if (narg != 4) error->all(FLERR,"Illegal compute ke/rigid command");
 
diff --git a/src/RIGID/compute_rigid_local.cpp b/src/RIGID/compute_rigid_local.cpp
index 9760945192..b746e5e6d5 100644
--- a/src/RIGID/compute_rigid_local.cpp
+++ b/src/RIGID/compute_rigid_local.cpp
@@ -33,7 +33,7 @@ enum{ID,MOL,MASS,X,Y,Z,XU,YU,ZU,VX,VY,VZ,FX,FY,FZ,IX,IY,IZ,
 /* ---------------------------------------------------------------------- */
 
 ComputeRigidLocal::ComputeRigidLocal(LAMMPS *lmp, int narg, char **arg) :
-  Compute(lmp, narg, arg)
+  Compute(lmp, narg, arg), rstyle(NULL), idrigid(NULL), fixrigid(NULL)
 {
   if (narg < 5) error->all(FLERR,"Illegal compute rigid/local command");
 
@@ -90,7 +90,6 @@ ComputeRigidLocal::ComputeRigidLocal(LAMMPS *lmp, int narg, char **arg) :
   ncount = nmax = 0;
   vector = NULL;
   array = NULL;
-  fixrigid = NULL;
 }
 
 /* ---------------------------------------------------------------------- */
diff --git a/src/RIGID/fix_ehex.cpp b/src/RIGID/fix_ehex.cpp
index c968887374..522076639b 100644
--- a/src/RIGID/fix_ehex.cpp
+++ b/src/RIGID/fix_ehex.cpp
@@ -49,7 +49,9 @@ enum{CONSTANT,EQUAL,ATOM};
 
 /* ---------------------------------------------------------------------- */
 
-FixEHEX::FixEHEX(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
+FixEHEX::FixEHEX(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg),
+  idregion(NULL), x(NULL), f(NULL), v(NULL), 
+  mass(NULL), rmass(NULL), type(NULL), scalingmask(NULL)
 {
   MPI_Comm_rank(world, &me);
  
@@ -73,8 +75,7 @@ FixEHEX::FixEHEX(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
   // optional args
 
   iregion = -1;
-  idregion = NULL;
-
+  
   // NOTE: constraints are deactivated by default
 
   constraints = 0;
diff --git a/src/RIGID/fix_ehex.h b/src/RIGID/fix_ehex.h
index 3ae974fc0d..3220b77195 100644
--- a/src/RIGID/fix_ehex.h
+++ b/src/RIGID/fix_ehex.h
@@ -53,18 +53,18 @@ class FixEHEX : public Fix {
   char *idregion;
   int me;
  
-  double ** x;              // coordinates
-  double ** f;              // forces
-  double ** v;              // velocities
-  double *  mass;           // masses
-  double *  rmass;          // reduced masses
-  int    *  type;           // atom types
+  double **x;              // coordinates
+  double **f;              // forces
+  double **v;              // velocities
+  double *mass;           // masses
+  double *rmass;          // reduced masses
+  int    *type;           // atom types
   int   nlocal;             // number of local atoms
   FixShake * fshake;        // pointer to fix_shake/fix_rattle
   int constraints;          // constraints (0/1)
   int cluster;              // rescaling entire clusters (0/1)
   int hex;                  // HEX mode (0/1)
-  bool * scalingmask;       // scalingmask[i] determines whether 
+  bool *scalingmask;       // scalingmask[i] determines whether 
                             // the velocity of atom i is to be rescaled
 };
 
diff --git a/src/RIGID/fix_rigid.cpp b/src/RIGID/fix_rigid.cpp
index 8c1ecdacc9..e9c06dee5c 100644
--- a/src/RIGID/fix_rigid.cpp
+++ b/src/RIGID/fix_rigid.cpp
@@ -56,7 +56,16 @@ enum{ISO,ANISO,TRICLINIC};
 /* ---------------------------------------------------------------------- */
 
 FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) :
-  Fix(lmp, narg, arg)
+  Fix(lmp, narg, arg), step_respa(NULL), 
+  infile(NULL), nrigid(NULL), mol2body(NULL), body2mol(NULL), 
+  body(NULL), displace(NULL), masstotal(NULL), xcm(NULL), 
+  vcm(NULL), fcm(NULL), inertia(NULL), ex_space(NULL), 
+  ey_space(NULL), ez_space(NULL), angmom(NULL), omega(NULL), 
+  torque(NULL), quat(NULL), imagebody(NULL), fflag(NULL), 
+  tflag(NULL), langextra(NULL), sum(NULL), all(NULL), 
+  remapflag(NULL), xcmimage(NULL), eflags(NULL), orient(NULL), 
+  dorient(NULL), id_dilate(NULL), random(NULL), avec_ellipsoid(NULL), 
+  avec_line(NULL), avec_tri(NULL)
 {
   int i,ibody;
 
diff --git a/src/RIGID/fix_rigid_nh.cpp b/src/RIGID/fix_rigid_nh.cpp
index b5b349c12e..e67f376135 100644
--- a/src/RIGID/fix_rigid_nh.cpp
+++ b/src/RIGID/fix_rigid_nh.cpp
@@ -47,7 +47,12 @@ enum{ISO,ANISO,TRICLINIC};   // same as in FixRigid
 /* ---------------------------------------------------------------------- */
 
 FixRigidNH::FixRigidNH(LAMMPS *lmp, int narg, char **arg) :
-  FixRigid(lmp, narg, arg)
+  FixRigid(lmp, narg, arg), conjqm(NULL), w(NULL), 
+  wdti1(NULL), wdti2(NULL), wdti4(NULL), q_t(NULL), q_r(NULL), 
+  eta_t(NULL), eta_r(NULL), eta_dot_t(NULL), eta_dot_r(NULL), 
+  f_eta_t(NULL), f_eta_r(NULL), q_b(NULL), eta_b(NULL), 
+  eta_dot_b(NULL), f_eta_b(NULL), rfix(NULL), id_temp(NULL), 
+  id_press(NULL), temperature(NULL), pressure(NULL)
 {
   // error checks: could be moved up to FixRigid
 
diff --git a/src/RIGID/fix_rigid_nh_small.cpp b/src/RIGID/fix_rigid_nh_small.cpp
index 09d3b5de87..b08c80b626 100644
--- a/src/RIGID/fix_rigid_nh_small.cpp
+++ b/src/RIGID/fix_rigid_nh_small.cpp
@@ -50,7 +50,12 @@ enum{FULL_BODY,INITIAL,FINAL,FORCE_TORQUE,VCM_ANGMOM,XCM_MASS,ITENSOR,DOF};
 /* ---------------------------------------------------------------------- */
 
 FixRigidNHSmall::FixRigidNHSmall(LAMMPS *lmp, int narg, char **arg) :
-  FixRigidSmall(lmp, narg, arg)
+  FixRigidSmall(lmp, narg, arg), w(NULL), wdti1(NULL), 
+  wdti2(NULL), wdti4(NULL), q_t(NULL), q_r(NULL), eta_t(NULL), 
+  eta_r(NULL), eta_dot_t(NULL), eta_dot_r(NULL), f_eta_t(NULL), 
+  f_eta_r(NULL), q_b(NULL), eta_b(NULL), eta_dot_b(NULL), 
+  f_eta_b(NULL), rfix(NULL), id_temp(NULL), id_press(NULL), 
+  temperature(NULL), pressure(NULL)
 {
   // error checks
 
diff --git a/src/RIGID/fix_rigid_small.cpp b/src/RIGID/fix_rigid_small.cpp
index bc2cd04bcc..4358793a33 100644
--- a/src/RIGID/fix_rigid_small.cpp
+++ b/src/RIGID/fix_rigid_small.cpp
@@ -67,7 +67,12 @@ enum{FULL_BODY,INITIAL,FINAL,FORCE_TORQUE,VCM_ANGMOM,XCM_MASS,ITENSOR,DOF};
 /* ---------------------------------------------------------------------- */
 
 FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) :
-  Fix(lmp, narg, arg)
+  Fix(lmp, narg, arg), step_respa(NULL), 
+  infile(NULL), body(NULL), bodyown(NULL), bodytag(NULL), atom2body(NULL), 
+  xcmimage(NULL), displace(NULL), eflags(NULL), orient(NULL), dorient(NULL), 
+  avec_ellipsoid(NULL), avec_line(NULL), avec_tri(NULL), counts(NULL), 
+  itensor(NULL), mass_body(NULL), langextra(NULL), random(NULL), id_dilate(NULL), 
+  onemols(NULL), hash(NULL), bbox(NULL), ctr(NULL), idclose(NULL), rsqclose(NULL)
 {
   int i;
 
diff --git a/src/RIGID/fix_shake.cpp b/src/RIGID/fix_shake.cpp
index fe9116e446..5907a69b1f 100644
--- a/src/RIGID/fix_shake.cpp
+++ b/src/RIGID/fix_shake.cpp
@@ -49,7 +49,16 @@ FixShake *FixShake::fsptr;
 /* ---------------------------------------------------------------------- */
 
 FixShake::FixShake(LAMMPS *lmp, int narg, char **arg) :
-  Fix(lmp, narg, arg)
+  Fix(lmp, narg, arg), bond_flag(NULL), angle_flag(NULL), 
+  type_flag(NULL), mass_list(NULL), bond_distance(NULL), angle_distance(NULL), 
+  loop_respa(NULL), step_respa(NULL), x(NULL), v(NULL), f(NULL), ftmp(NULL), 
+  vtmp(NULL), mass(NULL), rmass(NULL), type(NULL), shake_flag(NULL), 
+  shake_atom(NULL), shake_type(NULL), xshake(NULL), nshake(NULL), 
+  list(NULL), b_count(NULL), b_count_all(NULL), b_ave(NULL), b_max(NULL), 
+  b_min(NULL), b_ave_all(NULL), b_max_all(NULL), b_min_all(NULL), 
+  a_count(NULL), a_count_all(NULL), a_ave(NULL), a_max(NULL), a_min(NULL), 
+  a_ave_all(NULL), a_max_all(NULL), a_min_all(NULL), atommols(NULL), 
+  onemols(NULL)
 {
   MPI_Comm_rank(world,&me);
   MPI_Comm_size(world,&nprocs);
diff --git a/src/SHOCK/fix_append_atoms.cpp b/src/SHOCK/fix_append_atoms.cpp
index e14d88aad9..13aca77ca3 100644
--- a/src/SHOCK/fix_append_atoms.cpp
+++ b/src/SHOCK/fix_append_atoms.cpp
@@ -37,7 +37,8 @@ enum{LAYOUT_UNIFORM,LAYOUT_NONUNIFORM,LAYOUT_TILED};    // several files
 /* ---------------------------------------------------------------------- */
 
 FixAppendAtoms::FixAppendAtoms(LAMMPS *lmp, int narg, char **arg) :
-  Fix(lmp, narg, arg)
+  Fix(lmp, narg, arg), randomx(NULL), randomt(NULL), basistype(NULL), 
+  spatialid(NULL), gfactor1(NULL), gfactor2(NULL)
 {
   force_reneighbor = 1;
   next_reneighbor = -1;
diff --git a/src/SHOCK/fix_msst.cpp b/src/SHOCK/fix_msst.cpp
index 42b8358602..c514a9f086 100644
--- a/src/SHOCK/fix_msst.cpp
+++ b/src/SHOCK/fix_msst.cpp
@@ -40,7 +40,9 @@ using namespace FixConst;
 /* ---------------------------------------------------------------------- */
 
 FixMSST::FixMSST(LAMMPS *lmp, int narg, char **arg) :
-  Fix(lmp, narg, arg)
+  Fix(lmp, narg, arg), old_velocity(NULL), rfix(NULL), 
+  id_temp(NULL), id_press(NULL), id_pe(NULL), temperature(NULL), 
+  pressure(NULL), pe(NULL), atoms_allocated(0)
 {
   if (narg < 4) error->all(FLERR,"Illegal fix msst command");
 
diff --git a/src/SHOCK/fix_nphug.cpp b/src/SHOCK/fix_nphug.cpp
index 7fc0f8a381..d28e9daf77 100644
--- a/src/SHOCK/fix_nphug.cpp
+++ b/src/SHOCK/fix_nphug.cpp
@@ -34,7 +34,7 @@ enum{ISO,ANISO,TRICLINIC}; // same as fix_nh.cpp
 /* ---------------------------------------------------------------------- */
 
 FixNPHug::FixNPHug(LAMMPS *lmp, int narg, char **arg) :
-  FixNH(lmp, narg, arg)
+  FixNH(lmp, narg, arg), pe(NULL), id_pe(NULL)
 {
 
   // Prevent masses from being updated every timestep
diff --git a/src/SHOCK/fix_wall_piston.cpp b/src/SHOCK/fix_wall_piston.cpp
index 3513d6e759..7dff3d986f 100644
--- a/src/SHOCK/fix_wall_piston.cpp
+++ b/src/SHOCK/fix_wall_piston.cpp
@@ -33,7 +33,7 @@ using namespace MathConst;
 /* ---------------------------------------------------------------------- */
 
 FixWallPiston::FixWallPiston(LAMMPS *lmp, int narg, char **arg) :
-  Fix(lmp, narg, arg)
+  Fix(lmp, narg, arg), randomt(NULL), gfactor1(NULL), gfactor2(NULL)
 {
   force_reneighbor = 1;
   next_reneighbor = -1;
-- 
GitLab