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
18#ifdef __EXX
19// #include <RI/physics/Exx.h>
21#endif
22namespace LR
23{
25 template<typename T, typename TR = double>
27 {
28 public:
32 ESolver_LR(const Input_para& inp, UnitCell& ucell);
34 delete this->psi_ks;
35 }
36
38 // initialize sth. independent of the ground state
39 virtual void before_all_runners(UnitCell& ucell, const Input_para& inp) override {};
40 virtual void runner(UnitCell& ucell, int istep) override;
41 virtual void after_all_runners(UnitCell& ucell) override;
42
43 virtual double cal_energy() override { return 0.0; };
44 virtual void cal_force(UnitCell& ucell, ModuleBase::matrix& force) override {};
45 virtual void cal_stress(UnitCell& ucell, ModuleBase::matrix& stress) override {};
46
47 protected:
51 std::vector<double> orb_cutoff_;
52
53 // not to use ElecState because 2-particle state is quite different from 1-particle state.
54 // implement a independent one (ExcitedState) to pack physical properties if needed.
55 // put the components of ElecState here:
56 std::vector<std::shared_ptr<PotHxcLR>> pot;
57
58 // ground state info
59
61 psi::Psi<T>* psi_ks = nullptr;
62
65
70 std::vector<ct::Tensor> X;
72
73 std::vector<int> nocc;
74 int nocc_in = 1;
75 int nocc_max = 1;
76 std::vector<int> nvirt;
77 int nvirt_in = 1;
78 int nbands = 2;
79 int nbasis = 2;
81 std::vector<int> npairs;
83 int nstates = 1;
84 int nspin = 1;
85 int nk = 1;
86 int nupdown = 0;
87 bool openshell = false;
88 std::string xc_kernel;
89
90 std::unique_ptr<ModuleGint::GintInfo> gint_info_ = nullptr;
91 void set_gint();
92
96 std::vector<Parallel_2D> paraX_;
99
101
104 void set_X_initial_guess();
105
107 void read_ks_wfc();
109 void read_ks_chg(Charge& chg);
110
111 void init_pot(const Charge& chg_gs);
112
114 void parameter_check() const;
116 void set_dimension();
118 void reset_dim_spin2();
119
120#ifdef __EXX
122 std::shared_ptr<Exx_LRI<T>> exx_lri = nullptr;
123 void move_exx_lri(std::shared_ptr<Exx_LRI<double>>&);
124 void move_exx_lri(std::shared_ptr<Exx_LRI<std::complex<double>>>&);
125 Exx_Info& exx_info;
126#endif
127 };
128}
Definition charge.h:18
Definition Exx_LRI.h:51
Definition sltk_grid_driver.h:43
Excited State Solver: Linear Response TDDFT (Tamm Dancoff Approximation)
Definition esolver_lrtd_lcao.h:27
int nloc_per_band
Definition esolver_lrtd_lcao.h:71
virtual void runner(UnitCell &ucell, int istep) override
run energy solver
Definition esolver_lrtd_lcao.cpp:414
void setup_eigenvectors_X()
allocate and set the inital value of X
Definition esolver_lrtd_lcao.cpp:561
void read_ks_wfc()
read in the ground state wave function, band energy and occupation
Definition esolver_lrtd_lcao.cpp:652
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:70
void parameter_check() const
check the legality of the input parameters
Definition esolver_lrtd_lcao.cpp:78
virtual void cal_stress(UnitCell &ucell, ModuleBase::matrix &stress) override
calcualte stress of given cell
Definition esolver_lrtd_lcao.h:45
int nk
Definition esolver_lrtd_lcao.h:85
std::vector< std::shared_ptr< PotHxcLR > > pot
Definition esolver_lrtd_lcao.h:56
const UnitCell & ucell
Definition esolver_lrtd_lcao.h:49
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:39
Parallel_Orbitals paraMat_
variables for parallel distribution of matrix in AO representation
Definition esolver_lrtd_lcao.h:98
virtual double cal_energy() override
calculate total energy of a given system
Definition esolver_lrtd_lcao.h:43
std::vector< int > nocc
number of occupied orbitals for each spin used in the calculation
Definition esolver_lrtd_lcao.h:73
std::string xc_kernel
Definition esolver_lrtd_lcao.h:88
const Input_para & input
Definition esolver_lrtd_lcao.h:48
void set_X_initial_guess()
Definition esolver_lrtd_lcao.cpp:585
TwoCenterBundle two_center_bundle_
Definition esolver_lrtd_lcao.h:100
void init_pot(const Charge &chg_gs)
Definition esolver_lrtd_lcao.cpp:632
ModuleBase::matrix eig_ks
ground state bands, read from the file, or moved from ESolver_FP::pelec.ekb
Definition esolver_lrtd_lcao.h:64
int nocc_in
nocc read from input (adjusted by nelec): max(spin-up, spindown)
Definition esolver_lrtd_lcao.h:74
int nspin
Definition esolver_lrtd_lcao.h:84
int nbands
Definition esolver_lrtd_lcao.h:78
std::vector< Parallel_2D > paraX_
variables for parallel distribution of excited states
Definition esolver_lrtd_lcao.h:96
Parallel_2D paraC_
variables for parallel distribution of KS orbitals
Definition esolver_lrtd_lcao.h:94
~ESolver_LR()
Definition esolver_lrtd_lcao.h:33
void reset_dim_spin2()
reset nocc, nvirt, npairs after read ground-state wavefunction when nspin=2
Definition esolver_lrtd_lcao.cpp:131
psi::Psi< T > * psi_ks
ground state wave function
Definition esolver_lrtd_lcao.h:61
int nbasis
Definition esolver_lrtd_lcao.h:79
std::vector< double > orb_cutoff_
Definition esolver_lrtd_lcao.h:51
int nstates
how many 2-particle states to be solved
Definition esolver_lrtd_lcao.h:83
int nupdown
Definition esolver_lrtd_lcao.h:86
std::vector< int > nvirt
number of virtual orbitals for each spin used in the calculation
Definition esolver_lrtd_lcao.h:76
virtual void after_all_runners(UnitCell &ucell) override
perform post processing calculations
Definition esolver_lrtd_lcao.cpp:525
int nocc_max
nelec/2
Definition esolver_lrtd_lcao.h:75
virtual void cal_force(UnitCell &ucell, ModuleBase::matrix &force) override
calcualte forces for the atoms in the given cell
Definition esolver_lrtd_lcao.h:44
void read_ks_chg(Charge &chg)
read in the ground state charge density
Definition esolver_lrtd_lcao.cpp:684
std::unique_ptr< ModuleGint::GintInfo > gint_info_
Definition esolver_lrtd_lcao.h:90
Grid_Driver gd
Definition esolver_lrtd_lcao.h:50
bool openshell
Definition esolver_lrtd_lcao.h:87
void set_dimension()
set nocc, nvirt, nbasis, npairs and nstates
Definition esolver_lrtd_lcao.cpp:94
std::vector< int > npairs
n_occ*nvirt, the basis size of electron-hole pair representation
Definition esolver_lrtd_lcao.h:81
int nvirt_in
nvirt read from input (adjusted by nelec): min(spin-up, spindown)
Definition esolver_lrtd_lcao.h:77
Definition matrix.h:19
Definition esolver_fp.h:32
Definition esolver_ks_lcao.h:32
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:17
Definition psi.h:37
Definition esolver_ks_lcao.h:19
Definition exx_info.h:12
Definition input_parameter.h:13