tbplas.HopDict

class tbplas.HopDict(num_orb: int)

Class for holding hopping terms in matrix form, reserved for compatibility with old version of TBPlaS.

DO NOT try to rewrite this class based on IntraHopping. This class is intended for compatibility reasons and follows a different philosophy than IntraHopping. Hopping terms will not be reduced by conjugate relation even for the (0, 0, 0) cell, as some users may utilize H(R) and H(-R) for different kinds of hopping terms. However, this makes this class bug-prone. So we do not recommend common users to use this class.

Since the hopping terms are not reduced, the order of H(R) and H(-R) may lead to random results. To avoid that, we use OrderedDict instead of dict for holding the hopping terms.

_hoppings

Keys should be cell indices and values should be complex matrices.

Type:

OrderedDict[Tuple[int, int, int], np.ndarray]

_num_orb

number of orbitals

Type:

int

_mat_shape

shape of hopping matrices

Type:

Tuple[int, int]

__init__(num_orb: int) None
Parameters:

num_orb – number of orbitals

Methods

__init__(num_orb)

to_spare()

Return an ordered dictionary with values being sparse matrices.

Attributes

hoppings

Interface for the 'hoppings' attribute.

mat_shape

Interface for the 'mat_shape' attribute.

num_orb

Interface for the '_num_orb' attribute.

__getitem__(rn: Tuple[int, int] | Tuple[int, int, int]) ndarray

Get the hopping matrix according to cell index. :param rn: cell index of hopping matrix :return: (num_orb, num_orb) complex128 array hopping matrix of rn

__init__(num_orb: int) None
Parameters:

num_orb – number of orbitals

__setitem__(rn: Tuple[int, int] | Tuple[int, int, int], hop_mat: ndarray) None

Add or update a hopping matrix according to cell index. :param rn: cell index of hopping matrix :param hop_mat: (num_orb, num_orb) complex128 array hopping matrix :return: None

to_spare() Dict[Tuple[int, int, int], coo_matrix]

Return an ordered dictionary with values being sparse matrices. :return: ordered sparse hopping dictionary

__weakref__

list of weak references to the object

property hoppings: Dict[Tuple[int, int, int], ndarray]

Interface for the ‘hoppings’ attribute.

property mat_shape: Tuple[int, int]

Interface for the ‘mat_shape’ attribute.

property num_orb: int

Interface for the ‘_num_orb’ attribute.