diff --git a/source/module_hamilt_lcao/module_tddft/band_energy.cpp b/source/module_hamilt_lcao/module_tddft/band_energy.cpp index 67bcb53535..90242912d0 100644 --- a/source/module_hamilt_lcao/module_tddft/band_energy.cpp +++ b/source/module_hamilt_lcao/module_tddft/band_energy.cpp @@ -109,7 +109,7 @@ void compute_ekb(const Parallel_Orbitals* pv, } int info = 0; - int naroc[2]; + int naroc[2] = {0, 0}; double* Eii = new double[nband]; ModuleBase::GlobalFunc::ZEROS(Eii, nband); @@ -242,7 +242,7 @@ void compute_ekb_tensor(const Parallel_Orbitals* pv, } int info = 0; - int naroc[2]; + int naroc[2] = {0, 0}; // Create a Tensor for Eii ct::Tensor Eii(ct::DataType::DT_DOUBLE, ct::DeviceType::CpuDevice, ct::TensorShape({nband})); diff --git a/source/module_hamilt_lcao/module_tddft/norm_psi.cpp b/source/module_hamilt_lcao/module_tddft/norm_psi.cpp index dcf055f14b..c053dcbc6a 100644 --- a/source/module_hamilt_lcao/module_tddft/norm_psi.cpp +++ b/source/module_hamilt_lcao/module_tddft/norm_psi.cpp @@ -98,7 +98,7 @@ void norm_psi(const Parallel_Orbitals* pv, GlobalV::ofs_running << std::endl; } - int naroc[2]; // maximum number of row or column + int naroc[2] = {0, 0}; // maximum number of row or column for (int iprow = 0; iprow < pv->dim0; ++iprow) { @@ -304,7 +304,7 @@ void norm_psi_tensor(const Parallel_Orbitals* pv, GlobalV::ofs_running << std::endl; } - int naroc[2]; // maximum number of row or column + int naroc[2] = {0, 0}; // maximum number of row or column for (int iprow = 0; iprow < pv->dim0; ++iprow) { diff --git a/source/module_hamilt_lcao/module_tddft/propagator.cpp b/source/module_hamilt_lcao/module_tddft/propagator.cpp index ef0e46cde3..474c4438f9 100644 --- a/source/module_hamilt_lcao/module_tddft/propagator.cpp +++ b/source/module_hamilt_lcao/module_tddft/propagator.cpp @@ -916,8 +916,8 @@ void Propagator::compute_propagator_taylor(const int nlocal, } // set rank0 - int info; - int naroc[2]; // maximum number of row or column + int info = 0; + int naroc[2] = {0, 0}; // maximum number of row or column for (int iprow = 0; iprow < this->ParaV->dim0; ++iprow) {