Skip to content

Commit d80b5af

Browse files
authored
Update esolver_ks_lcao.cpp (#5494)
Just edit some notes
1 parent 722e922 commit d80b5af

File tree

1 file changed

+22
-28
lines changed

1 file changed

+22
-28
lines changed

source/module_esolver/esolver_ks_lcao.cpp

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ namespace ModuleESolver
6666

6767
//------------------------------------------------------------------------------
6868
//! the 1st function of ESolver_KS_LCAO: constructor
69-
//! mohan add 2024-05-11
7069
//------------------------------------------------------------------------------
7170
template <typename TK, typename TR>
7271
ESolver_KS_LCAO<TK, TR>::ESolver_KS_LCAO()
@@ -94,7 +93,6 @@ ESolver_KS_LCAO<TK, TR>::ESolver_KS_LCAO()
9493

9594
//------------------------------------------------------------------------------
9695
//! the 2nd function of ESolver_KS_LCAO: deconstructor
97-
//! mohan add 2024-05-11
9896
//------------------------------------------------------------------------------
9997
template <typename TK, typename TR>
10098
ESolver_KS_LCAO<TK, TR>::~ESolver_KS_LCAO()
@@ -103,21 +101,19 @@ ESolver_KS_LCAO<TK, TR>::~ESolver_KS_LCAO()
103101

104102
//------------------------------------------------------------------------------
105103
//! the 3rd function of ESolver_KS_LCAO: init
106-
//! mohan add 2024-05-11
107104
//! 1) calculate overlap matrix S or initialize
108105
//! 2) init ElecState
109106
//! 3) init LCAO basis
110-
//! 4) redundant pv and LM pointers
111-
//! 5) initialize Density Matrix
112-
//! 6) initialize Hamilt in LCAO
113-
//! 7) initialize exx
114-
//! 8) Quxin added for DFT+U
115-
//! 9) ppcell
116-
//! 10) init HSolver
117-
//! 11) inititlize the charge density.
118-
//! 12) initialize the potential.
119-
//! 13) initialize deepks
120-
//! 14) set occupations?
107+
//! 4) initialize the density matrix
108+
//! 5) initialize Hamilt in LCAO
109+
//! 6) initialize exx
110+
//! 7) initialize DFT+U
111+
//! 8) ppcell
112+
//! 9) inititlize the charge density
113+
//! 10) initialize the potential.
114+
//! 11) initialize deepks
115+
//! 12) set occupations
116+
//! 13) print a warning if needed
121117
//------------------------------------------------------------------------------
122118
template <typename TK, typename TR>
123119
void ESolver_KS_LCAO<TK, TR>::before_all_runners(const Input_para& inp, UnitCell& ucell)
@@ -151,8 +147,7 @@ void ESolver_KS_LCAO<TK, TR>::before_all_runners(const Input_para& inp, UnitCell
151147
} // end ifnot get_S
152148

153149
// 2) init ElecState
154-
// autoset nbands in ElecState, it should before basis_init (for Psi 2d
155-
// divid)
150+
// autoset nbands in ElecState, it should before basis_init (for Psi 2d division)
156151
if (this->pelec == nullptr)
157152
{
158153
// TK stands for double and complex<double>?
@@ -177,27 +172,26 @@ void ESolver_KS_LCAO<TK, TR>::before_all_runners(const Input_para& inp, UnitCell
177172
ucell,
178173
two_center_bundle_,
179174
orb_);
180-
//------------------init Basis_lcao----------------------
181175

182-
// 5) initialize density matrix
176+
// 4) initialize the density matrix
183177
// DensityMatrix is allocated here, DMK is also initialized here
184178
// DMR is not initialized here, it will be constructed in each before_scf
185179
dynamic_cast<elecstate::ElecStateLCAO<TK>*>(this->pelec)->init_DM(&this->kv, &(this->pv), PARAM.inp.nspin);
186180

187-
// this function should be removed outside of the function
181+
// this function should be removed outside of the function in near future
188182
if (PARAM.inp.calculation == "get_S")
189183
{
190184
ModuleBase::timer::tick("ESolver_KS_LCAO", "init");
191185
return;
192186
}
193187

194-
// 6) initialize Hamilt in LCAO
188+
// 5) initialize Hamilt in LCAO
195189
// * allocate H and S matrices according to computational resources
196190
// * set the 'trace' between local H/S and global H/S
197191
LCAO_domain::divide_HS_in_frag(PARAM.globalv.gamma_only_local, pv, this->kv.get_nks(), orb_);
198192

199193
#ifdef __EXX
200-
// 7) initialize exx
194+
// 6) initialize exx
201195
// PLEASE simplify the Exx_Global interface
202196
if (PARAM.inp.calculation == "scf" || PARAM.inp.calculation == "relax" || PARAM.inp.calculation == "cell-relax"
203197
|| PARAM.inp.calculation == "md")
@@ -220,20 +214,20 @@ void ESolver_KS_LCAO<TK, TR>::before_all_runners(const Input_para& inp, UnitCell
220214
}
221215
#endif
222216

223-
// 8) initialize DFT+U
217+
// 7) initialize DFT+U
224218
if (PARAM.inp.dft_plus_u)
225219
{
226220
GlobalC::dftu.init(ucell, &this->pv, this->kv.get_nks(), orb_);
227221
}
228222

229-
// 9) initialize ppcell
223+
// 8) initialize ppcell
230224
GlobalC::ppcell.init_vloc(GlobalC::ppcell.vloc, this->pw_rho);
231225

232-
// 11) inititlize the charge density
226+
// 9) inititlize the charge density
233227
this->pelec->charge->allocate(PARAM.inp.nspin);
234228
this->pelec->omega = GlobalC::ucell.omega;
235229

236-
// 12) initialize the potential
230+
// 10) initialize the potential
237231
if (this->pelec->pot == nullptr)
238232
{
239233
this->pelec->pot = new elecstate::Potential(this->pw_rhod,
@@ -246,7 +240,7 @@ void ESolver_KS_LCAO<TK, TR>::before_all_runners(const Input_para& inp, UnitCell
246240
}
247241

248242
#ifdef __DEEPKS
249-
// 13) initialize deepks
243+
// 11) initialize deepks
250244
if (PARAM.inp.deepks_scf)
251245
{
252246
// load the DeePKS model from deep neural network
@@ -256,13 +250,13 @@ void ESolver_KS_LCAO<TK, TR>::before_all_runners(const Input_para& inp, UnitCell
256250
}
257251
#endif
258252

259-
// 14) set occupations
253+
// 12) set occupations
260254
if (PARAM.inp.ocp)
261255
{
262256
this->pelec->fixed_weights(PARAM.inp.ocp_kb, PARAM.inp.nbands, PARAM.inp.nelec);
263257
}
264258

265-
// 15) if kpar is not divisible by nks, print a warning
259+
// 13) if kpar is not divisible by nks, print a warning
266260
if (GlobalV::KPAR_LCAO > 1)
267261
{
268262
if (this->kv.get_nks() % GlobalV::KPAR_LCAO != 0)

0 commit comments

Comments
 (0)