Skip to content

Commit 72585a1

Browse files
author
dyzheng
committed
Feature: same truncation of multi-k and gamma_only calculation with DeePKS
1 parent cbaccdf commit 72585a1

1 file changed

Lines changed: 18 additions & 23 deletions

File tree

source/module_hamilt_lcao/hamilt_lcaodft/operator_lcao/deepks_lcao.cpp

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ void hamilt::DeePKS<hamilt::OperatorLCAO<TK, TR>>::initialize_HR(Grid_Driver* Gr
4848
ModuleBase::TITLE("DeePKS", "initialize_HR");
4949
ModuleBase::timer::tick("DeePKS", "initialize_HR");
5050

51-
//this->H_V_delta = new HContainer<TR>(paraV);
51+
this->H_V_delta = new HContainer<TR>(paraV);
5252
if(std::is_same<TK, double>::value)
5353
{
54-
this->H_V_delta = new HContainer<TR>(paraV);
54+
//this->H_V_delta = new HContainer<TR>(paraV);
5555
this->H_V_delta->fix_gamma();
5656
}
5757

@@ -117,10 +117,10 @@ void hamilt::DeePKS<hamilt::OperatorLCAO<TK, TR>>::initialize_HR(Grid_Driver* Gr
117117
R_index2.y - R_index1.y,
118118
R_index2.z - R_index1.z,
119119
paraV);
120-
if(std::is_same<TK, double>::value)
121-
{
122-
this->H_V_delta->insert_pair(tmp);
123-
}
120+
//if(std::is_same<TK, double>::value)
121+
//{
122+
this->H_V_delta->insert_pair(tmp);
123+
//}
124124
}
125125
}
126126
if(pre_cal_nlm)
@@ -129,15 +129,10 @@ void hamilt::DeePKS<hamilt::OperatorLCAO<TK, TR>>::initialize_HR(Grid_Driver* Gr
129129
}
130130
}
131131
// allocate the memory of BaseMatrix in HR, and set the new values to zero
132-
if(std::is_same<TK, double>::value)
133-
{
134-
// only gamma-only has full size of Hamiltonian of DeePKS now,
135-
// multi-k keep same size of nonlocal operator, H_V_delta will be allocated by hR
136-
this->H_V_delta->allocate(nullptr, true);
137-
// expand hR with H_V_delta, only gamma-only case now
138-
this->hR->add(*this->H_V_delta);
139-
this->hR->allocate(nullptr, false);
140-
}
132+
//if(std::is_same<TK, double>::value)
133+
//{
134+
this->H_V_delta->allocate(nullptr, true);
135+
//}
141136

142137
ModuleBase::timer::tick("DeePKS", "initialize_HR");
143138
}
@@ -200,10 +195,10 @@ void DeePKS<OperatorLCAO<std::complex<double>, double>>::contributeHR()
200195
//GlobalC::ld.add_v_delta_k(*this->ucell, GlobalC::ORB, GlobalC::GridD, this->LM->ParaV->nnr);
201196

202197
// recalculate the H_V_delta
203-
if(this->H_V_delta == nullptr)
204-
{
205-
this->H_V_delta = new hamilt::HContainer<double>(*this->hR);
206-
}
198+
//if(this->H_V_delta == nullptr)
199+
//{
200+
// this->H_V_delta = new hamilt::HContainer<double>(*this->hR);
201+
//}
207202
this->H_V_delta->set_zero();
208203
this->calculate_HR();
209204

@@ -242,10 +237,10 @@ void DeePKS<OperatorLCAO<std::complex<double>, std::complex<double>>>::contribut
242237
// .add_v_delta_k(*this->ucell, GlobalC::ORB, GlobalC::GridD, this->LM->ParaV->nnr);
243238

244239
// recalculate the H_V_delta
245-
if(this->H_V_delta == nullptr)
246-
{
247-
this->H_V_delta = new hamilt::HContainer<std::complex<double>>(*this->hR);
248-
}
240+
//if(this->H_V_delta == nullptr)
241+
//{
242+
// this->H_V_delta = new hamilt::HContainer<std::complex<double>>(*this->hR);
243+
//}
249244
this->H_V_delta->set_zero();
250245
this->calculate_HR();
251246

0 commit comments

Comments
 (0)