@@ -51,9 +51,11 @@ template <typename T, typename Device>
5151void ESolver_KS<T, Device>::before_all_runners(UnitCell& ucell, const Input_para& inp)
5252{
5353 ModuleBase::TITLE (" ESolver_KS" , " before_all_runners" );
54- // ! 1) initialize "before_all_runniers" in ESolver_FP
54+
55+ // ! 1) init "before_all_runniers" in ESolver_FP
5556 ESolver_FP::before_all_runners (ucell, inp);
5657
58+ // ! 2) setup some parameters
5759 classname = " ESolver_KS" ;
5860 basisname = " " ;
5961
@@ -65,8 +67,8 @@ void ESolver_KS<T, Device>::before_all_runners(UnitCell& ucell, const Input_para
6567
6668 std::string fft_device = inp.device ;
6769
68- // Fast Fourier Transform
69- // LCAO basis doesn't support GPU acceleration on FFT currently
70+ // ! 3) setup pw_wfc
71+ // currently LCAO doesn't support GPU acceleration of FFT
7072 if (inp.basis_type == " lcao" )
7173 {
7274 fft_device = " cpu" ;
@@ -82,71 +84,49 @@ void ESolver_KS<T, Device>::before_all_runners(UnitCell& ucell, const Input_para
8284 pw_wfc = new ModulePW::PW_Basis_K_Big (fft_device, fft_precision);
8385 ModulePW::PW_Basis_K_Big* tmp = static_cast <ModulePW::PW_Basis_K_Big*>(pw_wfc);
8486
85- // should not use INPUT here, mohan 2024-05-12
8687 tmp->setbxyz (inp.bx , inp.by , inp.bz );
8788
88- // /----------------------------------------------------------
89- // / charge mixing
90- // /----------------------------------------------------------
89+ // ! 4) setup charge mixing
9190 p_chgmix = new Charge_Mixing ();
9291 p_chgmix->set_rhopw (this ->pw_rho , this ->pw_rhod );
9392
9493 // cell_factor
9594 this ->ppcell .cell_factor = inp.cell_factor ;
9695
96+ ModuleBase::GlobalFunc::DONE (GlobalV::ofs_running, " SETUP UNITCELL" );
9797
98- // ! 3) it has been established that
99- // xc_func is same for all elements, therefore
100- // only the first one if used
98+ // ! 5) setup Exc for the first element '0', because all elements have same exc
10199 XC_Functional::set_xc_type (ucell.atoms [0 ].ncpp .xc_func );
102100
103- ModuleBase::GlobalFunc::DONE (GlobalV::ofs_running, " SETUP UNITCELL" );
104-
105- // ! 4) setup the charge mixing parameters
106- p_chgmix->set_mixing (inp.mixing_mode ,
107- inp.mixing_beta ,
108- inp.mixing_ndim ,
109- inp.mixing_gg0 ,
110- inp.mixing_tau ,
111- inp.mixing_beta_mag ,
112- inp.mixing_gg0_mag ,
113- inp.mixing_gg0_min ,
114- inp.mixing_angle ,
115- inp.mixing_dmr ,
116- ucell.omega ,
117- ucell.tpiba );
101+ // ! 6) setup the charge mixing parameters
102+ p_chgmix->set_mixing (inp.mixing_mode , inp.mixing_beta , inp.mixing_ndim ,
103+ inp.mixing_gg0 , inp.mixing_tau , inp.mixing_beta_mag , inp.mixing_gg0_mag ,
104+ inp.mixing_gg0_min , inp.mixing_angle , inp.mixing_dmr , ucell.omega , ucell.tpiba );
118105
119106 p_chgmix->init_mixing ();
120107
121- // ! 5) ESolver depends on the Symmetry module
122- // symmetry analysis should be performed every time the cell is changed
108+ // ! 7) symmetry analysis should be performed every time the cell is changed
123109 if (ModuleSymmetry::Symmetry::symm_flag == 1 )
124110 {
125111 ucell.symm .analy_sys (ucell.lat , ucell.st , ucell.atoms , GlobalV::ofs_running);
126112 ModuleBase::GlobalFunc::DONE (GlobalV::ofs_running, " SYMMETRY" );
127113 }
128114
129- // ! 6 ) Setup the k points according to symmetry.
115+ // ! 8 ) Setup the k points according to symmetry.
130116 this ->kv .set (ucell,ucell.symm , inp.kpoint_file , inp.nspin , ucell.G , ucell.latvec , GlobalV::ofs_running);
131117 ModuleBase::GlobalFunc::DONE (GlobalV::ofs_running, " INIT K-POINTS" );
132118
133- // ! 7 ) print information
119+ // ! 9 ) print information
134120 ModuleIO::setup_parameters (ucell, this ->kv );
135121
136- // ! 8 ) setup plane wave for electronic wave functions
122+ // ! 10 ) setup plane wave for electronic wave functions
137123 ModuleESolver::pw_setup (inp, ucell, *this ->pw_rho , this ->kv , *this ->pw_wfc );
138124
139- // ! 9) initialize the real-space uniform grid for FFT and parallel
140- // ! distribution of plane waves
141- Pgrid.init (this ->pw_rhod ->nx ,
142- this ->pw_rhod ->ny ,
143- this ->pw_rhod ->nz ,
144- this ->pw_rhod ->nplane ,
145- this ->pw_rhod ->nrxx ,
146- pw_big->nbz ,
147- pw_big->bz );
148-
149- // ! 10) calculate the structure factor
125+ // ! 11) parallel of FFT grid
126+ Pgrid.init (this ->pw_rhod ->nx , this ->pw_rhod ->ny , this ->pw_rhod ->nz ,
127+ this ->pw_rhod ->nplane , this ->pw_rhod ->nrxx , pw_big->nbz , pw_big->bz );
128+
129+ // ! 12) calculate the structure factor
150130 this ->sf .setup_structure_factor (&ucell, Pgrid, this ->pw_rhod );
151131}
152132
0 commit comments