TRIQS/TRIQS 4.0.0
Researching Interacting Quantum Systems
Loading...
Searching...
No Matches
triqs::mesh::refreq_log

#include <triqs/mesh/refreq_log.hpp>

Detailed Description

Logarithmic real frequency mesh type.

A logarithmic real frequency mesh is defined by a cutoff frequency \( \varepsilon > 0 \), an upper bound \( \omega_{\mathrm{max}} \geq \varepsilon \) and a common ratio \( r > 1 \). It contains a symmetric set of \( N \) mesh points around zero, formed by mirroring the positive geometric sequence \( \omega_{\mathrm{max}}, \omega_{\mathrm{max}} / r, \omega_{\mathrm{max}} / r^2, \ldots \) (taken while the sequence stays above \( \varepsilon \)) to the negative axis. The mesh always has an even number of points and does not include zero.

A logarithmic real frequency mesh has the following properties:

  • Each mesh point is identified by a unique index \( n \in \{0, 1, \ldots, N-1\} \).
  • An index \( n \) is mapped to the corresponding data index \( d \) by the identity function \( d(n) = n \) and vice versa.
  • An index \( n \) is mapped to the corresponding value \( \omega_n \) by

    • \( \omega_n = -\omega_{\mathrm{max}} / r^n \) for \( 0 \leq n < N/2 \) and
    • \( \omega_n = \omega_{\mathrm{max}} / r^{N - 1 - n} \) for \( N/2 \leq n \leq N - 1 \),

    such that the mesh points are sorted in ascending order with \( \omega_0 = -\omega_{\mathrm{max}} \) and \( \omega_{N-1} = \omega_{\mathrm{max}} \).

  • An arbitrary value \( \omega \in [-\omega_{\mathrm{max}}, \omega_{\mathrm{max}}] \) is mapped to the closest mesh point with index \( n \) by binary search on the sorted mesh points.

Green's function containers that are based on a logarithmic real frequency mesh store the function values at the discrete frequency points \( \omega_n \), i.e. \( f_n = f(\omega_n) \), and use linear interpolation to evaluate the function at an arbitrary frequency \( \omega \in [-\omega_{\mathrm{max}}, \omega_{\mathrm{max}}] \).

Definition at line 74 of file refreq_log.hpp.

Classes

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

Public Types

using data_index_t = long
 Data index type.
using index_t = long
 Index type.
using value_t = double
 Value type.

Public Member Functions

 refreq_log ()=default
 Default constructor creates an empty mesh.
 refreq_log (double eps, double w_max, double ratio)
 Construct a logarithmic real frequency mesh.
auto begin () const
 Get an iterator to the beginning of the mesh.
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.
double eps () const noexcept
 Get the smallest positive frequency \( \varepsilon \).
bool is_index_valid (index_t n) const noexcept
 Check if an index \( n \) is valid.
bool is_value_valid (double w) const noexcept
 Check if a value \( \omega \) is within the mesh range.
uint64_t mesh_hash () const noexcept
 Get the hash value of the mesh.
mesh_point_t operator() (index_t n) const noexcept
 Function call operator to access a mesh point by its index.
bool operator== (refreq_log const &) const =default
 Equal-to comparison operator compares \( \varepsilon \), \( \omega_{\mathrm{max}} \) and the ratio.
mesh_point_t operator[] (closest_mesh_point_t< double > const &cmp) const noexcept
 Subscript operator to access the mesh point closest to a given value.
mesh_point_t operator[] (long d) const noexcept
 Subscript operator to access a mesh point by its data index.
std::vector< double > const & points () const noexcept
 Get the vector of frequency point values.
double ratio () const noexcept
 Get the common ratio \( r \) of the geometric sequence.
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 number of mesh points.
data_index_t to_data_index (closest_mesh_point_t< double > const &cmp) const noexcept
 Map a value to the closest mesh point and return its data index.
data_index_t to_data_index (index_t n) const noexcept
 Map an index \( n \) to its corresponding data index \( d(n) = n \).
index_t to_index (closest_mesh_point_t< double > const &cmp) const noexcept
 Map a value to the closest mesh point and return its index using binary search.
index_t to_index (data_index_t d) const noexcept
 Map a data index \( d \) to the corresponding index \( n(d) = d \).
double to_value (index_t n) const noexcept
 Map an index \( n \) to its corresponding value \( \omega_n \).
double w_max () const noexcept
 Get the largest frequency \( \omega_{\mathrm{max}} \).

Static Public Member Functions

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

Friends

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

Constructor & Destructor Documentation

◆ refreq_log()

triqs::mesh::refreq_log::refreq_log ( double eps,
double w_max,
double ratio )
inline

Construct a logarithmic real frequency mesh.

Parameters
epsSmallest positive frequency \( \varepsilon > 0 \) (cutoff near zero).
w_maxLargest frequency \( \omega_{\mathrm{max}} \geq \varepsilon \).
ratioCommon ratio \( r > 1 \) of the geometric sequence.

Definition at line 158 of file refreq_log.hpp.

Member Function Documentation

◆ deserialize()

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

Deserialize the mesh from a generic archive.

Parameters
arArchive to deserialize from.

Definition at line 328 of file refreq_log.hpp.

◆ is_index_valid()

bool triqs::mesh::refreq_log::is_index_valid ( index_t n) const
inlinenodiscardnoexcept

Check if an index \( n \) is valid.

Parameters
nIndex \( n \) to check.
Returns
True if \( 0 \leq n < N \), false otherwise.

Definition at line 174 of file refreq_log.hpp.

◆ is_value_valid()

bool triqs::mesh::refreq_log::is_value_valid ( double w) const
inlinenodiscardnoexcept

Check if a value \( \omega \) is within the mesh range.

Parameters
wValue to check.
Returns
True if \( -\omega_{\mathrm{max}} \leq \omega \leq \omega_{\mathrm{max}} \), false otherwise.

Definition at line 182 of file refreq_log.hpp.

◆ operator()()

mesh_point_t triqs::mesh::refreq_log::operator() ( index_t n) const
inlinenodiscardnoexcept

Function call operator to access a mesh point by its index.

Parameters
nIndex of the mesh point.
Returns
mesh_point_t at the given index.

Definition at line 260 of file refreq_log.hpp.

◆ operator[]() [1/2]

mesh_point_t triqs::mesh::refreq_log::operator[] ( closest_mesh_point_t< double > const & cmp) const
inlinenodiscardnoexcept

Subscript operator to access the mesh point closest to a given value.

Parameters
cmptriqs::mesh::closest_mesh_point_t containing the value.
Returns
mesh_point_t of the closest mesh point.

Definition at line 252 of file refreq_log.hpp.

◆ operator[]() [2/2]

mesh_point_t triqs::mesh::refreq_log::operator[] ( long d) const
inlinenodiscardnoexcept

Subscript operator to access a mesh point by its data index.

Parameters
dData index of the mesh point.
Returns
mesh_point_t at the given data index.

Definition at line 244 of file refreq_log.hpp.

◆ serialize()

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

Serialize the mesh to a generic archive.

Parameters
arArchive to serialize to.

Definition at line 322 of file refreq_log.hpp.

◆ to_data_index() [1/2]

data_index_t triqs::mesh::refreq_log::to_data_index ( closest_mesh_point_t< double > const & cmp) const
inlinenodiscardnoexcept

Map a value to the closest mesh point and return its data index.

Parameters
cmptriqs::mesh::closest_mesh_point_t containing the value to map.
Returns
Data index of the closest mesh point.

Definition at line 201 of file refreq_log.hpp.

◆ to_data_index() [2/2]

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

Map an index \( n \) to its corresponding data index \( d(n) = n \).

Parameters
nIndex \( n \) to map.
Returns
Data index \( d(n) = n \).

Definition at line 190 of file refreq_log.hpp.

◆ to_index() [1/2]

index_t triqs::mesh::refreq_log::to_index ( closest_mesh_point_t< double > const & cmp) const
inlinenodiscardnoexcept

Map a value to the closest mesh point and return its index using binary search.

Parameters
cmptriqs::mesh::closest_mesh_point_t containing the value to map.
Returns
Index of the closest mesh point.

Definition at line 222 of file refreq_log.hpp.

◆ to_index() [2/2]

index_t triqs::mesh::refreq_log::to_index ( data_index_t d) const
inlinenodiscardnoexcept

Map a data index \( d \) to the corresponding index \( n(d) = d \).

Parameters
dData index \( d \) to map.
Returns
Index \( n(d) = d \).

Definition at line 211 of file refreq_log.hpp.

◆ to_value()

double triqs::mesh::refreq_log::to_value ( index_t n) const
inlinenodiscardnoexcept

Map an index \( n \) to its corresponding value \( \omega_n \).

Parameters
nIndex to map.
Returns
Value of the mesh point \( \omega_n \).

Definition at line 271 of file refreq_log.hpp.

◆ h5_read

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

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

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

Definition at line 358 of file refreq_log.hpp.

◆ h5_write

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

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

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

Definition at line 343 of file refreq_log.hpp.

◆ operator<<

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

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

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

Definition at line 313 of file refreq_log.hpp.


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