@@ -76,6 +76,7 @@ void LRI_CV<Tdata>::set_orbitals(
7676
7777template <typename Tdata> template <typename Tresult>
7878auto LRI_CV<Tdata>::cal_datas(
79+ const UnitCell &ucell,
7980 const std::vector<TA> &list_A0,
8081 const std::vector<TAC> &list_A1,
8182 const std::map<std::string,bool > &flags,
@@ -96,17 +97,17 @@ auto LRI_CV<Tdata>::cal_datas(
9697 const TA iat0 = list_A0[i0];
9798 const TA iat1 = list_A1[i1].first ;
9899 const TC &cell1 = list_A1[i1].second ;
99- const int it0 = GlobalC:: ucell.iat2it [iat0];
100- const int ia0 = GlobalC:: ucell.iat2ia [iat0];
101- const int it1 = GlobalC:: ucell.iat2it [iat1];
102- const int ia1 = GlobalC:: ucell.iat2ia [iat1];
103- const ModuleBase::Vector3<double > tau0 = GlobalC:: ucell.atoms [it0].tau [ia0];
104- const ModuleBase::Vector3<double > tau1 = GlobalC:: ucell.atoms [it1].tau [ia1];
100+ const int it0 = ucell.iat2it [iat0];
101+ const int ia0 = ucell.iat2ia [iat0];
102+ const int it1 = ucell.iat2it [iat1];
103+ const int ia1 = ucell.iat2ia [iat1];
104+ const ModuleBase::Vector3<double > tau0 = ucell.atoms [it0].tau [ia0];
105+ const ModuleBase::Vector3<double > tau1 = ucell.atoms [it1].tau [ia1];
105106 const double Rcut = std::min (
106107 orb_cutoff_[it0] * rmesh_times + orb_cutoff_[it1],
107108 orb_cutoff_[it1] * rmesh_times + orb_cutoff_[it0]);
108- const Abfs::Vector3_Order<double > R_delta = -tau0+tau1+(RI_Util::array3_to_Vector3 (cell1)*GlobalC:: ucell.latvec );
109- if ( R_delta.norm ()*GlobalC:: ucell.lat0 < Rcut )
109+ const Abfs::Vector3_Order<double > R_delta = -tau0+tau1+(RI_Util::array3_to_Vector3 (cell1)*ucell.latvec );
110+ if ( R_delta.norm ()*ucell.lat0 < Rcut )
110111 {
111112 const Tresult Data = func_DPcal_data (it0, it1, R_delta, flags);
112113// if(Data.norm(std::numeric_limits<double>::max()) > threshold)
@@ -124,6 +125,7 @@ auto LRI_CV<Tdata>::cal_datas(
124125
125126template <typename Tdata>
126127auto LRI_CV<Tdata>::cal_Vs(
128+ const UnitCell &ucell,
127129 const std::vector<TA> &list_A0,
128130 const std::vector<TAC> &list_A1,
129131 const std::map<std::string,bool > &flags) // + "writable_Vws"
@@ -134,11 +136,12 @@ auto LRI_CV<Tdata>::cal_Vs(
134136 func_DPcal_V = std::bind (
135137 &LRI_CV<Tdata>::DPcal_V, this ,
136138 std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4);
137- return this ->cal_datas (list_A0, list_A1, flags, this ->ccp_rmesh_times , func_DPcal_V);
139+ return this ->cal_datas (ucell, list_A0, list_A1, flags, this ->ccp_rmesh_times , func_DPcal_V);
138140}
139141
140142template <typename Tdata>
141143auto LRI_CV<Tdata>::cal_dVs(
144+ const UnitCell &ucell,
142145 const std::vector<TA> &list_A0,
143146 const std::vector<TAC> &list_A1,
144147 const std::map<std::string,bool > &flags) // + "writable_dVws"
@@ -150,11 +153,12 @@ auto LRI_CV<Tdata>::cal_dVs(
150153 &LRI_CV<Tdata>::DPcal_dV, this ,
151154 std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4);
152155 return LRI_CV_Tools::change_order (
153- this ->cal_datas (list_A0, list_A1, flags, this ->ccp_rmesh_times , func_DPcal_dV));
156+ this ->cal_datas (ucell, list_A0, list_A1, flags, this ->ccp_rmesh_times , func_DPcal_dV));
154157}
155158
156159template <typename Tdata>
157160auto LRI_CV<Tdata>::cal_Cs_dCs(
161+ const UnitCell &ucell,
158162 const std::vector<TA> &list_A0,
159163 const std::vector<TAC> &list_A1,
160164 const std::map<std::string,bool > &flags) // "cal_dC" + "writable_Cws", "writable_dCws", "writable_Vws", "writable_dVws"
@@ -166,7 +170,7 @@ auto LRI_CV<Tdata>::cal_Cs_dCs(
166170 &LRI_CV<Tdata>::DPcal_C_dC, this ,
167171 std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4);
168172 std::map<TA,std::map<TAC, std::pair<RI::Tensor<Tdata>, std::array<RI::Tensor<Tdata>,3 >>>>
169- Cs_dCs_tmp = this ->cal_datas (list_A0, list_A1, flags, std::min (1.0 ,this ->ccp_rmesh_times ), func_DPcal_C_dC);
173+ Cs_dCs_tmp = this ->cal_datas (ucell, list_A0, list_A1, flags, std::min (1.0 ,this ->ccp_rmesh_times ), func_DPcal_C_dC);
170174
171175 std::map<TA,std::map<TAC,RI::Tensor<Tdata>>> Cs;
172176 std::array<std::map<TA,std::map<TAC,RI::Tensor<Tdata>>>,3 > dCs;
0 commit comments