Program Listing for File convention.hpp

↰ Return to documentation for file (SeQuant/domain/mbpt/convention.hpp)

//
// Created by Eduard Valeyev on 2019-04-01.
//

#ifndef SEQUANT_CONVENTION_HPP
#define SEQUANT_CONVENTION_HPP

#include <SeQuant/domain/mbpt/fwd.hpp>

#include <SeQuant/core/basis.hpp>
#include <SeQuant/core/context.hpp>
#include <SeQuant/core/index_basis_registry.hpp>

#include <limits>
#include <string_view>

namespace sequant {
namespace mbpt {

enum class Convention {
  Minimal,
  SR,
  MR,
  MinimalMR,
  F12,
  QCiFS
};

enum class SpinConvention {
  None,
  Default,
  Legacy,
};

void load(Convention conv = Convention::Minimal,
          SpinConvention spconv = SpinConvention::Default);

std::wstring decorate_label(std::wstring label, bool up);

void add_fermi_spin(IndexBasisRegistry& ibr);

inline constexpr IndexBasis::instance_type default_ao_basis_instance =
    std::numeric_limits<IndexBasis::instance_type>::max() - 1;


void add_ao_basis(std::shared_ptr<IndexBasisRegistry>& ibr,
                  IndexSpace::QuantumNumbers spin_any);

[[deprecated(
    "the VBS and ABS AO bases are the program's basis-registry layout; "
    "register them there, and the OBS AO basis with add_ao_basis(ibr, "
    "spin_any)")]] void
add_ao_basis(std::shared_ptr<IndexBasisRegistry>& ibr,
             IndexSpace::QuantumNumbers spin_any, bool vbs, bool abs = false,
             IndexBasis::instance_type instance = default_ao_basis_instance);

[[deprecated("the AO bases are named basis instances; use add_ao_basis")]] void
add_ao_spaces(std::shared_ptr<IndexBasisRegistry>& ibr,
              IndexSpace::QuantumNumbers spin_any, bool vbs = false,
              bool abs = false);

void add_df_spaces(std::shared_ptr<IndexBasisRegistry>& ibr);

void add_thc_spaces(std::shared_ptr<IndexBasisRegistry>& ibr);

[[deprecated(
    "the PAO basis is a named basis instance; use add_pao_basis")]] void
add_pao_spaces(std::shared_ptr<IndexBasisRegistry>& ibr,
               IndexSpace::QuantumNumbers spin_any);

inline constexpr IndexBasis::instance_type default_pao_basis_instance =
    std::numeric_limits<IndexBasis::instance_type>::max();

struct PAOBasisSpec {
  std::wstring_view label = L"μ̃";
  std::wstring_view ao_basis = L"μ";
  IndexBasis::instance_type instance = default_pao_basis_instance;
};


void add_pao_basis(std::shared_ptr<IndexBasisRegistry>& ibr,
                   IndexSpace::QuantumNumbers spin_any,
                   const PAOBasisSpec& spec = {});

void add_batching_spaces(std::shared_ptr<IndexBasisRegistry>& ibr);


std::shared_ptr<IndexBasisRegistry> make_min_sr_spaces(
    SpinConvention scv = SpinConvention::Default);

std::shared_ptr<IndexBasisRegistry> make_F12_sr_spaces(
    SpinConvention spconv = SpinConvention::Default);

std::shared_ptr<IndexBasisRegistry> make_mr_spaces(
    SpinConvention spconv = SpinConvention::Default);

std::shared_ptr<IndexBasisRegistry> make_min_mr_spaces(
    SpinConvention spconv = SpinConvention::Default);

std::shared_ptr<IndexBasisRegistry> make_sr_spaces(
    SpinConvention spconv = SpinConvention::Default);

std::shared_ptr<IndexBasisRegistry> make_legacy_spaces(
    SpinConvention spconv = SpinConvention::Default);

std::pair<std::shared_ptr<IndexBasisRegistry>,
          std::shared_ptr<IndexBasisRegistry>>
make_fermi_and_bose_spaces(SpinConvention spconv = SpinConvention::Default);


inline void check_for_batching_space() {
  SEQUANT_ASSERT(
      sequant::get_default_context().index_basis_registry()->contains(L"z"));
}

}  // namespace mbpt
}  // namespace sequant

#endif  // SEQUANT_CONVENTION_HPP