TRIQS/TRIQS 4.0.0
Researching Interacting Quantum Systems
Loading...
Searching...
No Matches
triqs::gfs::imfreq

#include <triqs/mesh/imfreq.hpp>

Detailed Description

Imaginary frequency mesh type.

An imaginary frequency mesh is defined by the number of positive frequencies \( N_{i\omega_n} \geq 0 \), the inverse temperature \( \beta > 0 \), its particle statistics and an option (all_frequencies vs positive_frequencies_only).

An imaginary frequency mesh has the following properties:

  • Each mesh point is identified by a unique index \( n \in \{ n_{\text{min}}, n_{\text{min}} + 1, \dots, n_{\text{max}} - 1, n_{\text{max}} \} \), where \( n_{\text{max}} = N_{i\omega_n} - 1 \) and

    \[ n_{\text{min}} = \begin{cases} -N_{i\omega_n} & \text{if fermionic statistics and all frequencies} \\ -N_{i\omega_n} + 1 & \text{if bosonic statistics and all frequencies} \\ 0 & \text{if positive frequencies only} \end{cases} \; . \]

  • The size of the mesh is \( N = n_{\text{max}} - n_{\text{min}} + 1 \).
  • An index \( n \) is mapped to the corresponding data index \( d \) by the function \( d(n) = n - n_{\text{min}} \). The inverse map is \( n(d) = d + n_{\text{min}} \).
  • An index \( n \) is mapped to the corresponding value \( i\omega_n \equiv i\omega(n) \) by the function

    \[ i\omega_n = \begin{cases} i\frac{2n \pi}{\beta} & \text{if fermionic statistics} \\ i\frac{(2n + 1) \pi}{\beta} & \text{if bosonic statistics} \end{cases} \; . \]

Green's function containers that are based on an imaginary frequency mesh store the function values at the discrete frequency points \( i\omega_n \), i.e. \( f_n = f(i\omega(n)) \), and to evaluate the function at a specific Matsubara frequency \( i\omega_n \) with \( n_{\text{min}} \leq n \leq n_{\text{max}} \) the container simply returns the corresponding \( f_n \).

Definition at line 102 of file imfreq.hpp.

Inheritance diagram for triqs::gfs::imfreq:
triqs::mesh::tail_fitter_handle

Classes

class  mesh_point_t
 Mesh point of a triqs::mesh::imfreq mesh. More...

Public Types

using data_index_t = long
 Data index type.
using index_t = long
 Index type.
enum class  option
 Enum to specify which frequencies should be included in the mesh. More...
using value_t = matsubara_freq
 Value type.

Public Member Functions

 imfreq ()=default
 Default constructor constructs an empty mesh.
 imfreq (double beta, statistic_enum statistic, energy_t w_max, option opt=option::all_frequencies)
 Construct an imaginary frequency mesh with a threshold for the largest positive Matsubara frequency on the mesh.
 imfreq (double beta, statistic_enum statistic, long n_iw=1025, option opt=option::all_frequencies)
 Construct an imaginary frequency mesh with \( N_{i\omega_n} \geq 0 \) positive Matsubara frequencies.
auto begin () const
 Get an iterator to the beginning of the mesh.
double beta () const noexcept
 Get the inverse temperature \( \beta \).
auto cbegin () const
 Get a const iterator to the beginning of the mesh.
auto cend () const
 Get a const iterator to the end of the mesh.
void deserialize (auto &ar)
 Deserialize the mesh from a generic archive.
auto end () const
 Get an iterator to the end of the mesh.
bool eval_to_zero (index_t n) const
 Return true if the given Matsubara index \( n \) is not valid (see is_index_valid()).
bool eval_to_zero (matsubara_freq iw) const
 Return true if the Matsubara index of the given Matsubara frequency \( i\omega_n \) is not valid.
bool eval_to_zero (mesh_point_t mp) const
 Return true if the Matsubara index of the given mesh point is not valid (see is_index_valid()).
long first_index () const
 Get the first Matsubara index, i.e. \( n_{\text{min}} \).
imfreq get_positive_freq () const
 Get a new mesh with the same \( \beta \), particle statistics and \( N_{i\omega_n} \) but only positive frequencies.
bool is_index_valid (index_t n) const
 Check if a Matsubara index \( n \) is valid.
long last_index () const
 Get the last Matsubara index, i.e. \( n_{\text{max}} \).
uint64_t mesh_hash () const noexcept
 Get the hash value of the mesh.
long n_iw () const noexcept
 Get the number of positive Matsubara frequencies \( N_{i\omega_n} \).
mesh_point_t operator() (long n) const
 Function call operator to access a mesh point by its Matsubara index \( n \in \{ n_{\text{min}}, \dots, n_{\text{max}} \} \).
bool operator== (imfreq const &m) const
 Equal-to comparison operator compares \( \beta \), the particle statistics, \( N_{i\omega_n} \) and whether all or only positive frequencies are in the mesh.
mesh_point_t operator[] (closest_mesh_point_t< value_t > const &cmp) const
 Subscript operator to access a mesh point by a Matsubara frequency \( i\omega_n \) contained in a triqs::mesh::closest_mesh_point_t.
mesh_point_t operator[] (long d) const
 Subscript operator to access a mesh point by its data index \( d \in \{0, 1, \ldots, N-1\} \).
bool positive_only () const
 Is the mesh restricted to positive Matsubara frequencies?
void serialize (auto &ar) const
 Serialize the mesh to a generic archive.
long size () const noexcept
 Get the size \( N \) of the mesh, i.e. the total number of mesh points.
statistic_enum statistic () const noexcept
 Get the particle statistics.
data_index_t to_data_index (closest_mesh_point_t< value_t > const &cmp) const
 Map a Matsubara frequency \( i\omega_n \) contained in a triqs::mesh::closest_mesh_point_t to its data index \( d(i\omega_n) \).
data_index_t to_data_index (index_t n) const noexcept
 Map a Matsubara index \( n \in \{ n_{\text{min}}, \dots, n_{\text{max}} \} \) to its corresponding data index \( d(n) \).
data_index_t to_data_index (matsubara_freq const &iw) const noexcept
 Map a Matsubara frequency \( i\omega_n \) to its data index \( d(i\omega_n) \).
index_t to_index (closest_mesh_point_t< value_t > const &cmp) const
 Map a Matsubara frequency \( i\omega_n \) contained in a triqs::mesh::closest_mesh_point_t to its Matsubara index \( n(i\omega_n) \).
index_t to_index (data_index_t d) const
 Map a data index \( d \in \{0, 1, \ldots, N-1\} \) to the corresponding Matsubara index \( n(d) \).
matsubara_freq to_value (index_t n) const
 Map a Matsubara index \( n \in \{ n_{\text{min}}, \dots, n_{\text{max}} \} \) to its corresponding Matsubara frequency \( i\omega_n \).
std::complex< double > w_max () const
 Get the complex value of the largest positive Matsubara frequency in the mesh.
Public Member Functions inherited from triqs::mesh::tail_fitter_handle
tail_fitterget_tail_fitter () const
 Get the triqs::mesh::tail_fitter object.
tail_fitterget_tail_fitter (double tail_fraction, int n_tail_max=tail_fitter::default_n_tail_max, std::optional< int > expansion_order={}) const
 Construct a new triqs::mesh::tail_fitter object with the given parameters and return it.
void set_tail_fit_parameters (double tail_fraction, int n_tail_max=tail_fitter::default_n_tail_max, std::optional< int > expansion_order={}) const
 Set the pointer to a new tail-fitter object constructed with the given parameters.

Static Public Member Functions

static std::string hdf5_format ()
 Get the HDF5 format tag.

Friends

void h5_read (h5::group g, std::string name, imfreq &m)
 Read a triqs::mesh::imfreq mesh from HDF5.
void h5_write (h5::group g, std::string name, imfreq const &m)
 Write a triqs::mesh::imfreq mesh to HDF5.
std::ostream & operator<< (std::ostream &sout, imfreq const &m)
 Write a triqs::mesh::imfreq mesh to a std::ostream.

Member Enumeration Documentation

◆ option

enum class triqs::mesh::imfreq::option
strong

Enum to specify which frequencies should be included in the mesh.

The following options are supported:

  • all_frequencies: Include negative and positive frequencies.
  • positive_frequencies_only: Include only positive frequencies.

Definition at line 167 of file imfreq.hpp.

Constructor & Destructor Documentation

◆ imfreq() [1/2]

triqs::mesh::imfreq::imfreq ( double beta,
statistic_enum statistic,
long n_iw = 1025,
option opt = option::all_frequencies )
inline

Construct an imaginary frequency mesh with \( N_{i\omega_n} \geq 0 \) positive Matsubara frequencies.

Parameters
betaInverse temperature \( \beta > 0 \).
statisticParticle statistics.
n_iwNumber of positive Matsubara frequencies, i.e. \( N_{i\omega_n} \).
optWhether to use all or only the positive frequencies.

Definition at line 181 of file imfreq.hpp.

◆ imfreq() [2/2]

triqs::mesh::imfreq::imfreq ( double beta,
statistic_enum statistic,
energy_t w_max,
option opt = option::all_frequencies )
inline

Construct an imaginary frequency mesh with a threshold for the largest positive Matsubara frequency on the mesh.

The number of positive Matsubara frequencies is related to the threshold \( \omega_{\text{max}} \) by

\[ N_{i\omega_n} = \begin{cases} \left\lfloor \frac{\omega_{\text{max}} \beta / \pi - 1}{2} \right\rfloor & \text{if fermionic statistics} \\ \left\lfloor \frac{\omega_{\text{max}} \beta / \pi}{2} \right\rfloor & \text{if bosonic statistics} \\ \end{cases} \; . \]

Parameters
betaInverse temperature \( \beta > 0 \).
statisticParticle statistics.
w_maxThreshold \( \omega_{\text{max}} > 0 \) for the largest positive Matsubara frequency.
optWhether to use all or only the positive frequencies.

Definition at line 206 of file imfreq.hpp.

Member Function Documentation

◆ deserialize()

void triqs::mesh::imfreq::deserialize ( auto & ar)
inline

Deserialize the mesh from a generic archive.

Parameters
arArchive to deserialize from.

Definition at line 390 of file imfreq.hpp.

◆ is_index_valid()

bool triqs::mesh::imfreq::is_index_valid ( index_t n) const
inlinenodiscard

Check if a Matsubara index \( n \) is valid.

Parameters
nMatsubara index \( n \) to check.
Returns
True if \( n_\text{min} \leq n \leq n_\text{max} \), false otherwise.

Definition at line 221 of file imfreq.hpp.

◆ operator()()

mesh_point_t triqs::mesh::imfreq::operator() ( long n) const
inlinenodiscard

Function call operator to access a mesh point by its Matsubara index \( n \in \{ n_{\text{min}}, \dots, n_{\text{max}} \} \).

Parameters
nMatsubara index \( n \) of the mesh point.
Returns
mesh_point_t with the Matsubara index \( n \), data index \( d(n) = n - n_{\text{min}} \) and same \( \beta \), particle statistics and hash value as the current mesh.

Definition at line 308 of file imfreq.hpp.

◆ operator[]() [1/2]

mesh_point_t triqs::mesh::imfreq::operator[] ( closest_mesh_point_t< value_t > const & cmp) const
inlinenodiscard

Subscript operator to access a mesh point by a Matsubara frequency \( i\omega_n \) contained in a triqs::mesh::closest_mesh_point_t.

Parameters
cmptriqs::mesh::closest_mesh_point_t containing \( i\omega_n \).
Returns
mesh_point_t with the Matsubara index \( n(i\omega_n) = n \), data index \( d(i\omega_n) = n - n_{\text{min}} \) and same \( \beta \), particle statistics and hash value as the current mesh.

Definition at line 298 of file imfreq.hpp.

◆ operator[]() [2/2]

mesh_point_t triqs::mesh::imfreq::operator[] ( long d) const
inlinenodiscard

Subscript operator to access a mesh point by its data index \( d \in \{0, 1, \ldots, N-1\} \).

Parameters
dData index \( d \) of the mesh point.
Returns
mesh_point_t with the Matsubara index \( n(d) = d + n_{\text{min}} \), data index \( d \) and same \( \beta \), particle statistics and hash value as the current mesh.

Definition at line 288 of file imfreq.hpp.

◆ serialize()

void triqs::mesh::imfreq::serialize ( auto & ar) const
inline

Serialize the mesh to a generic archive.

Parameters
arArchive to serialize to.

Definition at line 384 of file imfreq.hpp.

◆ to_data_index() [1/3]

data_index_t triqs::mesh::imfreq::to_data_index ( closest_mesh_point_t< value_t > const & cmp) const
inlinenodiscard

Map a Matsubara frequency \( i\omega_n \) contained in a triqs::mesh::closest_mesh_point_t to its data index \( d(i\omega_n) \).

Parameters
cmptriqs::mesh::closest_mesh_point_t containing \( i\omega_n \).
Returns
Data index \( d(i\omega_n) = n - n_{\text{min}} \).

Definition at line 253 of file imfreq.hpp.

◆ to_data_index() [2/3]

data_index_t triqs::mesh::imfreq::to_data_index ( index_t n) const
inlinenodiscardnoexcept

Map a Matsubara index \( n \in \{ n_{\text{min}}, \dots, n_{\text{max}} \} \) to its corresponding data index \( d(n) \).

Parameters
nMatsubara index \( n \) to map.
Returns
Data index \( d(n) = n - n_{\text{min}} \).

Definition at line 230 of file imfreq.hpp.

◆ to_data_index() [3/3]

data_index_t triqs::mesh::imfreq::to_data_index ( matsubara_freq const & iw) const
inlinenodiscardnoexcept

Map a Matsubara frequency \( i\omega_n \) to its data index \( d(i\omega_n) \).

Parameters
iwMatsubara frequency to map.
Returns
Data index \( d(i\omega_n) = n - n_{\text{min}} \).

Definition at line 241 of file imfreq.hpp.

◆ to_index() [1/2]

index_t triqs::mesh::imfreq::to_index ( closest_mesh_point_t< value_t > const & cmp) const
inlinenodiscard

Map a Matsubara frequency \( i\omega_n \) contained in a triqs::mesh::closest_mesh_point_t to its Matsubara index \( n(i\omega_n) \).

Parameters
cmptriqs::mesh::closest_mesh_point_t containing \( i\omega_n \).
Returns
Matsubara index \( n(i\omega_n) = n \).

Definition at line 276 of file imfreq.hpp.

◆ to_index() [2/2]

Map a data index \( d \in \{0, 1, \ldots, N-1\} \) to the corresponding Matsubara index \( n(d) \).

Parameters
dData index \( d \) to map.
Returns
Matsubara index \( n(d) = d + n_{\text{min}} \).

Definition at line 264 of file imfreq.hpp.

◆ to_value()

Map a Matsubara index \( n \in \{ n_{\text{min}}, \dots, n_{\text{max}} \} \) to its corresponding Matsubara frequency \( i\omega_n \).

Parameters
nMatsubara index \( n \) to map.
Returns
Matsubara frequency \( i\omega_n \).

Definition at line 317 of file imfreq.hpp.

◆ h5_read

void h5_read ( h5::group g,
std::string name,
imfreq & m )
friend

Read a triqs::mesh::imfreq mesh from HDF5.

Parameters
gh5::group to be read from.
nameName of the subgroup.
mMesh object to be read into.

Definition at line 418 of file imfreq.hpp.

◆ h5_write

void h5_write ( h5::group g,
std::string name,
imfreq const & m )
friend

Write a triqs::mesh::imfreq mesh to HDF5.

Parameters
gh5::group to be written to.
nameName of the subgroup.
mMesh object to be written.

Definition at line 402 of file imfreq.hpp.

◆ operator<<

std::ostream & operator<< ( std::ostream & sout,
imfreq const & m )
friend

Write a triqs::mesh::imfreq mesh to a std::ostream.

Parameters
soutstd::ostream object.
mMesh to be written.
Returns
Reference to std::ostream object.

Definition at line 374 of file imfreq.hpp.


The documentation for this class was generated from the following file: