ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
Exx_LRI.h
Go to the documentation of this file.
1//=======================
2// AUTHOR : Peize Lin
3// DATE : 2022-08-17
4//=======================
5
6#ifndef EXX_LRI_H
7#define EXX_LRI_H
8
9#include "LRI_CV.h"
10#include "ewald_Vq.h"
13#include "source_base/matrix.h"
14#include <RI/physics/Exx.h>
15
16#include <vector>
17#include <array>
18#include <map>
19#include <deque>
20#include <mpi.h>
21
23
25
26 template<typename T, typename Tdata>
27 class RPA_LRI;
28
29 template<typename T, typename Tdata>
31
32 namespace LR
33 {
34 template<typename T, typename TR>
35 class ESolver_LR;
36
37 template<typename T>
39 }
40
41template<typename Tdata>
43{
44 // match with Conv_Coulomb_Pot_K::Coulomb_Method
45 public:
48 std::vector<std::vector<std::vector<Numerical_Orbital_Lm>>> abfs_ccp;
49};
50
51template<typename Tdata>
53{
54private:
55 using TA = int;
56 using Tcell = int;
57 static constexpr std::size_t Ndim = 3;
58 using TC = std::array<Tcell,Ndim>;
59 using TAC = std::pair<TA,TC>;
60 using TatomR = std::array<double,Ndim>; // tmp
61
62public:
63 Exx_LRI(const Exx_Info::Exx_Info_RI& info_in) :info(info_in) {}
64 Exx_LRI operator=(const Exx_LRI&) = delete;
66
67 void init(
68 const MPI_Comm &mpi_comm_in,
69 const UnitCell &ucell,
70 const K_Vectors &kv_in,
71 const LCAO_Orbitals& orb);
72 void init(
73 const MPI_Comm &mpi_comm_in,
74 const UnitCell &ucell,
75 const K_Vectors &kv_in,
76 const LCAO_Orbitals& orb,
77 const std::vector<std::vector<std::vector<Numerical_Orbital_Lm>>>& abfs_in);
78 void init_spencer(const MPI_Comm& mpi_comm_in,
79 const UnitCell& ucell,
80 const K_Vectors& kv_in,
81 const LCAO_Orbitals& orb);
82 void init_spencer(const MPI_Comm& mpi_comm_in,
83 const UnitCell& ucell,
84 const K_Vectors& kv_in,
85 const LCAO_Orbitals& orb,
86 const std::vector<std::vector<std::vector<Numerical_Orbital_Lm>>>& abfs_in);
87 void cal_exx_ions(const UnitCell& ucell, const bool write_cv = false);
89 std::map<TA, std::map<TAC, RI::Tensor<Tdata>>>& Vs_cut_IJR,
90 std::map<TA, std::map<TAC, RI::Tensor<Tdata>>>& Cs,
91 const UnitCell& ucell,
92 const bool write_cv = false);
94 std::map<TA, std::map<TAC, RI::Tensor<Tdata>>>& Vs_full_IJR,
95 std::map<TA, std::map<TAC, RI::Tensor<Tdata>>>& Cs,
96 const UnitCell& ucell,
97 const bool write_cv = false);
98 void cal_exx_elec(
99 const std::vector<std::map<TA, std::map<TAC, RI::Tensor<Tdata>>>>& Ds,
100 const UnitCell& ucell,
101 const Parallel_Orbitals& pv,
102 const ModuleSymmetry::Symmetry_rotation* p_symrot = nullptr);
103 void cal_exx_force(const int& nat);
104 void cal_exx_stress(const double& omega, const double& lat0);
105
106 void reset_Cs(const std::map<TA, std::map<TAC, RI::Tensor<Tdata>>>& Cs_in) { this->exx_lri.set_Cs(Cs_in, this->info.C_threshold); }
107 void reset_Vs(const std::map<TA, std::map<TAC, RI::Tensor<Tdata>>>& Vs_in) { this->exx_lri.set_Vs(Vs_in, this->info.V_threshold); }
108 //std::vector<std::vector<int>> get_abfs_nchis() const;
109
110 std::vector< std::map<TA, std::map<TAC, RI::Tensor<Tdata>>>> Hexxs;
111 double Eexx;
114
115
116private:
118 MPI_Comm mpi_comm;
119 const K_Vectors *p_kv = nullptr;
120 std::shared_ptr<ORB_gaunt_table> MGT;
121 std::vector<double> orb_cutoff_;
122
123 std::vector<std::vector<std::vector<Numerical_Orbital_Lm>>> lcaos;
124 std::vector<std::vector<std::vector<Numerical_Orbital_Lm>>> abfs;
125 //std::vector<std::vector<std::vector<Numerical_Orbital_Lm>>> abfs_ccp;
126 std::map<Conv_Coulomb_Pot_K::Coulomb_Method, Exx_Obj<Tdata>> exx_objs;
127 //LRI_CV<Tdata> cv;
128 RI::Exx<TA,Tcell,Ndim,Tdata> exx_lri;
130 std::pair<bool,
132 std::vector<std::map<std::string,std::string>>>>> coulomb_settings;
133
134 void post_process_Hexx( std::map<TA, std::map<TAC, RI::Tensor<Tdata>>> &Hexxs_io ) const;
135 double post_process_Eexx(const double& Eexx_in) const;
136
137 friend class RPA_LRI<double, Tdata>;
138 friend class RPA_LRI<std::complex<double>, Tdata>;
139 friend class Exx_LRI_Interface<double, Tdata>;
140 friend class Exx_LRI_Interface<std::complex<double>, Tdata>;
141 friend class LR::ESolver_LR<double, double>;
142 friend class LR::ESolver_LR<std::complex<double>, double>;
143 friend class LR::OperatorLREXX<double>;
144 friend class LR::OperatorLREXX<std::complex<double>>;
145};
146
147#include "Exx_LRI.hpp"
148
149#endif
Definition ewald_Vq.h:23
Definition Exx_LRI_interface.h:35
Definition Exx_LRI.h:53
ModuleBase::matrix stress_exx
Definition Exx_LRI.h:113
void post_process_Hexx(std::map< TA, std::map< TAC, RI::Tensor< Tdata > > > &Hexxs_io) const
Definition Exx_LRI.hpp:965
std::vector< std::vector< std::vector< Numerical_Orbital_Lm > > > lcaos
Definition Exx_LRI.h:123
std::map< Conv_Coulomb_Pot_K::Coulomb_Method, std::pair< bool, std::map< Conv_Coulomb_Pot_K::Coulomb_Type, std::vector< std::map< std::string, std::string > > > > > coulomb_settings
Definition Exx_LRI.h:132
std::vector< std::vector< std::vector< Numerical_Orbital_Lm > > > abfs
Definition Exx_LRI.h:124
void init(const MPI_Comm &mpi_comm_in, const UnitCell &ucell, const K_Vectors &kv_in, const LCAO_Orbitals &orb)
Definition Exx_LRI.hpp:85
void reset_Vs(const std::map< TA, std::map< TAC, RI::Tensor< Tdata > > > &Vs_in)
Definition Exx_LRI.h:107
void cal_cut_coulomb_cs(std::map< TA, std::map< TAC, RI::Tensor< Tdata > > > &Vs_cut_IJR, std::map< TA, std::map< TAC, RI::Tensor< Tdata > > > &Cs, const UnitCell &ucell, const bool write_cv=false)
Definition Exx_LRI.hpp:760
static constexpr std::size_t Ndim
Definition Exx_LRI.h:57
const Exx_Info::Exx_Info_RI & info
Definition Exx_LRI.h:117
Exx_LRI(const Exx_Info::Exx_Info_RI &info_in)
Definition Exx_LRI.h:63
std::vector< std::map< TA, std::map< TAC, RI::Tensor< Tdata > > > > Hexxs
Definition Exx_LRI.h:110
ModuleBase::matrix force_exx
Definition Exx_LRI.h:112
void init_spencer(const MPI_Comm &mpi_comm_in, const UnitCell &ucell, const K_Vectors &kv_in, const LCAO_Orbitals &orb)
Definition Exx_LRI.hpp:179
void cal_exx_elec(const std::vector< std::map< TA, std::map< TAC, RI::Tensor< Tdata > > > > &Ds, const UnitCell &ucell, const Parallel_Orbitals &pv, const ModuleSymmetry::Symmetry_rotation *p_symrot=nullptr)
Definition Exx_LRI.hpp:913
std::shared_ptr< ORB_gaunt_table > MGT
Definition Exx_LRI.h:120
double post_process_Eexx(const double &Eexx_in) const
Definition Exx_LRI.hpp:976
std::pair< TA, TC > TAC
Definition Exx_LRI.h:59
void reset_Cs(const std::map< TA, std::map< TAC, RI::Tensor< Tdata > > > &Cs_in)
Definition Exx_LRI.h:106
int TA
Definition Exx_LRI.h:55
double Eexx
Definition Exx_LRI.h:111
std::map< Conv_Coulomb_Pot_K::Coulomb_Method, Exx_Obj< Tdata > > exx_objs
Definition Exx_LRI.h:126
void cal_exx_ions(const UnitCell &ucell, const bool write_cv=false)
Definition Exx_LRI.hpp:306
MPI_Comm mpi_comm
Definition Exx_LRI.h:118
void cal_exx_force(const int &nat)
Definition Exx_LRI.hpp:1002
std::array< Tcell, Ndim > TC
Definition Exx_LRI.h:58
std::array< double, Ndim > TatomR
Definition Exx_LRI.h:60
RI::Exx< TA, Tcell, Ndim, Tdata > exx_lri
Definition Exx_LRI.h:128
void cal_ewald_coulomb(std::map< TA, std::map< TAC, RI::Tensor< Tdata > > > &Vs_full_IJR, std::map< TA, std::map< TAC, RI::Tensor< Tdata > > > &Cs, const UnitCell &ucell, const bool write_cv=false)
Definition Exx_LRI.hpp:835
Exx_LRI operator=(const Exx_LRI &)=delete
int Tcell
Definition Exx_LRI.h:56
void cal_exx_stress(const double &omega, const double &lat0)
Definition Exx_LRI.hpp:1025
const K_Vectors * p_kv
Definition Exx_LRI.h:119
Exx_LRI operator=(Exx_LRI &&)
std::vector< double > orb_cutoff_
Definition Exx_LRI.h:121
Definition Exx_LRI.h:43
LRI_CV< Tdata > cv
Definition Exx_LRI.h:46
std::vector< std::vector< std::vector< Numerical_Orbital_Lm > > > abfs_ccp
Definition Exx_LRI.h:48
Ewald_Vq< Tdata > evq
Definition Exx_LRI.h:47
Definition klist.h:12
Definition ORB_read.h:18
Definition LRI_CV.h:25
Excited State Solver: Linear Response TDDFT (Tamm Dancoff Approximation)
Definition esolver_lrtd_lcao.h:27
Definition Exx_LRI.h:38
Definition matrix.h:18
Definition symmetry_rotation.h:16
Definition parallel_orbitals.h:9
Definition RPA_LRI.h:25
Definition unitcell.h:15
std::complex< double > complex
Definition diago_cusolver.cpp:15
Coulomb_Type
Definition conv_coulomb_pot_k.h:10
Coulomb_Method
Definition conv_coulomb_pot_k.h:16
Definition esolver_ks_lcao.h:20
Definition exx_info.h:52
double V_threshold
Definition exx_info.h:63
double C_threshold
Definition exx_info.h:62