TRIQS/triqs_cthyb 4.0.0
A TRIQS application
Loading...
Searching...
No Matches
perturbation_hist.hpp
1/*******************************************************************************
2 *
3 * TRIQS: a Toolbox for Research in Interacting Quantum Systems
4 *
5 * Copyright (C) 2014, 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#include "../qmc_data.hpp"
23#include <triqs/stat/histograms.hpp>
24
25namespace triqs_cthyb {
26
27 struct measure_perturbation_hist {
28
29 qmc_data const &data;
30 int block_index;
31 stat::histogram &histo_perturbation_order;
32
33 measure_perturbation_hist(int block_index, qmc_data const &data, stat::histogram &hist)
34 : data(data), block_index(block_index), histo_perturbation_order(hist) {
35 histo_perturbation_order = {0, 1000};
36 }
37
38 void accumulate(mc_weight_t) { histo_perturbation_order << data.dets[block_index].size(); }
39
40 void collect_results(mpi::communicator const &c) { histo_perturbation_order = mpi::all_reduce(histo_perturbation_order, c); }
41 };
42
43 // -----------------------------------------------------------------------------
44 struct measure_perturbation_hist_total {
45
46 qmc_data const &data;
47 stat::histogram &histo_perturbation_order;
48
49 measure_perturbation_hist_total(qmc_data const &data, stat::histogram &hist) : data(data), histo_perturbation_order(hist) {
50 histo_perturbation_order = {0, 1000};
51 }
52
53 void accumulate(mc_weight_t) { histo_perturbation_order << data.config.size() / 2; }
54
55 void collect_results(mpi::communicator const &c) { histo_perturbation_order = mpi::all_reduce(histo_perturbation_order, c); }
56 };
57}