tbplas.SCInterHopping
- class tbplas.SCInterHopping(sc_bra: SuperCell, sc_ket: SuperCell)
Container class for hopping terms between different supercells within the sample.
- _sc_bra
the ‘bra’ supercell from which the hopping terms exist
- Type:
‘SuperCell’ instance
- _sc_ket
the ‘ket’ supercell to which the hopping terms exist
- Type:
‘SuperCell’ instance
Notes
Reduction
Since inter-hopping terms exist within different super-cells, there is no need to reduce them according to the conjugate relation.
Rules
We restrict hopping terms to be from the (0, 0, 0) ‘bra’ supercell to any ‘ket’ supercell. The counterparts are restored via the conjugate relation:
<bra, R0, i|H|ket, Rn, j> = <ket, R0, j|H|bra, -Rn, i>*
- __init__(sc_bra: SuperCell, sc_ket: SuperCell) None
- Parameters:
sc_bra – the ‘bra’ supercell from which the hopping terms exist
sc_ket – the ‘ket’ supercell to which the hopping terms exist
Methods
__init__
(sc_bra, sc_ket)add_hopping
(rn, orb_i, orb_j, energy)Add a new hopping term or update existing term.
add_subscriber
(sub)Add a subscriber :param sub: the new subscriber :return: None
Check if the object is unlocked for modification.
Count how many times each orbital pair emerges.
get_array
([pos_bra, pos_ket, check_dup])Get all arrays in a single call.
get_hop
([check_dup])Get hopping indices, energies and distances.
get_hopping
(rn, orb_i, orb_j)Get an existing hopping term. :param rn: (r_a, r_b, r_c), cell index :param orb_i: orbital index or bra :param orb_j: orbital index of ket :return: (energy, status) where energy is the hopping energy and status is whether the term has been found.
lock
()Lock the object.
plot
(axes[, with_conj, hop_as_arrows, ...])Plot hopping terms to axes. :param axes: axes on which the figure will be plotted :param with_conj: whether to plot conjugate hopping terms as well :param hop_as_arrows: whether to plot hopping terms as arrows :param hop_eng_cutoff: cutoff for showing hopping terms. :param hop_color: color of hopping terms :param view: kind of view point, should be in 'ab', 'bc', 'ca', 'ba', 'cb', 'ac' :return: None.
purge
()Remove empty cell indices.
remove_hopping
(rn, orb_i, orb_j)Remove an existing hopping term.
remove_orbitals
(indices)Remove the hopping terms corresponding to a list of orbitals and update remaining hopping terms.
remove_rn
(rn)Remove all the hopping terms of given cell index.
to_array
([use_int64])Convert hopping terms to array of 'hop_ind' and 'hop_eng', for constructing attributes of 'PrimitiveCell' or 'Sample'. :param use_int64: whether to use 64-bit integer for hop_ind, should be enabled for 'SuperCell' and 'SCInterHopping' classes :return: (hop_ind, hop_eng) hop_ind: (num_hop, 5) int32/int64 array, hopping indices hop_eng: (num_hop,) complex128 array, hopping energies.
to_list
()Flatten all hopping terms into a list.
unlock
()Unlock the object.
update
()Call subscribers to update their data.
Attributes
Interface for the '_hoppings' attribute.
Count the number of hopping terms.
Interface for the '_sc_bra' attribute.
Interface for the '_sc_ket' attribute.
- __hash__() int
Return hash(self).
- __init__(sc_bra: SuperCell, sc_ket: SuperCell) None
- Parameters:
sc_bra – the ‘bra’ supercell from which the hopping terms exist
sc_ket – the ‘ket’ supercell to which the hopping terms exist
- add_hopping(rn: Tuple[int, int] | Tuple[int, int, int], orb_i: int, orb_j: int, energy: complex) None
Add a new hopping term or update existing term. :param rn: (r_a, r_b, r_c), cell index :param orb_i: orbital index or bra :param orb_j: orbital index of ket :param energy: hopping energy :return: None
- add_subscriber(sub: Any) None
Add a subscriber :param sub: the new subscriber :return: None
- check_editable() None
Check if the object is unlocked for modification. :return: None
- count_pairs() Dict[Tuple[int, int], int]
Count how many times each orbital pair emerges. :return: numbers of emergence of orbital pairs
- get_array(pos_bra: ndarray = None, pos_ket: ndarray = None, check_dup: bool = False) namedtuple
Get all arrays in a single call.
NOTE: If this function is called by Sample.init_array(), then pos_bra and pos_ket are external and passed as arguments. In other cases, they are generated in place.
- Parameters:
pos_bra – (num_orb_bra, 3) float64 array Cartesian coordinates of sc_bra in NM
pos_ket – (num_orb_ket, 3) float64 array Cartesian coordinates of sc_ket in NM
check_dup – whether to check for duplicate hopping terms
- Returns:
namedtuple with arrays as attributes
- get_hop(check_dup: bool = False) Tuple[ndarray, ndarray, ndarray]
Get hopping indices, energies and distances.
If periodic conditions are enabled, orbital indices in hop_ind[:, 1] may be wrapped back if it falls out of the supercell. Nevertheless, the distances in dr are still the ones before wrapping. This is essential for adding magnetic field, calculating band structure and many properties involving dr.
- Parameters:
check_dup – whether to check for duplicate hopping terms
- Returns:
(hop_ind, hop_eng, dr) hop_ind: (num_hop_sc, 2) int64 array row and column indices of hopping terms hop_eng: (num_hop_sc,) complex128 array energies of hopping terms in accordance with hop_ind in eV dr: (num_hop_sc, 3) float64 array distances of hopping terms in accordance with hop_ind in nm
- get_hopping(rn: Tuple[int, int] | Tuple[int, int, int], orb_i: int, orb_j: int) Tuple[complex, bool]
Get an existing hopping term. :param rn: (r_a, r_b, r_c), cell index :param orb_i: orbital index or bra :param orb_j: orbital index of ket :return: (energy, status)
where energy is the hopping energy and status is whether the term has been found
- lock() None
Lock the object. Modifications are not allowed then unless the ‘unlock’ method is called. :return: None
- plot(axes: Axes, with_conj: bool = False, hop_as_arrows: bool = True, hop_eng_cutoff: float = 1e-05, hop_color: str = 'r', view: str = 'ab') None
Plot hopping terms to axes. :param axes: axes on which the figure will be plotted :param with_conj: whether to plot conjugate hopping terms as well :param hop_as_arrows: whether to plot hopping terms as arrows :param hop_eng_cutoff: cutoff for showing hopping terms. :param hop_color: color of hopping terms :param view: kind of view point, should be in ‘ab’, ‘bc’, ‘ca’, ‘ba’,
‘cb’, ‘ac’
- Returns:
None
- purge() None
Remove empty cell indices. :return: None
- remove_hopping(rn: Tuple[int, int] | Tuple[int, int, int], orb_i: int, orb_j: int) bool
Remove an existing hopping term. :param rn: (r_a, r_b, r_c), cell index :param orb_i: orbital index or bra :param orb_j: orbital index of ket :return: where the hopping term is removed, False if not found
- remove_orbitals(indices: Iterable[int] | ndarray) None
Remove the hopping terms corresponding to a list of orbitals and update remaining hopping terms. :param indices: indices of orbitals to remove :return: None
- remove_rn(rn: Tuple[int, int] | Tuple[int, int, int]) bool
Remove all the hopping terms of given cell index. :param rn: (r_a, r_b, r_c), cell index :return: where the hopping terms are removed, False if not found
- to_array(use_int64: bool = False) Tuple[ndarray, ndarray]
Convert hopping terms to array of ‘hop_ind’ and ‘hop_eng’, for constructing attributes of ‘PrimitiveCell’ or ‘Sample’. :param use_int64: whether to use 64-bit integer for hop_ind, should be
enabled for ‘SuperCell’ and ‘SCInterHopping’ classes
- Returns:
(hop_ind, hop_eng) hop_ind: (num_hop, 5) int32/int64 array, hopping indices hop_eng: (num_hop,) complex128 array, hopping energies
- to_list() List[Tuple[int, int, int, int, int, complex]]
Flatten all hopping terms into a list. :return: list of hopping terms (rb, rb, rc, orb_i, orb_j, energy)
- unlock() None
Unlock the object. Modifications are allowed then. :return: None
- update() None
Call subscribers to update their data. :return: None
- __weakref__
list of weak references to the object
- property hoppings: Dict[Tuple[int, int, int], Dict[Tuple[int, int], complex]]
Interface for the ‘_hoppings’ attribute.
- property num_hop: int
Count the number of hopping terms. :return: number of hopping terms