ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
H_TDDFT_pw.h
Go to the documentation of this file.
1#ifndef H_TDDFT_PW_H
2#define H_TDDFT_PW_H
3
4#include "pot_base.h"
6#include "source_io/module_parameter/parameter.h" // PARAM.globalv.global_readin_dir, PARAM.inp.mdp.md_restart
7
8namespace elecstate
9{
10
11class H_TDDFT_pw : public PotBase
12{
13 public:
14 H_TDDFT_pw(const ModulePW::PW_Basis* rho_basis_in, const UnitCell* ucell_in) : ucell_(ucell_in)
15 {
16 this->dynamic_mode = false;
17 this->fixed_mode = true;
18
19 this->rho_basis_ = rho_basis_in;
20
21 // If it is the first time to create an H_TDDFT_pw instance and is restart calculation,
22 // initialize istep using current_step_info
24 {
25 int restart_istep = -1;
26 std::string file_dir = PARAM.globalv.global_readin_dir;
27 current_step_info(file_dir, restart_istep);
28
29 if (restart_istep >= 0)
30 {
31 H_TDDFT_pw::istep = restart_istep - 1; // Update istep
32 }
33
34 is_initialized = true; // Mark as initialized, so that istep will not be initialized again
35 }
36 }
37
39
40 void cal_fixed_v(double* vl_pseudo) override;
41
48 static void compute_force(const UnitCell& cell, ModuleBase::matrix& fe);
49
50 // parameters
51 static int stype; // 0: length gauge; 1: velocity gauge; 2: hybrid gauge
52
53 static std::vector<int> ttype;
54 // 0: Gaussian type function.
55 // 1: Trapezoid type function.
56 // 2: Trigonometric functions, sin^2.
57 // 3: Heaviside step function.
58
59 static int tstart;
60 static int tend;
61 static double dt;
62 // cut dt for integral
63 static double dt_int;
64 static int istep_int;
65
66 // Space domain parameters
67
68 // length gauge
69 static double lcut1;
70 static double lcut2;
71
72 // velocity gauge, vector potential
76
77 // Time domain parameters
78
79 // Gauss
80 static int gauss_count;
81 static std::vector<double> gauss_omega; // time(a.u.)^-1
82 static std::vector<double> gauss_phase;
83 static std::vector<double> gauss_sigma; // time(a.u.)
84 static std::vector<double> gauss_t0;
85 static std::vector<double> gauss_amp; // Ry/bohr
86 // add for velocity gauge, recut dt into n pieces to make sure the integral is accurate enough
87 // must be even, thus would get odd number of points for Simpson integral
88 static std::vector<int> gauss_ncut;
89
90 // Trapezoid
91 static int trape_count;
92 static std::vector<double> trape_omega; // time(a.u.)^-1
93 static std::vector<double> trape_phase;
94 static std::vector<double> trape_t1;
95 static std::vector<double> trape_t2;
96 static std::vector<double> trape_t3;
97 static std::vector<double> trape_amp; // Ry/bohr
98 // add for velocity gauge, recut dt into n pieces to make sure the integral is accurate enough
99 static std::vector<int> trape_ncut;
100
101 // Trigonometric
102 static int trigo_count;
103 static std::vector<double> trigo_omega1; // time(a.u.)^-1
104 static std::vector<double> trigo_omega2; // time(a.u.)^-1
105 static std::vector<double> trigo_phase1;
106 static std::vector<double> trigo_phase2;
107 static std::vector<double> trigo_amp; // Ry/bohr
108 // add for velocity gauge, recut dt into n pieces to make sure the integral is accurate enough
109 static std::vector<int> trigo_ncut;
110
111 // Heaviside
112 static int heavi_count;
113 static std::vector<double> heavi_t0;
114 static std::vector<double> heavi_amp; // Ry/bohr
115
116 // update At for velocity gauge by intergral of E(t)dt
117 static void update_At();
118
119 private:
120 static int istep;
121 static bool is_initialized; // static flag variable, used to ensure initialization only once
122
123 static double amp;
124 static vector<double> global_vext_time;
125
126 const UnitCell* ucell_ = nullptr;
127
128 // Obtain the current MD step information, used for restart calculation
129 void current_step_info(const std::string& file_dir, int& istep);
130
131 // Potential of electric field in space domain: for length gauge only
132 void cal_v_space(std::vector<double>& vext_space, int direc);
133 void cal_v_space_length(std::vector<double>& vext_space, int direc);
134 double cal_v_space_length_potential(double i);
135
136 // Potential of electric field in time domain: Gaussian, trapezoid, trigonometric, Heaviside
137 static double cal_v_time(int t_type, const bool last);
138 static double cal_v_time_Gauss(const bool last);
139 static double cal_v_time_trapezoid(const bool last);
140 static double cal_v_time_trigonometric(const bool last);
141 static double cal_v_time_heaviside(const bool last);
142
143 // Get ncut number for At integral
144 static int check_ncut(int t_type);
145};
146
147} // namespace elecstate
148
149#endif
3 elements vector
Definition vector3.h:22
Definition matrix.h:19
A class which can convert a function of "r" to the corresponding linear superposition of plane waves ...
Definition pw_basis.h:56
const Input_para & inp
Definition parameter.h:26
const System_para & globalv
Definition parameter.h:30
Definition unitcell.h:16
Definition H_TDDFT_pw.h:12
static ModuleBase::Vector3< double > Et
Definition H_TDDFT_pw.h:75
static double dt
Definition H_TDDFT_pw.h:61
static std::vector< double > heavi_t0
Definition H_TDDFT_pw.h:113
static std::vector< double > gauss_t0
Definition H_TDDFT_pw.h:84
static int check_ncut(int t_type)
Definition H_TDDFT_pw.cpp:240
static std::vector< double > gauss_amp
Definition H_TDDFT_pw.h:85
static std::vector< double > trape_phase
Definition H_TDDFT_pw.h:93
static std::vector< int > trape_ncut
Definition H_TDDFT_pw.h:99
static int tend
Definition H_TDDFT_pw.h:60
static std::vector< double > trape_amp
Definition H_TDDFT_pw.h:97
static int stype
Definition H_TDDFT_pw.h:51
static int heavi_count
Definition H_TDDFT_pw.h:112
static std::vector< double > trape_t1
Definition H_TDDFT_pw.h:94
static double dt_int
Definition H_TDDFT_pw.h:63
void current_step_info(const std::string &file_dir, int &istep)
Definition H_TDDFT_pw.cpp:82
static void compute_force(const UnitCell &cell, ModuleBase::matrix &fe)
Compute ionic force of electric field.
Definition H_TDDFT_pw.cpp:475
static ModuleBase::Vector3< double > At
Definition H_TDDFT_pw.h:73
const UnitCell * ucell_
Definition H_TDDFT_pw.h:126
static int gauss_count
Definition H_TDDFT_pw.h:80
static std::vector< double > gauss_phase
Definition H_TDDFT_pw.h:82
static int trigo_count
Definition H_TDDFT_pw.h:102
static std::vector< double > trape_t2
Definition H_TDDFT_pw.h:95
static double amp
Definition H_TDDFT_pw.h:123
double cal_v_space_length_potential(double i)
Definition H_TDDFT_pw.cpp:222
void cal_v_space_length(std::vector< double > &vext_space, int direc)
Definition H_TDDFT_pw.cpp:178
static double cal_v_time_trapezoid(const bool last)
Definition H_TDDFT_pw.cpp:401
static double cal_v_time_heaviside(const bool last)
Definition H_TDDFT_pw.cpp:454
static ModuleBase::Vector3< double > At_laststep
Definition H_TDDFT_pw.h:74
static std::vector< int > gauss_ncut
Definition H_TDDFT_pw.h:88
void cal_fixed_v(double *vl_pseudo) override
Definition H_TDDFT_pw.cpp:100
static std::vector< int > ttype
Definition H_TDDFT_pw.h:53
static double cal_v_time_Gauss(const bool last)
Definition H_TDDFT_pw.cpp:381
~H_TDDFT_pw()
Definition H_TDDFT_pw.h:38
static std::vector< double > trape_t3
Definition H_TDDFT_pw.h:96
static double cal_v_time(int t_type, const bool last)
Definition H_TDDFT_pw.cpp:352
H_TDDFT_pw(const ModulePW::PW_Basis *rho_basis_in, const UnitCell *ucell_in)
Definition H_TDDFT_pw.h:14
static std::vector< double > trigo_phase1
Definition H_TDDFT_pw.h:105
static std::vector< double > trape_omega
Definition H_TDDFT_pw.h:92
static int istep
Definition H_TDDFT_pw.h:120
static std::vector< double > gauss_omega
Definition H_TDDFT_pw.h:81
static std::vector< double > trigo_phase2
Definition H_TDDFT_pw.h:106
static int trape_count
Definition H_TDDFT_pw.h:91
static std::vector< double > heavi_amp
Definition H_TDDFT_pw.h:114
static double lcut1
Definition H_TDDFT_pw.h:69
static std::vector< double > trigo_omega2
Definition H_TDDFT_pw.h:104
static vector< double > global_vext_time
Definition H_TDDFT_pw.h:124
static double lcut2
Definition H_TDDFT_pw.h:70
void cal_v_space(std::vector< double > &vext_space, int direc)
Definition H_TDDFT_pw.cpp:159
static std::vector< double > trigo_amp
Definition H_TDDFT_pw.h:107
static int tstart
Definition H_TDDFT_pw.h:59
static double cal_v_time_trigonometric(const bool last)
Definition H_TDDFT_pw.cpp:434
static std::vector< double > gauss_sigma
Definition H_TDDFT_pw.h:83
static int istep_int
Definition H_TDDFT_pw.h:64
static bool is_initialized
Definition H_TDDFT_pw.h:121
static std::vector< double > trigo_omega1
Definition H_TDDFT_pw.h:103
static void update_At()
Definition H_TDDFT_pw.cpp:268
static std::vector< int > trigo_ncut
Definition H_TDDFT_pw.h:109
Definition pot_base.h:22
const ModulePW::PW_Basis * rho_basis_
Definition pot_base.h:35
bool dynamic_mode
Definition pot_base.h:32
bool fixed_mode
Definition pot_base.h:31
Definition cal_dm.h:10
Parameter PARAM
Definition parameter.cpp:3
MD_para mdp
Definition input_parameter.h:175
bool md_restart
1: restart MD, 0: no restart MD
Definition md_parameter.h:14
std::string global_readin_dir
global readin directory
Definition system_parameter.h:43