dgamore.interaction#

Interaction tensors. LocalInteraction wraps the momentum-independent (Hubbard/Kanamori) interaction \(U_{abcd}\); Interaction adds a momentum dimension for the non-local interaction \(V_{abcd}^q\). Both provide the channel projections (density/magnetic/singlet/triplet) and the algebra used in the ladder equations.

class dgamore.interaction.Interaction(mat: ndarray, channel: SpinChannel = SpinChannel.NONE, nq: tuple[int, int, int] = (1, 1, 1), has_compressed_q_dimension: bool = False)[source]#

Bases: IAmNonLocal, LocalInteraction

Class for the non-local (momentum-dependent) interaction \(V_{abcd}^q\).

Parameters:
add(other) Interaction[source]#

Adds another (non-)local interaction or a raw numpy array (a local operand is broadcast over the momentum axis); see _add().

Parameters:

other – An Interaction, a LocalInteraction, or a numpy array.

Returns:

A new Interaction holding the sum (inheriting the non-NONE channel of the operands).

Return type:

Interaction

as_channel(channel: SpinChannel) Interaction[source]#

Projects the bare non-local interaction onto a given spin channel. Only the non-local particle-hole contribution enters the ladder DGA equations and the ph-bar contribution to the spin channels vanishes, so the projections reduce to \(V_d = 2V\), \(V_m = 0\), \(V_s = V_t = V\).

Parameters:

channel (SpinChannel) – Target spin channel (density, magnetic, singlet or triplet).

Returns:

A new Interaction in the requested channel.

Raises:

ValueError – If the object is already in a (non-NONE) channel, or the target channel is unsupported.

Return type:

Interaction

permute_orbitals(permutation: str = 'abcd->abcd') Interaction[source]#

Permutes the four orbital axes (leaving the momentum axis untouched).

Parameters:

permutation (str) – Einsum permutation of the four orbital labels, e.g. "abcd->adcb".

Returns:

A new Interaction with permuted orbitals (a deep copy for the identity permutation).

Raises:

ValueError – If the permutation string is not a valid four-orbital permutation.

Return type:

Interaction

pow(power) Interaction[source]#

Raises the interaction to an integer power via repeated momentum-diagonal orbital contraction \(V^{(n);q}_{abef} = V^{q}_{abcd} V^{(n-1);q}_{dcef}\).

Parameters:

power – Positive integer exponent (must be greater than zero).

Returns:

A new Interaction in the same momentum-compression state as self.

Raises:

ValueError – If power is not a positive integer greater than zero.

Return type:

Interaction

sub(other) Interaction[source]#

Subtracts another (non-)local interaction or a raw numpy array; see _add().

Parameters:

other – An Interaction, a LocalInteraction, or a numpy array.

Returns:

A new Interaction holding the difference self - other.

Return type:

Interaction

class dgamore.interaction.LocalInteraction(mat: ndarray, channel: SpinChannel = SpinChannel.NONE)[source]#

Bases: IHaveMat, IHaveChannel

Class for the local (momentum-independent) interaction \(U_{abcd}\).

Parameters:
add(other) LocalInteraction[source]#

Adds another interaction or a raw numpy array element-wise; see _add().

Parameters:

other – A LocalInteraction or a numpy array broadcastable to mat.

Returns:

A new LocalInteraction holding the sum (inheriting the non-NONE channel of the operands).

Return type:

LocalInteraction

as_channel(channel: SpinChannel) LocalInteraction[source]#

Projects the bare interaction onto a given spin channel. With the crossing-permuted tensor \(\tilde U_{abcd} = U_{adcb}\) the projections are \(U_d = 2U - \tilde U\), \(U_m = -\tilde U\), \(U_s = U + \tilde U\), \(U_t = U - \tilde U\).

Parameters:

channel (SpinChannel) – Target spin channel (density, magnetic, singlet or triplet).

Returns:

A new LocalInteraction in the requested channel.

Raises:

ValueError – If the object is already in a (non-NONE) channel, or the target channel is unsupported.

Return type:

LocalInteraction

property n_bands: int#

Returns the number of bands (orbitals).

Returns:

Number of bands, i.e. the size of the first orbital axis.

permute_orbitals(permutation: str = 'abcd->abcd') LocalInteraction[source]#

Permutes the four orbital axes according to an einsum-style permutation string.

Parameters:

permutation (str) – Einsum permutation of the four orbital labels, e.g. "abcd->adcb".

Returns:

A new LocalInteraction with permuted orbitals (a deep copy for the identity permutation).

Raises:

ValueError – If the permutation string is not a valid four-orbital permutation.

Return type:

LocalInteraction

pow(power) LocalInteraction[source]#

Raises the interaction to an integer power via repeated orbital contraction \(U^{(n)}_{abef} = U_{abcd} U^{(n-1)}_{dcef}\).

Parameters:

power – Positive integer exponent (must be greater than zero).

Returns:

A new LocalInteraction equal to self contracted with itself power times.

Raises:

ValueError – If power is not a positive integer greater than zero.

Return type:

LocalInteraction

sub(other) LocalInteraction[source]#

Subtracts another interaction or a raw numpy array element-wise; see _add().

Parameters:

other – A LocalInteraction or a numpy array broadcastable to mat.

Returns:

A new LocalInteraction holding the difference self - other.

Return type:

LocalInteraction