PROGRESS  master
prg_response_mod Module Reference

Module to compute the density matrix response and related quantities. More...

Data Types

type  respdata_type
 

Functions/Subroutines

subroutine, public prg_parse_response (RespData, filename)
 The parser for the calculation of the DM response. More...
 
subroutine, public prg_compute_dipole (charges, coordinate, dipoleMoment, factor, verbose)
 To compute the dipole moment of the system. The units of the dipole moment are determined by the units of the coordinates and charges that are given. More...
 
subroutine, public prg_write_dipole_tcl (dipoleMoment, file, factor, verbose)
 To visualize a dipole moment using VMD. This will prg_generate a .tcl script that could be run using VMD To visualize with VMD: $ vmd -e dipole.tcl. More...
 
subroutine, public prg_compute_polarizability (rsp_bml, prt_bml, polarizability, factor, verbose)
 To compute the polarizability of the system. The units of the directional polarizability are determined by the units of the perturbation and Hamiltonian. This equation can be found in [5] equation 4a. Note that in equation 4a of the reference there is a 2 that account for the double occupancy which is not present in this case cause the density matrix construction is done by taking the occupancy into account. More...
 
subroutine, public prg_pert_from_file (prt_bml, norb)
 Read perturbation from file. More...
 
subroutine, public prg_compute_response_rs (ham_bml, prt_bml, rsp_bml, lambda, bndfil, threshold, verbose)
 Computes the first order response density matrix using Rayleigh Schrodinger Perturbation theory The transformation hereby performed are: More...
 
subroutine, public prg_compute_response_fd (ham_bml, prt_bml, rsp_bml, prg_delta, bndfil, threshold, verbose)
 Computes the first order response density matrix using finite differences. The transformation hereby performed are: More...
 
subroutine, public prg_pert_constant_field (field, intensity, coordinate, lambda, prt_bml, threshold, spindex, norbi, verbose, over_bml)
 Apply a constant field perturbation through the dipole moment operator ( \( \hat{\mu} = e \hat{\textbf{r}} \)). In the matrix representation, this is: \( H^{(1)} = \lambda \frac{1}{2}(\,S \, e \textbf{r} \cdot \textbf{E} + \, e \textbf{r} \cdot \textbf{E}S) \). The symmetrization is done in order to preserve the Hermiticity of H. In this case the whole system will be affected by the field. In a latter version we will add the possibility of applying this field to a region of the system. In this implementation \( e= 1 \) and units can be transformed by using the parameter \( \lambda \). More...
 
subroutine, public prg_pert_sin_pot (direction, lx, coordinate, lambda, prt_bml, threshold, spindex, norbi, verbose, over_bml)
 Apply a sinusoidal length dependent potential ( \( \sin(\tilde{\textbf{r}}_x) \)) where \( \textbf{r}_x \) is the x coordinate. The Hamiltonian gets modified as follows: \( H^{(1)} = \frac{1}{2}\lambda (S \sin(\tilde{\textbf{r}}_x) + \sin(\tilde{\textbf{r}}_x) S) \). \( \tilde{\textbf{r}}_x = 2\pi(\textbf{r}/l_x) - \pi \). The symmetrization is done in order to preserve the Hermiticity of H. Units can be transformed by using the parameter \( \lambda \). More...
 
subroutine, public prg_pert_cos_pot (direction, lx, coordinate, lambda, prt_bml, threshold, spindex, norbi, verbose, over_bml)
 Apply a cosine length dependent potential ( \( \cos(\tilde{\textbf{r}}_x) \)) where \( \textbf{r}_x \) is the x coordinate. The Hamiltonian gets modified as follows: \( H^{(1)} = \frac{1}{2}\lambda (S \sin(\tilde{\textbf{r}}_x) + \sin(\tilde{\textbf{r}}_x) S) \). \( \tilde{\textbf{r}}_x = 2\pi(\textbf{r}/l_x) - \pi \). The symmetrization is done in order to preserve the Hermiticity of H. Units can be transformed by using the parameter \( \lambda \). More...
 
subroutine, public prg_compute_response_sp2 (ham_bml, prt_bml, rsp_bml, rho_bml, lambda, bndfil, minsp2iter, maxsp2iter, sp2conv, idemtol, threshold, verbose)
 Finds the first order response matrix from a Hamiltonian matrix. More...
 
subroutine, public prg_project_response (rsp_bml, over_bml, spindex, norbi, coordinates, rspfunc, verbose)
 Project the response onto atomic positions. First order response to the perturbation ( \( \rho^{(1)} \)) projected onto the atomic position. Basically: \( rsp(i) = \sum_{\alpha \in i}\rho^{(1)}_{\alpha \alpha} \), where orbital \( \alpha \) belong to atom \( i \). More...
 
subroutine, public prg_canon_response_vector (P1_bml, H1_bml, Nocc, beta, evals, mu0, m, thresh, HDIM)
 First-order Canonical Density Matrix Perturbation Theory. More...
 
subroutine, public prg_canon_response (P1_bml, H1_bml, Nocc, beta, evals, mu0, m, HDIM)
 First-order Canonical Density Matrix Perturbation Theory. More...
 
subroutine, public prg_canon_response_orig (P1_bml, H1_bml, Nocc, beta, evals, mu0, m, thresh, HDIM)
 First-order Canonical Density Matrix Perturbation Theory. More...
 
subroutine, public prg_canon_response_p1_dpdmu (P1_bml, dPdMu, H1_bml, Norbs, beta, Q_bml, evals, mu0, m, HDIM)
 First-order Canonical Density Matrix Perturbation Theory. More...
 

Variables

integer, parameter dp = kind(1.0d0)
 
real(dp), parameter pi = 3.14159265358979323846264338327950_dp
 

Detailed Description

Module to compute the density matrix response and related quantities.

Todo:

Add the response scf

Change name response_SP2 to dm_prt_response

Change name response_rs to rs_prt_response

More information about the theory can be found at [3] and Niklasson2015

Function/Subroutine Documentation

◆ prg_canon_response()

subroutine, public prg_response_mod::prg_canon_response ( type(bml_matrix_t), intent(inout)  P1_bml,
type(bml_matrix_t), intent(inout)  H1_bml,
real(dp), intent(in)  Nocc,
real(dp), intent(in)  beta,
real(dp), dimension(hdim), intent(in)  evals,
real(dp), intent(in)  mu0,
integer, intent(in)  m,
integer, intent(in)  HDIM 
)

First-order Canonical Density Matrix Perturbation Theory.

Assuming known mu0 and representation in H0's eigenbasis Q, where H0 and P0 become diagonal. (mu0, eigenvalues e and eigenvectors Q of H0 are assumed known) Based on PRL 92, 193001 (2004) and PRE 92, 063301 (2015).

Parameters
P1_bmlFirst-order canonical response output.
H1_bmlPerturbative hamiltonian input.
NoccNumber of ocupied orbitals.
betaInverse electronic temperature.
evalsEigenvalues of the system.
mu0Chemical potential.
mNumber of recursive steps.
HDIMNumber of orbitals - Hamiltonina zise.

Definition at line 947 of file prg_response_mod.F90.

◆ prg_canon_response_orig()

subroutine, public prg_response_mod::prg_canon_response_orig ( type(bml_matrix_t), intent(inout)  P1_bml,
type(bml_matrix_t), intent(inout)  H1_bml,
real(dp), intent(in)  Nocc,
real(dp), intent(in)  beta,
real(dp), dimension(hdim), intent(in)  evals,
real(dp), intent(in)  mu0,
integer, intent(in)  m,
real(dp), intent(in)  thresh,
integer, intent(in)  HDIM 
)

First-order Canonical Density Matrix Perturbation Theory.

Assuming known mu0 and representation in H0's eigenbasis Q, where H0 and P0 become diagonal. Original routine. (mu0, eigenvalues e and eigenvectors Q of H0 are assumed known) Based on PRL 92, 193001 (2004) and PRE 92, 063301 (2015).

Parameters
P1_bmlFirst-order canonical response output.
H1_bmlPerturbative hamiltonian input.
NoccNumber of ocupied orbitals.
betaInverse electronic temperature.
evalsEigenvalues of the system.
mu0Chemical potential.
mNumber of recursive steps.
HDIMNumber of orbitals - Hamiltonina zise.

Definition at line 1038 of file prg_response_mod.F90.

◆ prg_canon_response_p1_dpdmu()

subroutine, public prg_response_mod::prg_canon_response_p1_dpdmu ( type(bml_matrix_t), intent(inout)  P1_bml,
real(dp), dimension(hdim), intent(inout)  dPdMu,
type(bml_matrix_t), intent(inout)  H1_bml,
integer, intent(in)  Norbs,
real(dp), intent(in)  beta,
type(bml_matrix_t)  Q_bml,
real(dp), dimension(hdim), intent(in)  evals,
real(dp), intent(in)  mu0,
integer, intent(in)  m,
integer, intent(in)  HDIM 
)

First-order Canonical Density Matrix Perturbation Theory.

Assuming known mu0 and representation in H0's eigenbasis Q, where H0 and P0 become diagonal. (mu0, eigenvalues e and eigenvectors Q of H0 are assumed known) Based on PRL 92, 193001 (2004) and PRE 92, 063301 (2015)

Definition at line 1112 of file prg_response_mod.F90.

◆ prg_canon_response_vector()

subroutine, public prg_response_mod::prg_canon_response_vector ( type(bml_matrix_t), intent(inout)  P1_bml,
type(bml_matrix_t), intent(inout)  H1_bml,
real(dp), intent(in)  Nocc,
real(dp), intent(in)  beta,
real(dp), dimension(hdim), intent(in)  evals,
real(dp), intent(in)  mu0,
integer, intent(in)  m,
real(dp), intent(in)  thresh,
integer, intent(in)  HDIM 
)

First-order Canonical Density Matrix Perturbation Theory.

Assuming known mu0 and representation in H0's eigenbasis Q, where H0 and P0 become diagonal. (mu0, eigenvalues e and eigenvectors Q of H0 are assumed known) Based on PRL 92, 193001 (2004) and PRE 92, 063301 (2015).

Parameters
P1_bmlFirst-order canonical response output.
H1_bmlPerturbative hamiltonian input.
NoccNumber of ocupied orbitals.
betaInverse electronic temperature.
evalsEigenvalues of the system.
mu0Chemical potential.
mNumber of recursive steps.
HDIMNumber of orbitals - Hamiltonina zise.

Definition at line 849 of file prg_response_mod.F90.

◆ prg_compute_dipole()

subroutine, public prg_response_mod::prg_compute_dipole ( real(dp), dimension(:), intent(in)  charges,
real(dp), dimension(:,:), intent(in)  coordinate,
real(dp), dimension(3), intent(inout)  dipoleMoment,
real(dp), intent(in)  factor,
integer  verbose 
)

To compute the dipole moment of the system. The units of the dipole moment are determined by the units of the coordinates and charges that are given.

Parameters
chargesCharges on each atomic position.
coordinateCoordinates of the atoms.
natsNumber of atoms.
dipoleMomentDipole moment vector.
factorUnit conversion factor (use 1.0 is no conversion is required).
verboseTo give different verbosity levels. If coordinates are in \( \AA \) and charges are in fractions of electron, then transformation ea2debye form LATTE lib can be used to change units to Debye.

Definition at line 122 of file prg_response_mod.F90.

◆ prg_compute_polarizability()

subroutine, public prg_response_mod::prg_compute_polarizability ( type(bml_matrix_t), intent(in)  rsp_bml,
type(bml_matrix_t), intent(in)  prt_bml,
real(dp), intent(inout)  polarizability,
real(dp), intent(in)  factor,
integer  verbose 
)

To compute the polarizability of the system. The units of the directional polarizability are determined by the units of the perturbation and Hamiltonian. This equation can be found in [5] equation 4a. Note that in equation 4a of the reference there is a 2 that account for the double occupancy which is not present in this case cause the density matrix construction is done by taking the occupancy into account.

Parameters
chargesCharges on each atomic position.
coordinateCoordinates of the atoms.
natsNumber of atoms.
dipoleMomentDipole moment vector.
factorUnit conversion factor (use 1.0 is no conversion is required).
verboseTo give different verbosity levels. If coordinates are in \( \AA \) and charges are in fractions of electron, then transformation ea2debye form LATTE lib can be used to change units to Debye.

Definition at line 200 of file prg_response_mod.F90.

◆ prg_compute_response_fd()

subroutine, public prg_response_mod::prg_compute_response_fd ( type(bml_matrix_t), intent(in)  ham_bml,
type(bml_matrix_t), intent(in)  prt_bml,
type(bml_matrix_t), intent(inout)  rsp_bml,
real(dp prg_delta,
real(dp), intent(in)  bndfil,
real(dp), intent(in)  threshold,
integer  verbose 
)

Computes the first order response density matrix using finite differences. The transformation hereby performed are:

  • \( H^+ = H^{(0)} + \delta H^{(1)} \)
  • \( H^- = H^{(0)} - \delta H^{(1)} \)
  • \( \rho^+ = f(H^+) \)
  • \( \rho^- = f(H^-) \)
  • \( \rho^{(1)} = (\rho^+ - \rho^-)/(2\delta) \). Where f denotes the Fermi function (construction of the density matrix)
    Parameters
    ham_bmlHamiltonian in bml format ( \( H^{(0)} \)).
    prt_bmlPerturbation in bml format ( \( H^{(1)} \)).
    rsp_bmlFirst order response to the perturbation ( \( \rho^{(1)} \)).
    bndfilFiling factor.
    thresholdThreshold value for matrix elements.
    verboseDifferent levels of verbosity.
    Warning
    This works only for the prg_orthogonalized form of ham_bml.
    The response must be in the prg_orthogonalized form.

Definition at line 380 of file prg_response_mod.F90.

◆ prg_compute_response_rs()

subroutine, public prg_response_mod::prg_compute_response_rs ( type(bml_matrix_t), intent(in)  ham_bml,
type(bml_matrix_t), intent(in)  prt_bml,
type(bml_matrix_t), intent(inout)  rsp_bml,
real(dp lambda,
real(dp), intent(in)  bndfil,
real(dp), intent(in)  threshold,
integer  verbose 
)

Computes the first order response density matrix using Rayleigh Schrodinger Perturbation theory The transformation hereby performed are:

  • \( V = C^{\dagger} H^{(1)} C \)
  • \( \tilde{V}_{ij} = \frac{V_{ij}}{\epsilon_j - \epsilon_i} \), with \( \tilde{V}_{ii} = 0 \, \forall i \).
  • \( C^{(1)} = C \tilde{V} \)
  • And finally: \( \rho^{(1)} = Cf(C^{(1)})^{\dagger} + C^{(1)}fC^{\dagger}\)
    Parameters
    ham_bmlHamiltonian in bml format ( \( H^{(0)} \)).
    prt_bmlPerturbation in bml format ( \( H^{(1)} \)).
    rsp_bmlFirst order response to the perturbation ( \( \rho^{(1)} \)).
    bndfilFiling factor.
    thresholdThreshold value for matrix elements.
    verboseDifferent levels of verbosity.
    Warning
    This works only for the prg_orthogonalized form of ham_bml.
    The response must be in the prg_orthogonalized form.

Definition at line 250 of file prg_response_mod.F90.

◆ prg_compute_response_sp2()

subroutine, public prg_response_mod::prg_compute_response_sp2 ( type(bml_matrix_t), intent(in)  ham_bml,
type(bml_matrix_t), intent(in)  prt_bml,
type(bml_matrix_t), intent(inout)  rsp_bml,
type(bml_matrix_t), intent(inout)  rho_bml,
real(dp lambda,
real(dp), intent(in)  bndfil,
integer, intent(in)  minsp2iter,
integer, intent(in)  maxsp2iter,
character(len=*), intent(in)  sp2conv,
real(dp), intent(in)  idemtol,
real(dp), intent(in)  threshold,
integer  verbose 
)

Finds the first order response matrix from a Hamiltonian matrix.

Definition at line 653 of file prg_response_mod.F90.

◆ prg_parse_response()

subroutine, public prg_response_mod::prg_parse_response ( type(respdata_type RespData,
character(len=*)  filename 
)

The parser for the calculation of the DM response.

Parameters
RespDataResponse data type.
filenameName of the file to parse.

Definition at line 45 of file prg_response_mod.F90.

◆ prg_pert_constant_field()

subroutine, public prg_response_mod::prg_pert_constant_field ( real(dp), dimension(3), intent(in)  field,
real(dp intensity,
real(dp), dimension(:,:), intent(in)  coordinate,
real(dp lambda,
type(bml_matrix_t), intent(inout)  prt_bml,
real(dp threshold,
integer, dimension(:), intent(in)  spindex,
integer, dimension(:), intent(in)  norbi,
integer, intent(in)  verbose,
type(bml_matrix_t), intent(in), optional  over_bml 
)

Apply a constant field perturbation through the dipole moment operator ( \( \hat{\mu} = e \hat{\textbf{r}} \)). In the matrix representation, this is: \( H^{(1)} = \lambda \frac{1}{2}(\,S \, e \textbf{r} \cdot \textbf{E} + \, e \textbf{r} \cdot \textbf{E}S) \). The symmetrization is done in order to preserve the Hermiticity of H. In this case the whole system will be affected by the field. In a latter version we will add the possibility of applying this field to a region of the system. In this implementation \( e= 1 \) and units can be transformed by using the parameter \( \lambda \).

Note
If the Hamiltonian is already in the prg_orthogonalized form, then parameter over_bml can be omitted.
Parameters
fieldDirection of the applied field ( \( \hat{\textbf{E}} \)).
intensityIntensity of the field ( \( ||\textbf{E}|| \))..
coordinateCoordinates of the system ( \( \textbf{r}\)).
lambdaConstant to premultiply the perturbation ( \( \lambda\)).
prt_bmlPerturbation in bml format ( \( H^{(1)} \)).
thresholdThreshold value for bml format matrices.
spindexSpecies index. It gives the species index of a particular atom.
norbiNumber of orbitals for each atomic site.
verboseDifferent levels of verbosity.
over_bmlIt has to be present for a nonorthogonal representation ( \( S \)).

Definition at line 447 of file prg_response_mod.F90.

◆ prg_pert_cos_pot()

subroutine, public prg_response_mod::prg_pert_cos_pot ( character  direction,
real(dp lx,
real(dp), dimension(:,:), intent(in)  coordinate,
real(dp lambda,
type(bml_matrix_t), intent(inout)  prt_bml,
real(dp threshold,
integer, dimension(:), intent(in)  spindex,
integer, dimension(:), intent(in)  norbi,
integer, intent(in)  verbose,
type(bml_matrix_t), intent(in), optional  over_bml 
)

Apply a cosine length dependent potential ( \( \cos(\tilde{\textbf{r}}_x) \)) where \( \textbf{r}_x \) is the x coordinate. The Hamiltonian gets modified as follows: \( H^{(1)} = \frac{1}{2}\lambda (S \sin(\tilde{\textbf{r}}_x) + \sin(\tilde{\textbf{r}}_x) S) \). \( \tilde{\textbf{r}}_x = 2\pi(\textbf{r}/l_x) - \pi \). The symmetrization is done in order to preserve the Hermiticity of H. Units can be transformed by using the parameter \( \lambda \).

Note
If the Hamiltonian is already in the prg_orthogonalized form, then parameter over_bml can be omitted.
Parameters
directionDirection of the potential gradient (x,y or z).
lxLenght of the box in x direction.
coordinateCoordinates of the system ( \( \textbf{r}\)).
lambdaConstant to premultiply the perturbation ( \( \lambda\)).
prt_bmlPerturbation in bml format ( \( H^{(1)} \)).
thresholdThreshold value for bml format matrices.
norbiNumber of orbitals for each atomic site.
verboseDifferent levels of verbosity.
over_bmlIt has to be present for a nonorthogonal representation ( \( S \)).

Definition at line 592 of file prg_response_mod.F90.

◆ prg_pert_from_file()

subroutine, public prg_response_mod::prg_pert_from_file ( type(bml_matrix_t), intent(inout)  prt_bml,
integer  norb 
)

Read perturbation from file.

Todo:
Add read perturbation from file

Definition at line 225 of file prg_response_mod.F90.

◆ prg_pert_sin_pot()

subroutine, public prg_response_mod::prg_pert_sin_pot ( character  direction,
real(dp lx,
real(dp), dimension(:,:), intent(in)  coordinate,
real(dp lambda,
type(bml_matrix_t), intent(inout)  prt_bml,
real(dp threshold,
integer, dimension(:), intent(in)  spindex,
integer, dimension(:), intent(in)  norbi,
integer, intent(in)  verbose,
type(bml_matrix_t), intent(in), optional  over_bml 
)

Apply a sinusoidal length dependent potential ( \( \sin(\tilde{\textbf{r}}_x) \)) where \( \textbf{r}_x \) is the x coordinate. The Hamiltonian gets modified as follows: \( H^{(1)} = \frac{1}{2}\lambda (S \sin(\tilde{\textbf{r}}_x) + \sin(\tilde{\textbf{r}}_x) S) \). \( \tilde{\textbf{r}}_x = 2\pi(\textbf{r}/l_x) - \pi \). The symmetrization is done in order to preserve the Hermiticity of H. Units can be transformed by using the parameter \( \lambda \).

Note
If the Hamiltonian is already in the prg_orthogonalized form, then parameter over_bml can be omitted.
Parameters
directionDirection of the potential gradient (x,y or z).
lxLength of the box in x direction.
coordinateCoordinates of the system ( \( \textbf{r}\)).
lambdaConstant to premultiply the perturbation ( \( \lambda\)).
prt_bmlPerturbation in bml format ( \( H^{(1)} \)).
thresholdThreshold value for bml format matrices.
norbiNumber of orbitals for each atomic site.
verboseDifferent levels of verbosity.
over_bmlIt has to be present for a nonorthogonal representation ( \( S \)).

Definition at line 524 of file prg_response_mod.F90.

◆ prg_project_response()

subroutine, public prg_response_mod::prg_project_response ( type(bml_matrix_t), intent(inout)  rsp_bml,
type(bml_matrix_t), intent(in)  over_bml,
integer, dimension(:), intent(in)  spindex,
integer, dimension(:), intent(in)  norbi,
real(dp), dimension(:,:), intent(in)  coordinates,
real(dp), dimension(:), intent(inout), allocatable  rspfunc,
integer, intent(in)  verbose 
)

Project the response onto atomic positions. First order response to the perturbation ( \( \rho^{(1)} \)) projected onto the atomic position. Basically: \( rsp(i) = \sum_{\alpha \in i}\rho^{(1)}_{\alpha \alpha} \), where orbital \( \alpha \) belong to atom \( i \).

Parameters
rsp_bmlFirst order response density matrix.
spindexIt gives the species index of a particular atom.
norbiNumber of orbitals of species i.
coordinatesAtomic coordinates.
rspfuncResponse function at atomic positions.
verboseDifferent levels of verbosity.

Definition at line 797 of file prg_response_mod.F90.

◆ prg_write_dipole_tcl()

subroutine, public prg_response_mod::prg_write_dipole_tcl ( real(dp), dimension(3), intent(in)  dipoleMoment,
character(*), intent(in)  file,
real(dp), intent(in)  factor,
integer  verbose 
)

To visualize a dipole moment using VMD. This will prg_generate a .tcl script that could be run using VMD To visualize with VMD: $ vmd -e dipole.tcl.

Parameters
dipoleMomentDipole moment vector.
filePDB/XYZ file to load for visualization.
factorArbitrary scale for visualization.
verboseTo give different verbosity levels.

Definition at line 160 of file prg_response_mod.F90.

Variable Documentation

◆ dp

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

Definition at line 18 of file prg_response_mod.F90.

◆ pi

real(dp), parameter prg_response_mod::pi = 3.14159265358979323846264338327950_dp
private

Definition at line 19 of file prg_response_mod.F90.