Skip to content

Segfault in closed_shell_CC_spintrace #426

@obackhouse

Description

@obackhouse

I am trying to run the following

#include<SeQuant/core/context.hpp>
#include<SeQuant/core/op.hpp>
#include<SeQuant/domain/mbpt/convention.hpp>
#include<SeQuant/domain/mbpt/models/cc.hpp>
#include<SeQuant/domain/mbpt/spin.hpp>

using namespace sequant;
using namespace sequant::mbpt;

int main() {
    set_default_context({.index_space_registry_shared_ptr = make_min_sr_spaces(),
                         .vacuum = Vacuum::SingleProduct});

    auto t_eqs = CC{2}.t();
    auto t2_eq = t_eqs[2];
    auto t2_rhf = closed_shell_CC_spintrace(t2_eq);
    std::wcout << "T2 (RHF): " << to_latex(t2_rhf) << "\n";

    return 0;
}

but it is segfaulting seemingly in this call. If I change the build to Debug, it fails an assertion with

Assertion failed: (this->m_holder.m_size > n), function operator[], file vector.hpp, line 1742.

Compilation:

-- [range-v3]: C++ std=2a
-- std::variant uses shared storage: TRUE
-- PV_EXPLOIT_SHARED_STORAGE: ON
-- Fetching and building dependencies...
-- Done fetching dependencies
-- Skipping configuration of libPerm-specific LTO setup when built as a static library -> Global CMAKE_INTERPROCEDURAL_OPTIMIZATION takes effect.
-- Build spdlog: 1.15.3
-- Build type: Release
-- Using the multi-header code from /Users/oliver.backhouse/git/sequant/build/_deps/nlohmann_json-src/include/
-- Google Benchmark version: v1.9.4, normalized to 1.9.4
-- Enabling additional flags: -DINCLUDE_DIRECTORIES=/Users/oliver.backhouse/git/sequant/build/_deps/googlebenchmark-src/include
-- Performing Test HAVE_THREAD_SAFETY_ATTRIBUTES -- success
-- Performing Test HAVE_STD_REGEX -- success
-- Performing Test HAVE_GNU_POSIX_REGEX -- failed to compile
-- Performing Test HAVE_POSIX_REGEX -- success
-- Performing Test HAVE_STEADY_CLOCK -- success
-- Performing Test HAVE_PTHREAD_AFFINITY -- failed to compile
-- pybind11 v3.0.1 
-- === SeQuant Package/Feature Info ===
-- The following features have been enabled:

 * PYTHON, PySeQuant: Python bindings to SeQuant
 * SEQUANT_USE_SYSTEM_BOOST_HASH, SeQuant uses system Boost for hashing (thus results depend on the Boost version)
 * SEQUANT_CONTEXT_MANIPULATION_THREADSAFE, The default context can be changed from multiple threads
 * TESTS, Enable building of test cases

-- The following OPTIONAL packages have been found:

 * boost_charconv (required version == 1.89.0)
 * boost_atomic (required version == 1.89.0)
 * boost_chrono (required version == 1.89.0)
 * boost_container (required version == 1.89.0)
 * boost_date_time (required version == 1.89.0)
 * boost_exception (required version == 1.89.0)
 * boost_thread (required version == 1.89.0)
 * boost_locale (required version == 1.89.0)
 * boost_headers (required version == 1.89.0)
 * boost_regex (required version == 1.89.0)
 * Boost (required version >= 1.81)
 * Eigen3

-- The following REQUIRED packages have been found:

 * Threads
 * Python (required version >= 3)
 * Git

-- The following features have been disabled:

 * TBB, Intel Thread-Building Blocks is an optional prerequisite for C++'s parallel STL
 * EVAL_TESTS, Build evaluation tests (if true, will look for and/or build TiledArray)
 * BUILD_DOCS, Build SeQuant documentation. Doxygen and Sphinx are required.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions