pythtb.TBModel.set_hop#
- TBModel.set_hop(hop_amp, ind_i, ind_j, ind_R=None, mode='set', allow_conjugate_pair=False)[source]#
Define hopping amplitudes between tight-binding orbitals.
This assigns matrix elements
\[H_{ij}(\mathbf{R}) = \langle \phi_{0,i} | H | \phi_{\mathbf{R},j} \rangle\]between orbital \(i\) in the home cell and orbital \(j\) in the cell displaced by lattice vector \(\mathbf{R}\).
- Parameters:
- hop_ampscalar, array_like, (2,2) ndarray, str, or callable
Hopping amplitude specification.
Added in version 2.0.0: Symbolic expressions and callables are supported.
Valid formats depend on whether
spinfulis True or False, and whether a single orbital indexind_iis specified or all orbitals are being set at once.Spinless models (
spinful=False)Complex scalar.
Spinful models (
spinful=True)Scalar
a-> \(a I_2\) (same value for both spins).4-vector
[a, b, c, d]-> \(a I_2 + b \sigma_x + c \sigma_y + d \sigma_z\)Explicitly, a 4-vector produces
\[\begin{split}\begin{pmatrix} a+d & b - i c \\ b + i c & a-d \end{pmatrix}.\end{split}\]2x2 matrix (Hermitian ndarray).
Symbolic definitions
String: symbolic expression in user-defined parameters.
Callable:
f(param)returning any of the above forms.
- ind_iint
Index of the bra orbital (home cell).
- ind_jint
Index of the ket orbital (shifted cell).
- ind_Rarray_like of int, optional
Integer reduced-coordinate lattice vector specifying the cell of orbital
j. If omitted, defaults to the zero vector. May only carry non-zero values alongperiodic_dirs. Components along non-periodic directions must be zero. Attempting to hop across an open direction raisesValueError.- mode{‘set’, ‘add’}, optional
Operation mode:
'set': replace the hopping value (default)'add': add to existing value
Deprecated since version 2.0.0:
mode="reset"is deprecated. Usemode="set"instead.- allow_conjugate_pairbool, optional
If
False(default), the Hermitian conjugate term is automatically handled and specifying the opposite hopping is disallowed. IfTrue, both entries may be set explicitly.
See also
set_onsiteDefine on-site terms.
hamiltonianEvaluate the Hamiltonian at specified k-points and parameter values.
set_parametersPermanently register parameter values.
with_parametersReturn a new
TBModelwith specified parameters.
Notes
Only individual hopping terms may be defined; bulk hopping assignment is not supported.
Hermiticity is automatically enforced:
\[H_{ji}(-\mathbf{R}) = \left[ H_{ij}(\mathbf{R}) \right]^* .\]Therefore, it is unnecessary to define both directions unless
allow_conjugate_pair=True.ind_Ris defined in reduced coordinates and takes integer values. This means for a givenind_R = [n1, n2, n3], the hopping is between the home cell and the cell at position \(n_1 \mathbf{a}_1 + n_2 \mathbf{a}_2 + n_3 \mathbf{a}_3\), where \(\mathbf{a}_i\) are the lattice vectors.Symbolic and callable inputs automatically register their parameter names. For callables with multiple parameters, each parameter is registered.
Parameter evaluation is scalar only. Spinful on-site blocks must then be then be set with callables so that the returned values match the expected spinful structure.
Example:
# Spinful on-site via 4-vector with one parameter 'mA' tb.set_hop(lambda mA: [mA, 0.2, 0.0, -0.1], ind_i=0, ind_j=1, ind_R=[0,1]) # Spinful on-site via full 2x2 matrix with two parameters 'mA' and 'mB' tb.set_hop( lambda mA, mB: np.array([[mA + mB, 0.1 - 0.2j], [0.1 + 0.2j, mA - mB]]), ind_i=1, ind_j=1, ind_R=[0,0] ) # Calling Hamiltonian later with parameter values, for example: H = tb.hamiltonian(k_pts, mA=0.5, mB=[0, 1, 2, 3, 4]) # Setting the parameters later: tb.set_parameters(mA=0.5, mB=1.0)
Parameters values must later be supplied as scalars or 1D arrays to methods such as
set_parameters(),hamiltonian(),velocity(),solve_ham(), etc., via keyword arguments.Providing parameter values to downstream observables such as
hamiltonian(),velocity(),solve_ham(), etc., does not permanently store them in the model; they are used only for that evaluation. To persist parameter values on the model, useset_parameters().
Examples
Hopping between orbital 0 (home cell) and orbital 2 in cell
R=[0,1]:>>> tb.set_hop(0.3+0.4j, 0, 2, [0, 1])
Add to an existing hopping:
>>> tb.set_hop(100.0, 0, 2, [0, 1], mode="add")
Spinful hopping via 4-vector:
>>> tb.set_hop([0.1, 0.0, 0.2, -0.1], 0, 1, [1, 0])
Symbolic hopping:
>>> tb.set_hop("t1", 0, 1, [1, 0])
Callable hopping:
>>> tb.set_hop(lambda t1: t1**2, 0, 1, [1, 0])
Parametric hopping in spinful model via full 2x2 matrix:
>>> tb.set_hop( ... lambda t1, t2: np.array([[t1, 0.1 - 0.2j], ... [0.1 + 0.2j, t2]]), ... 0, 1, [1, 0] ... )
Later usage:
>>> H = tb.hamiltonian(k_pts, t1=0.5, t2=1.0) >>> H = tb.hamiltonian(k_pts, t1=np.linspace(0,1,5), t2=1.0)
Attempting to hop along a non-periodic axis:
>>> tb.set_hop(0.5, 0, 1, [0, 1, 0]) Traceback (most recent call last): ... ValueError: ind_R may only have non-zero components along periodic directions ...