1#ifndef ABACUS_SOURCE_LCAO_MODULE_LR_HAMILT_ZEQ_L_H
2#define ABACUS_SOURCE_LCAO_MODULE_LR_HAMILT_ZEQ_L_H
26 const std::vector<int>&
nocc,
27 const std::vector<int>&
nvirt,
29 const std::vector<double>& orb_cutoff,
35 const double& exx_alpha,
37 std::weak_ptr<PotLRBase> pot_hxc_gs,
39 const std::vector<Parallel_Blkcyclic>&
pX,
42 const std::string& spin_type,
43 const std::string& in_dir,
44 const std::string& out_dir,
45 const std::string& dft_functional)
58 *this->
DM_trans, pot_hxc_gs, ucell, orb_cutoff, gd, kv,
pX, pc, pmat,
60 this->
ops->add(op_hz);
62 if (gs_is_hybrid(dft_functional))
70 this->
ops->add(op_hz_exx);
82 for (
auto& t: dm_trans_2d)
87 for (
int ik = 0; ik < this->
nk; ++ik)
89 this->
DM_trans->set_dmk_ptr(ik, dm_trans_2d[ik].data<T>());
117 const std::vector<int>&
nocc,
118 const std::vector<int>&
nvirt,
120 const std::vector<double>& orb_cutoff,
126 const double& exx_alpha,
128 std::weak_ptr<PotLRBase> pot_hxc_gs,
130 const std::vector<Parallel_Blkcyclic>&
pX,
133 const std::string& dft_functional,
135 const int local_dimension,
136 const int global_dimension)
150 auto newHxc = [
this, &nspin, &naos, &
nocc, &
nvirt, &psi_ks, &pot_hxc_gs, &ucell, &orb_cutoff, &gd, &kv, &
pX, &pc, &pmat](
const int sl,
const int sr)
153 *this->
DM_trans, pot_hxc_gs, ucell, orb_cutoff, gd, kv,
pX, pc, pmat,
156 this->
ops[0]->add(newHxc(0, 0));
157 this->
ops[1] = newHxc(0, 1);
158 this->
ops[2] = newHxc(1, 0);
159 this->
ops[3]->add(newHxc(1, 1));
165 if (gs_is_hybrid(dft_functional))
167 for (
int is : {0, 1})
171 for (
int is : {0, 1})
183 const std::vector<ct::Tensor>* density_add)
override
185 assert(density_add ==
nullptr);
192 LR_Util::matsym(t.template data<T>(), this->naos_, this->pmat_.para_2d());
196 for (
auto& t: this->dm_buf_)
201 for (
int ik = 0;ik < this->
nk;++ik)
203 this->
DM_trans->set_dmk_ptr(ik, this->dm_buf_[ik].
template data<T>());
213 std::unique_ptr<module_dm::DensityMatrix<T, T>>
DM_trans;
Grid_Driver class for neighbor search interface.
Definition sltk_grid_driver.h:63
Class for k-points management.
Definition klist.h:20
int get_nks() const
Definition klist.h:71
const int nk
Definition hamilt_casida.h:200
const std::vector< Parallel_Blkcyclic > & pX
Definition hamilt_casida.h:201
std::function< void(const int &, const T *const)> cal_dm_trans
Definition hamilt_casida.h:229
const int nspin
Definition hamilt_casida.h:199
HamiltLR(const std::string &xc_kernel, const int &nspin, const int &naos, const std::vector< int > &nocc, const std::vector< int > &nvirt, const UnitCell &ucell_in, const std::vector< double > &orb_cutoff, const Grid_Driver &gd_in, const psi::Psi< T > &psi_ks_in, const ModuleBase::matrix &eig_ks, std::weak_ptr< PotLRBase > pot_in, const K_Vectors &kv_in, const std::vector< Parallel_Blkcyclic > &pX_in, const Parallel_Blkcyclic &pc_in, const Parallel_Orbitals &pmat_in, const std::string &spin_type, const std::string &in_dir, const std::string &out_dir, const std::string &ri_hartree_benchmark="none", const std::vector< int > &aims_nbasis={})
Definition hamilt_casida.h:23
const std::vector< int > & nocc
Definition hamilt_casida.h:197
std::unique_ptr< module_dm::DensityMatrix< T, T > > DM_trans
Definition hamilt_casida.h:224
hamilt::Operator< T, base_device::DEVICE_CPU > * ops
first node operator, add operations from each operators
Definition hamilt_casida.h:227
const std::vector< int > & nvirt
Definition hamilt_casida.h:198
Diag part of A operator: [AX]_iak = (e_ak - e_ik) X_iak.
Definition operator_lr_diag.h:13
Hxc part of A operator for LR-TDDFT.
Definition operator_lr_hxc.h:17
MO_TO_AO_TYPE
type of molecular orbital to atomic orbital transformation: CC_vo: MO = C_v^* AO C_o; CC_oo: MO = C_o...
Definition operator_lr_hxc.h:24
typename OperatorLRHxc< T >::MO_TO_AO_TYPE ATYPE
Definition hamilt_zeq_l.h:18
Z_vector_L(const std::string &xc_kernel, const int &nspin, const int &naos, const std::vector< int > &nocc, const std::vector< int > &nvirt, const UnitCell &ucell, const std::vector< double > &orb_cutoff, const Grid_Driver &gd, const psi::Psi< T > &psi_ks, const ModuleBase::matrix &eig_ks, std::weak_ptr< PotLRBase > pot_hxc_gs, const K_Vectors &kv, const std::vector< Parallel_Blkcyclic > &pX, const Parallel_Blkcyclic &pc, const Parallel_Orbitals &pmat, const std::string &spin_type, const std::string &in_dir, const std::string &out_dir, const std::string &dft_functional)
Definition hamilt_zeq_l.h:23
const psi::Psi< T > & psi_ks_
Definition hamilt_zeq_l.h:211
std::vector< ct::Tensor > dm_buf_
the tensors DM_trans points into; kept alive for the whole act chain
Definition hamilt_zeq_l.h:215
typename OperatorLRHxc< T >::MO_TO_AO_TYPE ATYPE
Definition hamilt_zeq_l.h:109
Z_vector_UL(const std::string &xc_kernel, const int &nspin, const int &naos, const std::vector< int > &nocc, const std::vector< int > &nvirt, const UnitCell &ucell, const std::vector< double > &orb_cutoff, const Grid_Driver &gd, const psi::Psi< T > &psi_ks, const ModuleBase::matrix &eig_ks, std::weak_ptr< PotLRBase > pot_hxc_gs, const K_Vectors &kv, const std::vector< Parallel_Blkcyclic > &pX, const Parallel_Blkcyclic &pc, const Parallel_Orbitals &pmat, const std::string &dft_functional, const int nk, const int local_dimension, const int global_dimension)
Definition hamilt_zeq_l.h:114
std::vector< psi::Psi< T > > psi_ks_spin_
Definition hamilt_zeq_l.h:212
std::unique_ptr< module_dm::DensityMatrix< T, T > > DM_trans
Definition hamilt_zeq_l.h:213
const Parallel_Blkcyclic & pc_
Definition hamilt_zeq_l.h:209
void set_dm(const int is, const T *const X, const std::vector< ct::Tensor > *density_add) override
rebuild the density matrices the operators read, from the is block of X
Definition hamilt_zeq_l.h:182
const Parallel_Orbitals & pmat_
Definition hamilt_zeq_l.h:210
const int naos_
Definition hamilt_zeq_l.h:208
std::vector< hamilt::Operator< T > * > ops
Definition hamilt_zequlr.h:193
const std::vector< int > & nvirt
Definition hamilt_zequlr.h:179
ZeqULR(const std::vector< int > &nocc_in, const std::vector< int > &nvirt_in, const std::vector< Parallel_Blkcyclic > &pX_in, const int nk_in, const int local_dimension, const int global_dimension)
Definition hamilt_zequlr.h:35
const std::vector< int > & nocc
Definition hamilt_zequlr.h:178
const int nk
Definition hamilt_zequlr.h:181
const std::vector< Parallel_Blkcyclic > & pX
Definition hamilt_zequlr.h:180
double * c
Definition matrix.h:21
std::vector< ModuleBase::Vector3< double > > kvec_d
Direct coordinates of the points.
Definition reciprocal_grid.h:57
Parallel block-cyclic matrix distribution.
Definition parallel_blkcyc.h:25
Definition parallel_orbitals.h:16
Parallel_Blkcyclic & para_2d()
Definition parallel_orbitals.h:24
Provide the basic information about unitcell.
Definition unitcell.h:16
A multi-dimensional array of elements of a single data type.
Definition tensor.h:32
#define T
Definition exp.cpp:237
psi::Psi< T > get_psi_spin(const psi::Psi< T > &psi_in, const int &is, const int &nk)
get the Psi wrapper of the selected spin from the Psi object
Definition lr_util.hpp:235
std::unique_ptr< T > make_unique(Args &&... args)
Definition lr_util.hpp:33
void matsym(const T *in, const int n, T *out)
Definition lr_util.hpp:79
void initialize_DMR(module_dm::DensityMatrix< T, TR > &dm, const Parallel_Orbitals &pmat, const UnitCell &ucell, const Grid_Driver &gd, const std::vector< double > &orb_cutoff)
Definition lr_util_hcontainer.h:179
Definition esolver_lr_lcao_tddft.h:28
std::vector< container::Tensor > cal_dm_trans_blas(const T *const X_istate, const psi::Psi< T > &c, const int &nocc, const int &nvirt, const T factor=(T) 1.0, const LR_Util::MO_TYPE type=LR_Util::MO_TYPE::VO)
calculate the 2d-block transition density matrix in AO basis using ?gemm
std::vector< container::Tensor > cal_dm_trans_pblas(const T *const X_istate, const Parallel_Blkcyclic &px, const psi::Psi< T > &c, const Parallel_Blkcyclic &pc, const int naos, const int nocc, const int nvirt, const Parallel_Blkcyclic &pmat, const T factor=(T) 1.0, const LR_Util::MO_TYPE type=LR_Util::MO_TYPE::VO)
calculate the 2d-block transition density matrix in AO basis using p?gemm
void TITLE(const std::string &class_name, const std::string &function_name, const bool disable)
Definition tool_title.cpp:18
@ lr_dmtrans_exx
Definition operator.h:32
@ lr_dmtrans_hxc
Definition operator.h:29