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
24 changes: 4 additions & 20 deletions SeQuant/domain/mbpt/spin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1222,24 +1222,6 @@ ExprPtr closed_shell_CC_spintrace(ExprPtr const& expr,
}
}

/// Collect all indices from an expression
container::set<Index, Index::LabelCompare> index_list(const ExprPtr& expr) {
container::set<Index, Index::LabelCompare> grand_idxlist;
if (expr->is<Tensor>()) {
ranges::for_each(expr->as<Tensor>().const_indices(),
[&grand_idxlist](const Index& idx) {
idx.reset_tag();
grand_idxlist.insert(idx);
});
}

for (const ExprPtr& subExpr : expr) {
grand_idxlist.merge(index_list(subExpr));
}

return grand_idxlist;
}

Tensor swap_spin(const Tensor& t) {
auto is_any_spin = [](const Index& i) {
return mbpt::to_spin(i.space().qns()) == mbpt::Spin::any;
Expand Down Expand Up @@ -1457,7 +1439,8 @@ std::vector<ExprPtr> open_shell_spintrace(
}

// Grand index list contains both internal and external indices
container::set<Index, Index::LabelCompare> grand_idxlist = index_list(expr);
container::set<Index, Index::LabelCompare> grand_idxlist =
get_used_indices<decltype(grand_idxlist)>(expr);

container::set<Index> ext_idxlist;
for (auto&& idxgrp : ext_index_groups) {
Expand Down Expand Up @@ -1766,7 +1749,8 @@ ExprPtr spintrace(
spinfree_index_spaces](const ProductPtr& product) {
ExprPtr expr = product->clone();
// List of all indices in the expression
container::set<Index, Index::LabelCompare> grand_idxlist = index_list(expr);
container::set<Index, Index::LabelCompare> grand_idxlist =
get_used_indices<decltype(grand_idxlist)>(expr);

// List of external indices, i.e. indices that are not summed over Einstein
// style (indices that are not repeated in an expression)
Expand Down
3 changes: 0 additions & 3 deletions SeQuant/domain/mbpt/spin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,9 +333,6 @@ ExprPtr closed_shell_CC_spintrace_v2(
ClosedShellCCSpintraceOptions options = {
.method = BiorthogonalizationMethod::V2, .naive_spintrace = false});

/// Collect all indices from an expression
container::set<Index, Index::LabelCompare> index_list(const ExprPtr& expr);

/// @brief Swap spin labels in a tensor
Tensor swap_spin(const Tensor& t);

Expand Down