Skip to content

Commit a983a23

Browse files
committed
modify some comments
1 parent ecedf4f commit a983a23

File tree

2 files changed

+21
-26
lines changed

2 files changed

+21
-26
lines changed

source/module_rdmft/rdmft.h

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -185,38 +185,39 @@ class RDMFT
185185
bool only_exx_type = false;
186186
const int cal_E_type = 1; // cal_type = 2 just support XC-functional without exx
187187

188+
//! initialization of rdmft calculation
188189
void init(Gint_Gamma& GG_in, Gint_k& GK_in, Parallel_Orbitals& ParaV_in, UnitCell& ucell_in,
189190
K_Vectors& kv_in, elecstate::ElecState& pelec_in, LCAO_Orbitals& orb_in, TwoCenterBundle& two_center_bundle_in, std::string XC_func_rdmft_in, double alpha_power_in);
190191

191-
// update in ion-step and get V_TV
192+
//! update in ion-step and get V_TV
192193
void update_ion(UnitCell& ucell_in, ModulePW::PW_Basis& rho_basis_in,
193194
ModuleBase::matrix& vloc_in, ModuleBase::ComplexMatrix& sf_in);
194195

195-
// update in elec-step
196+
//! update in elec-step
196197
// Or we can use rdmft_solver.wfc/occ_number directly when optimizing, so that the update_elec() function does not require parameters.
197198
void update_elec(const ModuleBase::matrix& occ_number_in, const psi::Psi<TK>& wfc_in, const Charge* charge_in = nullptr);
198199

199-
// update occ_number for optimization algorithms that depend on Hamilton
200+
//! update occ_number for optimization algorithms that depend on Hamilton
200201
void update_occNumber(const ModuleBase::matrix& occ_number_in);
201202

202-
// update occ_number for optimization algorithms that depend on Hamilton
203+
//! update occ_number for optimization algorithms that depend on Hamilton
203204
void update_wg(const ModuleBase::matrix& wg_in);
204205

205-
// do all calculation after update occNum&wfc, get Etotal and the gradient of energy with respect to the occNum&wfc
206+
//! do all calculation after update occNum&wfc, get Etotal and the gradient of energy with respect to the occNum&wfc
206207
double run(ModuleBase::matrix& E_gradient_occNum, psi::Psi<TK>& E_gradient_wfc);
207208

208209

209210

210211
protected:
211212

212-
// get the special density matrix DM_XC(nk*nbasis_local*nbasis_local)
213+
//! get the special density matrix DM_XC(nk*nbasis_local*nbasis_local)
213214
void get_DM_XC(std::vector< std::vector<TK> >& DM_XC);
214215

215216
void cal_V_TV();
216217

217218
void cal_V_hartree();
218219

219-
// construct V_XC based on different XC_functional( i.e. RDMFT class member XC_func_rdmft)
220+
//! construct V_XC based on different XC_functional( i.e. RDMFT class member XC_func_rdmft)
220221
void cal_V_XC();
221222

222223
double cal_E_gradient();
@@ -227,7 +228,7 @@ class RDMFT
227228

228229
private:
229230

230-
// get the total Hamilton in k-space
231+
//! get the total Hamilton in k-space
231232
void cal_Hk_Hpsi();
232233

233234
void update_charge();

source/module_rdmft/rdmft_tools.h

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,11 @@ namespace rdmft
8888
// }
8989

9090

91-
// now support XC_func_rdmft = "hf", "muller", "power", "pbe", "pbe0". "wp22" and "cwp22" is realizing.
91+
//! now support XC_func_rdmft = "hf", "muller", "power", "pbe", "pbe0". "wp22" and "cwp22" is realizing.
9292
// for the dft-xc-functional part of xc-functional, just use the default is right! Or don't use the function
9393
double occNum_func(double eta, int symbol = 0, const std::string XC_func_rdmft = "hf", const double alpha_power = 1.0);
9494

9595

96-
97-
9896
template <typename TK>
9997
void conj_psi(psi::Psi<TK>& wfc)
10098
{
@@ -109,7 +107,7 @@ void conj_psi<double>(psi::Psi<double>& wfc);
109107

110108

111109
// wfc and H_wfc need to be k_firest and provide wfc(ik, 0, 0) and H_wfc(ik, 0, 0)
112-
// psi::Psi<TK> psi's (), std::vector<TK> HK's [] operator overloading return TK
110+
//! implement matrix multiplication of Hk^dagger and psi
113111
template <typename TK>
114112
void HkPsi(const Parallel_Orbitals* ParaV, const TK& HK, const TK& wfc, TK& H_wfc)
115113
{
@@ -136,6 +134,7 @@ template <>
136134
void HkPsi<double>(const Parallel_Orbitals* ParaV, const double& HK, const double& wfc, double& H_wfc);
137135

138136

137+
//! implement matrix multiplication of psi^dagger and psi
139138
template <typename TK>
140139
void psiDotPsi(const Parallel_Orbitals* ParaV, const Parallel_2D& para_Eij_in, const TK& wfc, const TK& H_wfc, std::vector<TK>& Dmn, double* wfcHwfc)
141140
{
@@ -176,7 +175,7 @@ void psiDotPsi<double>(const Parallel_Orbitals* ParaV, const Parallel_2D& para_w
176175
const double& wfc, const double& H_wfc, std::vector<double>& Dmn, double* wfcHwfc);
177176

178177

179-
// realize occNum_wfc = occNum * wfc. Calling this function and we can get wfc = occNum*wfc.
178+
//! realize occNum_wfc = occNum * wfc. Calling this function and we can get wfc = occNum*wfc.
180179
template <typename TK>
181180
void occNum_MulPsi(const Parallel_Orbitals* ParaV, const ModuleBase::matrix& occ_number, psi::Psi<TK>& wfc, int symbol = 0,
182181
const std::string XC_func_rdmft = "hf", const double alpha = 1.0)
@@ -200,7 +199,7 @@ void occNum_MulPsi(const Parallel_Orbitals* ParaV, const ModuleBase::matrix& occ
200199
}
201200

202201

203-
// add psi with eta and g(eta)
202+
//! add psi with eta and g(eta)
204203
template <typename TK>
205204
void add_psi(const Parallel_Orbitals* ParaV,
206205
const K_Vectors* kv,
@@ -242,8 +241,8 @@ void add_psi(const Parallel_Orbitals* ParaV,
242241
}
243242

244243

245-
// occNum_wfcHwfc = occNum*wfcHwfc + occNum_wfcHwfc
246-
// When symbol = 0, 1, 2, 3, 4, occNum = occNum, 0.5*occNum, g(occNum), 0.5*g(occNum), d_g(occNum)/d_occNum respectively. Default symbol=0.
244+
//! occNum_wfcHwfc = occNum*wfcHwfc + occNum_wfcHwfc
245+
//! When symbol = 0, 1, 2, 3, 4, occNum = occNum, 0.5*occNum, g(occNum), 0.5*g(occNum), d_g(occNum)/d_occNum respectively. Default symbol=0.
247246
void occNum_Mul_wfcHwfc(const ModuleBase::matrix& occ_number,
248247
const ModuleBase::matrix& wfcHwfc,
249248
ModuleBase::matrix& occNum_wfcHwfc,
@@ -252,8 +251,8 @@ void occNum_Mul_wfcHwfc(const ModuleBase::matrix& occ_number,
252251
const double alpha = 1.0);
253252

254253

255-
// Default symbol = 0 for the gradient of Etotal with respect to occupancy
256-
// symbol = 1 for the relevant calculation of Etotal
254+
//! Default symbol = 0 for the gradient of Etotal with respect to occupancy
255+
//! symbol = 1 for the relevant calculation of Etotal
257256
void add_occNum(const K_Vectors& kv,
258257
const ModuleBase::matrix& occ_number,
259258
const ModuleBase::matrix& wfcHwfc_TV_in,
@@ -265,9 +264,7 @@ void add_occNum(const K_Vectors& kv,
265264
const double alpha = 1.0);
266265

267266

268-
// // do wk*g(occNum)*wfcHwfc and add for TV, hartree, XC. This function just use once, so it can be replace and delete
269-
// void add_wfcHwfc(const std::vector<double>& wk_in, const ModuleBase::matrix& occ_number, const ModuleBase::matrix& wfcHwfc_TV_in, const ModuleBase::matrix& wfcHwfc_hartree_in,
270-
// const ModuleBase::matrix& wfcHwfc_XC_in, ModuleBase::matrix& occNum_wfcHwfc, const std::string XC_func_rdmft, const double alpha);
267+
//! do wk*g(occNum)*wfcHwfc and add for TV, hartree, XC. This function just use once, so it can be replace and delete
271268
void add_wfcHwfc(const ModuleBase::matrix& wg,
272269
const ModuleBase::matrix& wk_fun_occNum,
273270
const ModuleBase::matrix& wfcHwfc_TV_in,
@@ -278,15 +275,15 @@ void add_wfcHwfc(const ModuleBase::matrix& wg,
278275
const double alpha);
279276

280277

281-
//give certain occNum_wfcHwfc, get the corresponding energy
278+
//! give certain occNum_wfcHwfc, get the corresponding energy
282279
double getEnergy(const ModuleBase::matrix& occNum_wfcHwfc);
283280

284281

285282

286283

287284

288285

289-
// this part of the code is copying from class Veff and do some modifications.
286+
//! this part of the code is copying from class Veff and do some modifications.
290287
template <typename TK, typename TR>
291288
class Veff_rdmft : public hamilt::OperatorLCAO<TK, TR>
292289
{
@@ -429,9 +426,6 @@ class Veff_rdmft : public hamilt::OperatorLCAO<TK, TR>
429426

430427

431428

432-
433-
434-
435429
}
436430

437431
#endif

0 commit comments

Comments
 (0)