Skip to content

Commit c778c00

Browse files
maki49kirk0830
andauthored
add annotation for inner_product
Co-authored-by: kirk0830 <[email protected]>
1 parent dcee5b3 commit c778c00

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

source/module_lr/esolver_lrtd_lcao.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,13 @@ void LR::ESolver_LR<T, TR>::set_dimension()
126126
if (input.ri_hartree_benchmark == "aims" && !input.aims_nbasis.empty())
127127
{
128128
this->nbasis = [&]() -> int { int nbas = 0; for (int it = 0;it < ucell.ntype;++it) { nbas += ucell.atoms[it].na * input.aims_nbasis[it]; };return nbas;}();
129-
this->nbasis = std::inner_product(input.aims_nbasis.begin(), input.aims_nbasis.end(), ucell.atoms, 0, std::plus<int>(), [](const int& a, const Atom& b) { return a * b.na; });
129+
// calculate total number of basis funcs, see https://en.cppreference.com/w/cpp/algorithm/inner_product
130+
this->nbasis = std::inner_product(input.aims_nbasis.begin(), /* iterator1.begin */
131+
input.aims_nbasis.end(), /* iterator1.end */
132+
ucell.atoms, /* iterator2.begin */
133+
0, /* init value */
134+
std::plus<int>(), /* iter op1 */
135+
[](const int& a, const Atom& b) { return a * b.na; }); /* iter op2 */
130136
std::cout << "nbasis from aims: " << this->nbasis << std::endl;
131137
}
132138
}

0 commit comments

Comments
 (0)