From 769a39d7e8aae23391785ea96a6cd4e311661a9d Mon Sep 17 00:00:00 2001 From: Robert Adam Date: Wed, 4 Feb 2026 09:52:51 +0100 Subject: [PATCH] Remove redundant index_list function --- SeQuant/domain/mbpt/spin.cpp | 24 ++++-------------------- SeQuant/domain/mbpt/spin.hpp | 3 --- 2 files changed, 4 insertions(+), 23 deletions(-) diff --git a/SeQuant/domain/mbpt/spin.cpp b/SeQuant/domain/mbpt/spin.cpp index eda1aa7534..dd72d0c3ef 100644 --- a/SeQuant/domain/mbpt/spin.cpp +++ b/SeQuant/domain/mbpt/spin.cpp @@ -1222,24 +1222,6 @@ ExprPtr closed_shell_CC_spintrace(ExprPtr const& expr, } } -/// Collect all indices from an expression -container::set index_list(const ExprPtr& expr) { - container::set grand_idxlist; - if (expr->is()) { - ranges::for_each(expr->as().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; @@ -1457,7 +1439,8 @@ std::vector open_shell_spintrace( } // Grand index list contains both internal and external indices - container::set grand_idxlist = index_list(expr); + container::set grand_idxlist = + get_used_indices(expr); container::set ext_idxlist; for (auto&& idxgrp : ext_index_groups) { @@ -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 grand_idxlist = index_list(expr); + container::set grand_idxlist = + get_used_indices(expr); // List of external indices, i.e. indices that are not summed over Einstein // style (indices that are not repeated in an expression) diff --git a/SeQuant/domain/mbpt/spin.hpp b/SeQuant/domain/mbpt/spin.hpp index a8265cbf73..c1ffae321c 100644 --- a/SeQuant/domain/mbpt/spin.hpp +++ b/SeQuant/domain/mbpt/spin.hpp @@ -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_list(const ExprPtr& expr); - /// @brief Swap spin labels in a tensor Tensor swap_spin(const Tensor& t);