dgamore.eliashberg_solver#

Linearized Eliashberg equation solver. Starting from the ladder-DGA full vertex (saved per channel by the non-local SDE step), this module assembles the particle-particle pairing vertex in the singlet/triplet channels at \(\omega = 0\), optionally adds the local reducible diagrams, and power-iterates the linearized gap equation \(\lambda \Delta = \pm\frac{1}{2\beta N_q}\, \Gamma^{pp}\, \chi_0^{pp}\, \Delta\) via an ARPACK/Lanczos eigensolver (two variants: an in-memory one and a memory-lean frequency-distributed one). The leading eigenvalue \(\lambda\) signals the pairing instability and the eigenvector is the gap function \(\Delta(k, \nu)\). Requires nq == nk. Equation numbers refer to the author’s master’s thesis (Chapter 4).

Functions

create_full_vertex_q_r(u_loc, v_nonloc, ...)

Calculates the momentum-dependent full ladder vertex in the given channel (density or magnetic) from the saved intermediates (inverse bubble, three-leg vertex, summed auxiliary susceptibility), and transforms it to pp notation unless save_fq requests keeping the ph form.

create_full_vertex_q_r_pp_w0(u_loc, ...)

Builds the full ladder vertex (see create_full_vertex_q_r()), optionally gathers and saves it in ph notation in the irreducible BZ, and returns it transformed to pp notation at \(\omega' = 0\).

create_full_vertex_q_r_pp_w0_v2(u_loc, ...)

Builds the full ladder vertex as a memory-lean variant of create_full_vertex_q_r_pp_w0(), looping over the rank-local q-points (see create_full_vertex_q_r_v2()), optionally saving it in ph notation, and returning it in pp notation at \(\omega' = 0\).

create_full_vertex_q_r_v2(u_loc, v_nonloc, ...)

Calculates the full ladder vertex for a single q-point (memory-lean per-q variant of create_full_vertex_q_r()), transforming it to pp notation unless save_fq keeps the ph form.

create_local_ud_diagrams_pp_w0(g_dmft)

Builds the local particle-particle reducible diagrams at \(\omega = 0\) in the up-down channel: the full vertex \(F^{ud}\), the irreducible vertex \(\Gamma^{ud}\), and the reducible part \(\Phi^{ud} = F^{ud} - \Gamma^{ud}\).

delete_files(filepath, *args)

Deletes files in the given directory.

get_initial_gap_function(shape, channel)

Generates the initial gap-function guess for the power iteration, seeded with the configured momentum symmetry (d-wave / p-wave-x / p-wave-y) and the corresponding frequency parity for the singlet/triplet channel; falls back to a random guess if no symmetry is configured or recognized.

get_ranks_for_lanczos(comm)

Picks two MPI ranks on different cluster nodes (if available) so the singlet and triplet Lanczos solves can run concurrently on separate nodes; falls back to two ranks on the same node otherwise.

solve(giwk_dga, g_dmft, u_loc, v_nonloc, comm)

Drives the Eliashberg step: assembles the singlet and triplet pairing vertices from the saved ladder-DGA full vertices (optionally adding the local reducible diagrams), then solves the linearized gap equation for each channel and returns the leading eigenvalues and gap functions.

solve_eliashberg_lanczos(gamma_r_pp, ...)

Solves the linearized Eliashberg equation for the leading superconducting eigenvalue(s) and gap function(s) using an ARPACK/Lanczos eigensolver, with the pairing kernel applied matrix-free via FFTs over the BZ.

solve_eliashberg_lanczos_v2(gamma_r_pp, ...)

Solves the linearized Eliashberg equation for the leading superconducting eigenvalue(s) and gap function(s) using an ARPACK/Lanczos eigensolver.

transform_vertex_loc_frequencies_w0(f_r_loc, ...)

Transforms a local vertex from particle-hole to the modified particle-particle notation at \(\omega' = 0\) (see _transform_vertex_frequencies_w0()).

transform_vertex_q_frequencies_w0(f_q_r, niv_pp)

Transforms a momentum-dependent vertex from particle-hole to the modified particle-particle notation at \(\omega' = 0\) (see _transform_vertex_frequencies_w0()).

dgamore.eliashberg_solver.create_full_vertex_q_r(u_loc: LocalInteraction, v_nonloc: Interaction, gamma_r: LocalFourPoint, niv_pp: int, mpi_dist: MpiDistributor) FourPoint[source]#

Calculates the momentum-dependent full ladder vertex in the given channel (density or magnetic) from the saved intermediates (inverse bubble, three-leg vertex, summed auxiliary susceptibility), and transforms it to pp notation unless save_fq requests keeping the ph form. Deletes the consumed intermediate files afterwards.

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

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

  • gamma_r (LocalFourPoint) – The local irreducible vertex \(\Gamma_{r}\) for this channel.

  • niv_pp (int) – Number of positive fermionic frequencies of the pp vertex.

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

Returns:

The full ladder vertex \(F^{q}_{r}\) as a FourPoint.

Return type:

FourPoint

dgamore.eliashberg_solver.create_full_vertex_q_r_pp_w0(u_loc: LocalInteraction, v_nonloc: Interaction, gamma_r: LocalFourPoint, niv_pp: int, mpi_dist_irrk: MpiDistributor)[source]#

Builds the full ladder vertex (see create_full_vertex_q_r()), optionally gathers and saves it in ph notation in the irreducible BZ, and returns it transformed to pp notation at \(\omega' = 0\).

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

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

  • gamma_r (LocalFourPoint) – The local irreducible vertex \(\Gamma_{r}\) for this channel.

  • niv_pp (int) – Number of positive fermionic frequencies of the pp vertex.

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

Returns:

The full ladder vertex \(F^{q}_{r}\) in pp notation as a FourPoint.

dgamore.eliashberg_solver.create_full_vertex_q_r_pp_w0_v2(u_loc: LocalInteraction, v_nonloc: Interaction, gamma_r: LocalFourPoint, niv_pp: int, mpi_dist_irrk: MpiDistributor)[source]#

Builds the full ladder vertex as a memory-lean variant of create_full_vertex_q_r_pp_w0(), looping over the rank-local q-points (see create_full_vertex_q_r_v2()), optionally saving it in ph notation, and returning it in pp notation at \(\omega' = 0\).

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

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

  • gamma_r (LocalFourPoint) – The local irreducible vertex \(\Gamma_{r}\) for this channel.

  • niv_pp (int) – Number of positive fermionic frequencies of the pp vertex.

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

Returns:

The full ladder vertex \(F^{q}_{r}\) in pp notation as a FourPoint.

dgamore.eliashberg_solver.create_full_vertex_q_r_v2(u_loc: LocalInteraction, v_nonloc: Interaction, gamma_r: LocalFourPoint, gchi0_q_inv: FourPoint, vrg_q_r: FourPoint, gchi_aux_q_r_sum: FourPoint, niv_pp: int, q_index: int) FourPoint[source]#

Calculates the full ladder vertex for a single q-point (memory-lean per-q variant of create_full_vertex_q_r()), transforming it to pp notation unless save_fq keeps the ph form.

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

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

  • gamma_r (LocalFourPoint) – The local irreducible vertex \(\Gamma_{r}\) for this channel.

  • gchi0_q_inv (FourPoint) – The inverse bare bubble \((\chi_0^q)^{-1}\) over all rank-local q-points.

  • vrg_q_r (FourPoint) – The momentum-dependent three-leg vertex \(\gamma^q_{r}\).

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

  • niv_pp (int) – Number of positive fermionic frequencies of the pp vertex.

  • q_index (int) – Index of the q-point (into the rank-local list) to compute.

Returns:

The full ladder vertex \(F^{q}_{r}\) for that q-point as a FourPoint.

Return type:

FourPoint

dgamore.eliashberg_solver.create_local_ud_diagrams_pp_w0(g_dmft: GreensFunction) tuple[LocalFourPoint, LocalFourPoint, LocalFourPoint][source]#

Builds the local particle-particle reducible diagrams at \(\omega = 0\) in the up-down channel: the full vertex \(F^{ud}\), the irreducible vertex \(\Gamma^{ud}\), and the reducible part \(\Phi^{ud} = F^{ud} - \Gamma^{ud}\). These are the local diagrams subtracted/added when include_local_part is enabled, to avoid double counting the local pairing contribution.

Parameters:

g_dmft (GreensFunction) – The local (DMFT) GreensFunction.

Returns:

The tuple (f_ud_loc_pp_w0, gamma_ud_loc_pp_w0, phi_ud_loc_pp_w0) of local pp diagrams at \(\omega = 0\).

Return type:

tuple[LocalFourPoint, LocalFourPoint, LocalFourPoint]

dgamore.eliashberg_solver.delete_files(filepath: str, *args) None[source]#

Deletes files in the given directory. If a file is not found, it is ignored. The deleted files are usually temporary files that are no longer needed after the calculation is done.

Parameters:
  • filepath (str) – Directory containing the files.

  • args – One or more file names (relative to filepath) to delete.

Returns:

None.

Raises:

TypeError – If any of the given names is not a string.

Return type:

None

dgamore.eliashberg_solver.get_initial_gap_function(shape: tuple, channel: SpinChannel) ndarray[source]#

Generates the initial gap-function guess for the power iteration, seeded with the configured momentum symmetry (d-wave / p-wave-x / p-wave-y) and the corresponding frequency parity for the singlet/triplet channel; falls back to a random guess if no symmetry is configured or recognized.

Parameters:
  • shape (tuple) – Target array shape [kx, ky, kz, o1, o2, v] of the gap function.

  • channel (SpinChannel) – Pairing channel, either SpinChannel.SING or SpinChannel.TRIP.

Returns:

The initial gap-function array.

Raises:

ValueError – If channel is neither SING nor TRIP.

Return type:

ndarray

dgamore.eliashberg_solver.get_ranks_for_lanczos(comm: mpi4py.MPI.Comm) tuple[int, int][source]#

Picks two MPI ranks on different cluster nodes (if available) so the singlet and triplet Lanczos solves can run concurrently on separate nodes; falls back to two ranks on the same node otherwise.

Parameters:

comm (mpi4py.MPI.Comm) – The MPI communicator.

Returns:

The tuple (rank_for_singlet, rank_for_triplet).

Return type:

tuple[int, int]

dgamore.eliashberg_solver.solve(giwk_dga: GreensFunction, g_dmft: GreensFunction, u_loc: LocalInteraction, v_nonloc: Interaction, comm: mpi4py.MPI.Comm)[source]#

Drives the Eliashberg step: assembles the singlet and triplet pairing vertices from the saved ladder-DGA full vertices (optionally adding the local reducible diagrams), then solves the linearized gap equation for each channel and returns the leading eigenvalues and gap functions. Dispatches between the in-memory and the memory-lean Lanczos solvers depending on the memory configuration.

Parameters:
  • giwk_dga (GreensFunction) – The converged momentum-dependent DGA GreensFunction.

  • g_dmft (GreensFunction) – The local (DMFT) GreensFunction (used for the local diagrams).

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

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

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

Returns:

A tuple (lambdas_sing, lambdas_trip, gaps_sing, gaps_trip) of the singlet/triplet eigenvalues and GapFunction lists.

dgamore.eliashberg_solver.solve_eliashberg_lanczos(gamma_r_pp: FourPoint, gchi0_q0_pp: FourPoint, ranks: tuple[int, int]) tuple[list[float], list[GapFunction]][source]#

Solves the linearized Eliashberg equation for the leading superconducting eigenvalue(s) and gap function(s) using an ARPACK/Lanczos eigensolver, with the pairing kernel applied matrix-free via FFTs over the BZ. This in-memory variant holds the full-BZ pairing vertex on the solving rank.

Parameters:
  • gamma_r_pp (FourPoint) – The pairing vertex \(\Gamma^{pp}_{r}\) (irreducible BZ, pp notation) for one channel.

  • gchi0_q0_pp (FourPoint) – The bare pp bubble \(\chi_0^{pp}\) at \(\omega = 0\).

  • ranks (tuple[int, int]) – The (rank_sing, rank_trip) pair used for logging.

Returns:

A tuple (lambdas, gaps) of the leading eigenvalues and the corresponding GapFunction objects.

Return type:

tuple[list[float], list[GapFunction]]

dgamore.eliashberg_solver.solve_eliashberg_lanczos_v2(gamma_r_pp: FourPoint, gchi0_q0_pp: FourPoint, mpi_dist_v: MpiDistributor, active_ranks: list) tuple[list[float], list[GapFunction]][source]#

Solves the linearized Eliashberg equation for the leading superconducting eigenvalue(s) and gap function(s) using an ARPACK/Lanczos eigensolver. This variant distributes the gap function along the fermionic frequency axis across ranks (and performs the \(\chi_0^{pp}\) multiplication only on the root rank), so it is more memory-efficient but slower than solve_eliashberg_lanczos().

Parameters:
  • gamma_r_pp (FourPoint) – The pairing vertex \(\Gamma^{pp}_{r}\) (frequency-distributed) for one channel.

  • gchi0_q0_pp (FourPoint) – The bare pp bubble \(\chi_0^{pp}\) at \(\omega = 0\) (held on the root rank).

  • mpi_dist_v (MpiDistributor) – MPI distributor over the fermionic frequency axis (see MpiDistributor).

  • active_ranks (list) – The ranks participating in this solve; the first is used as root.

Returns:

A tuple (lambdas, gaps) of the leading eigenvalues and the corresponding GapFunction objects.

Return type:

tuple[list[float], list[GapFunction]]

dgamore.eliashberg_solver.transform_vertex_loc_frequencies_w0(f_r_loc: LocalFourPoint, niv_pp: int) LocalFourPoint[source]#

Transforms a local vertex from particle-hole to the modified particle-particle notation at \(\omega' = 0\) (see _transform_vertex_frequencies_w0()).

Parameters:
  • f_r_loc (LocalFourPoint) – The local vertex \(F\) in ph notation.

  • niv_pp (int) – Number of positive fermionic frequencies of the pp vertex.

Returns:

The transformed vertex as a LocalFourPoint (channel UD, pp notation, no bosonic axis).

Return type:

LocalFourPoint

dgamore.eliashberg_solver.transform_vertex_q_frequencies_w0(f_q_r: FourPoint, niv_pp: int) FourPoint[source]#

Transforms a momentum-dependent vertex from particle-hole to the modified particle-particle notation at \(\omega' = 0\) (see _transform_vertex_frequencies_w0()).

Parameters:
  • f_q_r (FourPoint) – The momentum-dependent vertex \(F^{q}\) in ph notation.

  • niv_pp (int) – Number of positive fermionic frequencies of the pp vertex.

Returns:

The transformed vertex as a FourPoint (pp notation, no bosonic axis, compressed q).

Return type:

FourPoint