tbplas.HopDict
- class tbplas.HopDict(num_orb: int)
Class for holding hopping terms.
Reserved for compatibility with old version of TBPlaS.
NOTE: DO NOT try to rewrite this class based on IntraHopping. This class is intended for compatibility reasons and follows a different philosophy than IntraHopping.
- _hoppings
Keys should be cell indices and values should be complex matrices.
- Type:
Dict[Tuple[int, int, int], Union[coo_matrix, 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)- param num_orb:
number of orbitals
to_spare
()Convert hopping matrices from dense to sparse.
Attributes
Interface for the 'hoppings' attribute.
Interface for the 'mat_shape' attribute.
Interface for the '_num_orb' attribute.
- __getitem__(rn: Union[Tuple[int, int], Tuple[int, int, int]]) ndarray
Get the hopping matrix according to cell index.
- Parameters:
rn – cell index of hopping matrix
- Returns:
(num_orb, num_orb) complex128 array hopping matrix of rn
- Returns:
None
- Raises:
CellIndexLenError – if len(rn) != 2 or 3
- __init__(num_orb: int) None
- Parameters:
num_orb – number of orbitals
- __setitem__(rn: Union[Tuple[int, int], Tuple[int, int, int]], hop_mat: ndarray) None
Add or update a hopping matrix according to cell index.
- Parameters:
rn – cell index of hopping matrix
hop_mat – (num_orb, num_orb) complex128 array hopping matrix
- Returns:
None
- Raises:
CellIndexLenError – if len(rn) != 2 or 3
ValueError – if hop_mat.shape does not match number of orbitals
PCHopDiagonalError – if on-site energies are included in hopping matrix
- to_spare() None
Convert hopping matrices from dense to sparse.
- Returns:
None
- Raises:
PCHopDiagonalError – if on-site energies are included in hopping matrix
- __weakref__
list of weak references to the object (if defined)
- property hoppings: Dict[Tuple[int, int, int], Union[coo_matrix, 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.