|
14 | 14 | #include "source_io/output_log.h" |
15 | 15 | #include "source_io/print_info.h" |
16 | 16 | #include "source_io/rhog_io.h" |
17 | | -#include "source_io/write_elecstat_pot.h" |
18 | | -#include "source_io/write_elf.h" |
19 | 17 | #include "source_io/module_parameter/parameter.h" |
20 | 18 | #include "source_cell/k_vector_utils.h" |
21 | | - |
22 | | -#ifdef USE_LIBXC |
23 | | -#include "source_io/write_libxc_r.h" |
24 | | -#endif |
| 19 | +#include "source_io/ctrl_output_fp.h" |
25 | 20 |
|
26 | 21 | namespace ModuleESolver |
27 | 22 | { |
@@ -162,172 +157,9 @@ void ESolver_FP::after_scf(UnitCell& ucell, const int istep, const bool conv_eso |
162 | 157 | // 3) update delta_rho for charge extrapolation |
163 | 158 | CE.update_delta_rho(ucell, &(this->chr), &(this->sf)); |
164 | 159 |
|
| 160 | + // 4) print out charge density, potential, elf, etc. |
| 161 | + ModuleIO::ctrl_output_fp(ucell, this->pelec, istep); |
165 | 162 |
|
166 | | - // print out the 'g' index when istep_in!=-1 |
167 | | - int istep_in = -1; |
168 | | - if (PARAM.inp.out_freq_ion>0) // default value of out_freq_ion is 0 |
169 | | - { |
170 | | - if (istep % PARAM.inp.out_freq_ion == 0) |
171 | | - { |
172 | | - istep_in = istep; |
173 | | - } |
174 | | - } |
175 | | - |
176 | | - std::string geom_block; |
177 | | - if(istep_in==-1) |
178 | | - { |
179 | | - // do nothing |
180 | | - } |
181 | | - else if(istep_in>=0) |
182 | | - { |
183 | | - geom_block = "g" + std::to_string(istep + 1); |
184 | | - } |
185 | | - |
186 | | - // 4) write charge density |
187 | | - |
188 | | - const int nspin = PARAM.inp.nspin; |
189 | | - |
190 | | - if (PARAM.inp.out_chg[0] > 0) |
191 | | - { |
192 | | - for (int is = 0; is < nspin; ++is) |
193 | | - { |
194 | | - this->pw_rhod->real2recip(this->chr.rho_save[is], this->chr.rhog_save[is]); |
195 | | - |
196 | | - std::string fn =PARAM.globalv.global_out_dir + "chg"; |
197 | | - |
198 | | - std::string spin_block; |
199 | | - if(nspin == 2 || nspin == 4) |
200 | | - { |
201 | | - spin_block= "s" + std::to_string(is + 1); |
202 | | - } |
203 | | - else if(nspin == 1) |
204 | | - { |
205 | | - // do nothing |
206 | | - } |
207 | | - |
208 | | - fn += spin_block + geom_block + ".cube"; |
209 | | - |
210 | | - ModuleIO::write_vdata_palgrid(Pgrid, |
211 | | - this->chr.rho_save[is], |
212 | | - is, |
213 | | - nspin, |
214 | | - istep_in, |
215 | | - fn, |
216 | | - this->pelec->eferm.get_efval(is), |
217 | | - &(ucell), |
218 | | - PARAM.inp.out_chg[1], |
219 | | - 1); |
220 | | - |
221 | | - if (XC_Functional::get_ked_flag()) |
222 | | - { |
223 | | - fn = PARAM.globalv.global_out_dir + "tau"; |
224 | | - |
225 | | - fn += spin_block + geom_block + ".cube"; |
226 | | - |
227 | | - ModuleIO::write_vdata_palgrid(Pgrid, |
228 | | - this->chr.kin_r_save[is], |
229 | | - is, |
230 | | - nspin, |
231 | | - istep, |
232 | | - fn, |
233 | | - this->pelec->eferm.get_efval(is), |
234 | | - &(ucell)); |
235 | | - } |
236 | | - } |
237 | | - } |
238 | | - |
239 | | - // 5) write potential |
240 | | - if (PARAM.inp.out_pot == 1 || PARAM.inp.out_pot == 3) |
241 | | - { |
242 | | - for (int is = 0; is < nspin; is++) |
243 | | - { |
244 | | - std::string fn =PARAM.globalv.global_out_dir + "pot"; |
245 | | - |
246 | | - std::string spin_block; |
247 | | - if(nspin == 2 || nspin == 4) |
248 | | - { |
249 | | - spin_block= "s" + std::to_string(is + 1); |
250 | | - } |
251 | | - else if(nspin == 1) |
252 | | - { |
253 | | - // do nothing |
254 | | - } |
255 | | - |
256 | | - fn += spin_block + geom_block + ".cube"; |
257 | | - |
258 | | - ModuleIO::write_vdata_palgrid(Pgrid, |
259 | | - this->pelec->pot->get_effective_v(is), |
260 | | - is, |
261 | | - nspin, |
262 | | - istep_in, |
263 | | - fn, |
264 | | - 0.0, // efermi |
265 | | - &(ucell), |
266 | | - 3, // precision |
267 | | - 0); // out_fermi |
268 | | - } |
269 | | - } |
270 | | - else if (PARAM.inp.out_pot == 2) |
271 | | - { |
272 | | - std::string fn =PARAM.globalv.global_out_dir + "potes"; |
273 | | - fn += geom_block + ".cube"; |
274 | | - |
275 | | - ModuleIO::write_elecstat_pot( |
276 | | -#ifdef __MPI |
277 | | - this->pw_big->bz, |
278 | | - this->pw_big->nbz, |
279 | | -#endif |
280 | | - fn, |
281 | | - istep, |
282 | | - this->pw_rhod, |
283 | | - &this->chr, |
284 | | - &(ucell), |
285 | | - this->pelec->pot->get_fixed_v(), |
286 | | - this->solvent); |
287 | | - } |
288 | | - |
289 | | - // 6) write ELF |
290 | | - if (PARAM.inp.out_elf[0] > 0) |
291 | | - { |
292 | | - this->chr.cal_elf = true; |
293 | | - Symmetry_rho srho; |
294 | | - for (int is = 0; is < nspin; is++) |
295 | | - { |
296 | | - srho.begin(is, this->chr, this->pw_rhod, ucell.symm); |
297 | | - } |
298 | | - |
299 | | - std::string out_dir =PARAM.globalv.global_out_dir; |
300 | | - ModuleIO::write_elf( |
301 | | -#ifdef __MPI |
302 | | - this->pw_big->bz, |
303 | | - this->pw_big->nbz, |
304 | | -#endif |
305 | | - out_dir, |
306 | | - istep, |
307 | | - nspin, |
308 | | - this->chr.rho, |
309 | | - this->chr.kin_r, |
310 | | - this->pw_rhod, |
311 | | - this->Pgrid, |
312 | | - &(ucell), |
313 | | - PARAM.inp.out_elf[1]); |
314 | | - } |
315 | | - |
316 | | -#ifdef USE_LIBXC |
317 | | - // 7) write xc(r) |
318 | | - if(PARAM.inp.out_xc_r[0]>=0) |
319 | | - { |
320 | | - ModuleIO::write_libxc_r( |
321 | | - PARAM.inp.out_xc_r[0], |
322 | | - XC_Functional::get_func_id(), |
323 | | - this->pw_rhod->nrxx, // number of real-space grid |
324 | | - ucell.omega, // volume of cell |
325 | | - ucell.tpiba, |
326 | | - this->chr, |
327 | | - *this->pw_big, |
328 | | - *this->pw_rhod); |
329 | | - } |
330 | | -#endif |
331 | 163 | } |
332 | 164 |
|
333 | 165 | void ESolver_FP::before_scf(UnitCell& ucell, const int istep) |
|
0 commit comments