Skip to content

Commit 1631c5e

Browse files
initialize the variables and use doxygen-style notes
1 parent 997e736 commit 1631c5e

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

source/module_elecstate/module_charge/charge_mixing_preconditioner.cpp

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,19 @@ void Charge_Mixing::Kerker_screen_recip(std::complex<double>* drhog)
99
if (this->mixing_gg0 <= 0.0 || this->mixing_beta <= 0.1) {
1010
return;
1111
}
12-
double fac, gg0, amin;
12+
double fac = 0.0;
13+
double gg0 = 0.0;
14+
double amin = 0.0;
1315

14-
// consider a resize for mixing_angle
16+
/// consider a resize for mixing_angle
1517
int resize_tmp = 1;
1618
if (PARAM.inp.nspin == 4 && this->mixing_angle > 0) { resize_tmp = 2;
1719
}
1820

19-
// implement Kerker for density and magnetization separately
21+
/// implement Kerker for density and magnetization separately
2022
for (int is = 0; is < PARAM.inp.nspin / resize_tmp; ++is)
2123
{
22-
// new mixing method only support nspin=2 not nspin=4
24+
/// new mixing method only support nspin=2 not nspin=4
2325
if (is >= 1)
2426
{
2527
if (this->mixing_gg0_mag <= 0.0001 || this->mixing_beta_mag <= 0.1)
@@ -62,11 +64,11 @@ void Charge_Mixing::Kerker_screen_real(double* drhor)
6264
if (this->mixing_gg0 <= 0.0001 || this->mixing_beta <= 0.1) {
6365
return;
6466
}
65-
// consider a resize for mixing_angle
67+
/// consider a resize for mixing_angle
6668
int resize_tmp = 1;
6769
if (PARAM.inp.nspin == 4 && this->mixing_angle > 0) { resize_tmp = 2;
6870
}
69-
//
71+
7072
std::vector<std::complex<double>> drhog(this->rhopw->npw * PARAM.inp.nspin / resize_tmp);
7173
std::vector<double> drhor_filter(this->rhopw->nrxx * PARAM.inp.nspin / resize_tmp);
7274
for (int is = 0; is < PARAM.inp.nspin / resize_tmp; ++is)
@@ -75,8 +77,11 @@ void Charge_Mixing::Kerker_screen_real(double* drhor)
7577
// Thus we cannot use Kerker_screen_recip(drhog.data()) directly after it.
7678
this->rhopw->real2recip(drhor + is * this->rhopw->nrxx, drhog.data() + is * this->rhopw->npw);
7779
}
78-
// implement Kerker for density and magnetization separately
79-
double fac, gg0, amin;
80+
/// implement Kerker for density and magnetization separately
81+
double fac = 0.0;
82+
double gg0 = 0.0;
83+
double amin = 0.0;
84+
8085
for (int is = 0; is < PARAM.inp.nspin / resize_tmp; is++)
8186
{
8287

@@ -85,7 +90,7 @@ void Charge_Mixing::Kerker_screen_real(double* drhor)
8590
if (this->mixing_gg0_mag <= 0.0001 || this->mixing_beta_mag <= 0.1)
8691
{
8792
#ifdef __DEBUG
88-
assert(is == 1); // make sure break works
93+
assert(is == 1); /// make sure break works
8994
#endif
9095
double is_mag = PARAM.inp.nspin - 1;
9196
if (PARAM.inp.nspin == 4 && this->mixing_angle > 0) { is_mag = 1;
@@ -122,7 +127,7 @@ void Charge_Mixing::Kerker_screen_real(double* drhor)
122127
drhog[is * this->rhopw->npw + ig] *= (1 - filter_g);
123128
}
124129
}
125-
// inverse FT
130+
/// inverse FT
126131
for (int is = 0; is < PARAM.inp.nspin / resize_tmp; ++is)
127132
{
128133
this->rhopw->recip2real(drhog.data() + is * this->rhopw->npw, drhor_filter.data() + is * this->rhopw->nrxx);

0 commit comments

Comments
 (0)