ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
esolver_ks_lcao_tddft.h
Go to the documentation of this file.
1#ifndef ESOLVER_KS_LCAO_TDDFT_H
2#define ESOLVER_KS_LCAO_TDDFT_H
3#include "esolver_ks.h"
4#include "esolver_ks_lcao.h"
9
10#include <memory>
11
12namespace elecstate
13{
15class TDFieldManager;
16} // namespace elecstate
17
18namespace ModuleESolver
19{
20
22template <typename TR, typename Device = base_device::DEVICE_CPU>
23class ESolver_KS_LCAO_TDDFT : public ESolver_KS_LCAO<std::complex<double>, TR>
24{
25 public:
28
31
33 void before_all_runners(BaseCell &basecell, const Input_para &inp) override;
34
35 protected:
37 int scf_iter_limit(const int istep) const override;
38
40 TD_info *get_td_info() const override { return td_p; }
41
43 virtual void runner(BaseCell &basecell, const int istep) override;
44
46 virtual void hamilt2rho_single(
47 UnitCell &ucell,
48 const int istep,
49 const int iter,
50 const double ethr) override;
51
53 void store_h_s_psi(
54 UnitCell &ucell,
55 const int istep,
56 const int iter,
57 const bool conv_esolver);
58
60 void iter_finish(
61 UnitCell &ucell,
62 const int istep,
63 const int estep,
64 const int estep_max,
65 int &iter,
66 bool &conv_esolver);
67
69 virtual void after_scf(UnitCell &ucell, const int istep, const bool conv_esolver) override;
70
72 void print_step();
73
76
79
82
84 bool use_tensor = false;
86 bool use_lapack = false;
87
90
92 int totstep = -1;
93
96
98 TD_info *td_p = nullptr;
99
103 std::unique_ptr<module_rt::TD_MovingGauge> td_mg_;
104
106 bool restart_done = false;
107
109 std::shared_ptr<elecstate::TDFieldManager> td_field_manager_;
110
111 private:
114
116 void weight_dm_rho(const UnitCell &ucell);
117};
118
119} // namespace ModuleESolver
120#endif // ESOLVER_KS_LCAO_TDDFT_H
Definition basecell.h:9
ct::Tensor Sk_laststep
Overlap matrix for all local k-points of the last electronic step.
Definition esolver_ks_lcao_tddft.h:81
void store_h_s_psi(UnitCell &ucell, const int istep, const int iter, const bool conv_esolver)
Save H, S, and wave functions when requested at convergence or the maximum iteration count.
Definition esolver_ks_lcao_tddft.cpp:532
~ESolver_KS_LCAO_TDDFT()
Release the saved wave functions, Hamiltonian, and solver-owned TD contexts.
Definition esolver_ks_lcao_tddft.cpp:42
bool use_td_moving_gauge
Moving spatial gauge for Ehrenfest dynamics, to calculate the correction term arising from the moveme...
Definition esolver_ks_lcao_tddft.h:101
virtual void hamilt2rho_single(UnitCell &ucell, const int istep, const int iter, const double ethr) override
Obtain the density from initial-state diagonalization, loaded wave functions, or time propagation.
Definition esolver_ks_lcao_tddft.cpp:364
void iter_finish(UnitCell &ucell, const int istep, const int estep, const int estep_max, int &iter, bool &conv_esolver)
Finish an electronic iteration and update the saved state and requested energy-density matrix.
Definition esolver_ks_lcao_tddft.cpp:464
bool restart_done
Whether the saved restart endpoint has been replayed to rebuild the electronic state.
Definition esolver_ks_lcao_tddft.h:106
void print_step()
Print the electronic-step header using a 1-based step number.
Definition esolver_ks_lcao_tddft.cpp:356
psi::Psi< std::complex< double > > * psi_laststep
Wave functions for all local k-points of the last electronic step.
Definition esolver_ks_lcao_tddft.h:75
std::shared_ptr< elecstate::TDFieldManager > td_field_manager_
Field manager shared by propagation, potentials, and restart output.
Definition esolver_ks_lcao_tddft.h:109
void weight_dm_rho(const UnitCell &ucell)
Apply specified occupations and rebuild band energy, density matrices, and charge density.
Definition esolver_ks_lcao_tddft.cpp:678
static constexpr ct::DeviceType ct_device_type_hs
Store Hk_laststep and Sk_laststep on the CPU, including for GPU propagation.
Definition esolver_ks_lcao_tddft.h:89
Velocity_op< TR > * velocity_mat
Velocity matrix for calculating current.
Definition esolver_ks_lcao_tddft.h:95
ESolver_KS_LCAO_TDDFT()
Initialize the solver identity and basis name.
Definition esolver_ks_lcao_tddft.cpp:35
TD_info * get_td_info() const override
Return the solver-owned RT state used by LCAO operators and output.
Definition esolver_ks_lcao_tddft.h:40
void before_all_runners(BaseCell &basecell, const Input_para &inp) override
Initialize the LCAO solver, shared field state, and optional restart wave functions.
Definition esolver_ks_lcao_tddft.cpp:61
int scf_iter_limit(const int istep) const override
Use the initial-state limit for initialization or restart replay, and the RT limit for propagation.
Definition esolver_ks_lcao_tddft.cpp:127
virtual void after_scf(UnitCell &ucell, const int istep, const bool conv_esolver) override
Write the electronic-step energy and TD observables after the SCF loop.
Definition esolver_ks_lcao_tddft.cpp:653
int restart_step_
Fixed electronic-step origin loaded at restart, independent of field advancement.
Definition esolver_ks_lcao_tddft.h:113
bool use_tensor
Control tensor-based heterogeneous computing of the TDDFT solver.
Definition esolver_ks_lcao_tddft.h:84
std::unique_ptr< module_rt::TD_MovingGauge > td_mg_
Moving-basis correction matrices, allocated when the moving spatial gauge is enabled.
Definition esolver_ks_lcao_tddft.h:103
TD_info * td_p
Solver-owned TD context for field-dependent LCAO operators and observables.
Definition esolver_ks_lcao_tddft.h:98
ct::Tensor Hk_laststep
Hamiltonian for all local k-points of the last electronic step.
Definition esolver_ks_lcao_tddft.h:78
virtual void runner(BaseCell &basecell, const int istep) override
Run the electronic steps belonging to one MD call, including initialization or restart replay.
Definition esolver_ks_lcao_tddft.cpp:134
bool use_lapack
Use gathered full matrices rather than distributed matrices in tensor propagation.
Definition esolver_ks_lcao_tddft.h:86
int totstep
Current 0-based electronic-step index, with -1 before the initial state.
Definition esolver_ks_lcao_tddft.h:92
bool conv_esolver
Definition esolver.h:46
Definition td_info.h:18
Provide the basic information about unitcell.
Definition unitcell.h:16
Definition velocity_op.h:22
A multi-dimensional array of elements of a single data type.
Definition tensor.h:32
Own and advance all time-dependent electric fields in RT-TDDFT.
Definition td_field_manager.h:36
Definition psi.h:37
The First-Principles (FP) Energy Solver Class.
Definition opt_test_tools.cpp:93
@ DT_COMPLEX_DOUBLE
Definition tensor_enums.h:22
DeviceType
Definition tensor_enums.h:28
@ CpuDevice
Definition tensor_enums.h:30
Definition read_atoms_hlp_test.cpp:13
Definition input_parameter.h:13