Octopus
states_elec_calc_oct_m Module Reference

Data Types

interface  states_elec_rotate
 

Functions/Subroutines

subroutine, public states_elec_orthogonalize (st, namespace, mesh)
 Orthonormalizes nst orbitals in mesh (honours state parallelization). More...
 
subroutine, public states_elec_calc_norms (grid, kpoints, st, norm_ks)
 Compute the norms of the Kohn-Sham orbitals. More...
 
subroutine, public dstates_elec_orthogonalization_full (st, namespace, mesh, ik)
 Orthonormalizes nst orbitals in mesh (honours state parallelization). More...
 
subroutine dstates_elec_trsm (st, namespace, mesh, ik, ss)
 Apply the inverse of ss to the states st. More...
 
subroutine, public dstates_elec_orthogonalize_single (st, mesh, nst, iqn, phi, normalize, mask, overlap, norm, Theta_fi, beta_ij, against_all)
 ofthogonalize a single wave function against a set of states More...
 
subroutine, public dstates_elec_orthogonalize_single_batch (st, mesh, nst, iqn, phi, normalize, mask, overlap, norm, Theta_fi, beta_ij, against_all)
 orthogonalize a single wave function against a set of states More...
 
subroutine, public dstates_elec_orthogonalization (mesh, nst, dim, psi, phi, normalize, mask, overlap, norm, Theta_fi, beta_ij, gs_scheme)
 Orthonormalizes phi to the nst orbitals psi. More...
 
real(real64) function, public dstates_elec_residue (mesh, dim, hf, ee, ff)
 
subroutine, public dstates_elec_matrix (st1, st2, mesh, aa)
 
subroutine, public dstates_elec_calc_orth_test (st, namespace, mesh, kpoints)
 
subroutine dstates_elec_rotate (st, namespace, mesh, uu, ik)
 
subroutine, public dstates_elec_calc_overlap (st, mesh, ik, overlap)
 Computes the overlap matrix of the Kohn-Sham states with k-point ik. More...
 
subroutine, public dstates_elec_calc_projections (st, gs_st, namespace, mesh, ik, proj, gs_nst)
 This routine computes the projection between two set of states. More...
 
subroutine, public dstates_elec_rrqr_decomposition (st, namespace, mesh, nst, root, ik, jpvt)
 Perform RRQR on the transpose states stored in the states object and return the pivot vector. More...
 
subroutine, public zstates_elec_orthogonalization_full (st, namespace, mesh, ik)
 Orthonormalizes nst orbitals in mesh (honours state parallelization). More...
 
subroutine zstates_elec_trsm (st, namespace, mesh, ik, ss)
 Apply the inverse of ss to the states st. More...
 
subroutine, public zstates_elec_orthogonalize_single (st, mesh, nst, iqn, phi, normalize, mask, overlap, norm, Theta_fi, beta_ij, against_all)
 ofthogonalize a single wave function against a set of states More...
 
subroutine, public zstates_elec_orthogonalize_single_batch (st, mesh, nst, iqn, phi, normalize, mask, overlap, norm, Theta_fi, beta_ij, against_all)
 orthogonalize a single wave function against a set of states More...
 
subroutine, public zstates_elec_orthogonalization (mesh, nst, dim, psi, phi, normalize, mask, overlap, norm, Theta_fi, beta_ij, gs_scheme)
 Orthonormalizes phi to the nst orbitals psi. More...
 
real(real64) function, public zstates_elec_residue (mesh, dim, hf, ee, ff)
 
subroutine, public zstates_elec_matrix (st1, st2, mesh, aa)
 
subroutine, public zstates_elec_calc_orth_test (st, namespace, mesh, kpoints)
 
subroutine zstates_elec_rotate (st, namespace, mesh, uu, ik)
 
subroutine, public zstates_elec_calc_overlap (st, mesh, ik, overlap)
 Computes the overlap matrix of the Kohn-Sham states with k-point ik. More...
 
subroutine, public zstates_elec_calc_projections (st, gs_st, namespace, mesh, ik, proj, gs_nst)
 This routine computes the projection between two set of states. More...
 
subroutine, public zstates_elec_rrqr_decomposition (st, namespace, mesh, nst, root, ik, jpvt)
 Perform RRQR on the transpose states stored in the states object and return the pivot vector. More...
 

Function/Subroutine Documentation

◆ states_elec_orthogonalize()

subroutine, public states_elec_calc_oct_m::states_elec_orthogonalize ( type(states_elec_t), intent(inout)  st,
type(namespace_t), intent(in)  namespace,
class(mesh_t), intent(in)  mesh 
)

Orthonormalizes nst orbitals in mesh (honours state parallelization).

Parameters
[in,out]ststates to be orthogonalized
[in]namespacenamespace for message printout
[in]meshunderlying mesh
[in]ikkpoint index

Definition at line 194 of file states_elec_calc.F90.

◆ states_elec_calc_norms()

subroutine, public states_elec_calc_oct_m::states_elec_calc_norms ( type(grid_t), intent(in)  grid,
type(kpoints_t), intent(in)  kpoints,
type(states_elec_t), intent(in)  st,
real(real64), dimension(:, :), intent(out), contiguous  norm_ks 
)

Compute the norms of the Kohn-Sham orbitals.

Parameters
[in]stKS states
[out]norm_ksNorm of KS wavefunctions/orbitals

Definition at line 217 of file states_elec_calc.F90.

◆ dstates_elec_orthogonalization_full()

subroutine, public states_elec_calc_oct_m::dstates_elec_orthogonalization_full ( type(states_elec_t), intent(inout)  st,
type(namespace_t), intent(in)  namespace,
class(mesh_t), intent(in)  mesh,
integer, intent(in)  ik 
)

Orthonormalizes nst orbitals in mesh (honours state parallelization).

Parameters
[in,out]ststates to be orthogonalized
[in]namespacenamespace for message printout
[in]meshunderlying mesh
[in]ikkpoint index

Definition at line 325 of file states_elec_calc.F90.

◆ dstates_elec_trsm()

subroutine states_elec_calc_oct_m::dstates_elec_trsm ( type(states_elec_t), intent(inout)  st,
type(namespace_t), intent(in)  namespace,
class(mesh_t), intent(in)  mesh,
integer, intent(in)  ik,
real(real64), dimension(:, :), intent(in)  ss 
)
private

Apply the inverse of ss to the states st.

used internally by states_elec_calc_oct_m::dstates_elec_orthogonalization_full()

Parameters
[in,out]ststates
[in]namespacenamespace for messages
[in]meshunderlying mesh (for np)
[in]ikkpoint index
[in]ssoverlap matrix; dimension (1:st%nst, 1:st%nst)

Definition at line 647 of file states_elec_calc.F90.

◆ dstates_elec_orthogonalize_single()

subroutine, public states_elec_calc_oct_m::dstates_elec_orthogonalize_single ( type(states_elec_t), intent(in), target  st,
class(mesh_t), intent(in)  mesh,
integer, intent(in)  nst,
integer, intent(in)  iqn,
real(real64), dimension(:,:), intent(inout), contiguous  phi,
logical, intent(in), optional  normalize,
logical, dimension(:), intent(inout), optional  mask,
real(real64), dimension(:), intent(out), optional  overlap,
real(real64), intent(out), optional  norm,
real(real64), intent(in), optional  Theta_fi,
real(real64), dimension(:), intent(in), optional  beta_ij,
logical, intent(in), optional  against_all 
)

ofthogonalize a single wave function against a set of states

Does not use batchified routines.

Parameters
[in]stthe states
[in]meshunderlying mesh for number of points
[in]nstnumber of states to be considered
[in]iqnk-point index
[in,out]phiphi(meshnp_part, dim)
[in]normalizeoptional flag whether to normalize the result; default = .false.
[in,out]maskoptional mask(nst); TODO: add more information
[out]overlapoptional output: overlaps to the states
[out]normoptional output: norm of the resulting state
[in]theta_fioptional: TODO: add more information
[in]beta_ijoptional: beta_ij(nst); TODO add more information
[in]against_alloptional flag whether to include all states (up to nst)

Definition at line 763 of file states_elec_calc.F90.

◆ dstates_elec_orthogonalize_single_batch()

subroutine, public states_elec_calc_oct_m::dstates_elec_orthogonalize_single_batch ( type(states_elec_t), intent(in)  st,
class(mesh_t), intent(in)  mesh,
integer, intent(in)  nst,
integer, intent(in)  iqn,
real(real64), dimension(:,:), intent(inout), contiguous  phi,
logical, intent(in), optional  normalize,
logical, dimension(:), intent(inout), optional  mask,
real(real64), dimension(:), intent(out), optional  overlap,
real(real64), intent(out), optional  norm,
real(real64), intent(in), optional  Theta_fi,
real(real64), dimension(:), intent(in), optional  beta_ij,
logical, intent(in), optional  against_all 
)

orthogonalize a single wave function against a set of states

This version uses batchified routines.

Parameters
[in]stthe states
[in]meshunderlying mesh for number of points
[in]nstnumber of states to consider
[in]iqnk-point index
[in,out]phiphi(meshnp_part, dim)
[in]normalizeoptional flag whether to normalize the result; default = .false.
[in,out]maskoptional mask(nst)
[out]overlapoptional output: overlap to the states
[out]normoptional output: norm or the result
[in]theta_fioptional: beta_ij(nst); TODO add more information
[in]beta_ijbeta_ij(nst)
[in]against_alloptional flag whether to include all states (up to nst)

Definition at line 919 of file states_elec_calc.F90.

◆ dstates_elec_orthogonalization()

subroutine, public states_elec_calc_oct_m::dstates_elec_orthogonalization ( class(mesh_t), intent(in)  mesh,
integer, intent(in)  nst,
integer, intent(in)  dim,
real(real64), dimension(:,:,:), intent(in)  psi,
real(real64), dimension(:,:), intent(inout)  phi,
logical, intent(in), optional  normalize,
logical, dimension(:), intent(inout), optional  mask,
real(real64), dimension(:), intent(out), optional  overlap,
real(real64), intent(out), optional  norm,
real(real64), intent(in), optional  Theta_fi,
real(real64), dimension(:), intent(in), optional  beta_ij,
integer, intent(in), optional  gs_scheme 
)

Orthonormalizes phi to the nst orbitals psi.

It also permits doing only the orthogonalization (no normalization). And one can pass an extra optional argument, mask, which:

  • on input, if mask(p) = .true., the p-orbital is not used.
  • on output, mask(p) = .true. if p was already orthogonal (to within 1e-12). If Theta_Fi and beta_ij are present, it performs the generalized orthogonalization \( (Theta_Fi - sum_j beta_ij |j><j|Phi> \) as in De Gironcoli PRB 51, 6774 (1995). This is used in response for metals
    Parameters
    [in]meshunderlying mesh for np, np_part
    [in]nstnumber of states to orthoganolize against
    [in]dimspin dimension of the wave functions
    [in]psipsi(meshnp_part, dim, nst)
    [in,out]phiphi(meshnp_part, dim)
    [in]normalizeoptional flag whether to normalize the result
    [in,out]maskmask(nst)
    [out]overlapoptional output: overlap with the states
    [out]normoptional output: norm of resulting state
    [in]beta_ijbeta_ij(nst)

Definition at line 1081 of file states_elec_calc.F90.

◆ dstates_elec_residue()

real(real64) function, public states_elec_calc_oct_m::dstates_elec_residue ( class(mesh_t), intent(in)  mesh,
integer, intent(in)  dim,
real(real64), dimension(:,:), intent(in)  hf,
real(real64), intent(in)  ee,
real(real64), dimension(:,:), intent(in)  ff 
)

Definition at line 1267 of file states_elec_calc.F90.

◆ dstates_elec_matrix()

subroutine, public states_elec_calc_oct_m::dstates_elec_matrix ( type(states_elec_t), intent(in)  st1,
type(states_elec_t), intent(in)  st2,
class(mesh_t), intent(in)  mesh,
real(real64), dimension(:, :, :), intent(out), contiguous  aa 
)

Definition at line 1302 of file states_elec_calc.F90.

◆ dstates_elec_calc_orth_test()

subroutine, public states_elec_calc_oct_m::dstates_elec_calc_orth_test ( type(states_elec_t), intent(inout)  st,
type(namespace_t), intent(in)  namespace,
class(mesh_t), intent(in)  mesh,
type(kpoints_t), intent(in)  kpoints 
)

Definition at line 1350 of file states_elec_calc.F90.

◆ dstates_elec_rotate()

subroutine states_elec_calc_oct_m::dstates_elec_rotate ( type(states_elec_t), intent(inout)  st,
type(namespace_t), intent(in)  namespace,
class(mesh_t), intent(in)  mesh,
real(real64), dimension(:, :), intent(in), contiguous  uu,
integer, intent(in)  ik 
)
private

Definition at line 1462 of file states_elec_calc.F90.

◆ dstates_elec_calc_overlap()

subroutine, public states_elec_calc_oct_m::dstates_elec_calc_overlap ( type(states_elec_t), intent(inout)  st,
class(mesh_t), intent(in)  mesh,
integer, intent(in)  ik,
real(real64), dimension(:, :), intent(out), contiguous  overlap 
)

Computes the overlap matrix of the Kohn-Sham states with k-point ik.

Definition at line 1582 of file states_elec_calc.F90.

◆ dstates_elec_calc_projections()

subroutine, public states_elec_calc_oct_m::dstates_elec_calc_projections ( type(states_elec_t), intent(in)  st,
type(states_elec_t), intent(inout)  gs_st,
type(namespace_t), intent(in)  namespace,
class(mesh_t), intent(in)  mesh,
integer, intent(in)  ik,
real(real64), dimension(:, :), intent(out), contiguous  proj,
integer, intent(in), optional  gs_nst 
)

This routine computes the projection between two set of states.

Note
currently only implemented for unpacked states

Definition at line 1741 of file states_elec_calc.F90.

◆ dstates_elec_rrqr_decomposition()

subroutine, public states_elec_calc_oct_m::dstates_elec_rrqr_decomposition ( type(states_elec_t), intent(in)  st,
type(namespace_t), intent(in)  namespace,
class(mesh_t), intent(in)  mesh,
integer, intent(in)  nst,
logical, intent(in)  root,
integer, intent(in)  ik,
integer, dimension(:), intent(out)  jpvt 
)

Perform RRQR on the transpose states stored in the states object and return the pivot vector.

Note
This is not an all-purpose routine for RRQR, but only operates on the specific set stored in st

We follow [Pizzi et al., J. Phys.: Condens. Matter 32 (2020) 165902] for doing the extension to spinors

Parameters
[in]rootthis is needed for serial
[in]ikperform SCDM with this k-point

Definition at line 1918 of file states_elec_calc.F90.

◆ zstates_elec_orthogonalization_full()

subroutine, public states_elec_calc_oct_m::zstates_elec_orthogonalization_full ( type(states_elec_t), intent(inout)  st,
type(namespace_t), intent(in)  namespace,
class(mesh_t), intent(in)  mesh,
integer, intent(in)  ik 
)

Orthonormalizes nst orbitals in mesh (honours state parallelization).

Parameters
[in,out]ststates to be orthogonalized
[in]namespacenamespace for message printout
[in]meshunderlying mesh
[in]ikkpoint index

Definition at line 2240 of file states_elec_calc.F90.

◆ zstates_elec_trsm()

subroutine states_elec_calc_oct_m::zstates_elec_trsm ( type(states_elec_t), intent(inout)  st,
type(namespace_t), intent(in)  namespace,
class(mesh_t), intent(in)  mesh,
integer, intent(in)  ik,
complex(real64), dimension(:, :), intent(in)  ss 
)
private

Apply the inverse of ss to the states st.

used internally by states_elec_calc_oct_m::zstates_elec_orthogonalization_full()

Parameters
[in,out]ststates
[in]namespacenamespace for messages
[in]meshunderlying mesh (for np)
[in]ikkpoint index
[in]ssoverlap matrix; dimension (1:st%nst, 1:st%nst)

Definition at line 2562 of file states_elec_calc.F90.

◆ zstates_elec_orthogonalize_single()

subroutine, public states_elec_calc_oct_m::zstates_elec_orthogonalize_single ( type(states_elec_t), intent(in), target  st,
class(mesh_t), intent(in)  mesh,
integer, intent(in)  nst,
integer, intent(in)  iqn,
complex(real64), dimension(:,:), intent(inout), contiguous  phi,
logical, intent(in), optional  normalize,
logical, dimension(:), intent(inout), optional  mask,
complex(real64), dimension(:), intent(out), optional  overlap,
real(real64), intent(out), optional  norm,
real(real64), intent(in), optional  Theta_fi,
complex(real64), dimension(:), intent(in), optional  beta_ij,
logical, intent(in), optional  against_all 
)

ofthogonalize a single wave function against a set of states

Does not use batchified routines.

Parameters
[in]stthe states
[in]meshunderlying mesh for number of points
[in]nstnumber of states to be considered
[in]iqnk-point index
[in,out]phiphi(meshnp_part, dim)
[in]normalizeoptional flag whether to normalize the result; default = .false.
[in,out]maskoptional mask(nst); TODO: add more information
[out]overlapoptional output: overlaps to the states
[out]normoptional output: norm of the resulting state
[in]theta_fioptional: TODO: add more information
[in]beta_ijoptional: beta_ij(nst); TODO add more information
[in]against_alloptional flag whether to include all states (up to nst)

Definition at line 2678 of file states_elec_calc.F90.

◆ zstates_elec_orthogonalize_single_batch()

subroutine, public states_elec_calc_oct_m::zstates_elec_orthogonalize_single_batch ( type(states_elec_t), intent(in)  st,
class(mesh_t), intent(in)  mesh,
integer, intent(in)  nst,
integer, intent(in)  iqn,
complex(real64), dimension(:,:), intent(inout), contiguous  phi,
logical, intent(in), optional  normalize,
logical, dimension(:), intent(inout), optional  mask,
complex(real64), dimension(:), intent(out), optional  overlap,
real(real64), intent(out), optional  norm,
real(real64), intent(in), optional  Theta_fi,
complex(real64), dimension(:), intent(in), optional  beta_ij,
logical, intent(in), optional  against_all 
)

orthogonalize a single wave function against a set of states

This version uses batchified routines.

Parameters
[in]stthe states
[in]meshunderlying mesh for number of points
[in]nstnumber of states to consider
[in]iqnk-point index
[in,out]phiphi(meshnp_part, dim)
[in]normalizeoptional flag whether to normalize the result; default = .false.
[in,out]maskoptional mask(nst)
[out]overlapoptional output: overlap to the states
[out]normoptional output: norm or the result
[in]theta_fioptional: beta_ij(nst); TODO add more information
[in]beta_ijbeta_ij(nst)
[in]against_alloptional flag whether to include all states (up to nst)

Definition at line 2834 of file states_elec_calc.F90.

◆ zstates_elec_orthogonalization()

subroutine, public states_elec_calc_oct_m::zstates_elec_orthogonalization ( class(mesh_t), intent(in)  mesh,
integer, intent(in)  nst,
integer, intent(in)  dim,
complex(real64), dimension(:,:,:), intent(in)  psi,
complex(real64), dimension(:,:), intent(inout)  phi,
logical, intent(in), optional  normalize,
logical, dimension(:), intent(inout), optional  mask,
complex(real64), dimension(:), intent(out), optional  overlap,
complex(real64), intent(out), optional  norm,
real(real64), intent(in), optional  Theta_fi,
complex(real64), dimension(:), intent(in), optional  beta_ij,
integer, intent(in), optional  gs_scheme 
)

Orthonormalizes phi to the nst orbitals psi.

It also permits doing only the orthogonalization (no normalization). And one can pass an extra optional argument, mask, which:

  • on input, if mask(p) = .true., the p-orbital is not used.
  • on output, mask(p) = .true. if p was already orthogonal (to within 1e-12). If Theta_Fi and beta_ij are present, it performs the generalized orthogonalization \( (Theta_Fi - sum_j beta_ij |j><j|Phi> \) as in De Gironcoli PRB 51, 6774 (1995). This is used in response for metals
    Parameters
    [in]meshunderlying mesh for np, np_part
    [in]nstnumber of states to orthoganolize against
    [in]dimspin dimension of the wave functions
    [in]psipsi(meshnp_part, dim, nst)
    [in,out]phiphi(meshnp_part, dim)
    [in]normalizeoptional flag whether to normalize the result
    [in,out]maskmask(nst)
    [out]overlapoptional output: overlap with the states
    [out]normoptional output: norm of resulting state
    [in]beta_ijbeta_ij(nst)

Definition at line 2996 of file states_elec_calc.F90.

◆ zstates_elec_residue()

real(real64) function, public states_elec_calc_oct_m::zstates_elec_residue ( class(mesh_t), intent(in)  mesh,
integer, intent(in)  dim,
complex(real64), dimension(:,:), intent(in)  hf,
real(real64), intent(in)  ee,
complex(real64), dimension(:,:), intent(in)  ff 
)

Definition at line 3182 of file states_elec_calc.F90.

◆ zstates_elec_matrix()

subroutine, public states_elec_calc_oct_m::zstates_elec_matrix ( type(states_elec_t), intent(in)  st1,
type(states_elec_t), intent(in)  st2,
class(mesh_t), intent(in)  mesh,
complex(real64), dimension(:, :, :), intent(out), contiguous  aa 
)

Definition at line 3217 of file states_elec_calc.F90.

◆ zstates_elec_calc_orth_test()

subroutine, public states_elec_calc_oct_m::zstates_elec_calc_orth_test ( type(states_elec_t), intent(inout)  st,
type(namespace_t), intent(in)  namespace,
class(mesh_t), intent(in)  mesh,
type(kpoints_t), intent(in)  kpoints 
)

Definition at line 3265 of file states_elec_calc.F90.

◆ zstates_elec_rotate()

subroutine states_elec_calc_oct_m::zstates_elec_rotate ( type(states_elec_t), intent(inout)  st,
type(namespace_t), intent(in)  namespace,
class(mesh_t), intent(in)  mesh,
complex(real64), dimension(:, :), intent(in), contiguous  uu,
integer, intent(in)  ik 
)
private

Definition at line 3377 of file states_elec_calc.F90.

◆ zstates_elec_calc_overlap()

subroutine, public states_elec_calc_oct_m::zstates_elec_calc_overlap ( type(states_elec_t), intent(inout)  st,
class(mesh_t), intent(in)  mesh,
integer, intent(in)  ik,
complex(real64), dimension(:, :), intent(out), contiguous  overlap 
)

Computes the overlap matrix of the Kohn-Sham states with k-point ik.

Definition at line 3497 of file states_elec_calc.F90.

◆ zstates_elec_calc_projections()

subroutine, public states_elec_calc_oct_m::zstates_elec_calc_projections ( type(states_elec_t), intent(in)  st,
type(states_elec_t), intent(inout)  gs_st,
type(namespace_t), intent(in)  namespace,
class(mesh_t), intent(in)  mesh,
integer, intent(in)  ik,
complex(real64), dimension(:, :), intent(out), contiguous  proj,
integer, intent(in), optional  gs_nst 
)

This routine computes the projection between two set of states.

Note
currently only implemented for unpacked states

Definition at line 3673 of file states_elec_calc.F90.

◆ zstates_elec_rrqr_decomposition()

subroutine, public states_elec_calc_oct_m::zstates_elec_rrqr_decomposition ( type(states_elec_t), intent(in)  st,
type(namespace_t), intent(in)  namespace,
class(mesh_t), intent(in)  mesh,
integer, intent(in)  nst,
logical, intent(in)  root,
integer, intent(in)  ik,
integer, dimension(:), intent(out)  jpvt 
)

Perform RRQR on the transpose states stored in the states object and return the pivot vector.

Note
This is not an all-purpose routine for RRQR, but only operates on the specific set stored in st

We follow [Pizzi et al., J. Phys.: Condens. Matter 32 (2020) 165902] for doing the extension to spinors

Parameters
[in]rootthis is needed for serial
[in]ikperform SCDM with this k-point

Definition at line 3850 of file states_elec_calc.F90.