ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
onsite_proj_pw.h
Go to the documentation of this file.
1#ifndef MODULEHAMILTPW_ONSITE_PROJ_PW_H
2#define MODULEHAMILTPW_ONSITE_PROJ_PW_H
3
4#include "operator_pw.h"
5
8#include "source_lcao/module_dftu/dftu.h" // mohan add 20251106
9
10namespace hamilt {
11
12#ifndef ONSITETEMPLATE_H
13#define ONSITETEMPLATE_H
14
15template<class T> class OnsiteProj : public T {};
16// template<typename Real, typename Device = base_device::DEVICE_CPU>
17// class OnsiteProj : public OperatorPW<T, Device> {};
18
19#endif
20
21template<typename T, typename Device>
22class OnsiteProj<OperatorPW<T, Device>> : public OperatorPW<T, Device>
23{
24 private:
25 using Real = typename GetTypeReal<T>::type;
26
27 public:
28 OnsiteProj(const int* isk_in,
29 const UnitCell* ucell_in,
30 Plus_U *p_dftu, // mohan add 2025-11-06
31 const bool cal_delta_spin,
32 const bool cal_dftu);
33
34 template<typename T_in, typename Device_in = Device>
35 explicit OnsiteProj(const OnsiteProj<OperatorPW<T_in, Device_in>>* onsite_proj);
36
37 virtual ~OnsiteProj();
38
39 virtual void init(const int ik_in)override;
40
41 virtual void act(const int nbands,
42 const int nbasis,
43 const int npol,
44 const T* tmpsi_in,
45 T* tmhpsi,
46 const int ngk = 0,
47 const bool is_first_node = false)const override;
48
49 const int *get_isk() const {return this->isk;}
50 const UnitCell *get_ucell() const {return this->ucell;}
51
52 private:
53 void cal_ps_delta_spin(const int npol, const int m) const;
54
55 void cal_ps_dftu(const int npol, const int m) const;
56
57 void update_becp(const T* psi_in, const int npol, const int m) const;
58
59 void add_onsite_proj(T *hpsi_in, const int npol, const int m) const;
60
61 const int* isk = nullptr;
62
63 const UnitCell* ucell = nullptr;
64
65 Plus_U *dftu = nullptr; // mohan add 2025-11-06
66
67 mutable int* ip_iat = nullptr;
68 mutable T* lambda_coeff = nullptr;
69 mutable int* orb_l_iat = nullptr;
70 mutable int* ip_m = nullptr;
71 mutable int* vu_begin_iat = nullptr;
72 mutable T* vu_device = nullptr;
73
74 mutable int nkb_m = 0;
75
76 bool has_delta_spin = false;
77 bool has_dftu = false;
78
79 mutable bool init_dftu = false;
80 mutable bool init_delta_spin = false;
81
82 mutable T *ps = nullptr;
83 int tnp = 0;
84 Device* ctx = {};
85 base_device::DEVICE_CPU* cpu_ctx = {};
86
99
100 T one{1, 0};
101 T zero{0, 0};
102};
103
104} // namespace hamilt
105
106#endif
Definition dftu.h:20
Definition unitcell.h:17
const int * get_isk() const
Definition onsite_proj_pw.h:49
typename GetTypeReal< T >::type Real
Definition onsite_proj_pw.h:25
const UnitCell * get_ucell() const
Definition onsite_proj_pw.h:50
Definition onsite_proj_pw.h:15
void add_onsite_proj(std::complex< float > *hpsi_in, const int npol, const int m) const
Definition onsite_proj_pw.cpp:362
void cal_ps_delta_spin(const int npol, const int m) const
Definition onsite_proj_pw.cpp:376
void update_becp(const std::complex< float > *psi_in, const int npol, const int m) const
Definition onsite_proj_pw.cpp:369
void cal_ps_dftu(const int npol, const int m) const
Definition onsite_proj_pw.cpp:382
Definition operator_pw.h:8
#define T
Definition exp.cpp:237
Definition hamilt.h:12
T type
Definition macros.h:8
Definition math_kernel_op.h:217
Definition math_kernel_op.h:192
Definition memory_op.h:115
Definition memory_op.h:17
Definition memory_op.h:31
Plus_U dftu
Definition test_dftu.cpp:14
const std::map< std::string, std::vector< double > > zero
Definition vdwd3_autoset_xcparam.cpp:326