TRIQS/triqs_modest 3.3.0
Brillouin zone summation
Loading...
Searching...
No Matches
printing.cpp
Go to the documentation of this file.
1// Copyright (c) 2025--present, The Simons Foundation
2// This file is part of TRIQS/modest 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#include "./downfolding.hpp"
8#include <fmt/ranges.h>
9
10namespace triqs::modest {
11
12 // ----------------------------- PRINT FUNCTIONS ---------------------------------------------
13
14 std::ostream &operator<<(std::ostream &out, band_dispersion const &x) {
15 out << "Band dispersion ε^σ(k) on a grid [band_dispersion]:\n";
16 auto out1 = indented_ostream(out, 2);
17 out1 << fmt::format("Number of bands (max): {}\n", x.H_k.extent(3));
18 out1 << fmt::format("Represented on a fixed grid of {} points.\n", x.n_k());
19 out1 << fmt::format("Shape of H[k_idx, σ, ν, ν'] = {}\n", x.H_k.shape());
20 out1 << fmt::format("ε^σ(k) is matrix valued? = {}\n", x.matrix_valued);
21 return out;
22 }
23
24 // ---------------------------------------------------------------------------------------------
25
26 std::ostream &operator<<(std::ostream &out, downfolding_projector const &x) {
27 out << "Downfolding projector P^σ_mν(k) on a grid [downfolding_projector]:\n";
28 auto out1 = indented_ostream(out, 2);
29 out1 << fmt::format("Shape of P[k_idx, σ, m, ν] = {}\n", x.P_k.shape());
30 return out;
31 }
32
33 // ---------------------------------------------------------------------------------------------
34
35 std::ostream &operator<<(std::ostream &out, local_space const &x) {
36 out << "Local space [orbital_set]:\n";
37 auto out1 = indented_ostream(out, 2); // same stream, but shifted by 2 spaces
38 auto out2 = indented_ostream(out, 4);
39 auto out3 = indented_ostream(out, 6);
40 out1 << fmt::format("Total dimension [M]: {}\n", x.dim());
41 out1 << fmt::format("Number of correlated atoms: {}\n", x.atomic_shells().size());
42 // auto ineq = 0;
43 // for (auto iatom : range(x.atomic_shells().size())) {
44 // if (x.first_shell_of_its_equiv_cls(iatom) == iatom) ineq++;
45 // }
46 auto ineq = stdr::count_if(range(x.atomic_shells().size()), //
47 [&](auto i) { return x.first_shell_of_its_equiv_cls(i) == i; });
48 out1 << fmt::format("Number of inequivalent correlated atoms = {}\n", ineq);
49
50 out1 << "Atomic decomposition:\n";
51 auto pr_vec = [](auto const &V) {
52 return fmt::format("{}\n", fmt::join(V | stdv::transform([](auto x) { return fmt::format("{:>3}", x); }), " "));
53 };
54 auto dec = x.atomic_decomposition();
55 out2 << " dim_a: " << pr_vec(dec);
56 out2 << " a: " << pr_vec(range(dec.size()));
57 auto sub = x.atoms_block_decomposition()(r_all, 0) | stdv::transform([](auto x) { return fmt::format("{}", x); });
58 out2 << "irreps: " << fmt::format("{}\n", fmt::join(sub, " "));
59 return out;
60 }
61
62 // ---------------------------------------------------------------------------------------------
63 std::ostream &operator<<(std::ostream &out, ibz_symmetry_ops const &ibz) {
64 out << "[I]rreduicible [B]rillouin [Z]one symmetry operations from the DFT code [ibz_symmetry_ops]\n";
65 auto out1 = indented_ostream(out, 2);
66 out1 << fmt::format("Number of symmetry ops: {}\n", ibz.ops.size());
67 out1 << fmt::format("Number of rotations per op: {}\n", ibz.ops[0].mats.size());
68 return out;
69 }
70
71 // ---------------------------------------------------------------------------------------------
72
73 std::ostream &operator<<(std::ostream &out, one_body_elements_on_grid const &obe) {
74 auto out1 = indented_ostream(out, 2); // same stream, but shifted by 2 spaces
75 auto out2 = indented_ostream(out, 4);
76 out << "One body elements representing a downfolding from (restricted) Bloch 𝓑 to Correlated space 𝓒 from DFT code [one_body_elements_on_grid]\n";
77 out1 << "H:\n";
78 out2 << obe.H;
79 out1 << "C_space:\n";
80 out2 << obe.C_space;
81 out1 << "P:\n";
82 out2 << obe.P;
83 out1 << fmt::format("IBZ = {}\n", bool(obe.ibz_symm_ops));
84 if (obe.ibz_symm_ops) { out2 << obe.ibz_symm_ops.value(); };
85 return out;
86 }
87
88} // namespace triqs::modest
A custom output stream that automatically indents each new line by a specified number of spaces.
Definition streams.hpp:88
Describe the atomic orbitals within downfolded space.
nda::array< std::vector< long >, 2 > const & atoms_block_decomposition() const
List of all blocks spanning 𝓒 space -> atoms_block_decomposition.
auto atomic_decomposition() const
Generates [dimension of the atomic shell].
long dim() const
Dimension of the correlated space.
std::vector< atomic_orbs > const & atomic_shells() const
List of all atomic shells spanning the 𝓒 space.
std::ostream & operator<<(std::ostream &out, one_body_elements_on_grid const &)
Definition printing.cpp:73
static constexpr auto r_all
Definition defs.hpp:40
The one-body dispersion as a function of momentum.
bool matrix_valued
Is the dispersion matrix-valued?
nda::array< dcomplex, 4 > H_k
H_k [k_idx, σ', nu, nu'].
long n_k() const
Number of k points in the grid.
The projector that downfolds the one-body dispersion (ν) onto local orbitals (m).
nda::array< dcomplex, 4 > P_k
Pk[alpha][k_idx, σ', m_alpha, nu].
A one-body elements struct where all of the underlying data exists on a fixed momentum grid.
C2PY_IGNORE std::optional< ibz_symmetry_ops > ibz_symm_ops
IBZ symmetrizer after a k-sum.