Skip to content

Commit 69bedd8

Browse files
maki49kirk0830
andcommitted
add annotation and minor changes
Co-authored-by: kirk0830 <[email protected]>
1 parent 1e0e434 commit 69bedd8

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
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
}

source/module_lr/potentials/pot_hxc_lrtd.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ namespace LR
3636
{
3737
const std::set<std::string> lda_xc = { "lda", "pwlda" };
3838
assert(lda_xc.count(this->xc_kernel_));
39-
const int n_component = (1 == nspin) ? 1 : 3;
39+
const int n_component = (1 == nspin) ? 1 : 3; // spin components of fxc: (uu, ud=du, dd) when nspin=2
4040
this->xc_kernel_components_.v2rho2.resize(n_component * nrxx);
4141
// read fxc adn add to xc_kernel_components
4242
assert(lr_init_xc_kernel.size() >= n_component + 1);

source/module_lr/potentials/xc_kernel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ void LR::KernelXC::f_xc_libxc(const int& nspin, const double& omega, const doubl
3737

3838
// -----------------------------------------------------------------------------------
3939
// for GGA
40-
const bool is_gga = std::any_of(funcs.begin(), funcs.end(), [](const xc_func_type& f)->bool { return f.info->family == XC_FAMILY_GGA || f.info->family == XC_FAMILY_HYB_GGA; });
40+
const bool is_gga = std::any_of(funcs.begin(), funcs.end(), [](const xc_func_type& f) { return f.info->family == XC_FAMILY_GGA || f.info->family == XC_FAMILY_HYB_GGA; });
4141

4242
std::vector<std::vector<ModuleBase::Vector3<double>>> gradrho; // \nabla \rho
4343
std::vector<double> sigma; // |\nabla\rho|^2

0 commit comments

Comments
 (0)