Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions source/module_lr/utils/lr_util_hcontainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,21 @@ namespace LR_Util
auto dr_real = DMR_real.get_DMR_vector()[is];
assert(dr != nullptr);
assert(dr_real != nullptr);
for (int ia = 0;ia < nat;ia++)
for (int ia = 0;ia < nat;ia++) {
for (int ja = 0;ja < nat;ja++)
{
auto ap = dr->find_pair(ia, ja);
auto ap_real = dr_real->find_pair(ia, ja);
for (int iR = 0;iR < ap->get_R_size();++iR)
{
// R index may be different between the two HContainers, find by R value instead of R-index
auto dR = ap->get_R_index(iR);
auto ptr = ap->get_HR_values(iR).get_pointer();
auto ptr_real = ap_real->get_HR_values(iR).get_pointer();
for (int i = 0;i < ap->get_size();++i) ptr_real[i] = (get_imag ? ptr[i].imag() : ptr[i].real());
auto ptr_real = ap_real->get_HR_values(dR.x, dR.y, dR.z).get_pointer();
for (int i = 0;i < ap->get_size();++i) { ptr_real[i] = (get_imag ? ptr[i].imag() : ptr[i].real()); }
}
}
}
}
}

Expand All @@ -35,17 +38,20 @@ namespace LR_Util
const char& type)
{
bool get_imag = (type == 'I' || type == 'i');
for (int ia = 0;ia < nat;ia++)
for (int ia = 0;ia < nat;ia++) {
for (int ja = 0;ja < nat;ja++)
{
auto ap = HR.find_pair(ia, ja);
auto ap_real = HR_real.find_pair(ia, ja);
for (int iR = 0;iR < ap->get_R_size();++iR)
{
// R index may be different between the two HContainers, find by R value instead of R-index
auto dR = ap->get_R_index(iR);
auto ptr = ap->get_HR_values(iR).get_pointer();
auto ptr_real = ap_real->get_HR_values(iR).get_pointer();
for (int i = 0;i < ap->get_size();++i) get_imag ? ptr[i].imag(ptr_real[i]) : ptr[i].real(ptr_real[i]);
auto ptr_real = ap_real->get_HR_values(dR.x, dR.y, dR.z).get_pointer();
for (int i = 0;i < ap->get_size();++i) { get_imag ? ptr[i].imag(ptr_real[i]) : ptr[i].real(ptr_real[i]); }
}
}
}
}
}
2 changes: 1 addition & 1 deletion tests/integrate/291_NO_KP_LR/result.ref
Original file line number Diff line number Diff line change
@@ -1 +1 @@
totexcitationenergyref 0.784963
totexcitationenergyref 0.784471
Loading