1
1
#include " esolver_ks_lcao_tddft.h"
2
2
3
+ #include " source_estate/elecstate_tools.h"
3
4
#include " source_io/cal_r_overlap_R.h"
4
5
#include " source_io/dipole_io.h"
5
6
#include " source_io/td_current_io.h"
6
7
#include " source_io/write_HS.h"
7
8
#include " source_io/write_HS_R.h"
8
- #include " source_estate/elecstate_tools.h"
9
9
10
10
// --------------temporary----------------------------
11
11
#include " source_base/blas_connector.h"
17
17
#include " source_estate/module_dm/cal_edm_tddft.h"
18
18
#include " source_estate/module_dm/density_matrix.h"
19
19
#include " source_estate/occupy.h"
20
+ #include " source_io/print_info.h"
20
21
#include " source_lcao/module_rt/evolve_elec.h"
21
22
#include " source_lcao/module_rt/td_velocity.h"
22
23
#include " source_pw/module_pwdft/global.h"
23
- #include " source_io/print_info.h"
24
24
25
25
// -----HSolver ElecState Hamilt--------
26
+ #include " module_parameter/parameter.h"
26
27
#include " source_estate/cal_ux.h"
27
28
#include " source_estate/elecstate_lcao.h"
28
- #include " source_lcao/hamilt_lcaodft/hamilt_lcao.h"
29
29
#include " source_hsolver/hsolver_lcao.h"
30
- #include " module_parameter/parameter .h"
30
+ #include " source_lcao/hamilt_lcaodft/hamilt_lcao .h"
31
31
#include " source_psi/psi.h"
32
32
33
33
// -----force& stress-------------------
@@ -87,52 +87,52 @@ void ESolver_KS_LCAO_TDDFT<Device>::before_all_runners(UnitCell& ucell, const In
87
87
88
88
template <typename Device>
89
89
void ESolver_KS_LCAO_TDDFT<Device>::hamilt2rho_single(UnitCell& ucell,
90
- const int istep,
91
- const int iter,
92
- const double ethr)
90
+ const int istep,
91
+ const int iter,
92
+ const double ethr)
93
93
{
94
94
if (PARAM.inp .init_wfc == " file" )
95
95
{
96
96
if (istep >= 1 )
97
97
{
98
98
module_rt::Evolve_elec<Device>::solve_psi (istep,
99
- PARAM.inp .nbands ,
100
- PARAM.globalv .nlocal ,
101
- kv.get_nks (),
102
- this ->p_hamilt ,
103
- this ->pv ,
104
- this ->psi ,
105
- this ->psi_laststep ,
106
- this ->Hk_laststep ,
107
- this ->Sk_laststep ,
108
- this ->pelec ->ekb ,
109
- GlobalV::ofs_running,
110
- td_htype,
111
- PARAM.inp .propagator ,
112
- use_tensor,
113
- use_lapack);
99
+ PARAM.inp .nbands ,
100
+ PARAM.globalv .nlocal ,
101
+ kv.get_nks (),
102
+ this ->p_hamilt ,
103
+ this ->pv ,
104
+ this ->psi ,
105
+ this ->psi_laststep ,
106
+ this ->Hk_laststep ,
107
+ this ->Sk_laststep ,
108
+ this ->pelec ->ekb ,
109
+ GlobalV::ofs_running,
110
+ td_htype,
111
+ PARAM.inp .propagator ,
112
+ use_tensor,
113
+ use_lapack);
114
114
this ->weight_dm_rho ();
115
115
}
116
116
this ->weight_dm_rho ();
117
117
}
118
118
else if (istep >= 2 )
119
119
{
120
120
module_rt::Evolve_elec<Device>::solve_psi (istep,
121
- PARAM.inp .nbands ,
122
- PARAM.globalv .nlocal ,
123
- kv.get_nks (),
124
- this ->p_hamilt ,
125
- this ->pv ,
126
- this ->psi ,
127
- this ->psi_laststep ,
128
- this ->Hk_laststep ,
129
- this ->Sk_laststep ,
130
- this ->pelec ->ekb ,
131
- GlobalV::ofs_running,
132
- td_htype,
133
- PARAM.inp .propagator ,
134
- use_tensor,
135
- use_lapack);
121
+ PARAM.inp .nbands ,
122
+ PARAM.globalv .nlocal ,
123
+ kv.get_nks (),
124
+ this ->p_hamilt ,
125
+ this ->pv ,
126
+ this ->psi ,
127
+ this ->psi_laststep ,
128
+ this ->Hk_laststep ,
129
+ this ->Sk_laststep ,
130
+ this ->pelec ->ekb ,
131
+ GlobalV::ofs_running,
132
+ td_htype,
133
+ PARAM.inp .propagator ,
134
+ use_tensor,
135
+ use_lapack);
136
136
this ->weight_dm_rho ();
137
137
}
138
138
else
@@ -163,18 +163,14 @@ void ESolver_KS_LCAO_TDDFT<Device>::hamilt2rho_single(UnitCell& ucell,
163
163
}
164
164
165
165
template <typename Device>
166
- void ESolver_KS_LCAO_TDDFT<Device>::iter_finish(
167
- UnitCell& ucell,
168
- const int istep,
169
- int & iter,
170
- bool & conv_esolver)
166
+ void ESolver_KS_LCAO_TDDFT<Device>::iter_finish(UnitCell& ucell, const int istep, int & iter, bool & conv_esolver)
171
167
{
172
168
// print occupation of each band
173
169
if (iter == 1 && istep <= 2 )
174
170
{
175
- GlobalV::ofs_running << " ---------------------------------------------------------"
176
- << std::endl;
177
- GlobalV::ofs_running << " occupations of electrons " << std::endl;
171
+ GlobalV::ofs_running << " ---------------------------------------------------------- " << std::endl;
172
+ GlobalV::ofs_running << " Occupations of electrons " << std::endl;
173
+ GlobalV::ofs_running << " ---------------------------------------------------------- " << std::endl;
178
174
GlobalV::ofs_running << " k-point state occupation" << std::endl;
179
175
GlobalV::ofs_running << std::setiosflags (std::ios::showpoint);
180
176
GlobalV::ofs_running << std::left;
@@ -183,23 +179,21 @@ void ESolver_KS_LCAO_TDDFT<Device>::iter_finish(
183
179
{
184
180
for (int ib = 0 ; ib < PARAM.inp .nbands ; ib++)
185
181
{
186
- GlobalV::ofs_running << " " << std::setw (9 )
187
- << ik+1 << std::setw (8 ) << ib + 1
188
- << std::setw (12 ) << this ->pelec ->wg (ik, ib) << std::endl;
182
+ GlobalV::ofs_running << " " << std::setw (9 ) << ik + 1 << std::setw (8 ) << ib + 1 << std::setw (12 )
183
+ << this ->pelec ->wg (ik, ib) << std::endl;
189
184
}
190
185
}
191
- GlobalV::ofs_running << " ---------------------------------------------------------"
192
- << std::endl;
186
+ GlobalV::ofs_running << " ----------------------------------------------------------" << std::endl;
193
187
}
194
188
195
189
ESolver_KS_LCAO<std::complex<double >, double >::iter_finish (ucell, istep, iter, conv_esolver);
196
190
}
197
191
198
192
template <typename Device>
199
- void ESolver_KS_LCAO_TDDFT<Device>::update_pot(UnitCell& ucell,
200
- const int istep,
201
- const int iter,
202
- const bool conv_esolver)
193
+ void ESolver_KS_LCAO_TDDFT<Device>::update_pot(UnitCell& ucell,
194
+ const int istep,
195
+ const int iter,
196
+ const bool conv_esolver)
203
197
{
204
198
// Calculate new potential according to new Charge Density
205
199
if (!conv_esolver)
@@ -234,7 +228,6 @@ void ESolver_KS_LCAO_TDDFT<Device>::update_pot(UnitCell& ucell,
234
228
nrow_tmp = nlocal;
235
229
#endif
236
230
this ->psi_laststep = new psi::Psi<std::complex<double >>(kv.get_nks (), ncol_tmp, nrow_tmp, kv.ngk , true );
237
-
238
231
}
239
232
240
233
// allocate memory for Hk_laststep and Sk_laststep
@@ -282,8 +275,8 @@ void ESolver_KS_LCAO_TDDFT<Device>::update_pot(UnitCell& ucell,
282
275
if (td_htype == 1 )
283
276
{
284
277
this ->p_hamilt ->updateHk (ik);
285
- hamilt::MatrixBlock <std::complex<double >> h_mat;
286
- hamilt::MatrixBlock <std::complex<double >> s_mat;
278
+ hamilt::MatrixBlock<std::complex<double >> h_mat;
279
+ hamilt::MatrixBlock<std::complex<double >> s_mat;
287
280
this ->p_hamilt ->matrix (h_mat, s_mat);
288
281
289
282
if (use_tensor && use_lapack)
@@ -323,31 +316,31 @@ void ESolver_KS_LCAO_TDDFT<Device>::update_pot(UnitCell& ucell,
323
316
}
324
317
325
318
// print "eigen value" for tddft
326
- // it seems uncessary to print out E_ii because the band energies are printed
327
- /*
328
- if (conv_esolver)
329
- {
330
- GlobalV::ofs_running << "----------------------------------------------------------"
331
- << std::endl;
332
- GlobalV::ofs_running << " Print E=<psi_i|H|psi_i> " << std::endl;
333
- GlobalV::ofs_running << " k-point state energy (eV)" << std::endl;
334
- GlobalV::ofs_running << "----------------------------------------------------------"
335
- << std::endl;
336
- GlobalV::ofs_running << std::setprecision(6);
337
- GlobalV::ofs_running << std::setiosflags(std::ios::showpoint);
338
-
339
- for (int ik = 0; ik < kv.get_nks(); ik++)
319
+ // it seems unnecessary to print out E_ii because the band energies are printed
320
+ /*
321
+ if (conv_esolver)
340
322
{
341
- for (int ib = 0; ib < PARAM.inp.nbands; ib++)
323
+ GlobalV::ofs_running << "----------------------------------------------------------"
324
+ << std::endl;
325
+ GlobalV::ofs_running << " Print E=<psi_i|H|psi_i> " << std::endl;
326
+ GlobalV::ofs_running << " k-point state energy (eV)" << std::endl;
327
+ GlobalV::ofs_running << "----------------------------------------------------------"
328
+ << std::endl;
329
+ GlobalV::ofs_running << std::setprecision(6);
330
+ GlobalV::ofs_running << std::setiosflags(std::ios::showpoint);
331
+
332
+ for (int ik = 0; ik < kv.get_nks(); ik++)
342
333
{
343
- GlobalV::ofs_running << " " << std::setw(7) << ik + 1
344
- << std::setw(7) << ib + 1
345
- << std::setw(10) << this->pelec->ekb(ik, ib) * ModuleBase::Ry_to_eV
346
- << std::endl;
334
+ for (int ib = 0; ib < PARAM.inp.nbands; ib++)
335
+ {
336
+ GlobalV::ofs_running << " " << std::setw(7) << ik + 1
337
+ << std::setw(7) << ib + 1
338
+ << std::setw(10) << this->pelec->ekb(ik, ib) * ModuleBase::Ry_to_eV
339
+ << std::endl;
340
+ }
347
341
}
348
342
}
349
- }
350
- */
343
+ */
351
344
}
352
345
353
346
template <typename Device>
@@ -365,16 +358,11 @@ void ESolver_KS_LCAO_TDDFT<Device>::after_scf(UnitCell& ucell, const int istep,
365
358
{
366
359
std::stringstream ss_dipole;
367
360
ss_dipole << PARAM.globalv .global_out_dir << " SPIN" << is + 1 << " _DIPOLE" ;
368
- ModuleIO::write_dipole (ucell,
369
- this ->chr .rho_save [is],
370
- this ->chr .rhopw ,
371
- is,
372
- istep,
373
- ss_dipole.str ());
361
+ ModuleIO::write_dipole (ucell, this ->chr .rho_save [is], this ->chr .rhopw , is, istep, ss_dipole.str ());
374
362
}
375
363
}
376
364
377
- // (2) write current information
365
+ // (2) write current information
378
366
if (TD_Velocity::out_current == true )
379
367
{
380
368
elecstate::DensityMatrix<std::complex<double >, double >* tmp_DM
@@ -392,7 +380,6 @@ void ESolver_KS_LCAO_TDDFT<Device>::after_scf(UnitCell& ucell, const int istep,
392
380
this ->RA );
393
381
}
394
382
395
-
396
383
ModuleBase::timer::tick (" ESolver_LCAO_TDDFT" , " after_scf" );
397
384
}
398
385
@@ -410,7 +397,7 @@ void ESolver_KS_LCAO_TDDFT<Device>::weight_dm_rho()
410
397
}
411
398
412
399
// calculate Eband energy
413
- elecstate::calEBand (this ->pelec ->ekb ,this ->pelec ->wg ,this ->pelec ->f_en );
400
+ elecstate::calEBand (this ->pelec ->ekb , this ->pelec ->wg , this ->pelec ->f_en );
414
401
415
402
// calculate the density matrix
416
403
ModuleBase::GlobalFunc::NOTE (" Calculate the density matrix." );
0 commit comments