dgamore.nonlocal_sde#

Non-local ladder DGA step — the parallel-heavy core of the code. Starting from the local irreducible vertex \(\Gamma_{r}\) and the bare interaction, the functions here build, per momentum \(q\) and spin channel, the bubble \(\chi_0^q\), the auxiliary susceptibility \(\chi^{*;q}_{r}\), the three-leg vertex \(\gamma^q_{r}\), the physical susceptibility \(\chi^q_{r}\) (with shell and optional \(\lambda\)-correction) and the self-energy kernel, then contract the kernel with the Green’s function to get the momentum-dependent self-energy \(\Sigma(k, \nu)\). Several CPU/GPU/FFT variants of the heavy contractions are provided, distributed over MPI ranks. The whole thing is wrapped in a self-consistency loop with chemical- potential adjustment and self-energy mixing (linear / Pulay / Anderson). Equation numbers refer to the author’s master’s thesis (Chapters 3 & 4).

Functions

apply_mixing_strategy(sigma_new, sigma_old, ...)

Applies the self-energy mixing strategy for the self-consistency loop.

calculate_and_save_chi_q_r_rpa(...)

Calculates and saves the RPA susceptibility (for both density and magnetic channels) from the DMFT Green's functions, \(\chi_{d/m;\mathrm{RPA}} = \chi_0 (1 + U_{d/m}\chi_0)^{-1} = (\chi_0^{-1} + U_{d/m})^{-1}\).

calculate_kernel_r_q(vrg_q_r, ...)

Returns the kernel for the self-energy calculation minus 2/3 times the identity if the channel is the magnetic channel (due to the extra factor of \(U_{ah21}\) in Eq.

calculate_self_energy_q(comm, u_loc, ...)

Runs the non-local DGA self-energy calculation.

calculate_sigma_dc_kernel(f_dc_loc, gchi0_q, ...)

Returns the double-counting kernel for the self-energy calculation, contracting the local full vertex with the momentum-dependent bubble per q-point.

calculate_sigma_from_kernel(kernel, giwk, ...)

Returns \(\Sigma_{ij}^{k} = -\frac{1}{2\beta N_q} \sum_q U^q_{r;aibc} K_{r;cbjd}^{q\nu} G_{ad}^{\omega-\nu}\).

calculate_sigma_from_kernel_auto(...)

Dispatches the q-loop self-energy contraction to the GPU (calculate_sigma_from_kernel_gpu()) when CuPy and a usable CUDA device are available (one GPU per MPI rank, round-robin), otherwise falls back to the CPU implementation (calculate_sigma_from_kernel_cpu()).

calculate_sigma_from_kernel_cpu(kernel, ...)

Returns \(\Sigma_{ij}^{k} = -\frac{1}{2\beta N_q} \sum_q U^q_{r;aibc} K_{r;cbjd}^{q\nu} G_{ad}^{\omega-\nu}\).

calculate_sigma_from_kernel_fft(mpi_dist, ...)

Dispatches one bosonic-frequency FFT pass to the GPU (calculate_sigma_from_kernel_fft_gpu()) or CPU (calculate_sigma_from_kernel_fft_cpu()) implementation according to use_gpu (decided once by select_sigma_fft_device(), so no per-pass GPU-detection logging).

calculate_sigma_from_kernel_fft_cpu(...)

Computes the self-energy using distributed FFTs (CPU).

calculate_sigma_from_kernel_fft_gpu(...)

Computes the self-energy using distributed FFTs, running on the GPU (CuPy).

calculate_sigma_from_kernel_gpu(kernel, ...)

Returns \(\Sigma_{ij}^{k} = -\frac{1}{2\beta N_q} \sum_q U^q_{r;aibc} K_{r;cbjd}^{q\nu} G_{ad}^{\omega-\nu}\).

calculate_sigma_kernel_r_q(gamma_r, ...)

Returns the kernel for the self-energy calculation in a specific spin channel.

create_auxiliary_chi_r_q(gamma_r, ...)

Returns the auxiliary susceptibility, see Eq.

create_auxiliary_chi_r_q_sum_v1(gamma_r, ...)

Returns the sum over the auxiliary susceptibility, see Eq.

create_auxiliary_chi_r_q_sum_v2(gamma_r, ...)

Returns the sum over the auxiliary susceptibility, see Eq.

create_auxiliary_chi_r_q_sum_v3(gamma_r, ...)

Returns the sum over the auxiliary susceptibility, see Eq.

create_generalized_chi_q_with_shell_correction(...)

Calculates the generalized susceptibility with the shell correction as described by Motoharu Kitatani et al. 2022 J.

create_vrg_r_q(gchi_aux_q_r_sum, gchi0_q_inv)

Returns the momentum-dependent three-leg vertex, see Eq.

get_hartree_fock(u_loc, v_nonloc, q_list)

Returns the Hartree-Fock term separately for the local and non-local interaction.

get_starting_sigma(default_sigma)

Tries to retrieve the last calculated self-energy from a previous self-consistency calculation as a starting point for the next calculation.

perform_lambda_correction(chi_phys_q_r)

Performs the \(\lambda\)-correction on the physical susceptibility.

perform_ornstein_zernike_fit(chi_phys_q_r)

Fits the static (\(\omega = 0\)) physical susceptibility to an Ornstein-Zernike form \(\chi(q) = A / (\xi^{-2} + (q - q_0)^2)\) around the antiferromagnetic wave vector \(q_0 = (\pi, \pi, 0)\), per orbital combination, and writes the amplitude \(A\) and correlation length \(\xi\) to oz_coeff.txt.

read_last_n_sigmas_from_files(n[, ...])

Reads the last n total self-energies from the output directory and - if specified - the previous self-consistency path.

select_sigma_fft_device(mpi_distributor)

Detects whether CuPy and a usable CUDA device are available (one GPU per MPI rank, round-robin), selects this rank's GPU and logs the decision once.

dgamore.nonlocal_sde.apply_mixing_strategy(sigma_new: SelfEnergy, sigma_old: SelfEnergy, sigma_dmft: SelfEnergy, current_iter: int) SelfEnergy[source]#

Applies the self-energy mixing strategy for the self-consistency loop. Supports linear mixing as well as the accelerated Pulay (DIIS) and Anderson schemes (which use the self-energy history read from file); the accelerated schemes fall back to linear mixing when their least-squares problem is ill-conditioned or the history is too short. The mixing strategy and parameters are taken from the config.

Parameters:
  • sigma_new (SelfEnergy) – The freshly computed self-energy proposal.

  • sigma_old (SelfEnergy) – The previous iteration’s self-energy.

  • sigma_dmft (SelfEnergy) – The DMFT self-energy (used to seed the proposal history for the accelerated schemes).

  • current_iter (int) – The current self-consistency iteration number.

Returns:

The mixed SelfEnergy for the next iteration.

Return type:

SelfEnergy

dgamore.nonlocal_sde.calculate_and_save_chi_q_r_rpa(gchi0_q_core_inv: FourPoint, u_loc: LocalInteraction, v_nonloc: Interaction, mpi_dist_irrk: MpiDistributor)[source]#

Calculates and saves the RPA susceptibility (for both density and magnetic channels) from the DMFT Green’s functions, \(\chi_{d/m;\mathrm{RPA}} = \chi_0 (1 + U_{d/m}\chi_0)^{-1} = (\chi_0^{-1} + U_{d/m})^{-1}\). The result is gathered to rank 0 and written to file.

Parameters:
  • gchi0_q_core_inv (FourPoint) – The inverse bare bubble \((\chi_0^q)^{-1}\) (core box).

  • u_loc (LocalInteraction) – The bare local interaction \(U\).

  • v_nonloc (Interaction) – The non-local interaction \(V^{q}\).

  • mpi_dist_irrk (MpiDistributor) – MPI distributor over the irreducible BZ q-points (see MpiDistributor).

Returns:

None.

dgamore.nonlocal_sde.calculate_kernel_r_q(vrg_q_r: FourPoint, gchi_aux_q_r_sum: FourPoint, v_nonloc: Interaction, u_loc: LocalInteraction) FourPoint[source]#

Returns the kernel for the self-energy calculation minus 2/3 times the identity if the channel is the magnetic channel (due to the extra factor of \(U_{ah21}\) in Eq. (4.29) in my master’s thesis),

\[K = \gamma_{r;abcd}^{q\nu} - \gamma_{r;abef}^{q\nu} U^{q}_{r;fehg} \chi_{r;ghcd}^{q}.\]
Parameters:
  • vrg_q_r (FourPoint) – The momentum-dependent three-leg vertex \(\gamma^q_{r}\).

  • gchi_aux_q_r_sum (FourPoint) – The (shell-corrected) physical susceptibility \(\chi^{q}_{r}\).

  • v_nonloc (Interaction) – The non-local interaction \(V^{q}\).

  • u_loc (LocalInteraction) – The bare local interaction \(U\).

Returns:

The self-energy kernel \(U_r K\) as a FourPoint.

Return type:

FourPoint

dgamore.nonlocal_sde.calculate_self_energy_q(comm: mpi4py.MPI.Comm, u_loc: LocalInteraction, v_nonloc: Interaction, sigma_dmft: SelfEnergy, sigma_local: SelfEnergy) SelfEnergy[source]#

Runs the non-local DGA self-energy calculation. Calculates the Hartree- and Fock terms, the bubble, the double-counting correction and the kernel in the density and magnetic channel. Finally, calculates the non-local self-energy from the kernel and the Green’s function. Also takes care of the self-consistency loop and the chemical potential adjustment as well as the self-energy mixing, etc.

Parameters:
  • comm (mpi4py.MPI.Comm) – The MPI communicator.

  • u_loc (LocalInteraction) – The bare local interaction \(U\).

  • v_nonloc (Interaction) – The non-local interaction \(V^{q}\).

  • sigma_dmft (SelfEnergy) – The DMFT self-energy (used as the starting point and for the shell/tail correction).

  • sigma_local (SelfEnergy) – The locally recomputed self-energy (used for the double-counting \(\Delta\Sigma\)).

Returns:

The converged (or last-iteration) momentum-dependent DGA SelfEnergy.

Return type:

SelfEnergy

dgamore.nonlocal_sde.calculate_sigma_dc_kernel(f_dc_loc: LocalFourPoint, gchi0_q: FourPoint, u_loc: LocalInteraction) FourPoint[source]#

Returns the double-counting kernel for the self-energy calculation, contracting the local full vertex with the momentum-dependent bubble per q-point. For details, see Eq. (4.28) in my master’s thesis.

Parameters:
  • f_dc_loc (LocalFourPoint) – The local full vertex \(F\) used for the double-counting correction.

  • gchi0_q (FourPoint) – The momentum-dependent bare bubble \(\chi_0^q\).

  • u_loc (LocalInteraction) – The bare local interaction \(U\).

Returns:

The double-counting kernel as a FourPoint, cut to the core fermionic box.

Return type:

FourPoint

dgamore.nonlocal_sde.calculate_sigma_from_kernel(kernel: FourPoint, giwk: GreensFunction, my_full_q_list: ndarray) SelfEnergy[source]#

Returns \(\Sigma_{ij}^{k} = -\frac{1}{2\beta N_q} \sum_q U^q_{r;aibc} K_{r;cbjd}^{q\nu} G_{ad}^{\omega-\nu}\). For very large momentum grids, this function is the slowest part compared to the rest of the code due to the repeated loops. Potential speed-ups could be achieved by batching the q-points or using numba.

Parameters:
  • kernel (FourPoint) – The self-energy kernel \(K\) (full BZ, scattered across ranks).

  • giwk (GreensFunction) – The momentum-dependent GreensFunction.

  • my_full_q_list (ndarray) – Array of integer q-point index triplets handled by this rank.

Returns:

The rank-local contribution to the non-local SelfEnergy (compressed q, full niv range).

Return type:

SelfEnergy

dgamore.nonlocal_sde.calculate_sigma_from_kernel_auto(mpi_distributor: MpiDistributor, kernel: FourPoint, giwk: GreensFunction, my_full_q_list: ndarray) SelfEnergy[source]#

Dispatches the q-loop self-energy contraction to the GPU (calculate_sigma_from_kernel_gpu()) when CuPy and a usable CUDA device are available (one GPU per MPI rank, round-robin), otherwise falls back to the CPU implementation (calculate_sigma_from_kernel_cpu()).

Parameters:
  • mpi_distributor (MpiDistributor) – MPI distributor used to choose the per-rank GPU (see MpiDistributor).

  • kernel (FourPoint) – The self-energy kernel \(K\) (full BZ, scattered across ranks).

  • giwk (GreensFunction) – The momentum-dependent GreensFunction.

  • my_full_q_list (ndarray) – Array of integer q-point index triplets handled by this rank.

Returns:

The rank-local contribution to the non-local SelfEnergy.

Return type:

SelfEnergy

dgamore.nonlocal_sde.calculate_sigma_from_kernel_cpu(kernel: FourPoint, giwk: GreensFunction, my_full_q_list: ndarray) SelfEnergy[source]#

Returns \(\Sigma_{ij}^{k} = -\frac{1}{2\beta N_q} \sum_q U^q_{r;aibc} K_{r;cbjd}^{q\nu} G_{ad}^{\omega-\nu}\). For very large momentum grids, this function is the slowest part compared to the rest of the code due to the repeated loops. There is no real way to speed it up further without leveraging GPUs or other hardware accelerators. This is the CPU implementation (Fortran-ordered buffers, preallocated accumulator).

Parameters:
  • kernel (FourPoint) – The self-energy kernel \(K\) (full BZ, scattered across ranks).

  • giwk (GreensFunction) – The momentum-dependent GreensFunction.

  • my_full_q_list (ndarray) – Array of integer q-point index triplets handled by this rank.

Returns:

The rank-local contribution to the non-local SelfEnergy (compressed q, full niv range).

Return type:

SelfEnergy

dgamore.nonlocal_sde.calculate_sigma_from_kernel_fft(mpi_dist: MpiDistributor, kernel: FourPoint, giwk: GreensFunction, niw_index_w_pairs: list[tuple[int, int]], use_gpu: bool) SelfEnergy[source]#

Dispatches one bosonic-frequency FFT pass to the GPU (calculate_sigma_from_kernel_fft_gpu()) or CPU (calculate_sigma_from_kernel_fft_cpu()) implementation according to use_gpu (decided once by select_sigma_fft_device(), so no per-pass GPU-detection logging).

Parameters:
Returns:

The rank-local R-space SelfEnergy.

Return type:

SelfEnergy

dgamore.nonlocal_sde.calculate_sigma_from_kernel_fft_cpu(mpi_dist: MpiDistributor, kernel: FourPoint, giwk: GreensFunction, niw_index_w_pairs: list[tuple[int, int]]) SelfEnergy[source]#

Computes the self-energy using distributed FFTs (CPU). Replaces the q-loop with a real-space pointwise multiplication: both the Green’s function and the kernel are FFT’d to real space (the kernel to \(-R\) via the conjugate trick), contracted pointwise per rank-local R-slice, and accumulated. Returns \(\Sigma\) in R-space, positive-\(\nu\) half only; the caller must ifft over \((k_x, k_y, k_z)\) and then call SelfEnergy.to_full_niv_range() before use.

This contracts a single bosonic-frequency half (positive-w or negative-w) so the full-BZ kernel is never materialized over the full niw range (see LocalNPoint.to_negative_niw_range()): the kernel is consumed in whatever niw orientation it is handed (no internal to_full_niw_range), and niw_index_w_pairs selects which kernel w-slices to contract and how to shift the Green’s function.

Parameters:
  • mpi_dist (MpiDistributor) – MPI distributor providing the communicator and R-space pencil decomposition.

  • kernel (FourPoint) – The self-energy kernel \(K\) for one niw half (full BZ): the positive half (w >= 0) or the negative block from LocalNPoint.to_negative_niw_range() (w = 0, -1, ..., -niw).

  • giwk (GreensFunction) – The momentum-dependent GreensFunction.

  • niw_index_w_pairs (list[tuple[int, int]]) – The (kernel_w_index, w) pairs to contract. The positive pass passes [(i, i) for i in range(niw + 1)] (w = 0..+niw), the negative pass [(i, -i) for i in range(1, niw + 1)] (w = -1..-niw, skipping the w = 0 duplicate).

Returns:

The rank-local R-space SelfEnergy (compressed q, half niv range, moments not fitted).

Return type:

SelfEnergy

dgamore.nonlocal_sde.calculate_sigma_from_kernel_fft_gpu(mpi_dist: MpiDistributor, kernel: FourPoint, giwk: GreensFunction, niw_index_w_pairs: list[tuple[int, int]]) SelfEnergy[source]#

Computes the self-energy using distributed FFTs, running on the GPU (CuPy). Same algorithm as calculate_sigma_from_kernel_fft_cpu() (including the single-niw-half / niw_index_w_pairs contraction). Returns \(\Sigma\) in R-space, positive-\(\nu\) half only; the caller must ifft over \((k_x, k_y, k_z)\) and then call SelfEnergy.to_full_niv_range() before use.

Parameters:
  • mpi_dist (MpiDistributor) – MPI distributor providing the communicator and R-space pencil decomposition.

  • kernel (FourPoint) – The self-energy kernel \(K\) for one niw half (full BZ): the positive half or the negative block from LocalNPoint.to_negative_niw_range().

  • giwk (GreensFunction) – The momentum-dependent GreensFunction.

  • niw_index_w_pairs (list[tuple[int, int]]) – The (kernel_w_index, w) pairs to contract (see calculate_sigma_from_kernel_fft_cpu()).

Returns:

The rank-local R-space SelfEnergy (compressed q, half niv range, moments not fitted).

Return type:

SelfEnergy

dgamore.nonlocal_sde.calculate_sigma_from_kernel_gpu(kernel: FourPoint, giwk: GreensFunction, my_full_q_list: ndarray) SelfEnergy[source]#

Returns \(\Sigma_{ij}^{k} = -\frac{1}{2\beta N_q} \sum_q U^q_{r;aibc} K_{r;cbjd}^{q\nu} G_{ad}^{\omega-\nu}\). For very large momentum grids, this function is the slowest part compared to the rest of the code due to the repeated loops. This is the GPU implementation using CuPy.

Parameters:
  • kernel (FourPoint) – The self-energy kernel \(K\) (full BZ, scattered across ranks).

  • giwk (GreensFunction) – The momentum-dependent GreensFunction.

  • my_full_q_list (ndarray) – Array of integer q-point index triplets handled by this rank.

Returns:

The rank-local contribution to the non-local SelfEnergy (compressed q, full niv range).

Return type:

SelfEnergy

dgamore.nonlocal_sde.calculate_sigma_kernel_r_q(gamma_r: LocalFourPoint, gchi0_q_inv: FourPoint, gchi0_q_full_sum: FourPoint, gchi0_q_core_sum: FourPoint, u_loc: LocalInteraction, v_nonloc: Interaction, mpi_dist_irrq: MpiDistributor) FourPoint[source]#

Returns the kernel for the self-energy calculation in a specific spin channel. Calculates the auxiliary susceptibility, the three-leg vertex and the physical susceptibility with shell correction. Also performs a \(\lambda\)-correction on the physical susceptibility if specified in the config for single-band input. Saves the physical susceptibility (and, if Eliashberg is enabled, the intermediate vertices) to file.

Parameters:
  • gamma_r (LocalFourPoint) – The local irreducible vertex \(\Gamma_{r}\).

  • gchi0_q_inv (FourPoint) – The inverse bare bubble \((\chi_0^q)^{-1}\) (core box).

  • gchi0_q_full_sum (FourPoint) – The frequency-summed bare bubble over the full box.

  • gchi0_q_core_sum (FourPoint) – The frequency-summed bare bubble over the core box.

  • u_loc (LocalInteraction) – The bare local interaction \(U\).

  • v_nonloc (Interaction) – The non-local interaction \(V^{q}\).

  • mpi_dist_irrq (MpiDistributor) – MPI distributor over the irreducible BZ q-points (see MpiDistributor).

Returns:

The self-energy kernel for this channel as a FourPoint.

Return type:

FourPoint

dgamore.nonlocal_sde.create_auxiliary_chi_r_q(gamma_r: LocalFourPoint, gchi0_q_inv: FourPoint, u_loc: LocalInteraction, v_nonloc: Interaction) FourPoint[source]#

Returns the auxiliary susceptibility, see Eq. (3.60) in my master’s thesis,

\[\chi^{*;q\nu\nu'}_{r;abcd} = ((\chi_{0;abcd}^{q\nu})^{-1} + (\Gamma_{r;abcd}^{\omega\nu\nu'}-U_{r;abcd}-V_{r;abcd}^q)/\beta^2)^{-1}.\]
Parameters:
  • gamma_r (LocalFourPoint) – The local irreducible vertex \(\Gamma_{r}\).

  • gchi0_q_inv (FourPoint) – The inverse bare bubble \((\chi_0^q)^{-1}\) (core box).

  • u_loc (LocalInteraction) – The bare local interaction \(U\).

  • v_nonloc (Interaction) – The non-local interaction \(V^{q}\).

Returns:

The momentum-dependent auxiliary susceptibility \(\chi^{*;q}_{r}\) as a FourPoint.

Return type:

FourPoint

dgamore.nonlocal_sde.create_auxiliary_chi_r_q_sum_v1(gamma_r: LocalFourPoint, gchi0_q_inv: FourPoint, u_loc: LocalInteraction, v_nonloc: Interaction) FourPoint[source]#

Returns the sum over the auxiliary susceptibility, see Eq. (3.60) in my master’s thesis. This variant inverts and sums over the last fermionic frequency in one fused step (see FourPoint.invert_and_sum_over_last_vn()),

\[\sum_{\nu'}\chi^{*;q\nu\nu'}_{r;abcd} = \sum_{\nu'}((\chi_{0;abcd}^{q\nu})^{-1} + (\Gamma_{r;abcd}^{\omega\nu\nu'}-U_{r;abcd}-V_{r;abcd}^q)/\beta^2)^{-1}.\]
Parameters:
  • gamma_r (LocalFourPoint) – The local irreducible vertex \(\Gamma_{r}\).

  • gchi0_q_inv (FourPoint) – The inverse bare bubble \((\chi_0^q)^{-1}\) (core box).

  • u_loc (LocalInteraction) – The bare local interaction \(U\).

  • v_nonloc (Interaction) – The non-local interaction \(V^{q}\).

Returns:

The frequency-summed auxiliary susceptibility \(\sum_{\nu'}\chi^{*;q}_{r}\) as a FourPoint.

Return type:

FourPoint

dgamore.nonlocal_sde.create_auxiliary_chi_r_q_sum_v2(gamma_r: LocalFourPoint, gchi0_q_inv: FourPoint, u_loc: LocalInteraction, v_nonloc: Interaction, mpi_dist_irrq: MpiDistributor) FourPoint[source]#

Returns the sum over the auxiliary susceptibility, see Eq. (3.60) in my master’s thesis. This variant loops over the rank-local q-points (capping peak memory to one q at a time) and uses the standard fused invert-and-sum per q (see FourPoint.invert_and_sum_over_last_vn()),

\[\sum_{\nu'}\chi^{*;q\nu\nu'}_{r;abcd} = \sum_{\nu'}((\chi_{0;abcd}^{q\nu})^{-1} + (\Gamma_{r;abcd}^{\omega\nu\nu'}-U_{r;abcd}-V_{r;abcd}^q)/\beta^2)^{-1}.\]
Parameters:
  • gamma_r (LocalFourPoint) – The local irreducible vertex \(\Gamma_{r}\).

  • gchi0_q_inv (FourPoint) – The inverse bare bubble \((\chi_0^q)^{-1}\) (core box).

  • u_loc (LocalInteraction) – The bare local interaction \(U\).

  • v_nonloc (Interaction) – The non-local interaction \(V^{q}\).

  • mpi_dist_irrq (MpiDistributor) – MPI distributor over the irreducible BZ q-points (see MpiDistributor).

Returns:

The frequency-summed auxiliary susceptibility \(\sum_{\nu'}\chi^{*;q}_{r}\) as a FourPoint.

Return type:

FourPoint

dgamore.nonlocal_sde.create_auxiliary_chi_r_q_sum_v3(gamma_r: LocalFourPoint, gchi0_q_inv: FourPoint, u_loc: LocalInteraction, v_nonloc: Interaction, mpi_dist_irrq: MpiDistributor) FourPoint[source]#

Returns the sum over the auxiliary susceptibility, see Eq. (3.60) in my master’s thesis. This is the most memory-lean variant: it loops over the rank-local q-points and uses the highly memory-efficient linear-solver-based fused invert-and-sum per q (see FourPoint.invert_and_sum_over_last_vn_v2()),

\[\sum_{\nu'}\chi^{*;q\nu\nu'}_{r;abcd} = \sum_{\nu'}((\chi_{0;abcd}^{q\nu})^{-1} + (\Gamma_{r;abcd}^{\omega\nu\nu'}-U_{r;abcd}-V_{r;abcd}^q)/\beta^2)^{-1}.\]
Parameters:
  • gamma_r (LocalFourPoint) – The local irreducible vertex \(\Gamma_{r}\).

  • gchi0_q_inv (FourPoint) – The inverse bare bubble \((\chi_0^q)^{-1}\) (core box).

  • u_loc (LocalInteraction) – The bare local interaction \(U\).

  • v_nonloc (Interaction) – The non-local interaction \(V^{q}\).

  • mpi_dist_irrq (MpiDistributor) – MPI distributor over the irreducible BZ q-points (see MpiDistributor).

Returns:

The frequency-summed auxiliary susceptibility \(\sum_{\nu'}\chi^{*;q}_{r}\) as a FourPoint.

Return type:

FourPoint

dgamore.nonlocal_sde.create_generalized_chi_q_with_shell_correction(gchi_aux_q_sum: FourPoint, gchi0_q_full_sum: FourPoint, gchi0_q_core_sum: FourPoint, u_loc: LocalInteraction, v_nonloc: Interaction) FourPoint[source]#

Calculates the generalized susceptibility with the shell correction as described by Motoharu Kitatani et al. 2022 J. Phys. Mater. 5 034005; DOI 10.1088/2515-7639/ac7e6d. Eq. A.15. See also Sec. 3.7.2 in my master’s thesis for details.

Parameters:
  • gchi_aux_q_sum (FourPoint) – The frequency-summed auxiliary susceptibility \(\sum_{\nu\nu'}\chi^{*;q}_{r}\).

  • gchi0_q_full_sum (FourPoint) – The frequency-summed bare bubble over the full box.

  • gchi0_q_core_sum (FourPoint) – The frequency-summed bare bubble over the core box.

  • u_loc (LocalInteraction) – The bare local interaction \(U\).

  • v_nonloc (Interaction) – The non-local interaction \(V^{q}\).

Returns:

The shell-corrected physical susceptibility \(\chi^{q}_{r}\) as a FourPoint.

Return type:

FourPoint

dgamore.nonlocal_sde.create_vrg_r_q(gchi_aux_q_r_sum: FourPoint, gchi0_q_inv: FourPoint) FourPoint[source]#

Returns the momentum-dependent three-leg vertex, see Eq. (3.63) in my master’s thesis, \(\gamma_{r;abcd}^{q\nu} = \beta (\chi^{q\nu\nu}_{0;ablm})^{-1} (\sum_{\nu'} \chi^{*;q\nu\nu'}_{r;mlcd})\).

Parameters:
  • gchi_aux_q_r_sum (FourPoint) – The frequency-summed auxiliary susceptibility \(\sum_{\nu'}\chi^{*;q}_{r}\).

  • gchi0_q_inv (FourPoint) – The inverse bare bubble \((\chi_0^q)^{-1}\) (core box).

Returns:

The three-leg vertex \(\gamma^q_{r}\) (vrg) as a FourPoint.

Return type:

FourPoint

dgamore.nonlocal_sde.get_hartree_fock(u_loc: LocalInteraction, v_nonloc: Interaction, q_list: ndarray) tuple[ndarray, ndarray][source]#

Returns the Hartree-Fock term separately for the local and non-local interaction. Since we are always SU(2)-symmetric, the sum over the spins of the first term in Eq. (4.55) in Anna Galler’s thesis results in a simple factor of 2. This can be seen in my master’s thesis, Eq. (3.55). The Hartree-Fock term is given by

\[\Sigma_{HF}^k = 2(U_{acbd} + V^{q=0}_{acbd}) n_{dc} - 1/N_q \sum_q (U_{adcb} + V^{q}_{adcb}) n^{k-q}_{dc}\]

where the Hartree term reads \(\Sigma_{H} = 2(U_{acbd} + V^{q=0}_{acbd}) n_{dc}\) and the Fock term reads \(\Sigma_{F}^k = - 1/N_q \sum_q (U_{adcb} + V^{q}_{adcb}) n^{k-q}_{dc}\). The Hartree contraction uses the middle-index-swapped U_{acbd} so it picks up the inter-orbital density \(U'\) (stored at \(U_{abab}\)); see dgamore.local_sde.get_local_hartree_fock(). Processes the Fock term for each individual orbital to save memory, as for high momentum grids, the occ_qk property can become large.

Parameters:
  • u_loc (LocalInteraction) – The bare local interaction \(U\).

  • v_nonloc (Interaction) – The non-local interaction \(V^{q}\) (see Interaction).

  • q_list (ndarray) – Array of integer q-point index triplets handled by this rank.

Returns:

The tuple (hartree, fock) of self-energy contributions, broadcastable to [k, o1, o2, v].

Return type:

tuple[ndarray, ndarray]

dgamore.nonlocal_sde.get_starting_sigma(default_sigma: SelfEnergy) tuple[SelfEnergy, int][source]#

Tries to retrieve the last calculated self-energy from a previous self-consistency calculation as a starting point for the next calculation. Whether the normal or interpolated sigma is chosen depends on the setting. If no sigma_dga_*_N.npy file is found, we use the DMFT self-energy as a starting point.

Parameters:

default_sigma (SelfEnergy) – The fallback (DMFT) SelfEnergy used when no previous result is found.

Returns:

A tuple of the starting SelfEnergy (cut to the core box and interpolated onto the k-grid) and the iteration number it was taken from (0 if none found).

Return type:

tuple[SelfEnergy, int]

dgamore.nonlocal_sde.perform_lambda_correction(chi_phys_q_r: FourPoint) FourPoint[source]#

Performs the \(\lambda\)-correction on the physical susceptibility. If ‘spch’ is specified, the lambda correction will be performed on both the density and magnetic channel whereas only the magnetic channel will be corrected if ‘sp’ is specified as \(\lambda\)-correction type in the corresponding config. The local susceptibility sum-rule target is read from the saved local susceptibilities, and the determined \(\lambda\) is appended to a text file.

Parameters:

chi_phys_q_r (FourPoint) – The momentum-dependent physical susceptibility \(\chi^{q}_{r}\) to correct.

Returns:

The \(\lambda\)-corrected physical susceptibility (unchanged for the ‘sp’ type in non-magnetic channels).

Raises:

ValueError – If the configured lambda-correction type is neither ‘spch’ nor ‘sp’.

Return type:

FourPoint

dgamore.nonlocal_sde.perform_ornstein_zernike_fit(chi_phys_q_r: FourPoint) None[source]#

Fits the static (\(\omega = 0\)) physical susceptibility to an Ornstein-Zernike form \(\chi(q) = A / (\xi^{-2} + (q - q_0)^2)\) around the antiferromagnetic wave vector \(q_0 = (\pi, \pi, 0)\), per orbital combination, and writes the amplitude \(A\) and correlation length \(\xi\) to oz_coeff.txt. Non-converging fits are flagged with [-1, -1].

Parameters:

chi_phys_q_r (FourPoint) – The momentum-dependent physical susceptibility \(\chi^{q}_{r}\) (irreducible BZ).

Returns:

None.

Return type:

None

dgamore.nonlocal_sde.read_last_n_sigmas_from_files(n: int, output_path: str = './', previous_sc_path: str = './') list[ndarray][source]#

Reads the last n total self-energies from the output directory and - if specified - the previous self-consistency path. This is used for the Pulay/Anderson mixing schemes. If one has a history of self-energies from a previous calculation, these will be used as well.

Parameters:
  • n (int) – Number of most recent self-energies to read.

  • output_path (str) – Directory holding the current run’s sigma_dga_iteration_*.npy files.

  • previous_sc_path (str) – Directory of a previous self-consistency run to prepend to the history (if set).

Returns:

A list of self-energy arrays (cut to the core box and interpolated onto the k-grid), oldest first.

Return type:

list[ndarray]

dgamore.nonlocal_sde.select_sigma_fft_device(mpi_distributor: MpiDistributor) bool[source]#

Detects whether CuPy and a usable CUDA device are available (one GPU per MPI rank, round-robin), selects this rank’s GPU and logs the decision once. Intended to be called a single time before the positive- and negative-w FFT passes so the GPU-detection message is not emitted per pass.

Parameters:

mpi_distributor (MpiDistributor) – MPI distributor providing the per-rank GPU choice.

Returns:

True if the GPU implementation should be used, False to fall back to the CPU implementation.

Return type:

bool