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 integer lattice vector \(\mathbf{R}\) (in reduced coordinates). For periodic directions, hoppings contribute to the Bloch Hamiltonian with phase factors \(e^{i\mathbf{k}\cdot\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 spinful is True or False, and whether a single orbital index ind_i is 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. Components along non-periodic directions must be zero. Attempting to hop across an open direction raises ValueError. If omitted, defaults to the zero vector.

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. Use mode="set" instead.

allow_conjugate_pairbool, optional

If False (default), the Hermitian conjugate term is automatically handled and specifying the opposite hopping is disallowed. If True, both entries may be set explicitly.

See also

set_onsite

Define on-site terms.

set_parameters

Permanently register parameter values.

with_parameters

Return a new TBModel with 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.

  • When mode='add' the new value accumulates.

  • ind_R may only carry non-zero values along periodic_dirs.

  • 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, use set_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 ...