Hamiltonian Setup

In ed_hamiltonian_normal we setup and build the sector Hamiltonian, which are then used elsewhere to obtain the low part of the energy spectrum or construct the dynamical response functions.

The sector electron Hamiltonian is:

\[H_e = \vec{H}_\downarrow \otimes \vec{1}_\uparrow + \vec{1}_\downarrow \otimes \vec{H}_\uparrow + H_d + H_{nd}\]

while considering the electron-phonon coupling one has:

\[H = 1_{ph} \otimes H_e + H_{ph} \otimes 1_e + H_{ph-ph}\otimes H_{e-ph}\]

where \(H_\sigma\) have different shape according to the value of ed_total_ud. See j.cpc.2021.108261 for further information about this.

In this operational mode the vectors \(\vec{v}\) are stored as matrices \(v_{ i_\uparrow i_\downarrow}\). In parallel mode anumber of \(Q_\downarrow=\frac{D_\downarrow}{N_{threads}}\) of columns are assigned to each thread.

The matrices \(H_\sigma\), \(H_d\), having a small memory footprint, are entirely stored on each thread. The \(H_{nd}\) is instead splits across the threads and applied using the allgather_mpi algorithm (see j.cpc.2021.108261 ).

The matrix-vector operation proceeds as follow: First the diagonal part \(H_d\) is applied to the vector. This step is local in the memory of each thread. The \(H_\uparrow\) is then applied to each column of the vector \(\vec{v}\). This operation is also local on each thread. Next the matrix \(H_\downarrow\) is applied to the rows of the vector. In parallel mode this required parallel transposition of the vector matrix, which allows to perform this step locally on each thread. Finally, is non-vanishing, the last term \(H_{nd}\) is applied. In parallel mode, this step requires to perform a allgather_vector_mpi() which represents the bottleneck of the parallel execution.

Description

Setup and build the sector Hamiltonian, returns the correct dimension of the vectors in the Arpack/Lanczos procedure in each thread and provides an interface to Tri-Diagonalize the Hamiltonian on a Krylov basis given a starting vector.

Quick access

Routines:

build_hv_sector_normal(), delete_hv_sector_normal(), vecdim_hv_sector_normal(), tridiag_hv_sector_normal()

Used modules

  • ed_hamiltonian_normal_common: Global variables related to sector Hamiltonian construction. It contains the vector_transpose_mpi() implementing the MPI Allv-2-Allv parallel matrix transposition.

  • ed_hamiltonian_normal_stored_hxv: Constructs each terms of the sector Hamiltonian storing them into different sparse_matrix instances, implement the corresponding matrix-vector products using stored sparse matrices.

  • ed_hamiltonian_normal_direct_hxv: Constructs and applies on-the-fly each term of the sector Hamiltonian to the input vector \(\vec{w} = H\times \vec{v}\) in a Arpack/Lanczos framework.

Subroutines and functions

subroutine  ed_hamiltonian_normal/build_hv_sector_normal(isector[, hmat])

Builds the matrix-vector product \(H\times \vec{v}\) in the current sector.

  1. Building the sector through build_sector() for isector

  2. Retrieve all dimensions of the sectors, setup the MPI split in parallel mode.

  3. If total sector dimension is < lanc_dim_threshold then Hamiltonian is stored into dense matrix for Lapack diagonalization

  4. Else we proceeds according to the followins scheme:

Build Hamiltonian, \(H\times\vec{v}\) products.

ed_sparse_H = T

ed_sparse_H = F

ed_total_ud = T

serial: sphtimesv_p() => spmatvec_normal_main()
MPI: sphtimesv_p() => spmatvec_mpi_normal_main()
serial: sphtimesv_p() => directmatvec_normal_main()
MPI: sphtimesv_p() => directmatvec_mpi_normal_main()

ed_total_ud = F

serial: sphtimesv_p() => spmatvec_normal_orbs()
MPI: sphtimesv_p() => spmatvec_mpi_normal_orbs()
serial: sphtimesv_p() => directmatvec_normal_orbs()
MPI: sphtimesv_p() => directmatvec_mpi_normal_orbs()
Parameters:

isector [integer] – Index of the actual sector to be analyzed

Options:

hmat (•, •) [real] – Dense matrix to store the sector Hamiltonian is dim < lanc_dim_threshold

subroutine  ed_hamiltonian_normal/delete_hv_sector_normal()

Delete the all the memory used to construct the sector Hamiltonian and the corresponding matrix vector products. The sector is deleted, all the dimensions and MPI splitting variables are reset to zero. All the sparse matrices are deallocated having gone out of scope. The abstract interface pointer spHtimesV_p for the matrix-vector product is nullified.

function  ed_hamiltonian_normal/vecdim_hv_sector_normal(isector)

Returns the dimensions vecdim of the vectors used in the Arpack/Lanczos produces given the current sector index isector . If parallel mode is active the returned dimension corresponds to the correct chunk for each thread.

Parameters:

isector [integer] – current sector index

Return:

vecdim [integer] – vector or vector chunck dimension

subroutine  ed_hamiltonian_normal/tridiag_hv_sector_normal(isector, vvinit, alanc, blanc, norm2)

Returns the parameters \(\vec{\alpha}\) and \(\vec{\beta}\) , respectively alanc and blanc , of the partial tridiagonalization of the sector Hamiltonian on a Krylov basis with starting vector vvinit.

Input:
  • isector

  • vvinit

Output:
  • alanc corresponding to \(\vec{\alpha}\)

  • blanc corresponding to \(\vec{\beta}\)

  • norm2 the norm of the input vector \(\langle {\rm vvinit}|{\rm vvinit}\rangle\)

Parameters:
  • isector [integer] – current sector index

  • vvinit (•) [real] – input vector for the construction of the tridiagonal or Krylov basis

  • alanc (•) [real, allocatable]\(\vec{\alpha}\) or diagonal parameters of the tridiagonal basis.

  • blanc (•) [real, allocatable]\(\vec{\beta}\) or sub-/over-diagonal parameters of the tridiagonal basis.

  • norm2 [real] – norm of the input vector vvinit