hamiltonian#

Hamiltonian operations.

jrystal.hamiltonian.hamiltonian_matrix(band_coefficient: Complex[Array, 'spin kpt band x y z'], positions: Float[Array, 'atom 3'], charges: Int[Array, 'atom'], effictive_density_grid: Float[Array, 'x y z'], g_vector_grid: Float[Array, 'x y z 3'], kpts: Float[Array, 'kpt 3'], vol: Float, xc: str = 'lda', spin_restricted: bool = True, kohn_sham: bool = True) Complex[Array, 'kpt band band'][source]#

Compute the full Hamiltonian matrix in the orbital basis.

This function computes the complete Hamiltonian matrix including both diagonal and off-diagonal elements. The matrix elements are defined as:

\[H_{ij} = \langle \psi_i | \hat{H} | \psi_j \rangle\]

where \(\hat{H} = \hat{T} + \hat{V}_{eff}\) is the total Hamiltonian operator.

Parameters:
  • band_coefficient (Complex[Array, "spin kpt band x y z"]) – Plane wave coefficients with shape [spin, kpt, band, x, y, z]. The last three dimensions represent the spatial grid.

  • positions (Float[Array, "atom 3"]) – Atomic positions in Bohr units with shape [atom, 3].

  • charges (Int[Array, "atom"]) – Atomic numbers for each atom with shape [atom].

  • effictive_density_grid (Float[Array, "x y z"]) – Electron density for effective potential evaluated on real space grid with shape [x, y, z].

  • g_vector_grid (Float[Array, "x y z 3"]) – G-vector grid in reciprocal space with shape [x, y, z, 3].

  • kpts (Float[Array, "kpt 3"]) – K-points in reciprocal space with shape [kpt, 3]. Currently, only spin-restricted

  • K-points. (calculation enable parallel calculation for multiple)

  • vol (Float) – Volume of the unit cell.

  • xc (str) – Exchange-correlation functional name. Defaults to ‘lda’.

  • kohn_sham (bool) – Whether to use Kohn-Sham potential. Defaults to True.

Returns:

Complex array of shape [kpt, band, band] containing the complete Hamiltonian matrix elements between all pairs of bands at each k-point.

Return type:

Complex[Array, “kpt band band”]

jrystal.hamiltonian.hamiltonian_matrix_trace(band_coefficient: Complex[Array, 'spin kpt band x y z'], positions: Float[Array, 'atom 3'], charges: Int[Array, 'atom'], effictive_density_grid: Float[Array, 'x y z'], g_vector_grid: Float[Array, 'x y z 3'], kpts: Float[Array, 'kpt 3'], vol: Float, xc: str = 'lda', spin_restricted: bool = True, kohn_sham: bool = True, keep_kpts_axis: bool = False, keep_spin_axis: bool = False) Float | Float[Array, 'spin'] | Float[Array, 'spin kpt'][source]#

Calculate the trace of the Hamiltonian matrix.

The trace is computed as:

\[\text{Tr}(\hat{H}) = \sum_i H_{ii} = \sum_i \langle \psi_i | \hat{H} | \psi_i \rangle\]

This quantity represents the sum of the diagonal elements of the Hamiltonian matrix, which is useful for various physical quantities like total energy calculations.

Parameters:
  • band_coefficient (Complex[Array, "spin kpt band x y z"]) – Plane wave coefficients with shape [spin, kpt, band, x, y, z]. The last three dimensions represent the spatial grid.

  • positions (Float[Array, "atom 3"]) – Atomic positions in Bohr units with shape [atom, 3].

  • charges (Int[Array, "atom"]) – Atomic numbers for each atom with shape [atom].

  • effictive_density_grid (Float[Array, "x y z"]) – Electron density for effective potential evaluated on real space grid with shape [x, y, z].

  • g_vector_grid (Float[Array, "x y z 3"]) – G-vector grid in reciprocal space with shape [x, y, z, 3].

  • kpts (Float[Array, "kpt 3"]) – K-points in reciprocal space with shape [kpt, 3].

  • vol (Float) – Volume of the unit cell.

  • xc (str) – Exchange-correlation functional name. Defaults to ‘lda’.

  • kohn_sham (bool) – Whether to use Kohn-Sham potential. Defaults to True.

  • keep_kpts_axis (bool) – If True, retains the k-points axis in output. Defaults to False.

  • keep_spin_axis (bool) – If True, retains the spin axis in output. Defaults to False.

Returns:

The trace of the Hamiltonian matrix. The shape depends on keep_kpts_axis and keep_spin_axis:

  • If both False: returns a scalar Float

  • If keep_spin_axis True: returns Float[Array, “spin”]

  • If keep_kpts_axis True: returns Float[Array, “kpt”]

  • If both True: returns Float[Array, “spin kpt”]

Return type:

Union[Float, Float[Array, “spin”], Float[Array, “spin kpt”]]