dgamore.matsubara_frequencies#

Helpers for Matsubara frequency arithmetic. MFHelper builds the integer index grids and the corresponding real bosonic/fermionic Matsubara frequencies used throughout the code, and converts particle-hole (ph) frequency triples to particle-particle (pp) notation.

class dgamore.matsubara_frequencies.FrequencyShift(*values)[source]#

Bases: Enum

Enum for the direction of an asymptotic frequency shift (used when extending a quantity beyond its core box).

Variables:
  • MINUS – Shift towards negative frequencies.

  • PLUS – Shift towards positive frequencies.

  • CENTER – Centered (symmetric) shift.

  • NONE – No shift.

class dgamore.matsubara_frequencies.MFHelper[source]#

Bases: object

Collection of static helpers for Matsubara frequency index and grid arithmetic.

static get_frequencies_for_ph_to_pp_w0_channel_conversion(niw: int, niv: int) tuple[ndarray, ndarray, ndarray][source]#

Returns the index arrays that map a particle-hole quantity onto the \(\omega = 0\) particle-particle notation, i.e. the \((\omega', \nu_1', \nu_2')\) indices such that \(F_{pp}[\omega, \nu_1, \nu_2] = F_{ph}[\omega', \nu_1', \nu_2']\) with the frequency shift \((\omega = 0, \nu_1, \nu_2) \to (\nu_1 + \nu_2, \nu_1, \nu_2)\). The returned arrays are already offset so they can be used to index directly into the full (positive-and-negative) ph frequency axes.

Parameters:
  • niw (int) – Half-width of the bosonic frequency box of the source ph quantity.

  • niv (int) – Half-width of the fermionic frequency box of the source ph quantity.

Returns:

Tuple (wn_pp, vn_pp, vpn_pp) of index arrays for the bosonic and the two fermionic axes.

Return type:

tuple[ndarray, ndarray, ndarray]

vn(niv: int, shift: int = 0, return_only_positive: bool = False) ndarray[source]#

Returns the integer fermionic Matsubara indices in the half-open interval \([-\mathrm{niv}, \mathrm{niv})\), optionally shifted. This is the index-only overload (no temperature dependence).

Parameters:
  • niv (int) – Half-width of the fermionic frequency box (number of positive fermionic frequencies).

  • shift (int) – Integer offset added to the whole index range.

  • return_only_positive (bool) – If True, return only the non-negative indices \([0, \mathrm{niv})\).

Returns:

1D integer array of fermionic Matsubara indices.

Return type:

ndarray

vn(niv: int, beta: float, shift: int = 0, return_only_positive: bool = False) -> numpy.ndarray

Returns the real fermionic Matsubara frequencies \(\nu_n = (2 n + 1) \pi / \beta\) for the index range \(n \in [-\mathrm{niv}, \mathrm{niv})\), optionally shifted.

Parameters:
  • niv (int) – Half-width of the fermionic frequency box (number of positive fermionic frequencies).

  • beta – Inverse temperature \(\beta\).

  • shift (int) – Integer offset added to the whole index range before scaling.

  • return_only_positive (bool) – If True, return only the positive frequencies.

Returns:

1D real array of fermionic Matsubara frequencies.

Return type:

ndarray

wn(niw: int, shift: int = 0, return_only_positive: bool = False) ndarray[source]#

Returns the integer bosonic Matsubara indices in the closed interval \([-\mathrm{niw}, \mathrm{niw}]\), optionally shifted. This is the index-only overload (no temperature dependence).

Parameters:
  • niw (int) – Half-width of the bosonic frequency box (number of positive bosonic frequencies).

  • shift (int) – Integer offset added to the whole index range.

  • return_only_positive (bool) – If True, return only the non-negative indices \([0, \mathrm{niw}]\).

Returns:

1D integer array of bosonic Matsubara indices.

Return type:

ndarray

wn(niw: int, beta: float, shift: int = 0, return_only_positive: bool = False) -> numpy.ndarray

Returns the real bosonic Matsubara frequencies \(\omega_n = 2 n \pi / \beta\) for the index range \(n \in [-\mathrm{niw}, \mathrm{niw}]\), optionally shifted.

Parameters:
  • niw (int) – Half-width of the bosonic frequency box (number of positive bosonic frequencies).

  • beta – Inverse temperature \(\beta\).

  • shift (int) – Integer offset added to the whole index range before scaling.

  • return_only_positive (bool) – If True, return only the non-negative frequencies.

Returns:

1D real array of bosonic Matsubara frequencies.

Return type:

ndarray