pythtb.TBModel.solve_ham#

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

Diagonalize the Hamiltonian

Solve for eigenvalues and optionally eigenvectors of the tight-binding model at a list of one-dimensional k-vectors.

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

One-dimensional list or array of k-vectors, each given in reduced coordinates. 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, both eigenvalues and eigenvectors are returned. If False (default), only eigenvalues are returned.

Changed in version 2.0.0: Renamed from eig_vectors.

flatten_spin_axisbool, optional

If True (default), the spin axes are flattened into the orbital axes. If False, the spin axes are kept separate. This affects the shape of the returned eigenvectors for spinful models.

Added in version 2.0.0.

use_tensorflowbool, optional

If True, use TensorFlow to accelerate the diagonalization. This requires TensorFlow to be installed. Default is False.

Added in version 2.0.0.

**params

Keyword arguments mapping parameter names to value(s). Each value can be a scalar or a 1D array of values. If any values are array-like, the Hamiltonian is evaluated at all combinations of parameter values, and the final array is stacked with the k-axis leading, followed by each parameter axis in the order of given parameter names.

Added in version 2.0.0.

Returns:
evalnp.ndarray

Array of eigenvalues. Shape is:

  • (Nk, nstates) for periodic systems

  • (nstates,) for zero-dimensional (molecular) systems

  • (Nk, n_param1, n_param2, ..., nstates) if parameter sweeps are performed, with parameter axes added after the k-point axis.

evecnp.ndarray, optional

Array of eigenvectors (if return_eigvecs=True). The ordering of bands matches that in eval.

For spinless models the shape is:

  • (Nk, nstates, norb): periodic systems

  • (nstates, norb): zero-dimensional systems

  • (nstates, norb): If only one k-point is provided, the redundant k-axis is removed.

For spinful models the shape is (nstates = norb * 2):

  • (..., nstates, norb, 2): If flatten_spin_axis=False, an additional spin axis of size 2 is appended at the end.

  • (..., nstates, nstates): If flatten_spin_axis=True, the spin axes are flattened into the orbital axes.

If parameter sweeps are performed, parameter axes are added after the k-point axis.

  • (Nk, n_param1, n_param2, ..., nstates, norb[, 2]) or (Nk, n_param1, n_param2, ..., nstates, nstates) depending on flatten_spin_axis.

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})\).

  • In many cases, using the WFArray class offers a more elegant interface for handling eigenstates on a mesh of k and parameter points. This class will automatically manage the periodic gauge of the wavefunctions and provide additional methods for computing observables such as the Berry curvature.

Examples

Solve for eigenvalues at several k-points:

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

Solve for eigenvalues and eigenvectors:

>>> eval, evec = tb.solve_ham([[0.0, 0.0], [0.0, 0.2]], return_eigvecs=True)