Namespace qdk::chemistry::algorithms::detail

namespace detail

Functions

std::vector<size_t> _get_inactive_space_indices(size_t nelec, const std::vector<size_t> &active_space_indices)

Helper function to determine inactive space indices for restricted orbitals.

Parameters:
  • nelec – Number of electrons

  • active_space_indices – Active space orbital indices

Returns:

Vector of inactive space orbital indices

std::pair<std::vector<size_t>, std::vector<size_t>> _get_inactive_space_indices(size_t nelec_a, size_t nelec_b, const std::vector<size_t> &active_space_indices_a, const std::vector<size_t> &active_space_indices_b)

Helper function to determine inactive space indices for unrestricted orbitals.

Parameters:
  • nelec_a – Number of alpha electrons

  • nelec_b – Number of beta electrons

  • active_space_indices_a – Alpha active space orbital indices

  • active_space_indices_b – Beta active space orbital indices

Returns:

Pair of vectors containing (alpha_inactive_space_indices, beta_inactive_space_indices)

std::tuple<double, std::vector<size_t>, Eigen::VectorXd> _sort_entropies_and_indices(std::shared_ptr<data::Wavefunction> wavefunction, bool normalize_entropies)

Helper function to sort entropies and their corresponding orbital indices in descending order.

Parameters:
  • wavefunction – The wavefunction containing orbital entropies and indices.

  • normalize_entropies – If true, normalize entropies by the maximum entropy value.

Throws:

std::runtime_error – if the wavefunction does not have single orbital entropies.

Returns:

A pair containing a vector of sorted orbital indices and a vector of sorted entropies.

bool is_aufbau_determinant_wavefunction(std::shared_ptr<data::Wavefunction> wavefunction)

Check whether a wavefunction is exactly the Aufbau determinant.

An Aufbau determinant wavefunction contains a single determinant with the canonical Aufbau occupation implied by its electron counts.

Parameters:

wavefunction – The wavefunction to check.

Returns:

True if the wavefunction is exactly the Aufbau determinant.

std::shared_ptr<data::Wavefunction> new_aufbau_determinant_wavefunction(std::shared_ptr<data::Wavefunction> wavefunction, std::shared_ptr<data::Orbitals> new_orbitals, std::optional<data::ContainerTypes::MatrixVariant> one_rdm_spin_traced = std::nullopt)

Create an Aufbau determinant wavefunction with updated orbitals.

The returned wavefunction contains the canonical Aufbau determinant with a new set of orbitals.

Parameters:
  • wavefunction – The original wavefunction providing electron counts.

  • new_orbitals – The orbitals to attach to the output wavefunction.

  • one_rdm_spin_traced – Optional spin-traced active-space 1-RDM payload.

Returns:

An Aufbau determinant wavefunction with the updated orbitals.

std::shared_ptr<data::Orbitals> new_orbitals(std::shared_ptr<data::Wavefunction> wavefunction, const std::vector<size_t> &active_space_indices_a, const std::optional<std::vector<size_t>> &active_space_indices_b = std::nullopt)

Create a new Orbitals object with the specified active space indices.

Parameters:
  • wavefunction – The wavefunction containing the orbitals.

  • active_space_indices_a – The active space orbital indices for alpha electrons.

  • active_space_indices_b – The active space orbital indices for beta electrons (optional for restricted orbitals).

Returns:

A new Orbitals object with the specified active space indices.

std::shared_ptr<data::Wavefunction> new_wavefunction(std::shared_ptr<data::Wavefunction> wavefunction, std::shared_ptr<data::Orbitals> new_orbitals)

Create a new Wavefunction object with updated orbitals.

Generate a new Wavefunction by replacing the orbitals of the given wavefunction with the provided new orbitals, keeping the identical total, determinants.

Parameters:
  • wavefunction – The original wavefunction.

  • new_orbitals – The new orbitals to set in the wavefunction.

Returns:

A new Wavefunction object with the updated orbitals.

std::shared_ptr<data::Settings> resolve_algorithm_defaults(const std::string &type, const std::string &name)

Resolve default settings for a given algorithm type and name using the C++ factory dispatch.

void warn_if_not_aufbau_determinant_wavefunction(std::shared_ptr<data::Wavefunction> wavefunction, const std::string &localizer_name)

Log a warning when a localizer receives a non-Aufbau wavefunction.

Localizers transform orbitals and return an Aufbau determinant wavefunction; correlated-state coefficients from a multi-determinant input are not carried through the transformation.

Parameters:
  • wavefunction – The wavefunction to check.

  • localizer_name – Name of the localizer issuing the warning.

struct DeprecationAccess
#include <qdk/chemistry/algorithms/algorithm.hpp>

Internal reader for protected deprecation-warning hooks.

This is intentionally the only non-derived access path to Algorithm::_deprecation_message(). It lets factories and language bindings emit the same construction-time warnings without exposing deprecation metadata as part of the public Algorithm API.

Public Static Functions

template<typename Derived, typename ReturnType, typename ...Args>
static inline std::optional<std::string> message(const Algorithm<Derived, ReturnType, Args...> &algorithm)