TRIQS/triqs_ctseg 4.0.0
A TRIQS application
Loading...
Searching...
No Matches
Sperp_tau.cpp
1// Copyright (c) 2022--present, The Simons Foundation
2// Copyright (c) 2022--present, Max Planck Institute for Polymer Research, Mainz, Germany
3// This file is part of TRIQS/ctseg and is licensed under the terms of GPLv3 or later.
4// SPDX-License-Identifier: GPL-3.0-or-later
5// See LICENSE in the root of this distribution for details.
6
7#include "./Sperp_tau.hpp"
8#include "../logs.hpp"
9
10namespace triqs_ctseg::measures {
11
12 Sperp_tau::Sperp_tau(params_t const &p, work_data_t const &wdata, configuration_t const &config, results_t &results)
13 : wdata{wdata}, config{config}, results{results} {
14
15 beta = p.beta;
16
17 n_color = config.n_color();
18
19 ss_tau = gf<imtime>({beta, Boson, p.n_tau_chi2}, {1, 1});
20 ss_tau() = 0;
21 Z = 0;
22 }
23
24 // -------------------------------------
25
26 void Sperp_tau::accumulate(double s) {
27
28 LOG("\n =================== MEASURE < S_x S_x > (tau) ================ \n");
29
30 Z += s;
31
32 for (auto const &[k, line] : itertools::enumerate(config.Jperp_list)) {
33 auto dtau1 = double(line.tau_Splus - line.tau_Sminus);
34 auto dtau2 = double(line.tau_Sminus - line.tau_Splus);
35 ss_tau[closest_mesh_pt(dtau1)] += 0.5 / (real(wdata.Jperp(dtau1)(0, 0)));
36 ss_tau[closest_mesh_pt(dtau2)] += 0.5 / (real(wdata.Jperp(dtau2)(0, 0)));
37 }
38 }
39
40 // -------------------------------------
41
42 void Sperp_tau::collect_results(mpi::communicator const &c) {
43
44 Z = mpi::all_reduce(Z, c);
45
46 ss_tau = mpi::all_reduce(ss_tau, c);
47 ss_tau = ss_tau / (-beta * Z * ss_tau.mesh().delta());
48
49 // Fix the point at zero and beta
50 ss_tau[0] *= 2;
51 ss_tau[ss_tau.mesh().size() - 1] *= 2;
52
53 // store the result (not reused later, hence we can move it).
54 results.Sperp_tau = std::move(ss_tau);
55 }
56
57} // namespace triqs_ctseg::measures