TRIQS/TRIQS 4.0.0
Researching Interacting Quantum Systems
Loading...
Searching...
No Matches
refreq.hpp
Go to the documentation of this file.
1// Copyright (c) 2014-2018 Commissariat à l'énergie atomique et aux énergies alternatives (CEA)
2// Copyright (c) 2014-2018 Centre national de la recherche scientifique (CNRS)
3// Copyright (c) 2018-2023 Simons Foundation
4//
5// This program is free software: you can redistribute it and/or modify
6// it under the terms of the GNU General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You may obtain a copy of the License at
16// https://www.gnu.org/licenses/gpl-3.0.txt
17//
18// Authors: Philipp Dumitrescu, Olivier Parcollet, Nils Wentzell
19
24
25#pragma once
26
27#include "./bases/linear.hpp"
28#include "./tail_fitter.hpp"
29#include "../utility/macros.hpp"
30
31#include <fmt/format.h>
32#include <h5/h5.hpp>
33
34#include <iostream>
35#include <string>
36#include <utility>
37
38namespace triqs::mesh {
39
44
72 class C2PY_RENAME(MeshReFreq) refreq : public detail::linear<refreq, double>, public tail_fitter_handle {
73 public:
76
85 C2PY_DEPRECATED_PARAMETER_NAME(n_max : n_w)
86 refreq(double w_min = 0.0, double w_max = 0.0, long n_w = 0) : linear(w_min, w_max, n_w) {}
87
95 refreq(std::pair<double, double> window, int n_w) : refreq(window.first, window.second, n_w) {}
96
98 static constexpr bool positive_only() { return false; }
99
101 [[nodiscard]] C2PY_PROPERTY_GET(w_min) double w_min() const { return a_; }
102
104 [[nodiscard]] C2PY_PROPERTY_GET(w_max) double w_max() const { return b_; }
105
107 [[nodiscard]] static std::string hdf5_format() { return "MeshReFreq"; }
108
116 friend void h5_write(h5::group g, std::string const &name, refreq const &m) { m.h5_write_impl(g, name, "MeshReFreq"); }
117
125 friend void h5_read(h5::group g, std::string const &name, refreq &m) { m.h5_read_impl(g, name, "MeshReFreq"); }
126
134 friend std::ostream &operator<<(std::ostream &sout, refreq const &m) {
135 return sout << fmt::format("Real frequency mesh with w_min = {}, w_max = {}, N = {}", m.a_, m.b_, m.N_);
136 }
137 };
138
150 auto evaluate(refreq const &m, auto const &f, double w) { return m.evaluate(f, w); }
151
153
154} // namespace triqs::mesh
refreq(double w_min=0.0, double w_max=0.0, long n_w=0)
Construct a real frequency mesh on the interval with equally spaced mesh points.
Definition refreq.hpp:86
Mesh point of a triqs::mesh::detail::linear mesh.
Definition linear.hpp:94
auto evaluate(auto const &f, double x) const
Linear interpolation of a function defined on a triqs::mesh::detail::linear mesh at a value .
Definition linear.hpp:364
void h5_write_impl(h5::group g, std::string const &name, const char *format) const
Write the mesh to HDF5.
Definition linear.hpp:323
void h5_read_impl(h5::group g, std::string const &name, const char *exp_format)
Read the mesh from HDF5.
Definition linear.hpp:338
Real frequency mesh type.
Definition refreq.hpp:72
static std::string hdf5_format()
Get the HDF5 format tag.
Definition refreq.hpp:107
friend std::ostream & operator<<(std::ostream &sout, refreq const &m)
Write a triqs::mesh::refreq mesh to a std::ostream.
Definition refreq.hpp:134
detail::linear< refreq, double >::mesh_point_t mesh_point_t
Mesh point type of a triqs::mesh::refreq mesh (see triqs::mesh::detail::linear::mesh_point_t).
Definition refreq.hpp:75
friend void h5_write(h5::group g, std::string const &name, refreq const &m)
Write a triqs::mesh::refreq mesh to HDF5.
Definition refreq.hpp:116
friend void h5_read(h5::group g, std::string const &name, refreq &m)
Read a triqs::mesh::refreq mesh from HDF5.
Definition refreq.hpp:125
double w_min() const
Get the lower bound of the interval , i.e. the value of the first mesh point.
Definition refreq.hpp:101
refreq(std::pair< double, double > window, int n_w)
Construct a real frequency mesh on the interval with equally spaced mesh points.
Definition refreq.hpp:95
double w_max() const
Get the upper bound of the interval , i.e. the value of the last mesh point.
Definition refreq.hpp:104
refreq(double w_min=0.0, double w_max=0.0, long n_w=0)
Construct a real frequency mesh on the interval with equally spaced mesh points.
Definition refreq.hpp:86
static constexpr bool positive_only()
Is the mesh restricted to positive frequencies?
Definition refreq.hpp:98
Provides a linear mesh type with equally spaced mesh points on an interval.
Common macros used in TRIQS.
Provides tail fitting for functions defined on frequency meshes.