9
9
#include " LRI_CV.h"
10
10
#include " LRI_CV_Tools.h"
11
11
#include " exx_abfs-abfs_index.h"
12
+ #include " exx_abfs-construct_orbs.h"
12
13
#include " RI_Util.h"
13
14
#include " ../../source_base/tool_title.h"
14
15
#include " ../../source_base/timer.h"
@@ -43,16 +44,22 @@ void LRI_CV<Tdata>::set_orbitals(
43
44
const std::vector<std::vector<std::vector<Numerical_Orbital_Lm>>> &abfs_in,
44
45
const std::vector<std::vector<std::vector<Numerical_Orbital_Lm>>> &abfs_ccp_in,
45
46
const double &kmesh_times,
46
- const double &ccp_rmesh_times_in)
47
+ ORB_gaunt_table& MGT,
48
+ const bool & init_MGT,
49
+ const bool & init_C)
47
50
{
48
51
ModuleBase::TITLE (" LRI_CV" , " set_orbitals" );
49
52
ModuleBase::timer::tick (" LRI_CV" , " set_orbitals" );
50
53
51
- this ->orb_cutoff_ = orb.cutoffs ();
52
54
this ->lcaos = lcaos_in;
53
55
this ->abfs = abfs_in;
54
56
this ->abfs_ccp = abfs_ccp_in;
55
- this ->ccp_rmesh_times = ccp_rmesh_times_in;
57
+
58
+ this ->lcaos_rcut = Exx_Abfs::Construct_Orbs::get_Rcut (this ->lcaos );
59
+ this ->abfs_ccp_rcut = Exx_Abfs::Construct_Orbs::get_Rcut (this ->abfs_ccp );
60
+ const double lcaos_rmax = Exx_Abfs::Construct_Orbs::get_Rmax (this ->lcaos );
61
+ const double abfs_ccp_rmax
62
+ = Exx_Abfs::Construct_Orbs::get_Rmax (this ->abfs_ccp );
56
63
57
64
const ModuleBase::Element_Basis_Index::Range
58
65
range_lcaos = Exx_Abfs::Abfs_Index::construct_range ( lcaos );
@@ -62,27 +69,50 @@ void LRI_CV<Tdata>::set_orbitals(
62
69
range_abfs = Exx_Abfs::Abfs_Index::construct_range ( abfs );
63
70
this ->index_abfs = ModuleBase::Element_Basis_Index::construct_index ( range_abfs );
64
71
65
- this ->m_abfs_abfs .init ( 2 , ucell,orb, kmesh_times, (1 +this ->ccp_rmesh_times )/2.0 );
66
- this ->m_abfs_abfs .init_radial ( this ->abfs_ccp , this ->abfs );
67
- this ->m_abfs_abfs .init_radial_table ();
68
-
69
- this ->m_abfslcaos_lcaos .init ( 1 , ucell , orb, kmesh_times, 1 );
70
- this ->m_abfslcaos_lcaos .init_radial ( this ->abfs_ccp , this ->lcaos , this ->lcaos );
71
- this ->m_abfslcaos_lcaos .init_radial_table ();
72
+ int Lmax_v = std::numeric_limits<double >::min ();
73
+ this ->m_abfs_abfs .init (2 , ucell, orb, kmesh_times, lcaos_rmax + abfs_ccp_rmax, Lmax_v);
74
+ int Lmax_c = std::numeric_limits<double >::min ();
75
+ if (init_C)
76
+ this ->m_abfslcaos_lcaos .init (1 , ucell, orb, kmesh_times, lcaos_rmax, Lmax_c);
77
+ int Lmax = std::max (Lmax_v, Lmax_c);
78
+
79
+ if (init_MGT) {
80
+ MGT.init_Gaunt_CH (Lmax);
81
+ MGT.init_Gaunt (Lmax);
82
+ }
83
+
84
+ this ->m_abfs_abfs .init_radial (this ->abfs_ccp , this ->abfs , MGT);
85
+ this ->m_abfs_abfs .init_radial_table ();
86
+ if (init_C) {
87
+ this ->m_abfslcaos_lcaos .init_radial (this ->abfs_ccp ,
88
+ this ->lcaos ,
89
+ this ->lcaos ,
90
+ MGT);
91
+ this ->m_abfslcaos_lcaos .init_radial_table ();
92
+ }
72
93
73
94
ModuleBase::timer::tick (" LRI_CV" , " set_orbitals" );
74
95
}
75
96
97
+ template <typename Tdata>
98
+ double LRI_CV<Tdata>::cal_V_Rcut(const int it0, const int it1) {
99
+ return this ->abfs_ccp_rcut [it0] + this ->lcaos_rcut [it1];
100
+ }
76
101
102
+ template <typename Tdata>
103
+ double LRI_CV<Tdata>::cal_C_Rcut(const int it0, const int it1) {
104
+ return std::min (this ->abfs_ccp_rcut [it0], this ->lcaos_rcut [it0])
105
+ + this ->lcaos_rcut [it1];
106
+ }
77
107
78
108
template <typename Tdata> template <typename Tresult>
79
109
auto LRI_CV<Tdata>::cal_datas(
80
110
const UnitCell &ucell,
81
- const std::vector<TA> & list_A0,
82
- const std::vector<TAC> & list_A1,
83
- const std::map<std::string,bool > & flags,
84
- const double &rmesh_times ,
85
- const T_func_DPcal_data<Tresult> & func_DPcal_data)
111
+ const std::vector<TA>& list_A0,
112
+ const std::vector<TAC>& list_A1,
113
+ const std::map<std::string, bool >& flags,
114
+ const T_func_cal_Rcut& func_cal_Rcut ,
115
+ const T_func_DPcal_data<Tresult>& func_DPcal_data)
86
116
-> std::map<TA,std::map<TAC,Tresult>>
87
117
{
88
118
ModuleBase::TITLE (" LRI_CV" ," cal_datas" );
@@ -104,9 +134,8 @@ auto LRI_CV<Tdata>::cal_datas(
104
134
const int ia1 = ucell.iat2ia [iat1];
105
135
const ModuleBase::Vector3<double > tau0 = ucell.atoms [it0].tau [ia0];
106
136
const ModuleBase::Vector3<double > tau1 = ucell.atoms [it1].tau [ia1];
107
- const double Rcut = std::min (
108
- orb_cutoff_[it0] * rmesh_times + orb_cutoff_[it1],
109
- orb_cutoff_[it1] * rmesh_times + orb_cutoff_[it0]);
137
+ const double Rcut
138
+ = std::min (func_cal_Rcut (it0, it1), func_cal_Rcut (it1, it0));
110
139
const Abfs::Vector3_Order<double > R_delta = -tau0+tau1+(RI_Util::array3_to_Vector3 (cell1)*ucell.latvec );
111
140
if ( R_delta.norm ()*ucell.lat0 < Rcut )
112
141
{
@@ -137,7 +166,12 @@ auto LRI_CV<Tdata>::cal_Vs(
137
166
func_DPcal_V = std::bind (
138
167
&LRI_CV<Tdata>::DPcal_V, this ,
139
168
std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4);
140
- return this ->cal_datas (ucell,list_A0, list_A1, flags, this ->ccp_rmesh_times , func_DPcal_V);
169
+ const T_func_cal_Rcut func_cal_Rcut = std::bind (&LRI_CV<Tdata>::cal_V_Rcut,
170
+ this ,
171
+ std::placeholders::_1,
172
+ std::placeholders::_2);
173
+
174
+ return this ->cal_datas (ucell,list_A0, list_A1, flags, func_cal_Rcut, func_DPcal_V);
141
175
}
142
176
143
177
template <typename Tdata>
@@ -153,7 +187,13 @@ auto LRI_CV<Tdata>::cal_dVs(
153
187
func_DPcal_dV = std::bind (
154
188
&LRI_CV<Tdata>::DPcal_dV, this ,
155
189
std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4);
156
- return this ->cal_datas (ucell,list_A0, list_A1, flags, this ->ccp_rmesh_times , func_DPcal_dV);
190
+
191
+ const T_func_cal_Rcut func_cal_Rcut = std::bind (&LRI_CV<Tdata>::cal_V_Rcut,
192
+ this ,
193
+ std::placeholders::_1,
194
+ std::placeholders::_2);
195
+
196
+ return this ->cal_datas (ucell,list_A0, list_A1, flags, func_cal_Rcut, func_DPcal_dV);
157
197
}
158
198
159
199
template <typename Tdata>
@@ -171,8 +211,13 @@ auto LRI_CV<Tdata>::cal_Cs_dCs(
171
211
func_DPcal_C_dC = std::bind (
172
212
&LRI_CV<Tdata>::DPcal_C_dC, this ,
173
213
std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4);
214
+ const T_func_cal_Rcut func_cal_Rcut = std::bind (&LRI_CV<Tdata>::cal_C_Rcut,
215
+ this ,
216
+ std::placeholders::_1,
217
+ std::placeholders::_2);
218
+
174
219
std::map<TA,std::map<TAC, std::pair<RI::Tensor<Tdata>, std::array<RI::Tensor<Tdata>,3 >>>>
175
- Cs_dCs_tmp = this ->cal_datas (ucell,list_A0, list_A1, flags, std::min ( 1.0 , this -> ccp_rmesh_times ) , func_DPcal_C_dC);
220
+ Cs_dCs_tmp = this ->cal_datas (ucell,list_A0, list_A1, flags, func_cal_Rcut , func_DPcal_C_dC);
176
221
177
222
std::map<TA, std::map<TAC, RI::Tensor<Tdata>>> Cs;
178
223
std::map<TA, std::map<TAC, std::array<RI::Tensor<Tdata>, 3 >>> dCs;
0 commit comments