Skip to content

Commit c62a4d6

Browse files
committed
fix the R-index mismatch in lr_util_hcontainer
1 parent c03c879 commit c62a4d6

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

source/module_lr/utils/lr_util_hcontainer.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@ namespace LR_Util
2121
auto ap_real = dr_real->find_pair(ia, ja);
2222
for (int iR = 0;iR < ap->get_R_size();++iR)
2323
{
24+
// R index may be different between the two HContainers, find by R value instead of R-index
25+
auto dR = ap->get_R_index(iR);
2426
auto ptr = ap->get_HR_values(iR).get_pointer();
25-
auto ptr_real = ap_real->get_HR_values(iR).get_pointer();
27+
auto ptr_real = ap_real->get_HR_values(dR.x, dR.y, dR.z).get_pointer();
2628
for (int i = 0;i < ap->get_size();++i) ptr_real[i] = (get_imag ? ptr[i].imag() : ptr[i].real());
2729
}
2830
}
@@ -42,8 +44,10 @@ namespace LR_Util
4244
auto ap_real = HR_real.find_pair(ia, ja);
4345
for (int iR = 0;iR < ap->get_R_size();++iR)
4446
{
47+
// R index may be different between the two HContainers, find by R value instead of R-index
48+
auto dR = ap->get_R_index(iR);
4549
auto ptr = ap->get_HR_values(iR).get_pointer();
46-
auto ptr_real = ap_real->get_HR_values(iR).get_pointer();
50+
auto ptr_real = ap_real->get_HR_values(dR.x, dR.y, dR.z).get_pointer();
4751
for (int i = 0;i < ap->get_size();++i) get_imag ? ptr[i].imag(ptr_real[i]) : ptr[i].real(ptr_real[i]);
4852
}
4953
}

0 commit comments

Comments
 (0)