Skip to content

Commit 997e736

Browse files
initialize pointer with null
1 parent 6ee0e67 commit 997e736

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

source/module_elecstate/module_charge/charge_mixing_dmr.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ void Charge_Mixing::mix_dmr(elecstate::DensityMatrix<double, double>* DM)
3838
std::vector<std::vector<double>>& dmr_save = DM->get_DMR_save();
3939
//
4040
//const int dmr_nspin = (PARAM.inp.nspin == 2) ? 2 : 1;
41-
double* dmr_in;
42-
double* dmr_out;
41+
double* dmr_in = nullptr;
42+
double* dmr_out = nullptr;
4343
if (PARAM.inp.nspin == 1 || PARAM.inp.nspin == 4)
4444
{
4545
dmr_in = dmr_save[0].data();
@@ -137,8 +137,8 @@ void Charge_Mixing::mix_dmr(elecstate::DensityMatrix<std::complex<double>, doubl
137137
std::vector<std::vector<double>>& dmr_save = DM->get_DMR_save();
138138
//
139139
//const int dmr_nspin = (PARAM.inp.nspin == 2) ? 2 : 1;
140-
double* dmr_in;
141-
double* dmr_out;
140+
double* dmr_in = nullptr;
141+
double* dmr_out = nullptr;
142142
if (PARAM.inp.nspin == 1 || PARAM.inp.nspin == 4)
143143
{
144144
dmr_in = dmr_save[0].data();

0 commit comments

Comments
 (0)