Skip to main content
Ctrl+K
PythTB Docs - Home PythTB Docs - Home
  • About
  • Install
  • API
  • Tutorials
  • Development
  • Release notes
  • Changelog
    • Formalism
    • Resources
    • Citation
  • GitHub
  • PyPI
  • About
  • Install
  • API
  • Tutorials
  • Development
  • Release notes
  • Changelog
  • Formalism
  • Resources
  • Citation
  • GitHub
  • PyPI

Section Navigation

PythTB Classes

  • pythtb.TBModel
    • pythtb.TBModel.add_orb
    • pythtb.TBModel.axion_angle
    • pythtb.TBModel.berry_curvature
    • pythtb.TBModel.change_nonperiodic_vector
    • pythtb.TBModel.chern_number
    • pythtb.TBModel.clear_hoppings
    • pythtb.TBModel.clear_onsite
    • pythtb.TBModel.copy
    • pythtb.TBModel.cut_piece
    • pythtb.TBModel.display
    • pythtb.TBModel.get_lat
    • pythtb.TBModel.get_lat_vecs
    • pythtb.TBModel.get_num_orbitals
    • pythtb.TBModel.get_orb
    • pythtb.TBModel.get_orb_vecs
    • pythtb.TBModel.hamiltonian
    • pythtb.TBModel.info
    • pythtb.TBModel.k_path
    • pythtb.TBModel.k_uniform_mesh
    • pythtb.TBModel.local_chern_marker
    • pythtb.TBModel.make_finite
    • pythtb.TBModel.make_supercell
    • pythtb.TBModel.nn_bonds
    • pythtb.TBModel.plot_bands
    • pythtb.TBModel.position_expectation
    • pythtb.TBModel.position_hwf
    • pythtb.TBModel.position_matrix
    • pythtb.TBModel.quantum_geometric_tensor
    • pythtb.TBModel.quantum_metric
    • pythtb.TBModel.reduce_dim
    • pythtb.TBModel.remove_orb
    • pythtb.TBModel.set_hop
    • pythtb.TBModel.set_onsite
    • pythtb.TBModel.set_parameters
    • pythtb.TBModel.set_shell_hops
    • pythtb.TBModel.solve_all
    • pythtb.TBModel.solve_ham
    • pythtb.TBModel.solve_one
    • pythtb.TBModel.velocity
    • pythtb.TBModel.visualize
    • pythtb.TBModel.visualize_3d
    • pythtb.TBModel.with_parameters
    • pythtb.TBModel.assume_position_operator_diagonal
    • pythtb.TBModel.cell_volume
    • pythtb.TBModel.dim_k
    • pythtb.TBModel.dim_r
    • pythtb.TBModel.from_w90
    • pythtb.TBModel.hoppings
    • pythtb.TBModel.lat_vecs
    • pythtb.TBModel.lattice
    • pythtb.TBModel.nhops
    • pythtb.TBModel.norb
    • pythtb.TBModel.nspin
    • pythtb.TBModel.nstate
    • pythtb.TBModel.onsite
    • pythtb.TBModel.orb_vecs
    • pythtb.TBModel.parameters
    • pythtb.TBModel.periodic_dirs
    • pythtb.TBModel.recip_lat_vecs
    • pythtb.TBModel.recip_volume
    • pythtb.TBModel.spinful
  • pythtb.WFArray
    • pythtb.WFArray.berry_connection
    • pythtb.WFArray.berry_curvature
    • pythtb.WFArray.berry_flux
    • pythtb.WFArray.berry_phase
    • pythtb.WFArray.chern_number
    • pythtb.WFArray.choose_states
    • pythtb.WFArray.copy
    • pythtb.WFArray.empty_like
    • pythtb.WFArray.impose_loop
    • pythtb.WFArray.impose_pbc
    • pythtb.WFArray.links
    • pythtb.WFArray.overlap_matrix
    • pythtb.WFArray.position_expectation
    • pythtb.WFArray.position_hwf
    • pythtb.WFArray.position_matrix
    • pythtb.WFArray.projectors
    • pythtb.WFArray.remove_states
    • pythtb.WFArray.roll_states_with_pbc
    • pythtb.WFArray.set_states
    • pythtb.WFArray.solve_model
    • pythtb.WFArray.solve_on_grid
    • pythtb.WFArray.solve_on_one_point
    • pythtb.WFArray.states
    • pythtb.WFArray.wilson_loop
    • pythtb.WFArray.Mmn
    • pythtb.WFArray.dim_k
    • pythtb.WFArray.dim_lambda
    • pythtb.WFArray.energies
    • pythtb.WFArray.filled
    • pythtb.WFArray.hamiltonian
    • pythtb.WFArray.k_points
    • pythtb.WFArray.lattice
    • pythtb.WFArray.mesh
    • pythtb.WFArray.model
    • pythtb.WFArray.naxes
    • pythtb.WFArray.norb
    • pythtb.WFArray.nspin
    • pythtb.WFArray.nstates
    • pythtb.WFArray.param_points
    • pythtb.WFArray.psi_nk
    • pythtb.WFArray.shape
    • pythtb.WFArray.shape_mesh
    • pythtb.WFArray.spinful
    • pythtb.WFArray.u_nk
    • pythtb.WFArray.wfs
  • pythtb.Lattice
    • pythtb.Lattice.add_orb
    • pythtb.Lattice.change_nonperiodic_vector
    • pythtb.Lattice.cut_piece
    • pythtb.Lattice.get_kpath_distance
    • pythtb.Lattice.get_lat_vecs
    • pythtb.Lattice.get_orb_vecs
    • pythtb.Lattice.get_recip_lat_vecs
    • pythtb.Lattice.info
    • pythtb.Lattice.k_path
    • pythtb.Lattice.k_shell_weights
    • pythtb.Lattice.k_uniform_mesh
    • pythtb.Lattice.make_supercell
    • pythtb.Lattice.nn_bonds
    • pythtb.Lattice.nn_k_shell
    • pythtb.Lattice.remove_orb
    • pythtb.Lattice.visualize
    • pythtb.Lattice.visualize_3d
    • pythtb.Lattice.cell_volume
    • pythtb.Lattice.dim_k
    • pythtb.Lattice.dim_r
    • pythtb.Lattice.lat_vecs
    • pythtb.Lattice.norb
    • pythtb.Lattice.nsuper
    • pythtb.Lattice.orb_vecs
    • pythtb.Lattice.periodic_dirs
    • pythtb.Lattice.recip_lat_vecs
    • pythtb.Lattice.recip_volume
  • pythtb.Mesh
    • pythtb.Mesh.build_custom
    • pythtb.Mesh.build_grid
    • pythtb.Mesh.build_path
    • pythtb.Mesh.gen_hyper_cube
    • pythtb.Mesh.get_axis_range
    • pythtb.Mesh.get_k_points
    • pythtb.Mesh.get_param_points
    • pythtb.Mesh.info
    • pythtb.Mesh.is_axis_bz_winding
    • pythtb.Mesh.is_axis_closed
    • pythtb.Mesh.is_axis_looped
    • pythtb.Mesh.loop
    • pythtb.Mesh.unloop
    • pythtb.Mesh.axes
    • pythtb.Mesh.axis_names
    • pythtb.Mesh.axis_types
    • pythtb.Mesh.bz_winding_axes
    • pythtb.Mesh.bz_winding_mask
    • pythtb.Mesh.component_types
    • pythtb.Mesh.dim_k
    • pythtb.Mesh.dim_lambda
    • pythtb.Mesh.dim_total
    • pythtb.Mesh.endpoint_axes
    • pythtb.Mesh.endpoint_mask
    • pythtb.Mesh.filled
    • pythtb.Mesh.flat
    • pythtb.Mesh.is_grid
    • pythtb.Mesh.is_k_torus
    • pythtb.Mesh.k_axes
    • pythtb.Mesh.k_axis_indices
    • pythtb.Mesh.k_component_indices
    • pythtb.Mesh.lambda_axes
    • pythtb.Mesh.lambda_axis_indices
    • pythtb.Mesh.lambda_component_indices
    • pythtb.Mesh.loop_axes
    • pythtb.Mesh.loop_mask
    • pythtb.Mesh.naxes
    • pythtb.Mesh.nk_axes
    • pythtb.Mesh.nl_axes
    • pythtb.Mesh.nodes
    • pythtb.Mesh.npoints
    • pythtb.Mesh.points
    • pythtb.Mesh.shape
    • pythtb.Mesh.shape_axes
    • pythtb.Mesh.shape_k
    • pythtb.Mesh.shape_lambda
  • pythtb.W90
    • pythtb.W90.bands_qe
    • pythtb.W90.bands_w90
    • pythtb.W90.dist_hop
    • pythtb.W90.model
    • pythtb.W90.shells
    • pythtb.W90.w90_bands_consistency
  • pythtb.Wannier
    • pythtb.Wannier.disentangle
    • pythtb.Wannier.get_centers
    • pythtb.Wannier.get_trial_wfs
    • pythtb.Wannier.info
    • pythtb.Wannier.interp_bands
    • pythtb.Wannier.maxloc
    • pythtb.Wannier.min_spread
    • pythtb.Wannier.plot_centers
    • pythtb.Wannier.plot_decay
    • pythtb.Wannier.plot_density
    • pythtb.Wannier.project
    • pythtb.Wannier.set_tilde_states
    • pythtb.Wannier.set_trial_wfs
    • pythtb.Wannier.Amn
    • pythtb.Wannier.Omega_D
    • pythtb.Wannier.Omega_I
    • pythtb.Wannier.Omega_OD
    • pythtb.Wannier.bloch_states
    • pythtb.Wannier.centers
    • pythtb.Wannier.lattice
    • pythtb.Wannier.mesh
    • pythtb.Wannier.nks
    • pythtb.Wannier.num_twfs
    • pythtb.Wannier.spread
    • pythtb.Wannier.tilde_states
    • pythtb.Wannier.trial_wfs
    • pythtb.Wannier.wannier

PythTB Models

  • pythtb.models
    • pythtb.models.checkerboard
    • pythtb.models.fu_kane_mele
    • pythtb.models.graphene
    • pythtb.models.haldane
    • pythtb.models.kane_mele
    • pythtb.models.ssh

I/O Utilities

  • pythtb.io.w90
    • pythtb.io.w90.HRBlock
      • pythtb.io.w90.HRBlock.h
      • pythtb.io.w90.HRBlock.degeneracy
    • pythtb.io.w90.W90Dataset
      • pythtb.io.w90.W90Dataset.bands_ene_ev
      • pythtb.io.w90.W90Dataset.bands_k_red
      • pythtb.io.w90.W90Dataset.kpath_labels
      • pythtb.io.w90.W90Dataset.kpath_nodes_red
      • pythtb.io.w90.W90Dataset.meta
      • pythtb.io.w90.W90Dataset.win_lines
      • pythtb.io.w90.W90Dataset.prefix
      • pythtb.io.w90.W90Dataset.root
      • pythtb.io.w90.W90Dataset.lat_cart
      • pythtb.io.w90.W90Dataset.centres_xyz
      • pythtb.io.w90.W90Dataset.centres_red
      • pythtb.io.w90.W90Dataset.num_wan
      • pythtb.io.w90.W90Dataset.ham_r
    • pythtb.io.w90.load_w90_dataset
    • pythtb.io.w90.parse_unit_cell_cart
    • pythtb.io.w90.read_bands_w90
    • pythtb.io.w90.read_centres
    • pythtb.io.w90.read_hr
    • pythtb.io.w90.read_kpoint_path
    • pythtb.io.w90.read_win
    • pythtb.io.w90.W90ConsistencyError
    • pythtb.io.w90.W90ParseError
  • pythtb.io.qe
    • pythtb.io.qe.read_bands_qe
    • pythtb.io.qe.QEConsistencyError
    • pythtb.io.qe.QEParseError
  • PythTB API Reference
  • pythtb.WFArray
  • pythtb.WFArray.links

pythtb.WFArray.links#

WFArray.links(axis_idx=None, state_idx=None)[source]#

Compute unitary link matrices for specified axis directions.

For each mesh direction \(\mu\) in axis_idx, this routine computes the parallel-transport unitary (“link”) between the states at each point \(\boldsymbol{\kappa}\) and its nearest forward neighbor \(\boldsymbol{\kappa} + \hat{\mu}\).

First define the overlap matrix:

\[M_{\mu}(\boldsymbol{\kappa})_{mn} = \langle u_{m}(\boldsymbol{\kappa}) \mid u_{n}(\boldsymbol{\kappa} + \hat{\mu}) \rangle.\]

where \(m,n\) index the selected states in state_idx.

The unitary link is then obtained by taking the unitary factor of this overlap matrix:

\[U_{\mu}(\boldsymbol{\kappa}) \;\equiv\; \mathcal{U}\, \big[M_{\mu}(\boldsymbol{\kappa})\big],\]

Here \(\mathcal{U}[\cdot]\) denotes the unitary part of the matrix, i.e. the unitary factor in a matrix-factorization of \(M_{\mu}(\boldsymbol{\kappa})\). In practice this is obtained from the singular-value decomposition (see Notes).

Added in version 2.0.0.

Parameters:
axis_idxint or array_like of int, optional

List of Mesh axes along which to compute the links. If not provided, links will be computed for all directions in the mesh.

state_idxint or array_like of int, optional

Index or indices of the states for which to compute the links. If an integer is provided, only that state will be considered. If a list is provided, links for all specified states will be computed. If not provided, links will be computed for all states.

Returns:
U_forwardnp.ndarray

Array of unitary links. The leading dimension indexes the chosen axis_idx directions (or all axes if axis_idx is None). The trailing two dimensions are the matrix indices in band space.

Shape:

(ndirs, *mesh_shape, n_states, n_states)

where ndirs = len(axis_idx) (or WFArray.naxes by default).

See also

berry_connection(), berry_phase(), berry_flux()
wilson_loop()

Notes

  • This is the primitive building block for berry_connection(), berry_phase(), berry_flux(), and wilson_loop() functions.

  • The unitary link is construced from the singular value decomposition of the overlap matrix,

    \[M_{\mu} = V_{\mu}\,\Sigma_{\mu}\,W_{\mu}^{\dagger},\]

    as,

    \[\mathcal{U} \big[ M_{\mu}(\boldsymbol{\kappa}) \big] \equiv V_{\mu} W_{\mu}^\dagger\]

    This is equivalent to taking the unitary factor in the polar decomposition.

    \[\begin{split}M_{\mu} = U_{\mu}\,H_{\mu}, \qquad H_{\mu} = \bigl(M_{\mu}^{\dagger} M_{\mu}\bigr)^{1/2}, \\ \Rightarrow\quad \mathcal{U}[M_{\mu}] \equiv U_{\mu} = M_{\mu}\bigl(M_{\mu}^{\dagger} M_{\mu}\bigr)^{-1/2}.\end{split}\]
  • Boundary behavior follows the Mesh axis type:

    • Periodic (no endpoint)

      The final point wraps to the first (looped). All entries are meaningful.

    • Periodic with endpoint included

      The endpoint is explicitly included in the mesh. No wrap is applied; the final forward link is undefined and is filled with NaN. Discard the final slice along that axis.

    • Nonperiodic (open directions)

      No physical forward neighbor exists at the boundary. Forward links there are filled with NaN to keep the shape consistent. These values are not physically meaningful and should be dropped.

    These conventions match those used internally by wilson_loop(), berry_phase(), and related routines, which automatically trim invalid points.

previous

pythtb.WFArray.impose_pbc

next

pythtb.WFArray.overlap_matrix

On this page
  • WFArray.links()

© Copyright 2025, PythTB team.

Created using Sphinx 9.1.0.

Built with the PyData Sphinx Theme 0.18.0.