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:
while considering the electron-phonon coupling one has:
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 thevector_transpose_mpi()
implementing the MPIAllv-2-Allv
parallel matrix transposition.ed_hamiltonian_normal_stored_hxv
: Constructs each terms of the sector Hamiltonian storing them into differentsparse_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.
Building the sector through
build_sector()
forisector
Retrieve all dimensions of the sectors, setup the MPI split in parallel mode.
If total sector dimension is <
lanc_dim_threshold
then Hamiltonian is stored into dense matrix for Lapack diagonalizationElse we proceeds according to the followins scheme:
ed_sparse_H
=T
ed_sparse_H
=F
ed_total_ud
=T
ed_total_ud
=F
- 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 indexisector
. 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
andblanc
, of the partial tridiagonalization of the sector Hamiltonian on a Krylov basis with starting vectorvvinit
.- 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