PROGRESS  master
prg_densitymatrix_mod Module Reference

Module to obtain the density matrix by diagonalizing an orthogonalized Hamiltonian. More...

Functions/Subroutines

subroutine, public prg_build_density_t0 (ham_bml, rho_bml, threshold, bndfil, eigenvalues_out)
 Builds the density matrix from \( H_0 \) for zero electronic temperature. \( \rho = C \Theta(\mu I - \epsilon) C^{\dagger} \) Where, \( C \) is the matrix eigenvector and \( \epsilon \) is the matrix eigenvalue. \( \Theta() \) is the Heaviside function. More...
 
subroutine, public prg_build_density_t (ham_bml, rho_bml, threshold, bndfil, kbt, ef, eigenvalues_out)
 Builds the density matrix from \( H_0 \) for electronic temperature T. \( \rho = C f(\mu I - \epsilon) C^{\dagger} \) Where, \( C \) is the matrix eigenvector and \( \epsilon \) is the matrix eigenvalue. \( f \) is the Fermi function. More...
 
subroutine, public prg_build_density_t_fulldata (ham_bml, rho_bml, threshold, bndfil, kbt, ef, eigenvalues_out, evects_bml, fvals)
 Builds the density matrix from \( H_0 \) for electronic temperature T. \( \rho = C f(\mu I - \epsilon) C^{\dagger} \) Where, \( C \) is the matrix eigenvector and \( \epsilon \) is the matrix eigenvalue. \( f \) is the Fermi function. More...
 
subroutine, public prg_build_density_t_ed (ham_bml, rho_bml, evects_bml, threshold, bndfil, kbt, ef, evals, dvals, hindex, llsize, verbose)
 Builds the density matrix from \( H_0 \) for electronic temperature T. \( \rho = C f(\mu I - \epsilon) C^{\dagger} \) Where, \( C \) is the matrix eigenvector and \( \epsilon \) is the matrix eigenvalue. \( f \) is the Fermi function. More...
 
subroutine, public prg_get_evalsdvalsevects (ham_bml, threshold, hindex, llsize, evals, dvals, evects_bml, verbose)
 Gets the eigenvalues and eigenvectors and the core contribution to each eigenvalue (dvals) . More...
 
subroutine, public prg_build_density_fromevalsandevects (evects_bml, evals, rho_bml, threshold, bndfil, kbt, ef, verbose)
 Builds the density matrix from the evects and evals for electronic temperature T. More...
 
subroutine, public prg_build_density_t_fermi (ham_bml, rho_bml, threshold, kbt, ef, verbose, drho)
 Builds the density matrix from \( H_0 \) for electronic temperature T. \( \rho = C f(\mu I - \epsilon) C^{\dagger} \) Where, \( C \) is the matrix eigenvector and \( \epsilon \) is the matrix eigenvalue. \( f \) is the Fermi function. In this routine the Fermi level is passed as an argument. More...
 
subroutine, public prg_build_atomic_density (rhoat_bml, numel, hindex, spindex, norb, bml_type)
 Builds the atomic density matrix. \( \rho_{ii} = mathcal{Z}_{ii} \) Where, \( mathcal{Z}_{ii} \) is the number of electrons for orbital i. More...
 
subroutine, public prg_get_flevel (eigenvalues, kbt, bndfil, tol, Ef, err)
 Routine to compute the Fermi level given a set of eigenvalues and a temperature. It applies the Bisection method over the function: \( g(\mu) = \sum_k 2 f(\epsilon_k - \mu) - N = 0 \) Where \( f(\epsilon_k - \mu) = \frac{1}{1+\exp{(\epsilon_k - \mu)/(k_bT)}}\). More...
 
subroutine, public prg_get_flevel_nt (eigenvalues, kbt, bndfil, tol, ef, err, verbose)
 Routine to compute the Fermi level given a set of eigenvalues and a temperature. It applies the Newton-Raphson method over the function: \( g(\mu) = \sum_k 2 f(\epsilon_k - \mu) - N = 0 \) Where \( f(\epsilon_k - \mu) = \frac{1}{1+\exp{(\epsilon_k - \mu)/(k_bT)}}\). More...
 
subroutine, public prg_get_eigenvalues (ham_bml, eigenvalues, verbose)
 Gets the eigenvalues of the Orthogonalized Hamiltonian. More...
 
subroutine, public prg_check_idempotency (mat_bml, threshold, idempotency)
 To check the idempotency error of a matrix. This is calculated as the Frobenius norm of \( (A - A^2) \). More...
 
real(dp) function fermi (e, ef, kbt)
 Gives the Fermi distribution value for energy e. More...
 
real(dp) function dfermi (e, ef, kbt)
 Gives the gradient of Fermi distribution w.r.t. ef. More...
 
subroutine, public prg_toeigenspace (mat_bml, matEig_bml, evects_bml, threshold, verbose)
 Change an operator into the eigenspace representation. More...
 
subroutine, public prg_tocanonicalspace (mat_bml, matCan_bml, evects_bml, threshold, verbose)
 Change an operator into the eigenspace representation. More...
 
subroutine, public canon_dm_prt (P1, H1, Nocc, T, Q, e, mu0, m, HDIM)
 
subroutine eig (A, Q, ee, TYPE, HDIM)
 

Variables

integer, parameter dp = kind(1.0d0)
 

Detailed Description

Module to obtain the density matrix by diagonalizing an orthogonalized Hamiltonian.

Function/Subroutine Documentation

◆ canon_dm_prt()

subroutine, public prg_densitymatrix_mod::canon_dm_prt ( real(prec), dimension(hdim,hdim), intent(out)  P1,
real(prec), dimension(hdim,hdim), intent(in)  H1,
real(prec), intent(in)  Nocc,
real(prec), intent(in)  T,
real(prec), dimension(hdim,hdim), intent(in)  Q,
real(prec), dimension(hdim), intent(in)  e,
real(prec), intent(in)  mu0,
integer, intent(in)  m,
integer, intent(in)  HDIM 
)

Definition at line 1126 of file prg_densitymatrix_mod.F90.

◆ dfermi()

real(dp) function prg_densitymatrix_mod::dfermi ( real(dp), intent(in)  e,
real(dp), intent(in)  ef,
real(dp), intent(in)  kbt 
)
private

Gives the gradient of Fermi distribution w.r.t. ef.

Parameters
eEnergy.
efFermi energy.

Definition at line 1020 of file prg_densitymatrix_mod.F90.

◆ eig()

subroutine prg_densitymatrix_mod::eig ( real(prec), dimension(hdim,hdim), intent(in)  A,
real(prec), dimension(hdim,hdim), intent(out)  Q,
real(prec), dimension(hdim), intent(out)  ee,
character(1), intent(in)  TYPE,
integer, intent(in)  HDIM 
)
private

Definition at line 1192 of file prg_densitymatrix_mod.F90.

◆ fermi()

real(dp) function prg_densitymatrix_mod::fermi ( real(dp), intent(in)  e,
real(dp), intent(in)  ef,
real(dp), intent(in)  kbt 
)
private

Gives the Fermi distribution value for energy e.

Parameters
eEnergy.
efFermi energy.

Definition at line 1004 of file prg_densitymatrix_mod.F90.

◆ prg_build_atomic_density()

subroutine, public prg_densitymatrix_mod::prg_build_atomic_density ( type(bml_matrix_t), intent(inout)  rhoat_bml,
real(dp), dimension(:), intent(in)  numel,
integer, dimension(:,:), intent(in)  hindex,
integer, dimension(:), intent(in)  spindex,
integer, intent(in)  norb,
character(len=*), intent(in)  bml_type 
)

Builds the atomic density matrix. \( \rho_{ii} = mathcal{Z}_{ii} \) Where, \( mathcal{Z}_{ii} \) is the number of electrons for orbital i.

Parameters
rhoatOutput atomic diagonal density matrix,
hindexStart and end index for every atom in the system.
numelNumber of electrons per specie. It runs over the specie index.
spindexSpecie index.
norbsNumber of orbitals.

Definition at line 650 of file prg_densitymatrix_mod.F90.

◆ prg_build_density_fromevalsandevects()

subroutine, public prg_densitymatrix_mod::prg_build_density_fromevalsandevects ( type(bml_matrix_t), intent(inout)  evects_bml,
real(dp), dimension(*), intent(in)  evals,
type(bml_matrix_t), intent(inout)  rho_bml,
real(dp), intent(in)  threshold,
real(dp), intent(in)  bndfil,
real(dp), intent(in)  kbt,
real(dp), intent(inout)  ef,
integer, intent(in)  verbose 
)

Builds the density matrix from the evects and evals for electronic temperature T.

Parameters
evects_bmlEigenvectors.
evalsEigenvalues.
thresholdThreshold for sparse matrix algebra.
bndfilFiling factor.
kbtElectronic temperature.
efFermi level.
verboseVerbosity level.

Definition at line 481 of file prg_densitymatrix_mod.F90.

◆ prg_build_density_t()

subroutine, public prg_densitymatrix_mod::prg_build_density_t ( type(bml_matrix_t), intent(in)  ham_bml,
type(bml_matrix_t), intent(inout)  rho_bml,
real(dp), intent(in)  threshold,
real(dp), intent(in)  bndfil,
real(dp), intent(in)  kbt,
real(dp), intent(inout)  ef,
real(dp), dimension(:), intent(out), optional, allocatable  eigenvalues_out 
)

Builds the density matrix from \( H_0 \) for electronic temperature T. \( \rho = C f(\mu I - \epsilon) C^{\dagger} \) Where, \( C \) is the matrix eigenvector and \( \epsilon \) is the matrix eigenvalue. \( f \) is the Fermi function.

Parameters
ham_bmlInput Orthogonalized Hamiltonian matrix.
rho_bmlOutput density matrix,
thresholdThreshold for sparse matrix algebra.
bndfilFiling factor.
kbtElectronic temperature.
efFermi level.
eigenvalues_outOutput the eigenvalues.
Warning
This does not solve the generalized eigenvalue problem. The Hamiltonian that comes in has to be preorthogonalized.

Definition at line 122 of file prg_densitymatrix_mod.F90.

◆ prg_build_density_t0()

subroutine, public prg_densitymatrix_mod::prg_build_density_t0 ( type(bml_matrix_t), intent(in)  ham_bml,
type(bml_matrix_t), intent(inout)  rho_bml,
real(8), intent(in)  threshold,
real(8), intent(in)  bndfil,
real(dp), dimension(:), intent(out), optional, allocatable  eigenvalues_out 
)

Builds the density matrix from \( H_0 \) for zero electronic temperature. \( \rho = C \Theta(\mu I - \epsilon) C^{\dagger} \) Where, \( C \) is the matrix eigenvector and \( \epsilon \) is the matrix eigenvalue. \( \Theta() \) is the Heaviside function.

Parameters
ham_bmlInput Orthogonalized Hamiltonian matrix.
rho_bmlOutput density matrix.
thresholdThreshold for sparse matrix algebra.
bndfilFiling factor.
eigenvalues_outOutput the eigenvalues.
Warning
This does not solve the generalized eigenvalue problem. The Hamiltonian that comes in has to be preprg_orthogonalized.

Definition at line 41 of file prg_densitymatrix_mod.F90.

◆ prg_build_density_t_ed()

subroutine, public prg_densitymatrix_mod::prg_build_density_t_ed ( type(bml_matrix_t), intent(in)  ham_bml,
type(bml_matrix_t), intent(inout)  rho_bml,
type(bml_matrix_t), intent(inout)  evects_bml,
real(dp), intent(in)  threshold,
real(dp), intent(in)  bndfil,
real(dp), intent(in)  kbt,
real(dp), intent(inout)  ef,
real(dp), dimension(:), intent(inout), allocatable  evals,
real(dp), dimension(:), intent(inout), allocatable  dvals,
integer, dimension(:,:), intent(in), allocatable  hindex,
integer, intent(in)  llsize,
integer, intent(in)  verbose 
)

Builds the density matrix from \( H_0 \) for electronic temperature T. \( \rho = C f(\mu I - \epsilon) C^{\dagger} \) Where, \( C \) is the matrix eigenvector and \( \epsilon \) is the matrix eigenvalue. \( f \) is the Fermi function.

Parameters
ham_bmlInput Orthogonalized Hamiltonian matrix.
rho_bmlOutput density matrix,
thresholdThreshold for sparse matrix algebra.
bndfilFiling factor.
kbtElectronic temperature.
efFermi level.
evalsOutput the eigenvalues.
fvalsOutput the occupancies.
dvalsContribution to population from every evect.
core_indicesIndices in the core.
Warning
This does not solve the generalized eigenvalue problem. The Hamiltonian that comes in has to be orthogonalized.

Definition at line 292 of file prg_densitymatrix_mod.F90.

◆ prg_build_density_t_fermi()

subroutine, public prg_densitymatrix_mod::prg_build_density_t_fermi ( type(bml_matrix_t), intent(in)  ham_bml,
type(bml_matrix_t), intent(inout)  rho_bml,
real(dp), intent(in)  threshold,
real(dp), intent(in)  kbt,
real(dp), intent(in)  ef,
integer, intent(in), optional  verbose,
real(dp), intent(inout), optional  drho 
)

Builds the density matrix from \( H_0 \) for electronic temperature T. \( \rho = C f(\mu I - \epsilon) C^{\dagger} \) Where, \( C \) is the matrix eigenvector and \( \epsilon \) is the matrix eigenvalue. \( f \) is the Fermi function. In this routine the Fermi level is passed as an argument.

Parameters
ham_bmlInput Orthogonalized Hamiltonian matrix.
rho_bmlOutput density matrix,
thresholdThreshold for sparse matrix algebra.
Warning
This does not solve the generalized eigenvalue problem. The Hamiltonian that comes in has to be preorthogonalized.

Definition at line 566 of file prg_densitymatrix_mod.F90.

◆ prg_build_density_t_fulldata()

subroutine, public prg_densitymatrix_mod::prg_build_density_t_fulldata ( type(bml_matrix_t), intent(in)  ham_bml,
type(bml_matrix_t), intent(inout)  rho_bml,
real(dp), intent(in)  threshold,
real(dp), intent(in)  bndfil,
real(dp), intent(in)  kbt,
real(dp), intent(inout)  ef,
real(dp), dimension(:), intent(inout), allocatable  eigenvalues_out,
type(bml_matrix_t), intent(inout)  evects_bml,
real(dp), dimension(:), intent(inout), allocatable  fvals 
)

Builds the density matrix from \( H_0 \) for electronic temperature T. \( \rho = C f(\mu I - \epsilon) C^{\dagger} \) Where, \( C \) is the matrix eigenvector and \( \epsilon \) is the matrix eigenvalue. \( f \) is the Fermi function.

Parameters
ham_bmlInput Orthogonalized Hamiltonian matrix.
rho_bmlOutput density matrix,
thresholdThreshold for sparse matrix algebra.
bndfilFiling factor.
kbtElectronic temperature.
efFermi level.
eigenvalues_outOutput the eigenvalues.
evects_bmlOutput the eigenvectors.
fvalsOutput the occupancies.
Warning
This does not solve the generalized eigenvalue problem. The Hamiltonian that comes in has to be preorthogonalized.

Definition at line 207 of file prg_densitymatrix_mod.F90.

◆ prg_check_idempotency()

subroutine, public prg_densitymatrix_mod::prg_check_idempotency ( type(bml_matrix_t), intent(in)  mat_bml,
real(dp), intent(in)  threshold,
real(dp), intent(out)  idempotency 
)

To check the idempotency error of a matrix. This is calculated as the Frobenius norm of \( (A - A^2) \).

Parameters
mat_bmlSome bml matrix
idempotency(Output value of the idempotency error)

Definition at line 980 of file prg_densitymatrix_mod.F90.

◆ prg_get_eigenvalues()

subroutine, public prg_densitymatrix_mod::prg_get_eigenvalues ( type(bml_matrix_t), intent(in)  ham_bml,
real(dp), dimension(:), intent(inout), allocatable  eigenvalues,
integer, intent(in)  verbose 
)

Gets the eigenvalues of the Orthogonalized Hamiltonian.

Parameters
ham_bmlInput Orthogonalized Hamiltonian matrix.
eigenvaluesOutput eigenvalues of the system.
verboseVerbosity level.

Definition at line 935 of file prg_densitymatrix_mod.F90.

◆ prg_get_evalsdvalsevects()

subroutine, public prg_densitymatrix_mod::prg_get_evalsdvalsevects ( type(bml_matrix_t), intent(in)  ham_bml,
real(dp), intent(in)  threshold,
integer, dimension(:,:), intent(in), allocatable  hindex,
integer, intent(in)  llsize,
real(dp), dimension(:), intent(inout), allocatable  evals,
real(dp), dimension(:), intent(inout), allocatable  dvals,
type(bml_matrix_t), intent(inout)  evects_bml,
integer, intent(in)  verbose 
)

Gets the eigenvalues and eigenvectors and the core contribution to each eigenvalue (dvals) .

Parameters
ham_bmlInput Orthogonalized Hamiltonian matrix.
thresholdThreshold for sparse matrix algebra.
hindexStart and end index for every atom in the system.
llsizeNumber of atoms in the core of the graph part.
evalsEigenvalues.
dvalsContribution to population from every evect.
evects_bmlOutput the eigenvectors.
Warning
This does not solve the generalized eigenvalue problem. The Hamiltonian that comes in has to be orthogonalized.

Definition at line 386 of file prg_densitymatrix_mod.F90.

◆ prg_get_flevel()

subroutine, public prg_densitymatrix_mod::prg_get_flevel ( real(dp), dimension(:), intent(in)  eigenvalues,
real(dp), intent(in)  kbt,
real(dp), intent(in)  bndfil,
real(dp tol,
real(dp), intent(inout)  Ef,
logical, intent(inout)  err 
)

Routine to compute the Fermi level given a set of eigenvalues and a temperature. It applies the Bisection method over the function: \( g(\mu) = \sum_k 2 f(\epsilon_k - \mu) - N = 0 \) Where \( f(\epsilon_k - \mu) = \frac{1}{1+\exp{(\epsilon_k - \mu)/(k_bT)}}\).

Parameters
eigenvaluesEigenvalues of the system ( \( \{ \epsilon_k \} \)).
kbtTemperature times the Boltzmann's constant ( \( k_bT \)).
bndfilFiling factor ( \( N_{el}/(2*N_{orbs})\)).
tolTolerance for the bisection method.
EfFermi level ( \( \mu \)).
errError logical variable

Definition at line 775 of file prg_densitymatrix_mod.F90.

◆ prg_get_flevel_nt()

subroutine, public prg_densitymatrix_mod::prg_get_flevel_nt ( real(dp), dimension(:), intent(in)  eigenvalues,
real(dp), intent(in)  kbt,
real(dp), intent(in)  bndfil,
real(dp), intent(in)  tol,
real(dp), intent(inout)  ef,
logical, intent(inout)  err,
integer, intent(in), optional  verbose 
)

Routine to compute the Fermi level given a set of eigenvalues and a temperature. It applies the Newton-Raphson method over the function: \( g(\mu) = \sum_k 2 f(\epsilon_k - \mu) - N = 0 \) Where \( f(\epsilon_k - \mu) = \frac{1}{1+\exp{(\epsilon_k - \mu)/(k_bT)}}\).

Parameters
eigenvaluesEigenvalues of the system ( \( \{ \epsilon_k \} \)).
kbtTemperature times the Boltzmann's constant ( \( k_bT \)).
bndfilFiling factor ( \( N_{el}/(2*N_{orbs})\)).
tolTolerance for the bisection method.
EfFermi level ( \( \mu \)).
errError logical variable

Definition at line 847 of file prg_densitymatrix_mod.F90.

◆ prg_tocanonicalspace()

subroutine, public prg_densitymatrix_mod::prg_tocanonicalspace ( type(bml_matrix_t), intent(in)  mat_bml,
type(bml_matrix_t), intent(inout)  matCan_bml,
type(bml_matrix_t), intent(in)  evects_bml,
real(dp), intent(in)  threshold,
integer, intent(in), optional  verbose 
)

Change an operator into the eigenspace representation.

This routine performs \( O_{eig} = U O U^{t} \), where operator U is the unitary

Definition at line 1090 of file prg_densitymatrix_mod.F90.

◆ prg_toeigenspace()

subroutine, public prg_densitymatrix_mod::prg_toeigenspace ( type(bml_matrix_t), intent(in)  mat_bml,
type(bml_matrix_t), intent(inout)  matEig_bml,
type(bml_matrix_t), intent(in)  evects_bml,
real(dp), intent(in)  threshold,
integer, intent(in), optional  verbose 
)

Change an operator into the eigenspace representation.

This routine performs \( O_{eig} = U^{T} O U \), where operator U is the unitary transformations constructed from the eigenvectors of a Hamiltonian

Parameters
mat_bmlOperator to be transformed
matEig_bmlOutput operator after transformation
evects_bmlEigenvectors matrix (U)
thresholdThreshold parameter \verbose Verbosity level

Definition at line 1046 of file prg_densitymatrix_mod.F90.

Variable Documentation

◆ dp

integer, parameter prg_densitymatrix_mod::dp = kind(1.0d0)
private

Definition at line 19 of file prg_densitymatrix_mod.F90.