Skip to content

Commit 43a7227

Browse files
authored
Update overlap_new.cpp
1 parent 9cc044e commit 43a7227

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

source/module_hamilt_lcao/hamilt_lcaodft/operator_lcao/overlap_new.cpp

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ void hamilt::OverlapNew<hamilt::OperatorLCAO<TK, TR>>::initialize_SR(Grid_Driver
4141
for (int iat1 = 0; iat1 < ucell->nat; iat1++)
4242
{
4343
auto tau1 = ucell->get_tau(iat1);
44-
int T1, I1;
44+
int T1=0;
45+
int I1=0;
4546
ucell->iat2iait(iat1, &I1, &T1);
4647
AdjacentAtomInfo adjs;
4748
GridD->Find_atom(*ucell, tau1, T1, I1, &adjs);
@@ -84,8 +85,8 @@ void hamilt::OverlapNew<hamilt::OperatorLCAO<TK, TR>>::calculate_SR()
8485
for (int iap = 0; iap < this->SR->size_atom_pairs(); ++iap)
8586
{
8687
hamilt::AtomPair<TR>& tmp = this->SR->get_atom_pair(iap);
87-
int iat1 = tmp.get_atom_i();
88-
int iat2 = tmp.get_atom_j();
88+
const int iat1 = tmp.get_atom_i();
89+
const int iat2 = tmp.get_atom_j();
8990
const Parallel_Orbitals* paraV = tmp.get_paraV();
9091

9192
for (int iR = 0; iR < tmp.get_R_size(); ++iR)
@@ -116,9 +117,11 @@ void hamilt::OverlapNew<hamilt::OperatorLCAO<TK, TR>>::cal_SR_IJR(const int& iat
116117
// ---------------------------------------------
117118
// get info of orbitals of atom1 and atom2 from ucell
118119
// ---------------------------------------------
119-
int T1, I1;
120+
int T1=0;
121+
int I1=0;
120122
this->ucell->iat2iait(iat1, &I1, &T1);
121-
int T2, I2;
123+
int T2=0;
124+
int I2=0;
122125
this->ucell->iat2iait(iat2, &I2, &T2);
123126
Atom& atom1 = this->ucell->atoms[T1];
124127
Atom& atom2 = this->ucell->atoms[T2];
@@ -188,14 +191,15 @@ void hamilt::OverlapNew<hamilt::OperatorLCAO<TK, TR>>::contributeHR()
188191
template <typename TK, typename TR>
189192
void hamilt::OverlapNew<hamilt::OperatorLCAO<TK, TR>>::contributeHk(int ik)
190193
{
191-
// if k vector is not changed, then do nothing and return, only for gamma_only case
194+
//! if k vector is not changed, then do nothing and return, only for gamma_only case
192195
if (this->kvec_d[ik] == this->kvec_d_old && std::is_same<TK, double>::value)
193196
{
194197
return;
195198
}
196199
ModuleBase::TITLE("OverlapNew", "contributeHk");
197200
ModuleBase::timer::tick("OverlapNew", "contributeHk");
198-
// set SK to zero and then calculate SK for each k vector
201+
202+
//! set SK to zero and then calculate SK for each k vector
199203
this->hsk->set_zero_sk();
200204
if (ModuleBase::GlobalFunc::IS_COLUMN_MAJOR_KS_SOLVER(PARAM.inp.ks_solver))
201205
{
@@ -207,6 +211,7 @@ void hamilt::OverlapNew<hamilt::OperatorLCAO<TK, TR>>::contributeHk(int ik)
207211
const int ncol = this->SR->get_atom_pair(0).get_paraV()->get_col_size();
208212
hamilt::folding_HR(*this->SR, this->hsk->get_sk(), this->kvec_d[ik], ncol, 0);
209213
}
214+
210215
// update kvec_d_old
211216
this->kvec_d_old = this->kvec_d[ik];
212217

0 commit comments

Comments
 (0)