TRIQS/triqs_cthyb 4.0.0
A TRIQS application
Loading...
Searching...
No Matches
G2_iwll.hpp
1/*******************************************************************************
2 *
3 * TRIQS: a Toolbox for Research in Interacting Quantum Systems
4 *
5 * Copyright (C) 2016, P. Seth, I. Krivenko, M. Ferrero and O. Parcollet
6 *
7 * TRIQS is free software: you can redistribute it and/or modify it under the
8 * terms of the GNU General Public License as published by the Free Software
9 * Foundation, either version 3 of the License, or (at your option) any later
10 * version.
11 *
12 * TRIQS is distributed in the hope that it will be useful, but WITHOUT ANY
13 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
15 * details.
16 *
17 * You should have received a copy of the GNU General Public License along with
18 * TRIQS. If not, see <http://www.gnu.org/licenses/>.
19 *
20 ******************************************************************************/
21#pragma once
22
23#include <vector>
24#include <mpi/mpi.hpp>
25#include <triqs/stat/histograms.hpp>
26#include <triqs/experimental/nfft_array.hpp>
27
28#include <triqs/utility/legendre.hpp>
29
30#include "../qmc_data.hpp"
31
32#include "util.hpp"
33
34namespace triqs_cthyb {
35
36 using namespace nda;
37 using namespace triqs::experimental;
38
39 // Generates values of \tilde P_l(x(\tau_1-\tau_2))
40 struct tilde_p_gen {
41 triqs::utility::legendre_generator l_gen;
42 double beta;
43 double f;
44 tilde_p_gen(double beta) : beta(beta) {}
45 void reset(time_pt const &tau1, time_pt const &tau2) {
46 l_gen.reset(2 * double(tau1 - tau2) / beta - 1);
47 f = tau1 > tau2 ? 1 : -1;
48 }
49 double next() { return f * l_gen.next(); }
50 };
51
52 // Measure G^2(i\omega,l,l')
53 template <G2_channel Channel> struct measure_G2_iwll {
54
55 qmc_data const &data;
56 G2_iwll_t::view_type G2_iwll;
57 G2_measures_t G2_measures;
58 block_order order;
59
60 mc_weight_t average_sign;
61
62 // Object that performs NFFT transform
63 array<nfft_array_t<1, 6>, 2> nfft_buf;
64
65 measure_G2_iwll(std::optional<G2_iwll_t> & G2_iwll_opt, qmc_data const &data, G2_measures_t & G2_measures);
66 void accumulate(mc_weight_t s);
67 void collect_results(mpi::communicator const &c);
68
69 // internal methods
70 double setup_times(tilde_p_gen & p_l1_gen, tilde_p_gen & p_l2_gen, op_t const & i, op_t const & j, op_t const & k, op_t const & l);
71 };
72}