Skip to content

Commit bfd1cfa

Browse files
committed
move some files from esolver_fp to ctrl_output_fp
1 parent ebc48d9 commit bfd1cfa

File tree

4 files changed

+43
-29
lines changed

4 files changed

+43
-29
lines changed

source/source_esolver/esolver_fp.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#include "source_hamilt/module_vdw/vdw.h"
99
#include "source_pw/module_pwdft/global.h"
1010
#include "source_io/cif_io.h"
11-
#include "source_io/cube_io.h"
11+
#include "source_io/cube_io.h" // use write_vdata_palgrid
1212
#include "source_io/json_output/init_info.h"
1313
#include "source_io/json_output/output_info.h"
1414
#include "source_io/output_log.h"
@@ -158,7 +158,8 @@ void ESolver_FP::after_scf(UnitCell& ucell, const int istep, const bool conv_eso
158158
CE.update_delta_rho(ucell, &(this->chr), &(this->sf));
159159

160160
// 4) print out charge density, potential, elf, etc.
161-
ModuleIO::ctrl_output_fp(ucell, this->pelec, istep);
161+
ModuleIO::ctrl_output_fp(ucell, this->pelec, this->pw_big, this->pw_rhod,
162+
this->chr, this->solvent, this->Pgrid, istep);
162163

163164
}
164165

source/source_esolver/esolver_of.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@
1111
#include "source_pw/module_pwdft/global.h"
1212
#include "source_io/print_info.h"
1313
#include "source_estate/cal_ux.h"
14-
//-----force-------------------
1514
#include "source_pw/module_pwdft/forces.h"
16-
//-----stress------------------
1715
#include "source_pw/module_ofdft/of_stress_pw.h"
1816

1917
namespace ModuleESolver

source/source_io/ctrl_output_fp.cpp

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,24 @@
11
#include "source_io/ctrl_output_fp.h" // use ctrl_output_fp()
2-
#include "source_io/write_elecstat_pot.h"
2+
#include "source_estate/module_charge/symmetry_rho.h" // use Symmetry_rho
3+
#include "source_io/write_elecstat_pot.h" // use write_elecstat_pot
34
#include "source_io/write_elf.h"
5+
#include "cube_io.h" // use write_vdata_palgrid
46

57
#ifdef USE_LIBXC
68
#include "source_io/write_libxc_r.h"
9+
#include "source_hamilt/module_xc/xc_functional.h" // use XC_Functional::get_func_id()
710
#endif
811

912
namespace ModuleIO
1013
{
1114

1215
void ctrl_output_fp(UnitCell& ucell,
1316
elecstate::ElecState* pelec,
17+
ModulePW::PW_Basis_Big* pw_big,
18+
ModulePW::PW_Basis* pw_rhod,
19+
Charge &chr,
20+
surchem &solvent,
21+
Parallel_Grid &para_grid,
1422
const int istep)
1523
{
1624
ModuleBase::TITLE("ModuleIO", "ctrl_output_fp");
@@ -48,7 +56,7 @@ void ctrl_output_fp(UnitCell& ucell,
4856
{
4957
for (int is = 0; is < nspin; ++is)
5058
{
51-
this->pw_rhod->real2recip(this->chr.rho_save[is], this->chr.rhog_save[is]);
59+
pw_rhod->real2recip(chr.rho_save[is], chr.rhog_save[is]);
5260

5361
std::string fn =PARAM.globalv.global_out_dir + "chg";
5462

@@ -64,8 +72,8 @@ void ctrl_output_fp(UnitCell& ucell,
6472

6573
fn += spin_block + geom_block + ".cube";
6674

67-
ModuleIO::write_vdata_palgrid(Pgrid,
68-
this->chr.rho_save[is],
75+
ModuleIO::write_vdata_palgrid(para_grid,
76+
chr.rho_save[is],
6977
is,
7078
nspin,
7179
istep_in,
@@ -81,8 +89,8 @@ void ctrl_output_fp(UnitCell& ucell,
8189

8290
fn += spin_block + geom_block + ".cube";
8391

84-
ModuleIO::write_vdata_palgrid(Pgrid,
85-
this->chr.kin_r_save[is],
92+
ModuleIO::write_vdata_palgrid(para_grid,
93+
chr.kin_r_save[is],
8694
is,
8795
nspin,
8896
istep,
@@ -112,7 +120,7 @@ void ctrl_output_fp(UnitCell& ucell,
112120

113121
fn += spin_block + geom_block + ".cube";
114122

115-
ModuleIO::write_vdata_palgrid(Pgrid,
123+
ModuleIO::write_vdata_palgrid(para_grid,
116124
pelec->pot->get_effective_v(is),
117125
is,
118126
nspin,
@@ -131,41 +139,41 @@ void ctrl_output_fp(UnitCell& ucell,
131139

132140
ModuleIO::write_elecstat_pot(
133141
#ifdef __MPI
134-
this->pw_big->bz,
135-
this->pw_big->nbz,
142+
pw_big->bz,
143+
pw_big->nbz,
136144
#endif
137145
fn,
138146
istep,
139-
this->pw_rhod,
140-
&this->chr,
147+
pw_rhod,
148+
&chr,
141149
&(ucell),
142150
pelec->pot->get_fixed_v(),
143-
this->solvent);
151+
solvent);
144152
}
145153

146154
// 6) write ELF
147155
if (PARAM.inp.out_elf[0] > 0)
148156
{
149-
this->chr.cal_elf = true;
157+
chr.cal_elf = true;
150158
Symmetry_rho srho;
151159
for (int is = 0; is < nspin; is++)
152160
{
153-
srho.begin(is, this->chr, this->pw_rhod, ucell.symm);
161+
srho.begin(is, chr, pw_rhod, ucell.symm);
154162
}
155163

156164
std::string out_dir =PARAM.globalv.global_out_dir;
157165
ModuleIO::write_elf(
158166
#ifdef __MPI
159-
this->pw_big->bz,
160-
this->pw_big->nbz,
167+
pw_big->bz,
168+
pw_big->nbz,
161169
#endif
162170
out_dir,
163171
istep,
164172
nspin,
165-
this->chr.rho,
166-
this->chr.kin_r,
167-
this->pw_rhod,
168-
this->Pgrid,
173+
chr.rho,
174+
chr.kin_r,
175+
pw_rhod,
176+
para_grid,
169177
&(ucell),
170178
PARAM.inp.out_elf[1]);
171179
}
@@ -177,12 +185,12 @@ void ctrl_output_fp(UnitCell& ucell,
177185
ModuleIO::write_libxc_r(
178186
PARAM.inp.out_xc_r[0],
179187
XC_Functional::get_func_id(),
180-
this->pw_rhod->nrxx, // number of real-space grid
188+
pw_rhod->nrxx, // number of real-space grid
181189
ucell.omega, // volume of cell
182190
ucell.tpiba,
183-
this->chr,
184-
*this->pw_big,
185-
*this->pw_rhod);
191+
chr,
192+
*pw_big,
193+
*pw_rhod);
186194
}
187195
#endif
188196

source/source_io/ctrl_output_fp.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,15 @@
55

66
namespace ModuleIO
77
{
8+
89
void ctrl_output_fp(UnitCell& ucell,
9-
elecstate::ElecState* pelec,
10+
elecstate::ElecState* pelec,
11+
ModulePW::PW_Basis_Big* pw_big,
12+
ModulePW::PW_Basis* pw_rhod,
13+
Charge &chr,
14+
surchem &solvent,
15+
Parallel_Grid &para_grid,
1016
const int istep);
17+
1118
}
1219
#endif

0 commit comments

Comments
 (0)