dgamore.hamiltonian#

Lattice model setup. Hamiltonian assembles the (multi-orbital) Hubbard model: the real-space hopping \(t_{ab}(R)\), the local interaction \(U_{abcd}\) and the non-local interaction \(V_{abcd}(R)\). It offers convenience builders (single-band, orbital-diagonal, Kanamori, 2D \(t\)-\(t'\)-\(t''\)), readers/writers for wannier90 / wien2k hr/hk and umatrix files, and Fourier transforms to obtain the band dispersion \(\varepsilon_{ab}(k)\) and momentum-dependent interaction \(V_{abcd}(q)\). HoppingElement and InteractionElement are small validated containers for single hopping/ interaction entries.

class dgamore.hamiltonian.Hamiltonian[source]#

Bases: object

Class to handle the Hamiltonian of the Hubbard model. Contains the hopping terms (er) and the local (local_interaction) and nonlocal interaction (nonlocal_interaction) terms. Has a few helper methods to simplify adding terms to the Hamiltonian.

get_ek(k_grid: KGrid = None) ndarray[source]#

Returns the band dispersion \(\varepsilon_{ab}(k)\), computing and caching it from the real-space hopping on k_grid if not already set.

Parameters:

k_grid (KGrid) – The KGrid to evaluate on (ignored if the dispersion is already cached/set).

Returns:

The band dispersion array of shape [kx, ky, kz, o1, o2].

Return type:

ndarray

get_local_u() LocalInteraction[source]#

Returns the local interaction. Since the local interaction is momentum-independent, its momentum-space and real-space representations coincide.

Returns:

The local interaction as a LocalInteraction.

Return type:

LocalInteraction

get_vq(q_grid: KGrid) Interaction[source]#

Returns the momentum-dependent non-local interaction \(V_{abcd}(q)\) by Fourier-transforming the real-space interaction onto q_grid.

Parameters:

q_grid (KGrid) – The KGrid defining the momentum grid.

Returns:

The non-local interaction as an Interaction.

Return type:

Interaction

interaction_orbital_diagonal(u: float, n_bands: int = 1) Hamiltonian[source]#

Sets a purely orbital-diagonal local interaction for a multi-band model: the interaction tensor is zero everywhere except the [0,0,0,0] element, which is set to u.

Parameters:
  • u (float) – The Hubbard interaction \(U\) on the first orbital.

  • n_bands (int) – Number of orbitals/bands.

Returns:

self (for chaining).

Return type:

Hamiltonian

kanamori_interaction_d(n_bands: int, udd: float, jdd: float, vdd: float = None) Hamiltonian[source]#

Adds the Kanamori interaction terms ONLY for d orbitals to the Hamiltonian. The interaction terms are defined by the Hubbard udd (U), the exchange interaction jdd (J) and the inter-orbital density-density interaction vdd (V or sometimes U’). vdd is an optional parameter, if left empty, it is set to V=U-2J.

Parameters:
  • n_bands (int) – Number of d orbitals/bands.

  • udd (float) – The intra-orbital Hubbard interaction \(U_{dd}\).

  • jdd (float) – The Hund’s exchange \(J_{dd}\).

  • vdd (float) – The inter-orbital interaction \(V_{dd}\); defaults to \(U_{dd} - 2 J_{dd}\) if None.

Returns:

self (for chaining).

Return type:

Hamiltonian

kanamori_interaction_dp(nd_bands: int = 0, np_bands: int = 0, udd: float = 0.0, upp: float = 0.0, udp: float = 0.0, jdd: float = 0.0, jpp: float = 0.0, jdp: float = 0.0, vdd: float = None, vpp: float = None) Hamiltonian[source]#

Adds the full Kanamori interaction terms for d and p orbitals to the Hamiltonian. The interaction terms are defined by the local interaction Hubbard U, the exchange interaction J and the inter-orbital density-density interaction V or sometimes U’. vdd (vpp) (vdp) are optional parameters, if left empty, they are set to V=U-2J.

Parameters:
  • nd_bands (int) – Number of d orbitals (placed first in the orbital ordering).

  • np_bands (int) – Number of p orbitals (placed after the d orbitals).

  • udd (float) – Intra-orbital Hubbard \(U_{dd}\).

  • upp (float) – Intra-orbital Hubbard \(U_{pp}\).

  • udp (float) – The d-p inter-orbital interaction (used as \(V_{dp}\)).

  • jdd (float) – Hund’s exchange \(J_{dd}\).

  • jpp (float) – Hund’s exchange \(J_{pp}\).

  • jdp (float) – The d-p exchange \(J_{dp}\).

  • vdd (float) – Inter-orbital \(V_{dd}\); defaults to \(U_{dd} - 2 J_{dd}\) if None.

  • vpp (float) – Inter-orbital \(V_{pp}\); defaults to \(U_{pp} - 2 J_{pp}\) if None.

Returns:

self (for chaining).

Return type:

Hamiltonian

kanamori_interaction_p(n_bands: int, upp: float, jpp: float, vpp: float = None) Hamiltonian[source]#

Adds the Kanamori interaction terms ONLY for p orbitals to the Hamiltonian. The interaction terms are defined by the Hubbard upp (U), the exchange interaction jpp (J) and the inter-orbital density-density interaction vpp (V or sometimes U’). vpp is an optional parameter, if left empty, it is set to V=U-2J.

Parameters:
  • n_bands (int) – Number of p orbitals/bands.

  • upp (float) – The intra-orbital Hubbard interaction \(U_{pp}\).

  • jpp (float) – The Hund’s exchange \(J_{pp}\).

  • vpp (float) – The inter-orbital interaction \(V_{pp}\); defaults to \(U_{pp} - 2 J_{pp}\) if None.

Returns:

self (for chaining).

Return type:

Hamiltonian

kinetic_one_band_2d_t_tp_tpp(t: float, tp: float, tpp: float) Hamiltonian[source]#

Adds the kinetic terms for a one-band model in 2D with nearest (t), next-nearest (tp) and next-next-nearest (tpp) neighbor hopping.

Parameters:
  • t (float) – Nearest-neighbor hopping \(t\).

  • tp (float) – Next-nearest-neighbor hopping \(t'\).

  • tpp (float) – Next-next-nearest-neighbor hopping \(t''\).

Returns:

self (for chaining).

Return type:

Hamiltonian

read_hk_w2k(fname: str, spin_sym: bool = True)[source]#

Reads a Hamiltonian \(H_{bb'}(k)\) from a text file.

Expects a text file with white-space separated values in the syntax as generated by wannier90: the first line is a header with three integers, optionally followed by ‘#’-prefixed comment:

<no of k-points> <no of wannier functions> <no of bands (ignored)>

For each k-point, there is a header line with the x, y, z coordinates of the k-point, followed by <nbands> rows as lines of 2*<nbands> values each, which are the real and imaginary part of each column.

Parameters:
  • fname (str) – Path to the hk text file.

  • spin_sym (bool) – If True, assume spin symmetry (no spin-orbit); if False, the file carries a doubled spin structure that is folded back to nbands.

Returns:

A pair (ham, kpoints) where ham is a new Hamiltonian with ek set to the complex array \(H(k)\) (k-point first, then band indices) and kpoints is the real array of k-point (x, y, z) components (transposed).

Raises:
  • RuntimeError – If a spin-orbit Hamiltonian has an odd band count.

  • ValueError – If the file contains fewer k-points than declared in the header.

read_hr_w2k(filename: str = './wannier_hr.dat') Hamiltonian[source]#

Reads the wannier_hr.dat file from a wien2k hr file and sets the real-space kinetic Hamiltonian. This is then typically Fourier-transformed to momentum space to obtain the k-dependent band dispersion.

Parameters:

filename (str) – Path to the wannier_hr.dat file.

Returns:

self (for chaining).

Return type:

Hamiltonian

read_umatrix(filename: str) Hamiltonian[source]#

Reads a file and creates the interaction matrix from it. The file should contain the number of bands in the first line and the number of r values in the second line. From the third line onwards it should contain the interaction matrix entries. It looks very similar to the format of a wannier_hr.dat file. The format is: r_lat_x r_lat_y r_lat_z orb1 orb2 orb3 orb4 realvalue imagvalue, where r_lat is the relative lattice vector and orb1-4 are the orbital indices. The interaction is assumed to be purely real. The ordering of the entries themselves does not matter. Note: The file must not contain any comments or empty lines.

Parameters:

filename (str) – Path to the umatrix file.

Returns:

self (for chaining).

Return type:

Hamiltonian

set_ek(ek: ndarray) Hamiltonian[source]#

Sets the band dispersion directly (bypassing the Fourier transform).

Parameters:

ek (ndarray) – The band dispersion array.

Returns:

self (for chaining).

Return type:

Hamiltonian

single_band_interaction(u: float) Hamiltonian[source]#

Sets the local interaction for a single-band model from a single Hubbard \(U\).

Parameters:

u (float) – The Hubbard interaction \(U\).

Returns:

self (for chaining).

Return type:

Hamiltonian

write_hk_w2k(filename: str, k_grid: KGrid, ek: ndarray = None) None[source]#

Writes the k-space kinetic Hamiltonian to a file in the wien2k hk format.

Parameters:
  • filename (str) – Output file path.

  • k_grid (KGrid) – The KGrid defining the k-points to write.

  • ek (ndarray) – Optional band dispersion to write; computed from the Hamiltonian on k_grid if None.

Returns:

None.

Return type:

None

write_hr_w2k(filename: str) None[source]#

Writes the real-space kinetic Hamiltonian to a file in the wien2k hr format.

Parameters:

filename (str) – Output file path.

Returns:

None.

Return type:

None

class dgamore.hamiltonian.HoppingElement(r_lat: list, orbs: list, value: float = 0.0)[source]#

Bases: object

Data class to store a hopping element of the Hamiltonian. The hopping element is defined by the relative lattice vector r_lat, the orbitals orbs and the value of the hopping value. A hopping element represents a single line in a w2k file. Added this to make the code more readable and to avoid passing around lists of values.

Parameters:
class dgamore.hamiltonian.InteractionElement(r_lat: list[int], orbs: list[int], value: float)[source]#

Bases: object

Data class to store an interaction element of the Hamiltonian. The interaction element is defined by the relative lattice vector r_lat, the orbitals orbs and the value of the interaction value. An interaction element represents a single entry in the interaction matrix. Added this to make the code more readable and to avoid passing around lists of values.

Parameters: