|
13 | 13 | #include "source_io/print_info.h" |
14 | 14 | #include "source_io/rhog_io.h" |
15 | 15 | #include "source_io/module_parameter/parameter.h" |
16 | | -#include "source_io/ctrl_output_fp.h" |
17 | 16 |
|
18 | 17 | #include "source_pw/module_pwdft/setup_pwrho.h" // mohan 20251005 |
19 | 18 | #include "source_hamilt/module_xc/xc_functional.h" // mohan 20251005 |
| 19 | +#include "source_io/ctrl_output_fp.h" |
| 20 | +#include "source_io/write_init.h" // write_chg_init, write_pot_init |
20 | 21 |
|
21 | 22 | namespace ModuleESolver |
22 | 23 | { |
@@ -145,64 +146,9 @@ void ESolver_FP::before_scf(UnitCell& ucell, const int istep) |
145 | 146 | //! set direction of magnetism, used in non-collinear case |
146 | 147 | elecstate::cal_ux(ucell); |
147 | 148 |
|
148 | | - //! output the initial charge density |
149 | | - const int nspin = PARAM.inp.nspin; |
150 | | - if (PARAM.inp.out_chg[0] == 2) |
151 | | - { |
152 | | - for (int is = 0; is < nspin; is++) |
153 | | - { |
154 | | - std::stringstream ss; |
155 | | - ss << PARAM.globalv.global_out_dir << "chg"; |
156 | | - |
157 | | - if(nspin==1) |
158 | | - { |
159 | | - ss << "ini.cube"; |
160 | | - } |
161 | | - else if(nspin==2 || nspin==4) |
162 | | - { |
163 | | - ss << "s" << is + 1 << "ini.cube"; |
164 | | - } |
165 | | - |
166 | | - ModuleIO::write_vdata_palgrid(this->Pgrid, |
167 | | - this->chr.rho[is], |
168 | | - is, |
169 | | - nspin, |
170 | | - istep, |
171 | | - ss.str(), |
172 | | - this->pelec->eferm.ef, |
173 | | - &(ucell)); |
174 | | - } |
175 | | - } |
176 | | - |
177 | | - //! output total local potential of the initial charge density |
178 | | - if (PARAM.inp.out_pot == 3) |
179 | | - { |
180 | | - for (int is = 0; is < nspin; is++) |
181 | | - { |
182 | | - std::stringstream ss; |
183 | | - ss << PARAM.globalv.global_out_dir << "pot"; |
184 | | - |
185 | | - if(nspin==1) |
186 | | - { |
187 | | - ss << "ini.cube"; |
188 | | - } |
189 | | - else if(nspin==2 || nspin==4) |
190 | | - { |
191 | | - ss << "s" << is + 1 << "ini.cube"; |
192 | | - } |
193 | | - |
194 | | - ModuleIO::write_vdata_palgrid(this->Pgrid, |
195 | | - this->pelec->pot->get_effective_v(is), |
196 | | - is, |
197 | | - nspin, |
198 | | - istep, |
199 | | - ss.str(), |
200 | | - 0.0, // efermi |
201 | | - &(ucell), |
202 | | - 11, // precsion |
203 | | - 0); // out_fermi |
204 | | - } |
205 | | - } |
| 149 | + //! output the initial charge density and potential |
| 150 | + ModuleIO::write_chg_init(ucell, this->Pgrid, this->chr, this->pelec->eferm, istep, PARAM.inp); |
| 151 | +// ModuleIO::write_pot_init(ucell, this->Pgrid, this->pelec, istep, PARAM.inp); |
206 | 152 |
|
207 | 153 | return; |
208 | 154 | } |
|
0 commit comments