10 constexpr auto lattice_gf(
auto const &mesh,
auto const &obe,
auto const &Proj,
auto const &mu,
auto const &embedding_decomp,
auto const &Sigma_w,
11 auto const &broadening) {
13 return [&](
auto &k_idx,
auto &sigma) {
14 auto PSP = [&](
auto &w) {
15 auto N_nu = obe.H.N_nu(sigma, k_idx);
16 auto out = nda::zeros<dcomplex>(N_nu, N_nu);
18 auto P = Proj.P(sigma, k_idx)(R,
r_all);
19 out(
r_all,
r_all) += dagger(P) * nda::matrix<dcomplex>{Sigma_w(alpha, sigma).data()(w,
r_all,
r_all)} * P;
25 for (
auto &&[n, w] : enumerate(mesh)) { out.data()(n) = trace(inverse(w +
dcomplex(0.0, broadening) + mu - obe.H.H(sigma, k_idx) - PSP(n))); }
31 block2_gf<mesh::refreq, matrix_valued>
const &Sigma_w,
double broadening) {
33 auto const &mesh = Sigma_w(0, 0).mesh();
37 auto n_w = mesh.size();
38 auto n_k = obe_theta.
H.
n_k();
40 auto embedding_decomp =
get_struct(Sigma_w).dims(
r_all, 0) | tl::to<std::vector>();
42 auto PSP = [&](
auto &w,
auto &k_idx,
auto &sigma) {
43 auto N_nu = obe_theta.
H.
N_nu(sigma, k_idx);
44 auto out = nda::zeros<dcomplex>(N_nu, N_nu);
46 auto P = Proj.
P(sigma, k_idx)(R,
r_all);
47 out(
r_all,
r_all) += dagger(P) * nda::matrix<dcomplex>{Sigma_w(alpha, sigma).data()(w,
r_all,
r_all)} * P;
52 auto Gloc = [&](
auto &k_idx,
auto &sigma) {
53 auto out = gf{mesh, {n_M, n_M}};
54 auto P = obe_theta.
P.
P(sigma, k_idx);
55 for (
auto &&[n, w] : enumerate(mesh)) {
57 P * inverse(w +
dcomplex(0.0, broadening) + mu - obe_theta.
H.
H(sigma, k_idx) - PSP(n, k_idx, sigma)) * dagger(P);
64 for (
auto k_idx : range(n_k)) {
65 for (
auto sigma : range(n_sigma)) {
70 gloc_result = mpi::all_reduce(gloc_result);
74 auto total = nda::array<double, 2>(n_sigma, n_w);
75 auto per_theta = nda::array<double, 4>(n_sigma, n_w, n_M, n_M);
77 for (
auto sigma : nda::range(n_sigma)) {
78 auto g = gloc_result(0, sigma).data();
79 auto gC = conj(gloc_result(0, sigma)).data();
80 for (
auto [n, w] : enumerate(mesh)) {
83 total(sigma, n) = (-1.0 / M_PI) * imag(trace(g(n,
r_all,
r_all)));
88 return {.total = total, .per_theta = per_theta};
92 block2_gf<mesh::refreq, matrix_valued>
const &Sigma_w,
double broadening) {
93 auto const &mesh = Sigma_w(0, 0).mesh();
95 auto n_w = mesh.size();
96 auto n_k = obe.
H.
n_k();
98 auto data = nda::array<double, 3>(n_sigma, n_k, n_w);
100 auto embedding_decomp =
get_struct(Sigma_w).dims(
r_all, 0) | tl::to<std::vector>();
102 auto Glatt =
lattice_gf(mesh, obe, obe.
P, mu, embedding_decomp, Sigma_w, broadening);
104 for (
auto k_idx : range(n_k)) {
105 for (
auto sigma : range(n_sigma)) { data(sigma, k_idx,
r_all) = (-1.0 / M_PI) * imag(Glatt(k_idx, sigma).data()); }
long n_sigma() const
Dimension of the σ index.
auto atomic_decomposition() const
Generates [dimension of the atomic shell].
long dim() const
Dimension of the correlated space.
C2PY_IGNORE gf_struct2_t Gc_block_shape() const
Shape of the Green function in the correlated space, without block decomposition.
spectral_function_w projected_spectral_function(one_body_elements_on_grid const &obe_theta, downfolding_projector const &Proj, double mu, block2_gf< mesh::refreq, matrix_valued > const &Sigma_w, double broadening)
Compute the atom- and orbital-resolved spectral function (interacting density of states).
spectral_function_kw spectral_function_on_high_symmetry_path(one_body_elements_on_grid const &obe, double mu, block2_gf< mesh::refreq, matrix_valued > const &Sigma_w, double broadening)
Compute momentum-resolved spectral function A(k, ω) along high-symmetry path.
block2_gf< Mesh, matrix_valued > make_block2_gf(Mesh const &mesh, gf_struct2_t const &gf_s)
gf_struct_t get_struct(block_gf< Mesh > const &g)
constexpr auto lattice_gf(auto const &mesh, auto const &obe, auto const &Proj, auto const &mu, auto const &embedding_decomp, auto const &Sigma_w, auto const &broadening)
static constexpr auto r_all
generator< std::pair< long, nda::range > > enumerated_sub_slices(auto sub_div)
std::complex< double > dcomplex
nda::array< double, 1 > k_weights
k_weights[k_idx]
long n_k() const
Number of k points in the grid.
long N_nu(long sigma, long k_idx) const
Number of bands #ν
nda::matrix_const_view< dcomplex > H(long sigma, long k_idx) const
H^σ(k)_ν, returned as a MATRIX in (ν, ν)
The projector that downfolds the one-body dispersion (ν) onto local orbitals (m).
nda::matrix_const_view< dcomplex > P(long sigma, long k_idx) const
P^σ(k)_mν, returned as a matrix in (m ν)
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.
Returns Tr (A) [σ,k,ω] for all k points in obe grid and all omega in Sigma mesh.