TRIQS/TRIQS 4.0.0
Researching Interacting Quantum Systems
Loading...
Searching...
No Matches
adjoint.hpp
Go to the documentation of this file.
1// Copyright (c) 2022-2023 Simons Foundation
2//
3// This program is free software: you can redistribute it and/or modify
4// it under the terms of the GNU General Public License as published by
5// the Free Software Foundation, either version 3 of the License, or
6// (at your option) any later version.
7//
8// This program is distributed in the hope that it will be useful,
9// but WITHOUT ANY WARRANTY; without even the implied warranty of
10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11// GNU General Public License for more details.
12//
13// You may obtain a copy of the License at
14// https://www.gnu.org/licenses/gpl-3.0.txt
15//
16// Authors: Olivier Parcollet, Nils Wentzell
17
22
23#pragma once
24
25#include "./imtime.hpp"
26#include "./imfreq.hpp"
27#include "./dlr_imtime.hpp"
28#include "./dlr_imfreq.hpp"
29#include "./retime.hpp"
30#include "./refreq.hpp"
31#include "./cyclat.hpp"
32#include "./brzone.hpp"
33
34#include <numbers>
35
36namespace triqs::mesh {
37
50 [[nodiscard]] inline imfreq make_adjoint_mesh(imtime const &m, long n_iw = -1) {
51 if (n_iw == -1) n_iw = (m.size() - 1) / 6;
52 return {m.beta(), m.statistic(), n_iw};
53 }
54
67 [[nodiscard]] inline imtime make_adjoint_mesh(imfreq const &m, long n_tau = -1) {
68 if (n_tau == -1) n_tau = 6 * (m.last_index() + 1) + 1;
69 return {m.beta(), m.statistic(), n_tau};
70 }
71
81 [[nodiscard]] inline dlr_imfreq make_adjoint_mesh(dlr_imtime const &m) { return dlr_imfreq{m}; }
82
92 [[nodiscard]] inline dlr_imtime make_adjoint_mesh(dlr_imfreq const &m) { return dlr_imtime{m}; }
93
110 [[nodiscard]] inline refreq make_adjoint_mesh(retime const &m, bool shift_half_bin = false) {
111 using std::numbers::pi;
112 auto const N = static_cast<double>(m.size());
113 auto const wmax = pi * (N - 1) / (N * m.delta());
114 if (shift_half_bin) return {-wmax + pi / N / m.delta(), wmax + pi / N / m.delta(), m.size()};
115 return {-wmax, wmax, m.size()};
116 }
117
133 [[nodiscard]] inline retime make_adjoint_mesh(refreq const &m, bool shift_half_bin = false) {
134 using std::numbers::pi;
135 auto const N = static_cast<double>(m.size());
136 auto const tmax = pi * (N - 1) / (N * m.delta());
137 if (shift_half_bin) return {-tmax + pi / N / m.delta(), tmax + pi / N / m.delta(), m.size()};
138 return {-tmax, tmax, m.size()};
139 }
140
148 [[nodiscard]] inline brzone make_adjoint_mesh(cyclat const &m) { return {brillouin_zone{m.lattice()}, m.dims()}; }
149
157 [[nodiscard]] inline cyclat make_adjoint_mesh(brzone const &m) { return {m.bz().lattice(), m.dims()}; }
158
159} // namespace triqs::mesh
Provides a mesh type for Brillouin zones.
A Brillouin zone class.
Brillouin zone mesh type.
Definition brzone.hpp:104
auto const & dims() const
Get the number of mesh points in each of the three dimensions.
Definition brzone.hpp:374
auto const & bz() const noexcept
Get the underlying Brillouin zone.
Definition brzone.hpp:383
Cyclic lattice mesh type for Bravais lattices with Born-von Karman periodic boundary conditions.
Definition cyclat.hpp:88
auto const & lattice() const noexcept
Get the underlying Bravais lattice.
Definition cyclat.hpp:305
auto const & dims() const
Get the number of unit cells in each of the three dimensions.
Definition cyclat.hpp:297
value_t delta() const noexcept
Get the step size of the mesh, i.e. the distance between two consecutive mesh points.
Definition linear.hpp:280
long size() const noexcept
Get the size of the mesh, i.e. the number of mesh points.
Definition linear.hpp:277
Imaginary frequency discrete Lehmann representation (DLR) mesh type.
Imaginary time discrete Lehmann representation (DLR) mesh type.
Imaginary frequency mesh type.
Definition imfreq.hpp:102
statistic_enum statistic() const noexcept
Get the particle statistics.
Definition imfreq.hpp:335
double beta() const noexcept
Get the inverse temperature .
Definition imfreq.hpp:332
long last_index() const
Get the last Matsubara index, i.e. .
Definition imfreq.hpp:350
Imaginary time mesh type.
Definition imtime.hpp:68
double beta() const noexcept
Get the inverse temperature .
Definition imtime.hpp:88
statistic_enum statistic() const noexcept
Get the particle statistics.
Definition imtime.hpp:91
Real frequency mesh type.
Definition refreq.hpp:72
Real time mesh type.
Definition retime.hpp:70
Provides a mesh type for Bravais lattices with Born-von Karman periodic boundary conditions.
Provides a mesh type for the discrete Lehmann representation in imaginary frequency space.
Provides a mesh type for the discrete Lehmann representation in imaginary time.
imfreq make_adjoint_mesh(imtime const &m, long n_iw=-1)
Create the adjoint imaginary-frequency mesh to a given imaginary-time mesh.
Definition adjoint.hpp:50
Provides a mesh type on the imaginary frequency axis.
Provides a mesh type on the imaginary time axis.
Provides a mesh type on the real frequency axis.
Provides a mesh type on the real time axis.