ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
esolver_lrtd_lcao.h
Go to the documentation of this file.
1#pragma once
9
10#include <vector> //future tensor
11#include <memory>
12
13#include "source_esolver/esolver_ks_lcao.h" //for the move constructor
21#ifdef __EXX
22// #include <RI/physics/Exx.h>
24#endif
25namespace LR
26{
28 template<typename T, typename TR = double>
30 {
31 public:
35 ESolver_LR(const Input_para& inp, UnitCell& ucell);
37 delete this->psi_ks;
38 }
39
41 // initialize sth. independent of the ground state
42 virtual void before_all_runners(UnitCell& ucell, const Input_para& inp) override {};
43 virtual void runner(UnitCell& ucell, int istep) override;
44 virtual void after_all_runners(UnitCell& ucell) override;
45
46 virtual double cal_energy() override { return 0.0; };
47 virtual void cal_force(UnitCell& ucell, ModuleBase::matrix& force) override {};
48 virtual void cal_stress(UnitCell& ucell, ModuleBase::matrix& stress) override {};
49
50 protected:
54 std::vector<double> orb_cutoff_;
55
56 // not to use ElecState because 2-particle state is quite different from 1-particle state.
57 // implement a independent one (ExcitedState) to pack physical properties if needed.
58 // put the components of ElecState here:
59 std::vector<std::shared_ptr<PotHxcLR>> pot;
60
61 // ground state info
62
64 psi::Psi<T>* psi_ks = nullptr;
65
68
73 std::vector<ct::Tensor> X;
75
76 std::vector<int> nocc;
77 int nocc_in = 1;
78 int nocc_max = 1;
79 std::vector<int> nvirt;
80 int nvirt_in = 1;
81 int nbands = 2;
82 int nbasis = 2;
84 std::vector<int> npairs;
86 int nstates = 1;
87 int nspin = 1;
88 int nk = 1;
89 int nupdown = 0;
90 bool openshell = false;
91 std::string xc_kernel;
92
96 typename TGint<T>::type* gint_ = nullptr;
97 #ifndef __OLD_GINT
98 std::unique_ptr<ModuleGint::GintInfo> gint_info_ = nullptr;
99 #endif
100 void set_gint();
101
105 std::vector<Parallel_2D> paraX_;
108
110
113 void set_X_initial_guess();
114
116 void read_ks_wfc();
118 void read_ks_chg(Charge& chg);
119
120 void init_pot(const Charge& chg_gs);
121
123 void parameter_check() const;
125 void set_dimension();
127 void reset_dim_spin2();
128
129#ifdef __EXX
131 std::shared_ptr<Exx_LRI<T>> exx_lri = nullptr;
132 void move_exx_lri(std::shared_ptr<Exx_LRI<double>>&);
133 void move_exx_lri(std::shared_ptr<Exx_LRI<std::complex<double>>>&);
134 Exx_Info& exx_info;
135#endif
136 };
137}
Definition charge.h:20
Definition Exx_LRI.h:51
Definition gint_gamma.h:23
Definition gint_k.h:13
Definition sltk_grid_driver.h:43
Definition grid_technique.h:18
Excited State Solver: Linear Response TDDFT (Tamm Dancoff Approximation)
Definition esolver_lrtd_lcao.h:30
int nloc_per_band
Definition esolver_lrtd_lcao.h:74
virtual void runner(UnitCell &ucell, int istep) override
run energy solver
Definition esolver_lrtd_lcao.cpp:494
void setup_eigenvectors_X()
allocate and set the inital value of X
Definition esolver_lrtd_lcao.cpp:643
void read_ks_wfc()
read in the ground state wave function, band energy and occupation
Definition esolver_lrtd_lcao.cpp:734
Gint_Gamma gint_g_
Definition esolver_lrtd_lcao.h:94
std::vector< ct::Tensor > X
Excited state wavefunction (locc, lvirt are local size of nocc and nvirt in each process) size of X: ...
Definition esolver_lrtd_lcao.h:73
void parameter_check() const
check the legality of the input parameters
Definition esolver_lrtd_lcao.cpp:81
virtual void cal_stress(UnitCell &ucell, ModuleBase::matrix &stress) override
calcualte stress of given cell
Definition esolver_lrtd_lcao.h:48
int nk
Definition esolver_lrtd_lcao.h:88
std::vector< std::shared_ptr< PotHxcLR > > pot
Definition esolver_lrtd_lcao.h:59
const UnitCell & ucell
Definition esolver_lrtd_lcao.h:52
virtual void before_all_runners(UnitCell &ucell, const Input_para &inp) override
input: input, call, basis(LCAO), psi(ground state), elecstate
Definition esolver_lrtd_lcao.h:42
Parallel_Orbitals paraMat_
variables for parallel distribution of matrix in AO representation
Definition esolver_lrtd_lcao.h:107
Grid_Technique gt_
Definition esolver_lrtd_lcao.h:93
virtual double cal_energy() override
calculate total energy of a given system
Definition esolver_lrtd_lcao.h:46
std::vector< int > nocc
number of occupied orbitals for each spin used in the calculation
Definition esolver_lrtd_lcao.h:76
std::string xc_kernel
Definition esolver_lrtd_lcao.h:91
const Input_para & input
Definition esolver_lrtd_lcao.h:51
void set_X_initial_guess()
Definition esolver_lrtd_lcao.cpp:667
TwoCenterBundle two_center_bundle_
Definition esolver_lrtd_lcao.h:109
void init_pot(const Charge &chg_gs)
Definition esolver_lrtd_lcao.cpp:714
ModuleBase::matrix eig_ks
ground state bands, read from the file, or moved from ESolver_FP::pelec.ekb
Definition esolver_lrtd_lcao.h:67
int nocc_in
nocc read from input (adjusted by nelec): max(spin-up, spindown)
Definition esolver_lrtd_lcao.h:77
int nspin
Definition esolver_lrtd_lcao.h:87
int nbands
Definition esolver_lrtd_lcao.h:81
std::vector< Parallel_2D > paraX_
variables for parallel distribution of excited states
Definition esolver_lrtd_lcao.h:105
Parallel_2D paraC_
variables for parallel distribution of KS orbitals
Definition esolver_lrtd_lcao.h:103
~ESolver_LR()
Definition esolver_lrtd_lcao.h:36
void reset_dim_spin2()
reset nocc, nvirt, npairs after read ground-state wavefunction when nspin=2
Definition esolver_lrtd_lcao.cpp:134
psi::Psi< T > * psi_ks
ground state wave function
Definition esolver_lrtd_lcao.h:64
int nbasis
Definition esolver_lrtd_lcao.h:82
std::vector< double > orb_cutoff_
Definition esolver_lrtd_lcao.h:54
int nstates
how many 2-particle states to be solved
Definition esolver_lrtd_lcao.h:86
int nupdown
Definition esolver_lrtd_lcao.h:89
std::vector< int > nvirt
number of virtual orbitals for each spin used in the calculation
Definition esolver_lrtd_lcao.h:79
virtual void after_all_runners(UnitCell &ucell) override
perform post processing calculations
Definition esolver_lrtd_lcao.cpp:607
int nocc_max
nelec/2
Definition esolver_lrtd_lcao.h:78
virtual void cal_force(UnitCell &ucell, ModuleBase::matrix &force) override
calcualte forces for the atoms in the given cell
Definition esolver_lrtd_lcao.h:47
void read_ks_chg(Charge &chg)
read in the ground state charge density
Definition esolver_lrtd_lcao.cpp:765
Gint_k gint_k_
Definition esolver_lrtd_lcao.h:95
std::unique_ptr< ModuleGint::GintInfo > gint_info_
Definition esolver_lrtd_lcao.h:98
Grid_Driver gd
Definition esolver_lrtd_lcao.h:53
bool openshell
Definition esolver_lrtd_lcao.h:90
void set_dimension()
set nocc, nvirt, nbasis, npairs and nstates
Definition esolver_lrtd_lcao.cpp:97
std::vector< int > npairs
n_occ*nvirt, the basis size of electron-hole pair representation
Definition esolver_lrtd_lcao.h:84
TGint< T >::type * gint_
Definition esolver_lrtd_lcao.h:96
int nvirt_in
nvirt read from input (adjusted by nelec): min(spin-up, spindown)
Definition esolver_lrtd_lcao.h:80
Definition matrix.h:19
Definition esolver_fp.h:45
Definition esolver_ks_lcao.h:50
This class packs the basic information of 2D-block-cyclic parallel distribution of an arbitrary matri...
Definition parallel_2d.h:12
Definition parallel_orbitals.h:9
Definition two_center_bundle.h:11
Definition unitcell.h:16
Definition psi.h:37
Definition esolver_ks_lcao.h:37
Definition exx_info.h:12
Definition input_parameter.h:12
Definition gint_template.h:6