99#include " LRI_Cal_Aux.h"
1010#include " ../global/Array_Operator.h"
1111#include " ../global/Tensor_Multiply.h"
12-
12+ # include " ../symmetry/Symmetry_Filter.h "
1313#include < omp.h>
1414#ifdef __MKL_RI
1515#include < mkl_service.h>
@@ -22,8 +22,10 @@ template<typename TA, typename Tcell, std::size_t Ndim, typename Tdata>
2222void LRI<TA,Tcell,Ndim,Tdata>::cal_loop3(
2323 const std::vector<Label::ab_ab> &labels,
2424 std::map<TA, std::map<TAC, Tensor<Tdata>>> &Ds_result,
25- const double fac_add_Ds)
25+ const double fac_add_Ds,
26+ const std::map<std::pair<TA, TA>, std::set<TC>>& irreducible_sector)
2627{
28+ std::cout << " using loop3 LibRI" << std::endl;
2729 using namespace Array_Operator ;
2830
2931 const Data_Pack_Wrapper<TA,TC,Tdata> data_wrapper (this ->data_pool , this ->data_ab_name );
@@ -70,6 +72,8 @@ void LRI<TA,Tcell,Ndim,Tdata>::cal_loop3(
7072 ? LRI_Cal_Aux::cal_Ds_transpose ( data_wrapper (Label::ab::b).Ds_ab )
7173 : std::map<TA, std::map<TAC, Tensor<Tdata>>>{};
7274
75+ Symmetry_Filter<TA, Tcell, Ndim, Tdata> symmetry_filter (this ->period , irreducible_sector);
76+
7377 omp_lock_t lock_Ds_result_add;
7478 omp_init_lock (&lock_Ds_result_add);
7579
@@ -110,7 +114,9 @@ void LRI<TA,Tcell,Ndim,Tdata>::cal_loop3(
110114
111115 for (const TAC &Aa2 : list_Aa2)
112116 {
113- std::map<TAC,Tensor<Tdata>> Ds_result_fixed;
117+ if (!symmetry_filter.is_I_in_irreducible_sector (Aa2.first )) continue ;
118+
119+ std::map<TAC, Tensor<Tdata>> Ds_result_fixed;
114120
115121 #pragma omp for schedule(dynamic) nowait
116122 for (std::size_t ib01=0 ; ib01<list_Ab01.size (); ++ib01)
@@ -138,6 +144,9 @@ void LRI<TA,Tcell,Ndim,Tdata>::cal_loop3(
138144 // D_result = D_mul * D_b
139145 for (const TAC &Ab2 : list_Ab2)
140146 {
147+ // if ((Ab2-Aa2) exceeds the irreducible sector) continue (known Ab01)
148+ if (!symmetry_filter.in_irreducible_sector (Aa2, Ab2)) continue ;
149+
141150 const Tensor<Tdata> D_b = tools.get_Ds_ab (Label::ab::b, Ab01, Ab2);
142151 if (D_b.empty ()) continue ;
143152 // a2b2 = a2b0b1 * b0b1b2
@@ -232,7 +241,9 @@ void LRI<TA,Tcell,Ndim,Tdata>::cal_loop3(
232241
233242 for (const TAC &Ab01 : list_Ab01)
234243 {
235- std::map<TAC,Tensor<Tdata>> Ds_result_fixed;
244+ if (!symmetry_filter.is_J_in_irreducible_sector (Ab01.first )) continue ;
245+
246+ std::map<TAC, Tensor<Tdata>> Ds_result_fixed;
236247
237248 #pragma omp for schedule(dynamic) nowait
238249 for (std::size_t ia01=0 ; ia01<list_Aa01.size (); ++ia01)
@@ -258,7 +269,10 @@ void LRI<TA,Tcell,Ndim,Tdata>::cal_loop3(
258269 // D_result = D_mul * D_a * D_a0b0
259270 for (const TAC &Aa2 : list_Aa2)
260271 {
261- const Tensor<Tdata> &D_a_transpose = Global_Func::find (Ds_a_transpose, Aa01, Aa2);
272+ // if ((Ab01-Aa2) exceeds the irreducible sector) continue
273+ if (!symmetry_filter.in_irreducible_sector (Aa2, Ab01)) continue ;
274+
275+ const Tensor<Tdata>& D_a_transpose = Global_Func::find (Ds_a_transpose, Aa01, Aa2);
262276 if (D_a_transpose.empty ()) continue ;
263277 // b1a1a0 = b0b1a1 * a0b0
264278 const Tensor<Tdata> D_tmp2 = Tensor_Multiply::x1x2y0_ax1x2_y0a (D_mul, D_a0b0);
@@ -474,7 +488,9 @@ void LRI<TA,Tcell,Ndim,Tdata>::cal_loop3(
474488
475489 for (const TA &Aa01 : list_Aa01)
476490 {
477- std::map<TAC,Tensor<Tdata>> Ds_result_fixed;
491+ if (!symmetry_filter.is_I_in_irreducible_sector (Aa01)) continue ;
492+
493+ std::map<TAC, Tensor<Tdata>> Ds_result_fixed;
478494
479495 #pragma omp for schedule(dynamic) nowait
480496 for (std::size_t ib01=0 ; ib01<list_Ab01.size (); ++ib01)
@@ -500,8 +516,11 @@ void LRI<TA,Tcell,Ndim,Tdata>::cal_loop3(
500516 // D_result = D_mul * D_a0b0 * D_b
501517 for (const TAC &Ab2 : list_Ab2)
502518 {
519+ // if ((Ab2-Aa01) exceeds the irreducible sector) continue
520+ if (!symmetry_filter.in_irreducible_sector (Aa01, Ab2)) continue ;
521+
503522 const Tensor<Tdata> &D_b = tools.get_Ds_ab (Label::ab::b, Ab01, Ab2);
504- if (D_b.empty ()) continue ;
523+ if (D_b.empty ()) continue ;
505524
506525 // b0b1a1 = a0b0 * b1a1a0
507526 const Tensor<Tdata> D_tmp2 = Tensor_Multiply::x1y0y1_ax1_y0y1a (D_a0b0, D_mul);
@@ -720,7 +739,9 @@ void LRI<TA,Tcell,Ndim,Tdata>::cal_loop3(
720739
721740 for (const TA &Aa01 : list_Aa01)
722741 {
723- std::map<TAC,Tensor<Tdata>> Ds_result_fixed;
742+ if (!symmetry_filter.is_I_in_irreducible_sector (Aa01)) continue ;
743+
744+ std::map<TAC, Tensor<Tdata>> Ds_result_fixed;
724745
725746 #pragma omp for schedule(dynamic) nowait
726747 for (std::size_t ib2=0 ; ib2<list_Ab2.size (); ++ib2)
@@ -744,7 +765,10 @@ void LRI<TA,Tcell,Ndim,Tdata>::cal_loop3(
744765 // D_result = D_mul * D_a0b0 * D_b
745766 for (const TAC &Ab01 : list_Ab01)
746767 {
747- const Tensor<Tdata> &D_b_transpose = Global_Func::find (Ds_b_transpose, Ab01.first , TAC{Ab2.first , (Ab2.second -Ab01.second )%this ->period });
768+ // if ((Ab01-Aa01) exceeds the irreducible sector) continu
769+ if (!symmetry_filter.in_irreducible_sector (Aa01, Ab01)) continue ;
770+
771+ const Tensor<Tdata>& D_b_transpose = Global_Func::find (Ds_b_transpose, Ab01.first , TAC{ Ab2.first , (Ab2.second - Ab01.second ) % this ->period });
748772 if (D_b_transpose.empty ()) continue ;
749773 const Tensor<Tdata> D_a0b0 = tools.get_Ds_ab (Label::ab::a0b0, Aa01, Ab01);
750774 if (D_a0b0.empty ()) continue ;
0 commit comments