TRIQS/TRIQS 4.0.0
Researching Interacting Quantum Systems
Loading...
Searching...
No Matches
Many-body operators

Detailed Description

The many-body operator algebra in second quantization.

This group contains triqs::operators::many_body_operator_generic and its real- and complex-valued aliases. An operator is stored as a map from monomials (triqs::operators::monomial_t, an ordered product of triqs::operators::canonical_ops_t) to scalar coefficients.

In addition the group provides:

Classes

struct  triqs::operators::canonical_ops_t
 Second quantization creation/annihilation operator. More...
class  triqs::operators::many_body_operator_generic< T >
 Generic many-body operator. More...

Typedefs

using triqs::operators::indices_t = hilbert_space::fundamental_operator_set::indices_t
 Elevate triqs::hilbert_space::indices_t to the triqs::operators namespace.
using triqs::operators::many_body_operator = many_body_operator_generic<real_or_complex>
 Many-body operator with real or complex coefficients (see triqs::operators::many_body_operator_generic).
using triqs::operators::many_body_operator_complex = many_body_operator_generic<std::complex<double>>
 Many-body operator with complex coefficients (see triqs::operators::many_body_operator_generic).
using triqs::operators::many_body_operator_real = many_body_operator_generic<double>
 Many-body operator with real coefficients (see triqs::operators::many_body_operator_generic).
using triqs::operators::monomial_t = std::vector<canonical_ops_t>
 Type used to represent a monomial of canonical second quantization operators.

Functions

template<typename T1, typename T2>
void triqs::operators::assert_operators_are_close (many_body_operator_generic< T1 > const &op1, many_body_operator_generic< T2 > const &op2, double precision)
 Assert that two many-body operators are close to each other within a given precision.
template<typename T = real_or_complex, typename... IndexTypes>
many_body_operator_generic< T > triqs::operators::c (IndexTypes... indices)
 Create an annihilation operator \( \hat{c}_{\alpha} \).
template<typename T = real_or_complex, typename... IndexTypes>
many_body_operator_generic< T > triqs::operators::c_dag (IndexTypes... indices)
 Create a creation operator \( \hat{c}_{\alpha}^{\dagger} \).
template<typename T>
many_body_operator_generic< T > triqs::operators::imag (many_body_operator_generic< T > const &op)
 Get a copy of the given operator \( \hat{O} \) with the real parts of all monomial coefficients set to zero.
template<typename T>
bool triqs::operators::is_op_hermitian (many_body_operator_generic< T > const &op, double tolerance=0.0)
 Check if a many-body operator is Hermitian within a given precision.
template<typename T = real_or_complex, typename... IndexTypes>
many_body_operator_generic< T > triqs::operators::n (IndexTypes... indices)
 Create a number operator \( \hat{n}_{\alpha} = \hat{c}_{\alpha}^{\dagger} \hat{c}_{\alpha} \).
bool triqs::operators::operator< (monomial_t const &m1, monomial_t const &m2)
 Less-than comparison operator for triqs::operators::monomial_t.
std::ostream & triqs::operators::operator<< (std::ostream &os, canonical_ops_t const &op)
 Write a triqs::operators::canonical_ops_t to a std::ostream.
std::ostream & triqs::operators::operator<< (std::ostream &os, monomial_t const &m)
 Write a triqs::operators::monomial_t to a std::ostream.
template<typename T>
many_body_operator_generic< T > triqs::operators::real (many_body_operator_generic< T > const &op)
 Get a copy of the given operator \( \hat{O} \) with the imaginary parts of all monomial coefficients set to zero.

Typedef Documentation

◆ monomial_t

#include <triqs/operators/many_body_operator.hpp>

Type used to represent a monomial of canonical second quantization operators.

A monomial \( \hat{m} \) is a product of canonical second quantization operators, i.e.

\[ \hat{m} = \hat{d}_{\alpha_{i_1}} \hat{d}_{\alpha_{i_2}} \dots \hat{d}_{\alpha_{i_n}} \; , \]

where \( \hat{d}_{\alpha_{i_j}} \) is either a fermionic creation \( \hat{c}_{\alpha_{i_j}}^\dagger \) or annihilation operator \( \hat{c}_{\alpha_{i_j}} \) and \( n \) is the total number of operators in the monomial. See also triqs::operators::canonical_ops_t.

The order of the operators in the product matters, due to the fermionic anti-commutation relations.

Definition at line 186 of file many_body_operator.hpp.

Function Documentation

◆ assert_operators_are_close()

template<typename T1, typename T2>
void triqs::operators::assert_operators_are_close ( many_body_operator_generic< T1 > const & op1,
many_body_operator_generic< T2 > const & op2,
double precision )

#include <triqs/operators/many_body_operator.hpp>

Assert that two many-body operators are close to each other within a given precision.

Checks whether the difference \( \hat{O}_1 - \hat{O}_2 \) is close to zero within the given tolerance \( \epsilon \) using many_body_operator_generic::is_almost_zero(). Throws an exception otherwise.

Template Parameters
T1Scalar type of the first many-body operator.
T2Scalar type of the second many-body operator.
Parameters
op1Many-body operator \( \hat{O}_1 \).
op2Many-body operator \( \hat{O}_2 \).
precisionTolerance \( \epsilon \).

Definition at line 842 of file many_body_operator.hpp.

◆ c()

template<typename T = real_or_complex, typename... IndexTypes>
many_body_operator_generic< T > triqs::operators::c ( IndexTypes... indices)

#include <triqs/operators/many_body_operator.hpp>

Create an annihilation operator \( \hat{c}_{\alpha} \).

Template Parameters
TScalar type of the many-body operator.
IndexTypesInteger, string or double types.
Parameters
indices\( \beta_1, \dots, \beta_k \) that form the index \( \alpha \).
Returns
Many-body operator \( \hat{O} = \hat{c}_{\alpha} \).

Definition at line 903 of file many_body_operator.hpp.

◆ c_dag()

template<typename T = real_or_complex, typename... IndexTypes>
many_body_operator_generic< T > triqs::operators::c_dag ( IndexTypes... indices)

#include <triqs/operators/many_body_operator.hpp>

Create a creation operator \( \hat{c}_{\alpha}^{\dagger} \).

Template Parameters
TScalar type of the many-body operator.
IndexTypesInteger, string or double types.
Parameters
indices\( \beta_1, \dots, \beta_k \) that form the index \( \alpha \).
Returns
Many-body operator \( \hat{O} = \hat{c}_{\alpha}^{\dagger} \).

Definition at line 915 of file many_body_operator.hpp.

◆ imag()

template<typename T>
many_body_operator_generic< T > triqs::operators::imag ( many_body_operator_generic< T > const & op)

#include <triqs/operators/many_body_operator.hpp>

Get a copy of the given operator \( \hat{O} \) with the real parts of all monomial coefficients set to zero.

Implemented in terms of transform().

Template Parameters
TScalar type of the many-body operator.
Parameters
opOperator \( \hat{O} \) to be transformed.
Returns
Imaginary part of the operator.

Definition at line 873 of file many_body_operator.hpp.

◆ is_op_hermitian()

template<typename T>
bool triqs::operators::is_op_hermitian ( many_body_operator_generic< T > const & op,
double tolerance = 0.0 )

#include <triqs/operators/many_body_operator.hpp>

Check if a many-body operator is Hermitian within a given precision.

Checks whether the difference \( \hat{O}^{\dagger} - \hat{O} \) is close to zero within the given tolerance \( \epsilon \).

Template Parameters
TScalar type of the many-body operator.
Parameters
opMany-body operator \( \hat{O} \).
toleranceTolerance \( \epsilon \).
Returns
True if \( \hat{O} \) is Hermitian within the given precision, false otherwise.

Definition at line 891 of file many_body_operator.hpp.

◆ n()

template<typename T = real_or_complex, typename... IndexTypes>
many_body_operator_generic< T > triqs::operators::n ( IndexTypes... indices)

#include <triqs/operators/many_body_operator.hpp>

Create a number operator \( \hat{n}_{\alpha} = \hat{c}_{\alpha}^{\dagger} \hat{c}_{\alpha} \).

Template Parameters
TScalar type of the many-body operator.
IndexTypesInteger, string or double types.
Parameters
indices\( \beta_1, \dots, \beta_k \) that form the index \( \alpha \).
Returns
Many-body operator \( \hat{O} = \hat{n}_{\alpha} = \hat{c}_{\alpha}^{\dagger} \hat{c}_{\alpha} \).

Definition at line 927 of file many_body_operator.hpp.

◆ operator<()

bool triqs::operators::operator< ( monomial_t const & m1,
monomial_t const & m2 )

#include <triqs/operators/many_body_operator.cpp>

Less-than comparison operator for triqs::operators::monomial_t.

The ordering is defined as follows:

  • If the two monomials \( \hat{m}_1 \) and \( \hat{m}_2 \) contain a different number of operators, the shorter one is the smaller one.
  • Otherwise, the monomials are compared lexicographically according to the ordering of triqs::operators::canonical_ops_t::operator<=>().
Parameters
m1Left hand side monomial \( \hat{m}_1 \).
m2Right hand side monomial \( \hat{m}_2 \).
Returns
True if \( \hat{m}_1 < \hat{m}_2 \), false otherwise.

Definition at line 58 of file many_body_operator.cpp.

◆ operator<<() [1/2]

std::ostream & triqs::operators::operator<< ( std::ostream & os,
canonical_ops_t const & op )

#include <triqs/operators/many_body_operator.cpp>

Write a triqs::operators::canonical_ops_t to a std::ostream.

Parameters
osstd::ostream object.
opOperator to be written.
Returns
Reference to std::ostream object.

Definition at line 52 of file many_body_operator.cpp.

◆ operator<<() [2/2]

std::ostream & triqs::operators::operator<< ( std::ostream & os,
monomial_t const & m )

#include <triqs/operators/many_body_operator.cpp>

Write a triqs::operators::monomial_t to a std::ostream.

Parameters
osstd::ostream object.
mMonomial to be written.
Returns
Reference to std::ostream object.

Definition at line 62 of file many_body_operator.cpp.

◆ real()

template<typename T>
many_body_operator_generic< T > triqs::operators::real ( many_body_operator_generic< T > const & op)

#include <triqs/operators/many_body_operator.hpp>

Get a copy of the given operator \( \hat{O} \) with the imaginary parts of all monomial coefficients set to zero.

Implemented in terms of transform().

Template Parameters
TScalar type of the many-body operator.
Parameters
opOperator \( \hat{O} \) to be transformed.
Returns
Real part of the operator.

Definition at line 856 of file many_body_operator.hpp.