Skip to content

Commit 70a93c2

Browse files
committed
change uninit memeber value in module_md and module_relax
1 parent 3a0b270 commit 70a93c2

File tree

8 files changed

+41
-41
lines changed

8 files changed

+41
-41
lines changed

source/module_io/unk_overlap_lcao.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ class unkOverlap_lcao
2929
std::vector<std::vector<std::vector<double>>> psi_psi;
3030
std::vector<std::vector<std::vector<ModuleBase::Vector3<double>>>> psi_r_psi;
3131
bool allocate_flag; // translate: Used to initialize the array
32-
int** cal_tag; // Used for parallel scheme
32+
int** cal_tag=nullptr; // Used for parallel scheme
3333

34-
int kpoints_number;
34+
int kpoints_number=0;
3535

3636
std::vector<double> rcut_orb_; // real space cutoffs of LCAO orbitals' radial functions
3737

source/module_md/fire.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class FIRE : public MD_base
4141
*/
4242
void check_fire(void);
4343

44-
double max; ///< max force
44+
double max=0.0; ///< max force
4545
double alpha_start; ///< alpha_start begin
4646
double alpha; ///< alpha begin
4747
double finc; ///< finc begin

source/module_md/md_base.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,13 @@ class MD_base
8282
ModuleBase::Vector3<double>* force; ///< force of each atom
8383
ModuleBase::matrix virial; ///< virial for this lattice
8484
ModuleBase::matrix stress; ///< stress for this lattice
85-
double potential; ///< potential energy
85+
double potential=0.0; ///< potential energy
8686
double kinetic; ///< kinetic energy
8787

8888
protected:
8989
const MD_para& mdp; ///< input parameters used in md
90-
UnitCell& ucell; ///< unitcell information
91-
double energy_; ///< total energy of the system
90+
UnitCell& ucell; ///< unitcell information
91+
double energy_=0.0; ///< total energy of the system
9292

9393
bool cal_stress; ///< whether calculate stress
9494
int my_rank; ///< MPI rank of the processor

source/module_md/msst.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ class MSST : public MD_base
5959
double v0; ///< initial volume
6060
double e0; ///< initial energy
6161
double totmass; ///< total mass of the cell
62-
double lag_pos; ///< Lagrangian location of cell
63-
double vsum; ///< sum over v^2
62+
double lag_pos=0.0; ///< Lagrangian location of cell
63+
double vsum=0.0; ///< sum over v^2
6464
double msst_vel; ///< shock msst_vel (\AA/fs)
6565
double msst_qmass; ///< cell mass-like parameter (mass^2/length^4)
6666
double msst_vis; ///< artificial msst_vis (mass/length/time)

source/module_md/nhchain.h

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -71,33 +71,33 @@ class Nose_Hoover : public MD_base
7171
const static int nys = 7; ///< the number of scale evolution operator
7272
double w[nys]; ///< scale evolution operator
7373

74-
int tdof; ///< particle degree of freedom
75-
double t_target; ///< target temperature
76-
double* mass_eta; ///< mass of thermostats coupled with particles
77-
double* eta; ///< position of thermostats coupled with particles
78-
double* v_eta; ///< velocity of thermostats coupled with particles
79-
double* g_eta; ///< acceleration of thermostats coupled with particles
74+
int tdof; ///< particle degree of freedom
75+
double t_target=0.0;///< target temperature
76+
double* mass_eta; ///< mass of thermostats coupled with particles
77+
double* eta; ///< position of thermostats coupled with particles
78+
double* v_eta; ///< velocity of thermostats coupled with particles
79+
double* g_eta; ///< acceleration of thermostats coupled with particles
8080

81-
int npt_flag; ///< whether NPT ensemble
82-
double mass_omega[6]; ///< mass of lattice component
83-
double v_omega[6]; ///< velocity of lattice component
84-
double pstart[6]; ///< initial stress components
85-
double pstop[6]; ///< final stress components
86-
double pfreq[6]; ///< Oscillation frequency, used to determine qmass of thermostats coupled with barostat
87-
int pflag[6]; ///< control stress components
88-
int pdim; ///< pdim = pflag[0] + pflag[1] + pflag[2], number of barostatted dims
89-
double p_target[6]; ///< target stress components
90-
double p_hydro; ///< target hydrostatic target pressure
91-
double p_current[6]; ///< current stress after coupled
92-
double* mass_peta; ///< mass of thermostats coupled with barostat
93-
double* peta; ///< position of thermostats coupled with barostat
94-
double* v_peta; ///< velocity of thermostats coupled with barostat
95-
double* g_peta; ///< acceleration of thermostats coupled with barostat
96-
double mtk_term; ///< mtk correction
97-
double md_tfreq; ///< Oscillation frequency, used to determine qmass of thermostats coupled with particles
98-
double md_pfirst; ///< Initial pressure
99-
double md_plast; ///< Final pressure
100-
double md_pfreq; ///< Oscillation frequency, used to determine qmass of thermostats coupled with barostat
81+
int npt_flag; ///< whether NPT ensemble
82+
double mass_omega[6]; ///< mass of lattice component
83+
double v_omega[6]; ///< velocity of lattice component
84+
double pstart[6]; ///< initial stress components
85+
double pstop[6]; ///< final stress components
86+
double pfreq[6]; ///< Oscillation frequency, used to determine qmass of thermostats coupled with barostat
87+
int pflag[6]; ///< control stress components
88+
int pdim; ///< pdim = pflag[0] + pflag[1] + pflag[2], number of barostatted dims
89+
double p_target[6]; ///< target stress components
90+
double p_hydro = 0.0; ///< target hydrostatic target pressure
91+
double p_current[6] = {0.0}; ///< current stress after coupled
92+
double* mass_peta; ///< mass of thermostats coupled with barostat
93+
double* peta; ///< position of thermostats coupled with barostat
94+
double* v_peta; ///< velocity of thermostats coupled with barostat
95+
double* g_peta; ///< acceleration of thermostats coupled with barostat
96+
double mtk_term=0; ///< mtk correction
97+
double md_tfreq; ///< Oscillation frequency, used to determine qmass of thermostats coupled with particles
98+
double md_pfirst; ///< Initial pressure
99+
double md_plast; ///< Final pressure
100+
double md_pfreq; ///< Oscillation frequency, used to determine qmass of thermostats coupled with barostat
101101
};
102102

103103
#endif

source/module_relax/relax_old/bfgs_basic.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@ class BFGS_Basic
3939
static double relax_bfgs_w2; // fixed: parameters for Wolfe conditions.
4040

4141
protected:
42-
bool save_flag;
43-
bool tr_min_hit; //.TRUE. if the trust_radius has already been set
42+
bool save_flag=false;
43+
bool tr_min_hit=false; //.TRUE. if the trust_radius has already been set
4444
// to the minimum value at the previous step
4545

4646
// mohan add 2010-07-27
4747
double check_move(const double& lat0, const double& pos, const double& pos_p);
4848

4949
private:
50-
bool wolfe_flag;
50+
bool wolfe_flag=false;
5151
ModuleBase::matrix inv_hess;
5252

5353
int bfgs_ndim;

source/module_relax/relax_old/ions_move_cg.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ class Ions_Move_CG
1313
void start(UnitCell &ucell, const ModuleBase::matrix &force, const double &etot);
1414

1515
static double RELAX_CG_THR;
16-
int sd_step;
17-
int cg_step;
16+
int sd_step=0;
17+
int cg_step=0;
1818

1919
private:
2020
double *pos0;
2121
double *grad0;
2222
double *cg_grad0;
2323
double *move0;
24-
double e0;
24+
double e0=0.0;
2525
// setup gradients.
2626
void setup_cg_grad(double *grad,
2727
const double *grad0,

source/module_relax/relax_old/lattice_change_cg.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class Lattice_Change_CG
1818
double *grad0;
1919
double *cg_grad0;
2020
double *move0;
21-
double e0;
21+
double e0=0.0;
2222

2323
// setup gradients.
2424
void setup_cg_grad(double *grad,

0 commit comments

Comments
 (0)