Package reference#
Interactive problem definition#
To define the interactive problem, we use the following class:
- class meanfi.model.Model(h_0, h_int, filling)[source]#
Data class which defines the interacting tight-binding problem.
- Parameters:
Notes
The interaction h_int must be of density-density type. For example, h_int[(1,)][i, j] = V means a repulsive interaction of strength V between two particles with internal degrees of freedom i and j separated by 1 lattice vector.
- density_matrix(rho, nk=20)[source]#
Computes the density matrix from a given initial density matrix.
- Parameters:
- Returns:
Density matrix tight-binding dictionary.
- Return type:
Mean-field and density matrix#
- meanfi.mf.density_matrix(h, filling, nk)[source]#
Compute the real-space density matrix tight-binding dictionary.
- Parameters:
h (dict[tuple[int, ...], ndarray]) – Hamiltonian tight-binding dictionary from which to construct the density matrix.
filling (float) – Number of particles in a unit cell. Used to determine the Fermi level.
nk (int) – Number of k-points in a grid to sample the Brillouin zone along each dimension. If the system is 0-dimensional (finite), this parameter is ignored.
- Returns:
Density matrix tight-binding dictionary and Fermi energy.
- Return type:
- meanfi.mf.density_matrix_kgrid(kham, filling)[source]#
Calculate density matrix on a k-space grid.
- Parameters:
kham (ndarray) – Hamiltonian from which to construct the density matrix. The hamiltonian is sampled on a grid of k-points and has shape (nk, nk, …, ndof, ndof), where ndof is number of internal degrees of freedom.
filling (float) – Number of particles in a unit cell. Used to determine the Fermi level.
- Returns:
Density matrix on a k-space grid with shape (nk, nk, …, ndof, ndof) and Fermi energy.
- Return type:
- meanfi.mf.fermi_on_kgrid(vals, filling)[source]#
Compute the Fermi energy on a grid of k-points.
- Parameters:
- Returns:
Fermi energy
- Return type:
- meanfi.mf.meanfield(density_matrix, h_int)[source]#
Compute the mean-field correction from the density matrix.
- Parameters:
- Returns:
Mean-field correction tight-binding dictionary.
- Return type:
Notes
The interaction h_int must be of density-density type. For example, h_int[(1,)][i, j] = V means a repulsive interaction of strength V between two particles with internal degrees of freedom i and j separated by 1 lattice vector.
Observables#
Solvers#
- meanfi.solvers.cost_density(rho_params, model, nk=20)[source]#
Defines the cost function for root solver.
The cost function is the difference between the computed and inputted density matrix reduced to the hoppings only present in the h_int.
- Parameters:
rho_params (ndarray) – 1D real array that parametrises the density matrix reduced to the hoppings (keys) present in h_int.
Model – Interacting tight-binding problem definition.
nk (int) – Number of k-points in a grid to sample the Brillouin zone along each dimension. If the system is 0-dimensional (finite), this parameter is ignored.
model (Model)
- Returns:
1D real array that is the difference between the computed and inputted density matrix parametrisations reduced to the hoppings present in h_int.
- Return type:
- meanfi.solvers.cost_mf(mf_param, model, nk=20)[source]#
Defines the cost function for root solver.
The cost function is the difference between the computed and inputted mean-field.
- Parameters:
mf_param (ndarray) – 1D real array that parametrises the mean-field correction.
Model – Interacting tight-binding problem definition.
nk (int) – Number of k-points in a grid to sample the Brillouin zone along each dimension. If the system is 0-dimensional (finite), this parameter is ignored.
model (Model)
- Returns:
1D real array that is the difference between the computed and inputted mean-field parametrisations
- Return type:
- meanfi.solvers.solver(model, mf_guess, nk=20, optimizer=<function anderson>, optimizer_kwargs={'M': 0, 'line_search': 'wolfe'})#
Solve for the mean-field correction through self-consistent root finding by finding the density matrix fixed point.
- Parameters:
model (Model) – Interacting tight-binding problem definition.
mf_guess (dict[tuple[int, ...], ndarray]) – The initial guess for the mean-field correction in the tight-binding dictionary format.
nk (int) – Number of k-points in a grid to sample the Brillouin zone along each dimension. If the system is 0-dimensional (finite), this parameter is ignored.
optimizer (Callable | None) – The solver used to solve the fixed point iteration. Default uses
scipy.optimize.anderson
.optimizer_kwargs (dict[str, str] | None) – The keyword arguments to pass to the optimizer.
- Returns:
Mean-field correction solution in the tight-binding dictionary format.
- Return type:
- meanfi.solvers.solver_mf(model, mf_guess, nk=20, optimizer=<function anderson>, optimizer_kwargs={'M': 0})[source]#
Solve for the mean-field correction through self-consistent root finding by finding the mean-field correction fixed point.
- Parameters:
model (Model) – Interacting tight-binding problem definition.
mf_guess (ndarray) – The initial guess for the mean-field correction in the tight-binding dictionary format.
nk (int) – Number of k-points in a grid to sample the Brillouin zone along each dimension. If the system is 0-dimensional (finite), this parameter is ignored.
optimizer (Callable | None) – The solver used to solve the fixed point iteration. Default uses
scipy.optimize.anderson
.optimizer_kwargs (dict[str, str] | None) – The keyword arguments to pass to the optimizer.
- Returns:
Mean-field correction solution in the tight-binding dictionary format.
- Return type:
Tight-binding dictionary#
Manipulation#
Brillouin zone transformations#
- meanfi.tb.transforms.ifftn_to_tb(ifft_array)[source]#
Convert the result of
scipy.fft.ifftn
to a tight-binding dictionary.- Parameters:
ifft_array (ndarray) – Result of
scipy.fft.ifftn
to convert to a tight-binding dictionary. The input toscipy.fft.ifftn
should be from tb_to_khamvector.- Returns:
Tight-binding dictionary.
- Return type:
- meanfi.tb.transforms.kgrid_to_tb(kgrid_array)[source]#
Convert a k-space grid array to a tight-binding dictionary.
- meanfi.tb.transforms.tb_to_kfunc(tb)[source]#
Fourier transforms a real-space tight-binding model to a k-space function.
- Parameters:
tb (dict[tuple[int, ...], ndarray]) – Tight-binding dictionary.
- Returns:
A function that takes a k-space vector and returns a complex np.array.
- Return type:
Notes
Function doesn’t work for zero dimensions.
Parametrisation#
- meanfi.params.rparams.complex_to_real(z)[source]#
Split and concatenate real and imaginary parts of a complex array.
- meanfi.params.rparams.real_to_complex(z)[source]#
Undo
complex_to_real
.
Utility functions#
- meanfi.tb.utils.fermi_energy(tb, filling, nk=100)[source]#
Calculate the Fermi energy of a given tight-binding dictionary.
- Parameters:
tb (dict[tuple[int, ...], ndarray]) – Tight-binding dictionary.
filling (float) – Number of particles in a unit cell. Used to determine the Fermi level.
nk (int) – Number of k-points in a grid to sample the Brillouin zone along each dimension. If the system is 0-dimensional (finite), this parameter is ignored.
- Returns:
Fermi energy.
- meanfi.tb.utils.generate_tb_keys(cutoff, dim)[source]#
Generate tight-binding dictionary keys up to a cutoff.
kwant
interface#
- meanfi.kwant_helper.utils.build_interacting_syst(builder, lattice, func_onsite, func_hop=None, max_neighbor=1)[source]#
Construct an auxiliary
kwant
system that encodes the interactions.- Parameters:
builder (Builder) – Non-interacting
kwant.builder.Builder
system.lattice (Polyatomic) – Lattice of the system.
func_onsite (Callable) – Onsite interactions function.
func_hop (Callable | None) – Hopping/inter unit cell interactions function.
max_neighbor (int) – The maximal number of neighbouring unit cells (along a lattice vector) connected by interaction. Interaction goes to zero after this distance.
- Returns:
Auxiliary
kwant.builder.Builder
that encodes the interactions of the system.- Return type:
- meanfi.kwant_helper.utils.builder_to_tb(builder, params={}, return_data=False)[source]#
Construct a tight-binding dictionary from a
kwant.builder.Builder
system.- Parameters:
- Returns:
Tight-binding dictionary that corresponds to the builder.
Data with sites and number of orbitals. Only if return_data=True.
- Return type:
- meanfi.kwant_helper.utils.tb_to_builder(h_0, sites_list, periods)[source]#
Construct a
kwant.builder.Builder
from a tight-binding dictionary.- Parameters:
- Returns:
kwant.builder.Builder
that corresponds to the tight-binding dictionary.- Return type: