Template Class OpMaker

Class Documentation

template<Statistics S>
class OpMaker

makes a tensor-level many-body operator

A many-body operator has the following generic form: \( \frac{1}{P} T_{b_1 b_2 \dots b_B}^{k_1 k_2 \dots k_K} A^{b_1 b_2 \dots b_B}_{k_1 k_2 \dots k_K} \) where \( \{B,K\} \) are number of bra/ket indices of \( T \) or, equivalently, the number of creators/annihilators of normal-ordered (w.r.t. the default vacuum) operator \( A \). Hence \( \{ b_i \} \) / \( \{ k_i \} \) are (quasi)particle creation/annihilation indices. For example, for fermionic operators relative to Fermi vacuum these are:

  • (pure) excitation: (active) unoccupied/occupied, respectively;

  • (pure) deexcitation: occupied/unoccupied, respectively; For generic operators (neither excitation nor deexcitation) complete basis indices are assumed by default.

    \( P \) is the “normalization” factor and depends on the vacuum used to define \( A \), and indices \( \{ b_i \} \) / \( \{ k_i \} \).

Note

The choice of computational basis can be controlled by the default Context. See SeQuant/core/context.hpp and SeQuant/mbpt/context.hpp

Warning

Tensor \( T \) will be antisymmetrized if get_default_context().spbasis() == SPBasis::spinorbital, else it will be particle-symmetric; the latter is only valid if # of bra and ket indices coincide.

Public Types

enum class UseDepIdx

Values:

enumerator Bra

bra/cre indices depend on ket

enumerator Ket

ket/ann indices depend on bra

enumerator None

use plain indices

Public Functions

template<typename IndexSpaceTypeRange1, typename IndexSpaceTypeRange2>
inline OpMaker(OpType op, const cre<IndexSpaceTypeRange1> &cre_list, const ann<IndexSpaceTypeRange2> &ann_list)
Parameters:
  • op[in] the operator type

  • cre_list[in] list of creator indices

  • ann_list[in] list of annihilator indices

OpMaker(OpType op, ncre nc, nann na)
Parameters:
  • op[in] the operator type

  • nc[in] number of bra indices/creators

  • na[in] number of ket indices/annihilators

OpMaker(OpType op, std::size_t rank)

creates a particle-conserving replacement operator

Parameters:
  • op[in] the operator type

  • rank[in] particle rank of the operator (# of creators = # of annihilators = rank )

OpMaker(OpType op, ncre nc, nann na, const cre<IndexSpace> &cre_space, const ann<IndexSpace> &ann_space)
Parameters:
  • op[in] the operator type

  • nc[in] number of bra indices/creators

  • na[in] number of ket indices/annihilators

  • cre_space[in] IndexSpace referred to be the creator

  • ann_space[in] IndexSpace referred to be the annihilators

ExprPtr operator()(std::optional<UseDepIdx> dep_opt = {}, std::optional<Symmetry> opsymm_opt = {}) const
Parameters:
  • dep_opt[in] if given, controls whether bra (*dep_opt == UseDepIdx::Bra) / ket (*dep_opt == UseDepIdx::Ket) indices are dependent on the, respectively, ket/bra indices (i.e., use them as protoindices); if (*dep_opt == UseDepIdx::None) then plain indices are used; if dep_opt is not given then the default is determined by the MBPT context.

  • opsymm_opt[in] if given, controls whether (anti)symmetric tensor is returned; if opsymm_opt is not given then the default is determined by the MBPT context.

Public Static Functions

template<typename TensorGenerator>
static inline ExprPtr make(const container::svector<IndexSpace> &creators, const container::svector<IndexSpace> &annihilators, TensorGenerator &&tensor_generator, UseDepIdx dep = UseDepIdx::None)
Template Parameters:

TensorGenerator – callable with signature TensorGenerator(range<Index>, range<Index>, Symmetry) that returns a Tensor with the respective bra/cre and ket/ann indices and of the given symmetry

Parameters:
  • creators[in] creator indices

  • annihilators[in] annihilator indices

  • tensor_generator[in] the callable that generates the tensor

  • dep[in] whether to use dependent indices

template<typename TensorGenerator>
static inline ExprPtr make(std::initializer_list<IndexSpace::Type> creators, std::initializer_list<IndexSpace::Type> annihilators, TensorGenerator &&tensor_generator, UseDepIdx csv = UseDepIdx::None)

Protected Functions

OpMaker(OpType op)
inline const auto ncreators() const
inline const auto nannihilators() const

Protected Attributes

OpType op_
container::svector<IndexSpace> cre_spaces_
container::svector<IndexSpace> ann_spaces_