tbplas.Sample

class tbplas.Sample(*args: SuperCell | SCInterHopping)

Combination of SuperCell and SCInterHopping.

_sc_list

list of supercells within the sample

Type:

List[SuperCell]

_hop_list

list of inter-hopping sets between supercells within the sample

Type:

List[SCInterHopping]

__init__(*args: SuperCell | SCInterHopping) None
Parameters:

args – supercells and inter-hopping sets within this sample

Returns:

None

Methods

__init__(*args)

apply_magnetic_field(intensity[, gauge])

Apply magnetic field perpendicular to xOy-plane to -z direction via Peierls substitution.

get_array()

Get all array attributes for sending to C++ extensions. :return: name tuple with orb_eng, orb_pos, hop_ind, hop_eng, lat_vec, dr and sc0_lat_vec as attributes.

init_array([force_init])

Interface for initializing the arrays.

init_hop([force_init])

Reserved for compatibility.

init_orb_eng([force_init])

Reserved for compatibility.

init_orb_pos([force_init])

Reserved for compatibility.

plot([fig_name, fig_size, fig_dpi, ...])

Plot lattice vectors, orbitals, and hopping terms.

reset_array()

Reset all modifications to arrays.

save([directory])

Save model to disk.

Attributes

num_hop

Get the total number of hopping terms of the sample.

num_orb

Get the total number of orbitals of the sample.

sc0_lat_vec

Get lattice vectors of the first supercell. :return: (3, 3) float64 array Cartesian coordinates of lattice vectors in NM.

sc0_origin

Get origin of the first supercell. :return: (3, ) float64 array Cartesian coordinates of origin in NM.

__init__(*args: SuperCell | SCInterHopping) None
Parameters:

args – supercells and inter-hopping sets within this sample

Returns:

None

apply_magnetic_field(intensity: float, gauge: int = 0) None

Apply magnetic field perpendicular to xOy-plane to -z direction via Peierls substitution.

The gauge-invariant Peierls phase from R_i to R_j is evaluated as

exp[-1j * |e|/(2*h_bar*c) * (R_i - R_j) * (A_i + A_j)]

or

exp[1j * |e|/(2*h_bar*c) * (R_j - R_i) * (A_j + A_i)]

For the reference, see eqn. 10-11 of ref [1] and eqn. 19-20 of ref [2]. Be aware that ref [1] uses |e| while ref [2] uses e with sign.

For perpendicular magnetic pointing to +z, we have A = (-By, 0, 0). Then

(R_j - R_i) * (A_j + A_i) = -B * (y_j + y_i) * (x_j - x_i)

However, there isn’t the minus sign in the source code of TBPLaS. This is because we are considering a magnetic field pointing to -z.

Note that the above formulae use Gaussian units. For SI units, the speed of light vanishes. This is verified by checking the dimension under SI units:

[e]/[h_bar] = IT/(L^2 M T^-1) = L^-2 M^-1 I T^-2 [R][A] = L * (M T^-2 I^-1 L) = L^2 M I^-1 T^-2

which cancel out upon multiplication. Similarly, under Gaussian units we have: [e]/[c*h_bar] = L^(-3/2) M^(-1/2) T [R][A] = L^(3/2) M^(1/2) T which also cancel out upon multiplication.

The analysis also inspires to calculate the scaling factor in SI units as:

|e/2h_bar| = 759633724404755.2

However, we use nm for lengths. So the scaling factor should be divided by 1e18, yielding 0.0007596337244047553. That is exactly the magic number pi / 4135.666734 = 0.0007596339008078771 in the source code of TBPLaS.

Reference: [1] https://journals.aps.org/prb/pdf/10.1103/PhysRevB.51.4940 [2] https://journals.jps.jp/doi/full/10.7566/JPSJ.85.074709

Parameters:
  • intensity – magnetic B field in Tesla

  • gauge – gauge of vector potential of the magnetic field to -z 0 for (By, 0, 0), 1 for (0, -Bx, 0), 2 for (0.5By, -0.5Bx, 0)

Returns:

None

get_array() namedtuple

Get all array attributes for sending to C++ extensions. :return: name tuple with orb_eng, orb_pos, hop_ind, hop_eng, lat_vec,

dr and sc0_lat_vec as attributes

init_array(force_init: bool = False) None

Interface for initializing the arrays.

If any array is empty, build all arrays from scratch. Otherwise, build them when force_init is True.

Parameters:

force_init – whether to force initializing the arrays from scratch even if they have already been initialized

Returns:

None

init_hop(force_init: bool = False) None

Reserved for compatibility. Use init_array instead.

init_orb_eng(force_init: bool = False) None

Reserved for compatibility. Use init_array instead.

init_orb_pos(force_init: bool = False) None

Reserved for compatibility. Use init_array instead.

plot(fig_name: str = None, fig_size: Tuple[float, float] = None, fig_dpi: int = 300, sc_orb_colors: List[Callable[[ndarray], List[str]]] = None, sc_hop_colors: List[str] = None, inter_hop_colors: List[str] = None, **kwargs) None

Plot lattice vectors, orbitals, and hopping terms.

If figure name is give, save the figure to file. Otherwise, show it on the screen.

Parameters:
  • fig_name – file name to which the figure will be saved

  • fig_size – size of the figure

  • fig_dpi – resolution of the figure file

  • sc_orb_colors – colors for orbitals or each supercell

  • sc_hop_colors – colors for the hopping terms of each supercell

  • inter_hop_colors – colors for the hopping terms each inter-hopping container

  • kwargs – arguments for the ‘plot’ method of ‘Super’ and ‘SCInterHopping’ classes

Returns:

None

reset_array() None

Reset all modifications to arrays. :return: None

save(directory: str = 'sample') None

Save model to disk. :param directory: directory to which data will be saved :return: None

__weakref__

list of weak references to the object

property num_hop: int

Get the total number of hopping terms of the sample. :return: total number of hopping terms

property num_orb: int

Get the total number of orbitals of the sample. :return: total number of orbitals

property sc0_lat_vec: ndarray

Get lattice vectors of the first supercell. :return: (3, 3) float64 array

Cartesian coordinates of lattice vectors in NM

property sc0_origin: ndarray

Get origin of the first supercell. :return: (3, ) float64 array

Cartesian coordinates of origin in NM