pythtb.TBModel.solve_ham#

TBModel.solve_ham(k_pts=None, return_eigvecs=False, flatten_spin_axis=True, use_tensorflow=False, **params)[source]#

Diagonalize the tight-binding Hamiltonian.

Computes eigenvalues and optionally eigenvectors of the tight-binding Hamiltonian by first constructing the Bloch Hamiltonian using hamiltonian() and then diagonalizing it at each k-point.

Added in version 2.0.0: Merged solve_all() and solve_one() into solve_ham(). This function will equivalently handle both a single k-point and multiple k-points.

Parameters:
k_pts(Nk, dim_k) list or numpy.ndarray or None, optional

k-points in reduced (fractional) coordinates of the reciprocal lattice. Shape should be (Nk, dim_k), where dim_k is the number of periodic directions. Should not be specified for systems with zero-dimensional reciprocal space.

Changed in version 2.0.0: Renamed from k_list.

return_eigvecsbool, optional

If True, return (eigenvalues, eigenvectors), otherwise return only eigenvalues. Default is False.

Changed in version 2.0.0: Renamed from eig_vectors.

flatten_spin_axisbool, optional

For spinful models only. If True (default), the spin axes are folded into the orbital index so eigenvectors have shape (..., nstates, nstates) with nstates = norb * 2. If False, an explicit spin axis of size 2 is kept, and eigenvectors have shape (..., nstates, norb, 2).

Added in version 2.0.0.

use_tensorflowbool, optional

If True, use TensorFlow to accelerate the diagonalization (must be installed separately). If False (default), use NumPy for diagonalization.

Added in version 2.0.0.

**params

Named parameter values for parameterized models. Each value may be a scalar or a 1D array; array-valued parameters create sweep axes inserted after the k-point axis in the order of the specified parameters.

Added in version 2.0.0.

Returns:
eigenvaluesnp.ndarray

Sorted eigenvalues. Shape:

  • (nstates,) - finite system (dim_k=0), no sweeps.

  • (Nk, nstates) - periodic system

  • (Nk, n_p1, n_p2, ..., nstates) - with parameter sweeps.

If only one k-point is provided the leading k-axis is pruned to return shape (nstates,) for periodic systems as well.

eigenvectorsnp.ndarray, optional

Returned only when return_eigvecs=True. Band ordering matches that of eigenvalues. Shape:

  • Spinless: (..., nstates, norb)

  • Spinful, flatten_spin_axis=True: (..., nstates, nstates)

  • Spinful, flatten_spin_axis=False: (..., nstates, norb, 2)

Leading axes mirror those of eigenvalues. The trailing axes are ordered such that the eigenvector corresponding to eigenvalues[..., i] is given by eigenvectors[..., i, ...].

See also

hamiltonian

Construct the Bloch Hamiltonian at specified k-points and parameter values.

WFArray

Class for handling wavefunctions on a mesh of k and parameter points, with automatic management of periodic gauge and observables.

Notes

  • This function uses the convention described in section 3.1 of the Formalism.

  • The returned wavefunctions correspond to the cell-periodic part \(u_{n \mathbf{k}}(\mathbf{r})\) and not the full Bloch function \(\psi_{n \mathbf{k}}(\mathbf{r})\).

Examples

Solve for eigenvalues at several k-points:

>>> k_pts = [[0.0, 0.0], [0.5, 0.0], [0.5, 0.5]]
>>> eval = tb.solve_ham(k_pts)

Solve for eigenvalues and eigenvectors:

>>> eval, evec = tb.solve_ham(k_pts, return_eigvecs=True)

Parameter sweep example:

>>> eval, evec = tb.solve_ham(k_pts, return_eigvecs=True, t1=[0.0, 1.0, 2.0])