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