Skip to content

Commit

Permalink
Added screening of amos at each iteration
Browse files Browse the repository at this point in the history
  • Loading branch information
“hborchert” committed Aug 7, 2024
1 parent 48e8ab0 commit 9334e01
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/madness/chem/SCF.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2136,6 +2136,13 @@ void SCF::solve(World& world) {
vnuc = potentialmanager->vnuclear();
vnuc = vnuc + gthpseudopotential->vlocalpot();
}

// screen functions (amo) here
for (int i = 0; i < amo.size(); ++i) {
screen(amo[i], vtol, false);
}
world.gop.fence();

double enuclear = inner(rho, vnuc);
END_TIMER(world, "Nuclear energy");

Expand Down
12 changes: 12 additions & 0 deletions src/madness/mra/mra.h
Original file line number Diff line number Diff line change
Expand Up @@ -2724,6 +2724,18 @@ namespace madness {
return unary_op(z, detail::absop<NDIM>(), fence);
}

// screen nodes with small coeffs to zero
template <typename T, size_t NDIM>
void screen(Function<T, NDIM>& f, const double eps, bool fence=true) {
double eps1=eps;
auto op = [&eps1](const Key<NDIM>& key, Tensor<T>& coeff) {
if (coeff.normf() < eps1) {
coeff = T(0);
}
};
f.get_impl()->unary_op_coeff_inplace(op, fence);
}

}

#include <madness/mra/funcplot.h>
Expand Down

0 comments on commit 9334e01

Please sign in to comment.