Skip to content
Snippets Groups Projects
Commit 81cc50c5 authored by Kostas Vilkelis's avatar Kostas Vilkelis :flamingo: Committed by Johanna Zijderveld
Browse files

wrap up package references

parent e9817b21
No related branches found
No related tags found
1 merge request!7Examples
# Package reference # Package reference
## Interactive problem definition
To define the interactive problem, we use the following class:
```{eval-rst}
.. autoclass:: pymf.model.Model
:members: mfield
```
## Mean-field and density matrix
```{eval-rst}
.. automodule:: pymf.mf
:members: meanfield, construct_density_matrix, construct_density_matrix_kgrid, fermi_on_grid
:show-inheritance:
```
## Observables
```{eval-rst}
.. automodule:: pymf.observables
:members: expectation_value
:show-inheritance:
```
## Solvers
```{eval-rst}
.. automodule:: pymf.solvers
:members: solver, cost
:show-inheritance:
```
## Tight-binding dictionary
### Manipulation
```{eval-rst}
.. automodule:: pymf.tb.tb
:members: add_tb, scale_tb
:show-inheritance:
```
### Brillouin zone transformations
```{eval-rst}
.. automodule:: pymf.tb.transforms
:members:
:show-inheritance:
```
### Parametrisation
```{eval-rst}
.. automodule:: pymf.params.rparams
:members:
:show-inheritance:
```
### Utility functions
```{eval-rst}
.. automodule:: pymf.tb.utils
:members:
:show-inheritance:
```
## `kwant` interface
```{eval-rst} ```{eval-rst}
.. automodule:: pymf .. automodule:: pymf.kwant_helper.utils
:members: :members:
:show-inheritance: :show-inheritance:
``` ```
...@@ -5,14 +5,16 @@ from typing import Callable ...@@ -5,14 +5,16 @@ from typing import Callable
from pymf.tb.tb import tb_type from pymf.tb.tb import tb_type
import kwant import kwant
import kwant.lattice
import kwant.builder
import numpy as np import numpy as np
from scipy.sparse import coo_array from scipy.sparse import coo_array
def builder_to_tb( def builder_to_tb(
builder: kwant.Builder, params: dict = {}, return_data: bool = False builder: kwant.builder.Builder, params: dict = {}, return_data: bool = False
) -> tb_type: ) -> tb_type:
"""Construct a tight-binding dictionary from a `kwant.Builder` system. """Construct a tight-binding dictionary from a `kwant.builder.Builder` system.
Parameters Parameters
---------- ----------
...@@ -25,9 +27,9 @@ def builder_to_tb( ...@@ -25,9 +27,9 @@ def builder_to_tb(
Returns Returns
------- -------
h_0 : :
Tight-binding dictionary that corresponds to the builder. Tight-binding dictionary that corresponds to the builder.
data : :
Data with sites and number of orbitals. Only if `return_data=True`. Data with sites and number of orbitals. Only if `return_data=True`.
""" """
builder = copy(builder) builder = copy(builder)
...@@ -129,19 +131,19 @@ def builder_to_tb( ...@@ -129,19 +131,19 @@ def builder_to_tb(
def build_interacting_syst( def build_interacting_syst(
builder: kwant.Builder, builder: kwant.builder.Builder,
lattice: kwant.lattice, lattice: kwant.lattice.Polyatomic,
func_onsite: Callable, func_onsite: Callable,
func_hop: Callable, func_hop: Callable,
max_neighbor: int = 1, max_neighbor: int = 1,
) -> kwant.Builder: ) -> kwant.builder.Builder:
""" """
Construct an auxiliary `kwant` system that encodes the interactions. Construct an auxiliary `kwant` system that encodes the interactions.
Parameters Parameters
---------- ----------
builder : builder :
Non-interacting `kwant` system. Non-interacting `kwant.builder.Builder` system.
lattice : lattice :
Lattice of the system. Lattice of the system.
func_onsite : func_onsite :
...@@ -154,10 +156,12 @@ def build_interacting_syst( ...@@ -154,10 +156,12 @@ def build_interacting_syst(
Returns Returns
------- -------
int_builder : :
Auxiliary `kwant.Builder` that encodes the interactions of the system. Auxiliary `kwant.builder.Builder` that encodes the interactions of the system.
""" """
int_builder = kwant.Builder(kwant.TranslationalSymmetry(*builder.symmetry.periods)) int_builder = kwant.builder.Builder(
kwant.lattice.TranslationalSymmetry(*builder.symmetry.periods)
)
int_builder[builder.sites()] = func_onsite int_builder[builder.sites()] = func_onsite
for neighbors in range(max_neighbor): for neighbors in range(max_neighbor):
int_builder[lattice.neighbors(neighbors + 1)] = func_hop int_builder[lattice.neighbors(neighbors + 1)] = func_hop
......
...@@ -38,7 +38,7 @@ def construct_density_matrix_kgrid( ...@@ -38,7 +38,7 @@ def construct_density_matrix_kgrid(
def construct_density_matrix( def construct_density_matrix(
h: tb_type, filling: float, nk: int h: tb_type, filling: float, nk: int
) -> Tuple[tb_type, float]: ) -> Tuple[tb_type, float]:
"""Compute the density matrix in real-space tight-binding format. """Compute the real-space density matrix tight-binding dictionary.
Parameters Parameters
---------- ----------
...@@ -78,15 +78,19 @@ def meanfield(density_matrix: tb_type, h_int: tb_type) -> tb_type: ...@@ -78,15 +78,19 @@ def meanfield(density_matrix: tb_type, h_int: tb_type) -> tb_type:
Density matrix tight-binding dictionary. Density matrix tight-binding dictionary.
h_int : h_int :
Interaction hermitian Hamiltonian tight-binding dictionary. Interaction hermitian Hamiltonian tight-binding dictionary.
The interaction must be of density-density type, h_int[R][i, j] * c_i^dagger(R) c_j^dagger(0) c_j(0) c_i(R).
For example in 1D system with ndof internal degrees of freedom,
h_int[(2,)] = U * np.ones((ndof, ndof)) is a Coulomb repulsion interaction
with strength U between unit cells separated by 2 lattice vectors, where
the interaction is the same between all internal degrees of freedom.
Returns Returns
------- -------
: :
Mean-field correction tight-binding dictionary. Mean-field correction tight-binding dictionary.
Notes
-----
The interaction h_int must be of density-density type.
For example in 1D system with ndof internal degrees of freedom,
h_int[(2,)] = U * np.ones((ndof, ndof)) is a Coulomb repulsion interaction
with strength U between unit cells separated by 2 lattice vectors, where
the interaction is the same between all internal degrees of freedom.
""" """
n = len(list(density_matrix)[0]) n = len(list(density_matrix)[0])
local_key = tuple(np.zeros((n,), dtype=int)) local_key = tuple(np.zeros((n,), dtype=int))
......
...@@ -44,14 +44,17 @@ class Model: ...@@ -44,14 +44,17 @@ class Model:
Non-interacting hermitian Hamiltonian tight-binding dictionary. Non-interacting hermitian Hamiltonian tight-binding dictionary.
h_int : h_int :
Interaction hermitian Hamiltonian tight-binding dictionary. Interaction hermitian Hamiltonian tight-binding dictionary.
The interaction must be of density-density type, h_int[R][i, j] * c_i^dagger(R) c_j^dagger(0) c_j(0) c_i(R).
For example in 1D system with ndof internal degrees of freedom,
h_int[(2,)] = U * np.ones((ndof, ndof)) is a Coulomb repulsion interaction
with strength U between unit cells separated by 2 lattice vectors, where
the interaction is the same between all internal degrees of freedom.
filling : filling :
Number of particles in a unit cell. Number of particles in a unit cell.
Used to determine the Fermi level. Used to determine the Fermi level.
Notes
-----
The interaction h_int must be of density-density type.
For example in 1D system with ndof internal degrees of freedom,
h_int[(2,)] = U * np.ones((ndof, ndof)) is a Coulomb repulsion interaction
with strength U between unit cells separated by 2 lattice vectors, where
the interaction is the same between all internal degrees of freedom.
""" """
def __init__(self, h_0: tb_type, h_int: tb_type, filling: float) -> None: def __init__(self, h_0: tb_type, h_int: tb_type, filling: float) -> None:
......
...@@ -53,7 +53,8 @@ def generate_tb_keys(cutoff: int, dim: int) -> list[tuple[None] | tuple[int, ... ...@@ -53,7 +53,8 @@ def generate_tb_keys(cutoff: int, dim: int) -> list[tuple[None] | tuple[int, ...
Returns Returns
------- -------
List of generated tight-binding dictionary keys up to a cutoff. :
List of generated tight-binding dictionary keys up to a cutoff.
""" """
return [*product(*([[*range(-cutoff, cutoff + 1)]] * dim))] return [*product(*([[*range(-cutoff, cutoff + 1)]] * dim))]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment