ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
esolver_ks_pw_tddft.h
Go to the documentation of this file.
1#ifndef ESOLVER_KS_PW_TDDFT_H
2#define ESOLVER_KS_PW_TDDFT_H
3
10
11#include <iosfwd>
12#include <memory>
13
14namespace ModuleESolver
15{
16
17template <typename T, typename Device = base_device::DEVICE_CPU>
18class ESolver_KS_PW_TDDFT : public ESolver_KS_PW<T, Device>
19{
20 public:
22 ~ESolver_KS_PW_TDDFT() override = default;
23
25 void before_all_runners(BaseCell &basecell, const Input_para &inp) override;
26
28 void runner(BaseCell &basecell, const int istep) override;
29
30 protected:
32 int scf_iter_limit(const int istep) const override;
34 std::string diag_policy(const int istep) const override;
35
37 ESolver_KS::DensityStage density_stage(const int istep, const int iter) const override;
38 bool defer_iter_output(const int istep) const override;
39
40 void before_scf(UnitCell &ucell, const int istep) override;
41
43 void prepare_init_hamilt(const UnitCell &ucell) override;
44
46 void iter_init(UnitCell &ucell, const int istep, const int iter) override;
47
50 UnitCell &ucell,
51 const int istep,
52 const int iter,
53 const double ethr) override;
54
56 void after_scf(UnitCell &ucell, const int istep, const bool conv_esolver) override;
57
58 private:
59 using Real = typename GetTypeReal<T>::type;
60 std::ofstream &log_;
61 std::unique_ptr<pw::TDPropPW<T, Device>> td_prop_;
62
63 std::shared_ptr<elecstate::TDFieldManager> td_field_manager_;
67
71
72 void run_prop(UnitCell &cell, int step);
74 UnitCell &cell,
75 int step,
76 int index,
77 int depth,
78 const elecstate::TDFieldState &full,
79 pw::TDElecSnap &accepted,
81 void output_field(int step) const;
83 void print_step(const int istep) const;
84 void prep_td_step(const int istep);
85};
86
87} // namespace ModuleESolver
88#endif
Definition basecell.h:9
void prep_td_step(const int istep)
Definition esolver_ks_pw_tddft.cpp:346
std::string diag_policy(const int istep) const override
Use ground-state diagonalization for the initial electronic step.
Definition esolver_ks_pw_tddft.cpp:399
void before_all_runners(BaseCell &basecell, const Input_para &inp) override
Initialize the field, propagation solver and time-step history.
Definition esolver_ks_pw_tddft.cpp:43
std::ofstream & log_
Definition esolver_ks_pw_tddft.h:60
void prepare_init_hamilt(const UnitCell &ucell) override
Cover shifted projectors and bind endpoint A before the first Hamiltonian application.
Definition esolver_ks_pw_tddft.cpp:327
pw::CurrentRequest current_req_
Definition esolver_ks_pw_tddft.h:66
void iter_init(UnitCell &ucell, const int istep, const int iter) override
Print the TDDFT iteration header and initialize the PW iteration.
Definition esolver_ks_pw_tddft.cpp:409
void hamilt2rho_single(UnitCell &ucell, const int istep, const int iter, const double ethr) override
Switch between ground-state diagonalization and real-time propagation.
Definition esolver_ks_pw_tddft.cpp:431
ESolver_KS::DensityStage density_stage(const int istep, const int iter) const override
Require an unmixed endpoint prediction before accepting a corrected step.
Definition esolver_ks_pw_tddft.cpp:421
std::unique_ptr< pw::TDPropPW< T, Device > > td_prop_
Definition esolver_ks_pw_tddft.h:61
void after_scf(UnitCell &ucell, const int istep, const bool conv_esolver) override
Save the converged or iteration-limited endpoint for the next propagation step.
Definition esolver_ks_pw_tddft.cpp:480
void output_field(int step) const
Definition esolver_ks_pw_tddft.cpp:383
void before_scf(UnitCell &ucell, const int istep) override
Something to do before SCF iterations.
Definition esolver_ks_pw_tddft.cpp:310
typename GetTypeReal< T >::type Real
Definition esolver_ks_pw_tddft.h:59
double initial_rho_electrons_
Definition esolver_ks_pw_tddft.h:70
pw::TDHistoryPW< T, Device > history_
Definition esolver_ks_pw_tddft.h:68
ESolver_KS_PW_TDDFT()
Definition esolver_ks_pw_tddft.cpp:36
void run_prop(UnitCell &cell, int step)
Definition esolver_ks_pw_tddft.cpp:253
~ESolver_KS_PW_TDDFT() override=default
std::shared_ptr< elecstate::TDFieldManager > td_field_manager_
Definition esolver_ks_pw_tddft.h:63
bool defer_iter_output(const int istep) const override
Whether KS iterations defer output until the final state is accepted.
Definition esolver_ks_pw_tddft.cpp:149
pw::TDSpinPW< Real, Device > spin_
Definition esolver_ks_pw_tddft.h:65
pw::TDVelPW< Real, Device > vel_
Definition esolver_ks_pw_tddft.h:64
bool advance_interval(UnitCell &cell, int step, int index, int depth, const elecstate::TDFieldState &full, pw::TDElecSnap &accepted, hsolver::TDOrthStats &stats)
Definition esolver_ks_pw_tddft.cpp:161
void print_step(const int istep) const
Print the one-based electronic step header.
Definition esolver_ks_pw_tddft.cpp:301
void runner(BaseCell &basecell, const int istep) override
Run the electronic steps belonging to the current MD step.
Definition esolver_ks_pw_tddft.cpp:117
int scf_iter_limit(const int istep) const override
Use independent iteration limits for initial-state SCF and propagation.
Definition esolver_ks_pw_tddft.cpp:155
double initial_wave_electrons_
Definition esolver_ks_pw_tddft.h:69
DensityStage
Select whether the density is an endpoint predictor or an SCF iterate.
Definition esolver_ks.h:47
bool conv_esolver
Definition esolver.h:46
Provide the basic information about unitcell.
Definition unitcell.h:16
Accepted endpoint wavefunctions and potential snapshots.
Definition td_history_pw.h:33
Endpoint magnetism with reusable device workspaces and position-aware caches.
Definition td_spin_pw.h:23
Charge and spin currents sharing one velocity action per k point.
Definition td_vel_pw.h:17
The First-Principles (FP) Energy Solver Class.
Definition opt_test_tools.cpp:93
T type
Definition macros.h:8
Definition input_parameter.h:13
Field values for one trial interval, independent of the committed step counter.
Definition td_field_manager.h:18
Independent orthogonality maxima over accepted trial iterations and local k points.
Definition td_orbital_ops.h:15
Independent requests; all ranks must use the same choices.
Definition td_obs_pw.h:11
Electronic data at an accepted endpoint; orbitals and potential stay in TDHistoryPW.
Definition td_history_pw.h:18