@@ -21,7 +21,7 @@ void Matrix_Orbs21::init(const int mode,
2121
2222 const int ntype = orb.get_ntype ();
2323 int lmax_orb = -1 , lmax_beta = -1 ;
24- this ->lat0 = ucell.lat0 ;
24+ this ->lat0 = & ucell.lat0 ;
2525 for (int it = 0 ; it < ntype; it++)
2626 {
2727 lmax_orb = std::max (lmax_orb, orb.Phi [it].getLmax ());
@@ -62,29 +62,37 @@ void Matrix_Orbs21::init_radial(const std::vector<std::vector<std::vector<Numeri
6262 ModuleBase::TITLE (" Matrix_Orbs21" , " init_radial" );
6363 ModuleBase::timer::tick (" Matrix_Orbs21" , " init_radial" );
6464 assert (orb_A1.size () == orb_A2.size ());
65- for (size_t TA = 0 ; TA != orb_A1.size (); ++TA) {
66- for (size_t TB = 0 ; TB != orb_B.size (); ++TB) {
67- for (int LA1 = 0 ; LA1 != orb_A1[TA].size (); ++LA1) {
68- for (size_t NA1 = 0 ; NA1 != orb_A1[TA][LA1].size (); ++NA1) {
69- for (int LA2 = 0 ; LA2 != orb_A2[TA].size (); ++LA2) {
70- for (size_t NA2 = 0 ; NA2 != orb_A2[TA][LA2].size (); ++NA2) {
71- for (int LB = 0 ; LB != orb_B[TB].size (); ++LB) {
72- for (size_t NB = 0 ; NB != orb_B[TB][LB].size (); ++NB) {
65+ for (size_t TA = 0 ; TA != orb_A1.size (); ++TA)
66+ {
67+ for (size_t TB = 0 ; TB != orb_B.size (); ++TB)
68+ {
69+ for (int LA1 = 0 ; LA1 != orb_A1[TA].size (); ++LA1)
70+ {
71+ for (size_t NA1 = 0 ; NA1 != orb_A1[TA][LA1].size (); ++NA1)
72+ {
73+ for (int LA2 = 0 ; LA2 != orb_A2[TA].size (); ++LA2)
74+ {
75+ for (size_t NA2 = 0 ; NA2 != orb_A2[TA][LA2].size (); ++NA2)
76+ {
77+ for (int LB = 0 ; LB != orb_B[TB].size (); ++LB)
78+ {
79+ for (size_t NB = 0 ; NB != orb_B[TB][LB].size (); ++NB)
80+ {
7381 center2_orb21_s[TA][TB][LA1][NA1][LA2][NA2][LB].insert (
7482 std::make_pair (NB,
7583 Center2_Orb::Orb21 (orb_A1[TA][LA1][NA1],
7684 orb_A2[TA][LA2][NA2],
7785 orb_B[TB][LB][NB],
7886 psb_,
79- this ->MGT )));
80- }
81- }
82- }
83- }
84- }
85- }
86- }
87- }
87+ this ->MGT )));
88+ }
89+ }
90+ }
91+ }
92+ }
93+ }
94+ }
95+ }
8896 ModuleBase::timer::tick (" Matrix_Orbs21" , " init_radial" );
8997}
9098
@@ -95,60 +103,77 @@ void Matrix_Orbs21::init_radial(const std::vector<std::vector<std::vector<Numeri
95103 ModuleBase::TITLE (" Matrix_Orbs21" , " init_radial" );
96104 ModuleBase::timer::tick (" Matrix_Orbs21" , " init_radial" );
97105 assert (orb_A1.size () == orb_A2.get_ntype ());
98- for (size_t TA = 0 ; TA != orb_A1.size (); ++TA) {
99- for (size_t TB = 0 ; TB != orb_B.get_ntype (); ++TB) {
100- for (int LA1 = 0 ; LA1 != orb_A1[TA].size (); ++LA1) {
101- for (size_t NA1 = 0 ; NA1 != orb_A1[TA][LA1].size (); ++NA1) {
102- for (int LA2 = 0 ; LA2 <= orb_A2.Phi [TA].getLmax (); ++LA2) {
103- for (size_t NA2 = 0 ; NA2 != orb_A2.Phi [TA].getNchi (LA2); ++NA2) {
104- for (int LB = 0 ; LB <= orb_B.Phi [TB].getLmax (); ++LB) {
105- for (size_t NB = 0 ; NB != orb_B.Phi [TB].getNchi (LB); ++NB) {
106+ for (size_t TA = 0 ; TA != orb_A1.size (); ++TA)
107+ {
108+ for (size_t TB = 0 ; TB != orb_B.get_ntype (); ++TB)
109+ {
110+ for (int LA1 = 0 ; LA1 != orb_A1[TA].size (); ++LA1)
111+ {
112+ for (size_t NA1 = 0 ; NA1 != orb_A1[TA][LA1].size (); ++NA1)
113+ {
114+ for (int LA2 = 0 ; LA2 <= orb_A2.Phi [TA].getLmax (); ++LA2)
115+ {
116+ for (size_t NA2 = 0 ; NA2 != orb_A2.Phi [TA].getNchi (LA2); ++NA2)
117+ {
118+ for (int LB = 0 ; LB <= orb_B.Phi [TB].getLmax (); ++LB)
119+ {
120+ for (size_t NB = 0 ; NB != orb_B.Phi [TB].getNchi (LB); ++NB)
121+ {
106122 center2_orb21_s[TA][TB][LA1][NA1][LA2][NA2][LB].insert (
107123 std::make_pair (NB,
108124 Center2_Orb::Orb21 (orb_A1[TA][LA1][NA1],
109125 orb_A2.Phi [TA].PhiLN (LA2, NA2),
110126 orb_B.Phi [TB].PhiLN (LB, NB),
111127 psb_,
112- this ->MGT )));
113- }
114- }
115- }
116- }
117- }
118- }
119- }
120- }
128+ this ->MGT )));
129+ }
130+ }
131+ }
132+ }
133+ }
134+ }
135+ }
136+ }
121137 ModuleBase::timer::tick (" Matrix_Orbs21" , " init_radial" );
122138}
123139
124140void Matrix_Orbs21::init_radial_table ()
125141{
126142 ModuleBase::TITLE (" Matrix_Orbs21" , " init_radial" );
127143 ModuleBase::timer::tick (" Matrix_Orbs21" , " init_radial_table" );
128- for (auto & coA: center2_orb21_s) {
129- for (auto & coB: coA.second ) {
130- for (auto & coC: coB.second ) {
131- for (auto & coD: coC.second ) {
132- for (auto & coE: coD.second ) {
133- for (auto & coF: coE.second ) {
134- for (auto & coG: coF.second ) {
135- for (auto & coH: coG.second ) {
136- coH.second .init_radial_table ();
137- }
138- }
139- }
140- }
141- }
142- }
143- }
144- }
144+ for (auto & coA: center2_orb21_s)
145+ {
146+ for (auto & coB: coA.second )
147+ {
148+ for (auto & coC: coB.second )
149+ {
150+ for (auto & coD: coC.second )
151+ {
152+ for (auto & coE: coD.second )
153+ {
154+ for (auto & coF: coE.second )
155+ {
156+ for (auto & coG: coF.second )
157+ {
158+ for (auto & coH: coG.second )
159+ {
160+ coH.second .init_radial_table ();
161+ }
162+ }
163+ }
164+ }
165+ }
166+ }
167+ }
168+ }
145169 ModuleBase::timer::tick (" Matrix_Orbs21" , " init_radial_table" );
146170}
147171
148172void Matrix_Orbs21::init_radial_table (const std::map<size_t , std::map<size_t , std::set<double >>>& Rs)
149173{
150174 ModuleBase::TITLE (" Matrix_Orbs21" , " init_radial_table_Rs" );
151175 ModuleBase::timer::tick (" Matrix_Orbs21" , " init_radial_table" );
176+ const double lat0 = *this ->lat0 ;
152177 for (const auto & RsA: Rs) {
153178 for (const auto & RsB: RsA.second )
154179 {
@@ -164,25 +189,32 @@ void Matrix_Orbs21::init_radial_table(const std::map<size_t, std::map<size_t, st
164189 {
165190 const double position = R * lat0 / lcao_dr_;
166191 const size_t iq = static_cast <size_t >(position);
167- for (size_t i = 0 ; i != 4 ; ++i) {
168- radials.insert (iq + i);
169- }
192+ for (size_t i = 0 ; i != 4 ; ++i)
193+ {
194+ radials.insert (iq + i);
195+ }
196+ }
197+ for (auto & coC: *center2_orb21_sAB)
198+ {
199+ for (auto & coD: coC.second )
200+ {
201+ for (auto & coE: coD.second )
202+ {
203+ for (auto & coF: coE.second )
204+ {
205+ for (auto & coG: coF.second )
206+ {
207+ for (auto & coH: coG.second )
208+ {
209+ coH.second .init_radial_table (radials);
210+ }
211+ }
212+ }
213+ }
214+ }
170215 }
171- for (auto & coC: *center2_orb21_sAB) {
172- for (auto & coD: coC.second ) {
173- for (auto & coE: coD.second ) {
174- for (auto & coF: coE.second ) {
175- for (auto & coG: coF.second ) {
176- for (auto & coH: coG.second ) {
177- coH.second .init_radial_table (radials);
178- }
179- }
180- }
181- }
182- }
183- }
184216 }
185- }
186- }
217+ }
218+ }
187219 ModuleBase::timer::tick (" Matrix_Orbs21" , " init_radial_table" );
188220}
0 commit comments