TRIQS/triqs_ctint 4.0.0
A TRIQS application
Loading...
Searching...
No Matches
dets.hpp
1// Copyright (c) 2017--present, The Simons Foundation
2// This file is part of TRIQS/ctint and is licensed under the terms of GPLv3 or later.
3// SPDX-License-Identifier: GPL-3.0-or-later
4// See LICENSE in the root of this distribution for details.
5
6#pragma once
7
8#include <ostream>
9
10namespace triqs_ctint {
11
12 using triqs::det_manip::det_manip;
13
14 //------------------------------------
15
20 template <bool dag> struct arg_t {
21
23 static constexpr bool dagger = dag;
24
27
29 int u;
30
32 int vertex_label = 0;
33
35 int pos = 0;
36
38 int s = 0;
39
41 bool operator<(arg_t const &x) const { return std::tie(tau, u, vertex_label, pos, s) < std::tie(x.tau, x.u, x.vertex_label, x.pos, x.s); }
42 };
43
44 using c_t = arg_t<false>;
45 using cdag_t = arg_t<true>;
46
47 template <bool dag> std::ostream &operator<<(std::ostream &os, arg_t<dag> const &c) {
48 os << (c.dagger ? "cdag_t{" : "c_t{") << "tau=" << c.tau << ", "
49 << "u=" << c.u << ", "
50 << "vertex_label=" << c.vertex_label << ", "
51 << "pos=" << c.pos << ", "
52 << "s=" << c.s << "}";
53 return os;
54 }
55
60 struct G0hat_t {
62 gf_const_view<imtime, g_tau_t::target_t> G0_shift_tau;
63
65 array_const_view<double, 4> alpha;
66
67 g_tau_t::target_t::scalar_t operator()(c_t const &c, cdag_t const &cdag) const {
68 // Contractions between operators of the same vertex get an alpha shift
69 // Use tau-equality to check if cdag and c are from the same vertex
70 if (c.tau == cdag.tau) {
71 auto res = G0_shift_tau[0](c.u, cdag.u) + (c.u == cdag.u ? 1 : 0) - alpha(c.vertex_label, cdag.pos, c.pos, c.s);
72 return res;
73 }
74 auto [s, dtau] = cyclic_difference(c.tau, cdag.tau);
75 auto res = G0_shift_tau[closest_mesh_pt(dtau)](c.u, cdag.u);
76 // For the equal-time case, consider the order <c cdag>
77 return s * res;
78 }
79 };
80
82 using det_t = det_manip<G0hat_t>;
83
84} // namespace triqs_ctint
array_const_view< double, 4 > alpha
The alpha function.
Definition dets.hpp:65
gf_const_view< imtime, g_tau_t::target_t > G0_shift_tau
The (shifted) non-interacting Green function.
Definition dets.hpp:62
static constexpr bool dagger
Definition dets.hpp:23
bool operator<(arg_t const &x) const
Lexicographical sorting of arg_t. This determines the order of row and columns inside the dets.
Definition dets.hpp:41