Skip to content

Commit

Permalink
refactored uncontract() function from basis.h.in to shell.h
Browse files Browse the repository at this point in the history
  • Loading branch information
kshitij-05 committed Nov 17, 2023
1 parent 6248c66 commit 26c0b4d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
19 changes: 0 additions & 19 deletions include/libint2/basis.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -85,25 +85,6 @@ namespace libint2 {
return l;
}

/// Computes uncontracted shells from a vector of shells
/// @param[in] cluster a vector of shells
/// @return a vector of uncontracted shells
std::vector<Shell> uncontract(
const std::vector<Shell> &cluster) {
std::vector<Shell> primitive_cluster;
for (const auto &contracted_shell: cluster) {
for (auto p = 0; p < contracted_shell.nprim(); p++) {
const auto prim_shell = contracted_shell.extract_primitive(p, true);
// if dealing with generally contracted basis (e.g., cc-pvxz) represented
// as a segmented basis need to remove duplicates
if (std::find(primitive_cluster.begin(), primitive_cluster.end(),
prim_shell) == primitive_cluster.end())
primitive_cluster.emplace_back(std::move(prim_shell));
}
}
return primitive_cluster;
}

/// BasisSet is a slightly decorated \c std::vector of \c libint2::Shell objects.
class BasisSet : private std::vector<libint2::Shell> {
public:
Expand Down
19 changes: 19 additions & 0 deletions include/libint2/shell.h
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,25 @@ namespace libint2 {
// clang-format on

namespace detail {
/// Computes uncontracted shells from a vector of shells
/// @param[in] cluster a vector of shells
/// @return a vector of uncontracted shells
std::vector <Shell> uncontract(
const std::vector <Shell> &cluster) {
std::vector <Shell> primitive_cluster;
for (const auto &contracted_shell: cluster) {
for (auto p = 0; p < contracted_shell.nprim(); p++) {
const auto prim_shell = contracted_shell.extract_primitive(p, true);
// if dealing with generally contracted basis (e.g., cc-pvxz) represented
// as a segmented basis need to remove duplicates
if (std::find(primitive_cluster.begin(), primitive_cluster.end(),
prim_shell) == primitive_cluster.end())
primitive_cluster.emplace_back(std::move(prim_shell));
}
}
return primitive_cluster;
}

inline ScreeningMethod& default_screening_method_accessor() {
static ScreeningMethod default_screening_method = ScreeningMethod::Original;
return default_screening_method;
Expand Down

0 comments on commit 26c0b4d

Please sign in to comment.