ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
pot_hxc_lrtd.h
Go to the documentation of this file.
1#pragma once
3#include "xc_kernel.h"
4#include <unordered_map>
5#include <memory>
6
7namespace LR
8{
9 class PotHxcLR
10 {
11 public:
16 enum SpinType { S1 = 0, S2_singlet = 1, S2_triplet = 2, S2_updown = 3 };
18 enum XCType { None = 0, LDA = 1, GGA = 2, HYB_GGA = 4 };
20 PotHxcLR(const std::string& xc_kernel, const ModulePW::PW_Basis& rho_basis,
21 const UnitCell& ucell, const Charge& chg_gs/*ground state*/, const Parallel_Grid& pgrid,
22 const SpinType& st = SpinType::S1, const std::vector<std::string>& lr_init_xc_kernel = { "default" });
24 void cal_v_eff(double** rho, const UnitCell& ucell, ModuleBase::matrix& v_eff, const std::vector<int>& ispin_op = { 0,0 });
25 const int& nrxx = nrxx_;
26 private:
28 const int nspin_ = 1;
29 const int nrxx_ = 1;
30 std::unique_ptr<elecstate::PotHartree> pot_hartree_;
36 const std::string xc_kernel_;
37 const double& tpiba_;
40
41 // enum class as key for unordered_map is not supported in C++11 sometimes
42 // https://github.com/llvm/llvm-project/issues/49601
43 // struct SpinHash { std::size_t operator()(const SpinType& s) const { return std::hash<int>()(static_cast<int>(s)); } };
44 using Tfunc = std::function<void(const double* const ,
46 const std::vector<int>& ispin_op) >;
47 // std::unordered_map<SpinType, Tfunc, SpinHash> kernel_to_potential_;
48 std::map<SpinType, Tfunc> kernel_to_potential_;
49
50 void set_integral_func(const SpinType& s, const XCType& xc);
51 };
52
53} // namespace LR
Definition charge.h:20
Calculate the exchange-correlation (XC) kernel ($f_{xc}=\delta^2E_xc/\delta\rho^2$) and store its com...
Definition xc_kernel.h:12
Definition pot_hxc_lrtd.h:10
void set_integral_func(const SpinType &s, const XCType &xc)
Definition pot_hxc_lrtd.cpp:55
const int nspin_
Definition pot_hxc_lrtd.h:28
std::unique_ptr< elecstate::PotHartree > pot_hartree_
Definition pot_hxc_lrtd.h:30
const int nrxx_
Definition pot_hxc_lrtd.h:29
~PotHxcLR()
Definition pot_hxc_lrtd.h:23
const int & nrxx
Definition pot_hxc_lrtd.h:25
SpinType
Definition pot_hxc_lrtd.h:16
@ S1
Definition pot_hxc_lrtd.h:16
@ S2_singlet
Definition pot_hxc_lrtd.h:16
@ S2_triplet
Definition pot_hxc_lrtd.h:16
@ S2_updown
Definition pot_hxc_lrtd.h:16
const SpinType spin_type_
Definition pot_hxc_lrtd.h:38
const std::string xc_kernel_
Definition pot_hxc_lrtd.h:36
std::function< void(const double *const, ModuleBase::matrix &, const std::vector< int > &ispin_op) > Tfunc
Definition pot_hxc_lrtd.h:46
const ModulePW::PW_Basis & rho_basis_
Definition pot_hxc_lrtd.h:27
XCType
XCType here is to determin the method of integration from kernel to potential, not the way calculatin...
Definition pot_hxc_lrtd.h:18
@ HYB_GGA
Definition pot_hxc_lrtd.h:18
@ None
Definition pot_hxc_lrtd.h:18
@ LDA
Definition pot_hxc_lrtd.h:18
@ GGA
Definition pot_hxc_lrtd.h:18
XCType xc_type_
Definition pot_hxc_lrtd.h:39
std::map< SpinType, Tfunc > kernel_to_potential_
Definition pot_hxc_lrtd.h:48
const KernelXC xc_kernel_components_
Definition pot_hxc_lrtd.h:35
void cal_v_eff(double **rho, const UnitCell &ucell, ModuleBase::matrix &v_eff, const std::vector< int > &ispin_op={ 0, 0 })
Definition pot_hxc_lrtd.cpp:26
const double & tpiba_
Definition pot_hxc_lrtd.h:37
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
Definition parallel_grid.h:8
Definition unitcell.h:16
Definition esolver_ks_lcao.h:37