Skip to content

Commit c267b74

Browse files
committed
1. fix bug in LRI::cal_loop3() case a1b2_a2b1
1 parent b9d7391 commit c267b74

File tree

12 files changed

+30
-28
lines changed

12 files changed

+30
-28
lines changed

include/RI/distribute/Split_Processes.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,11 @@ namespace Split_Processes
6969
const std::size_t rank_size = static_cast<std::size_t>(MPI_Wrapper::mpi_get_size(mc));
7070
const std::size_t task_product = std::accumulate(
7171
task_sizes.begin(), task_sizes.end(), std::size_t(1), std::multiplies<std::size_t>() ); // double for numerical range
72-
const double num_average =
72+
const double num_average =
7373
task_product < rank_size
7474
? 1.0 // if task_product<rank_size, then num_average<1, then group_size>task_sizes[0]. Set group_size=task_sizes[0]
7575
: std::pow(static_cast<double>(task_product)/rank_size, 1.0/task_sizes.size());
76-
const std::size_t group_size =
76+
const std::size_t group_size =
7777
task_sizes[0] < num_average
7878
? 1 // if task_sizes[0]<<task_sizes[1:], then group_size<0.5. Set group_size=1
7979
: static_cast<std::size_t>(std::round(task_sizes[0]/num_average));

include/RI/parallel/Parallel_LRI_Equally.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ void Parallel_LRI_Equally<TA,Tcell,Ndim,Tdata>::set_parallel_loop3(
6868
atoms.b2 = atoms_period_vec;
6969
switch(label)
7070
{
71-
case Label::Aab_Aab::a01b01_a01b01:
71+
case Label::Aab_Aab::a01b01_a01b01:
7272
atoms.a2 = atoms_split_list2[0];
7373
atoms.b01 = atoms_split_list2[1];
7474
break;
@@ -89,7 +89,7 @@ void Parallel_LRI_Equally<TA,Tcell,Ndim,Tdata>::set_parallel_loop3(
8989
atoms.b01 = atoms_split_list1.second[0];
9090
break;
9191
default:
92-
throw std::invalid_argument(std::string(__FILE__)+" line "+std::to_string(__LINE__));
92+
throw std::invalid_argument(std::string(__FILE__)+" line "+std::to_string(__LINE__));
9393
}
9494
}
9595
}
@@ -175,7 +175,7 @@ auto Parallel_LRI_Equally<TA,Tcell,Ndim,Tdata>::comm_tensors_map2(
175175
if(flags[3]) std::get<0>(s_list).push_back(std::make_tuple( Global_Func::to_set(this->list_Aa01), Global_Func::to_set(this->list_Ab2) ));
176176
if(flags[4]) std::get<1>(s_list).push_back(std::make_tuple( Global_Func::to_set(this->list_Aa2), Global_Func::to_set(this->list_Ab01) ));
177177
if(flags[5]) std::get<1>(s_list).push_back(std::make_tuple( Global_Func::to_set(this->list_Aa2), Global_Func::to_set(this->list_Ab2) ));
178-
178+
179179
return Communicate_Tensors_Map_Judge::comm_map2_combine_origin_period(this->mpi_comm, Ds, s_list, this->period);
180180
}
181181

include/RI/physics/Exx.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ class Exx
9393
MPI_Comm mpi_comm;
9494
std::map<TA,Tatom_pos> atoms_pos;
9595
std::array<Tatom_pos,Ndim> latvec;
96-
std::array<Tcell,Ndim> period;
96+
std::array<Tcell,Ndim> period;
9797
};
9898

9999
}

include/RI/physics/GW.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class G0W0
6161
MPI_Comm mpi_comm;
6262
std::map<TA,Tatom_pos> atoms_pos;
6363
std::array<Tatom_pos,Ndim> latvec;
64-
std::array<Tcell,Ndim> period;
64+
std::array<Tcell,Ndim> period;
6565
};
6666

6767
}

include/RI/ri/CS_Matrix_Tools.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ namespace CS_Matrix_Tools
133133
uplimits[i2] = D_sub.norm(2);
134134
}
135135
return uplimits.max();
136-
};
136+
};
137137

138138
auto norm = [](const Tensor<Tdata> &D) -> Tlim
139139
{

include/RI/ri/Cell_Nearest.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class Cell_Nearest
1717
public:
1818
using Tatom_pos = std::array<Tpos,Npos>; // tmp
1919
using TC = std::array<Tcell,Ndim>;
20-
20+
2121
void init(
2222
const std::map<TA,Tatom_pos> &atoms_pos,
2323
const std::array<Tatom_pos,Ndim> &latvec_in,

include/RI/ri/Cell_Nearest.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ template<typename TA, typename Tcell, std::size_t Ndim, typename Tpos, std::size
2020
void Cell_Nearest<TA,Tcell,Ndim,Tpos,Npos>::init(
2121
const std::map<TA,Tatom_pos> &atoms_pos,
2222
const std::array<Tatom_pos,Ndim> &latvec_in,
23-
const std::array<Tcell,Ndim> &period_in)
23+
const std::array<Tcell,Ndim> &period_in)
2424
{
2525
using namespace Array_Operator;
2626
this->period = period_in;
27-
27+
2828
Tensor<Tpos> latvec({Ndim, Npos});
2929
for(std::size_t idim=0; idim<Ndim; ++idim)
3030
for(std::size_t ipos=0; ipos<Npos; ++ipos)

include/RI/ri/LRI-cal_loop3.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ void LRI<TA,Tcell,Ndim,Tdata>::cal_loop3(
384384
Ds_result_thread[0][Aa01]);
385385
LRI_Cal_Aux::add_Ds_omp_try(std::move(Ds_result_thread), Ds_result, lock_Ds_result_add, fac_add_Ds);
386386
} // end for Aa01
387-
} break; // end case a0b0_a2b2
387+
} break; // end case a1b1_a2b2
388388

389389
case Label::ab_ab::a1b2_a2b1:
390390
{
@@ -438,7 +438,9 @@ void LRI<TA,Tcell,Ndim,Tdata>::cal_loop3(
438438

439439
// D_result = D_mul2 * D_mul1
440440
// a0b0 = b1a1a0 * b0b1a1
441-
Ds_result_thread[0][Aa01][Ab01] = Tensor_Multiply::x2y0_abx2_y0ab(D_mul2, D_mul1);
441+
Tensor<Tdata> D_mul3 = Tensor_Multiply::x2y0_abx2_y0ab(D_mul2, D_mul1);
442+
LRI_Cal_Aux::add_Ds( std::move(D_mul3),
443+
Ds_result_thread[0][Aa01][Ab01]);
442444
} // end for Aa01
443445

444446
LRI_Cal_Aux::add_Ds_omp_try(std::move(Ds_result_thread), Ds_result, lock_Ds_result_add, fac_add_Ds);

include/RI/ri/LRI_Cal_Aux.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ namespace LRI_Cal_Aux
6868

6969
template<typename Tdata>
7070
inline void add_Ds(
71-
Tensor<Tdata> &&D_add,
72-
Tensor<Tdata> &D_result,
71+
Tensor<Tdata> &&D_add,
72+
Tensor<Tdata> &D_result,
7373
const double fac = 1.0)
7474
{
7575
if(D_result.empty())
@@ -221,8 +221,8 @@ namespace LRI_Cal_Aux
221221

222222
template<typename TA, typename TAC, typename Tdata>
223223
void add_Ds_omp_try(
224-
std::vector<std::map<TA, std::map<TAC, Tensor<Tdata>>>> &&Ds_result_thread,
225-
std::vector<std::map<TA, std::map<TAC, Tensor<Tdata>>>> &Ds_result,
224+
std::vector<std::map<TA, std::map<TAC, Tensor<Tdata>>>> &&Ds_result_thread,
225+
std::vector<std::map<TA, std::map<TAC, Tensor<Tdata>>>> &Ds_result,
226226
omp_lock_t &lock_Ds_result_add,
227227
const double &fac)
228228
{
@@ -235,13 +235,13 @@ namespace LRI_Cal_Aux
235235
}
236236
}
237237

238-
template<typename TA, typename TAC, typename Tdata>
238+
template<typename TA, typename TAC, typename Tdata>
239239
void add_Ds_omp_wait(
240-
std::vector<std::map<TA, std::map<TAC, Tensor<Tdata>>>> &&Ds_result_thread,
241-
std::vector<std::map<TA, std::map<TAC, Tensor<Tdata>>>> &Ds_result,
240+
std::vector<std::map<TA, std::map<TAC, Tensor<Tdata>>>> &&Ds_result_thread,
241+
std::vector<std::map<TA, std::map<TAC, Tensor<Tdata>>>> &Ds_result,
242242
omp_lock_t &lock_Ds_result_add,
243243
const double &fac)
244-
{
244+
{
245245
if(!LRI_Cal_Aux::judge_Ds_empty(Ds_result_thread))
246246
{
247247
omp_set_lock(&lock_Ds_result_add);

include/RI/ri/LRI_Cal_Tools.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class LRI_Cal_Tools
2929
LRI_Cal_Tools(
3030
const TC &period_in,
3131
const std::map<std::string, Data_Pack<TA,TC,Tdata>> &data_pool,
32-
const std::unordered_map<Label::ab, std::string> &data_ab_name,
32+
const std::unordered_map<Label::ab, std::string> &data_ab_name,
3333
std::vector<std::map<TA, std::map<TAC, Tensor<Tdata>>>> &Ds_result_in)
3434
:period(period_in), Ds_result(Ds_result_in)
3535
{
@@ -126,7 +126,7 @@ class LRI_Cal_Tools
126126
labels_filter.push_back(label);
127127
}
128128
return labels_filter;
129-
}
129+
}
130130

131131
public: // private:
132132
const TC &period;

0 commit comments

Comments
 (0)