## Documentation for module qs_scf_diagonalization

Different diagonalization schemes that can be used for the iterative solution of the eigenvalue problem

source: qs_scf_diagonalization.F

#### public Subroutines/Functions:

...
iterative diagonalization using the block davidson space approach
iterative diagonalization using the block Krylov-space approach
...
Kpoint diagonalization routine Transforms matrices to kpoint, distributes kpoint groups, performs general diagonalization (no storgae of overlap decomposition), stores MOs, calculates occupation numbers, calculates density matrices in kpoint representation, transforms density matrices to real space
the inner loop of scf, specific to iterative diagonalization using OT with S matrix; basically, in goes the ks matrix out goes a new p matrix
Solve a set restricted open Kohn-Sham (ROKS) equations based on the alpha and beta Kohn-Sham matrices from unrestricted Kohn-Sham.
inner loop within MOS subspace, to refine occupation and density, before next diagonalization of the Hamiltonian
the inner loop of scf, specific to diagonalization without S matrix basically, in goes the ks matrix out goes a new p matrix
the inner loop of scf, specific to diagonalization with S matrix basically, in goes the ks matrix out goes a new p matrix

#### SUBROUTINEdiag_subspace_allocate(subspace_env, qs_env, mos)^

...

##### Arguments:
 TYPE(subspace_env_type), POINTER :: subspace_env ... TYPE(qs_environment_type), POINTER :: qs_env ... TYPE(mo_set_p_type), POINTER :: mos(:) ...

#### SUBROUTINEdo_block_davidson_diag(qs_env, scf_env, mos, matrix_ks, matrix_s, scf_control, scf_section, check_moconv_only)^

iterative diagonalization using the block davidson space approach

##### Arguments:
 TYPE(qs_environment_type), POINTER :: qs_env ... TYPE(qs_scf_env_type), POINTER :: scf_env ... TYPE(mo_set_p_type), POINTER :: mos(:) ... TYPE(dbcsr_p_type), POINTER :: matrix_ks(:) ... TYPE(dbcsr_p_type), POINTER :: matrix_s(:) ... TYPE(scf_control_type), POINTER :: scf_control ... TYPE(section_vals_type), POINTER :: scf_section ... LOGICAL, INTENT(in), OPTIONAL :: check_moconv_only ...

#### SUBROUTINEdo_block_krylov_diag(scf_env, mos, matrix_ks, scf_control, scf_section, check_moconv_only)^

iterative diagonalization using the block Krylov-space approach

##### Arguments:
 TYPE(qs_scf_env_type), POINTER :: scf_env ... TYPE(mo_set_p_type), POINTER :: mos(:) ... TYPE(dbcsr_p_type), POINTER :: matrix_ks(:) ... TYPE(scf_control_type), POINTER :: scf_control ... TYPE(section_vals_type), POINTER :: scf_section ... LOGICAL, INTENT(in), OPTIONAL :: check_moconv_only ...

#### SUBROUTINEdo_general_diag(scf_env, mos, matrix_ks, matrix_s, scf_control, scf_section, diis_step)^

...

##### Arguments:
 TYPE(qs_scf_env_type), POINTER :: scf_env ... TYPE(mo_set_p_type), POINTER :: mos(:) ... TYPE(dbcsr_p_type), POINTER :: matrix_ks(:) ... TYPE(dbcsr_p_type), POINTER :: matrix_s(:) ... TYPE(scf_control_type), POINTER :: scf_control ... TYPE(section_vals_type), POINTER :: scf_section ... LOGICAL, INTENT(inout) :: diis_step ...

#### SUBROUTINEdo_general_diag_kp(matrix_ks, matrix_s, kpoints, scf_env, scf_control, update_p)^

Kpoint diagonalization routine Transforms matrices to kpoint, distributes kpoint groups, performs general diagonalization (no storgae of overlap decomposition), stores MOs, calculates occupation numbers, calculates density matrices in kpoint representation, transforms density matrices to real space

##### Arguments:
 TYPE(dbcsr_p_type), POINTER :: matrix_ks(:,:) Kohn-sham matrices (RS indices, global) TYPE(dbcsr_p_type), POINTER :: matrix_s(:,:) Overlap matrices (RS indices, global) TYPE(kpoint_type), POINTER :: kpoints Kpoint environment TYPE(qs_scf_env_type), POINTER :: scf_env SCF environment TYPE(scf_control_type), POINTER :: scf_control SCF control variables LOGICAL, INTENT(in) :: update_p ...

#### SUBROUTINEdo_ot_diag(scf_env, mos, matrix_ks, matrix_s, scf_control, scf_section, diis_step)^

the inner loop of scf, specific to iterative diagonalization using OT with S matrix; basically, in goes the ks matrix out goes a new p matrix

##### Arguments:
 TYPE(qs_scf_env_type), POINTER :: scf_env ... TYPE(mo_set_p_type), POINTER :: mos(:) ... TYPE(dbcsr_p_type), POINTER :: matrix_ks(:) ... TYPE(dbcsr_p_type), POINTER :: matrix_s(:) ... TYPE(scf_control_type), POINTER :: scf_control ... TYPE(section_vals_type), POINTER :: scf_section ... LOGICAL, INTENT(inout) :: diis_step ...

#### SUBROUTINEdo_roks_diag(scf_env, mos, matrix_ks, matrix_s, scf_control, scf_section, diis_step, orthogonal_basis)^

Solve a set restricted open Kohn-Sham (ROKS) equations based on the alpha and beta Kohn-Sham matrices from unrestricted Kohn-Sham.

##### Arguments:
 TYPE(qs_scf_env_type), POINTER :: scf_env ... TYPE(mo_set_p_type), POINTER :: mos(:) ... TYPE(dbcsr_p_type), POINTER :: matrix_ks(:) ... TYPE(dbcsr_p_type), POINTER :: matrix_s(:) ... TYPE(scf_control_type), POINTER :: scf_control ... TYPE(section_vals_type), POINTER :: scf_section ... LOGICAL, INTENT(inout) :: diis_step ... LOGICAL, INTENT(in) :: orthogonal_basis ...

#### SUBROUTINEdo_scf_diag_subspace(qs_env, scf_env, subspace_env, mos, rho, ks_env, scf_section, scf_control)^

inner loop within MOS subspace, to refine occupation and density, before next diagonalization of the Hamiltonian

##### Arguments:
 TYPE(qs_environment_type), POINTER :: qs_env ... TYPE(qs_scf_env_type), POINTER :: scf_env ... TYPE(subspace_env_type), POINTER :: subspace_env ... TYPE(mo_set_p_type), POINTER :: mos(:) ... TYPE(qs_rho_type), POINTER :: rho ... TYPE(qs_ks_env_type), POINTER :: ks_env ... TYPE(section_vals_type), POINTER :: scf_section ... TYPE(scf_control_type), POINTER :: scf_control ...

#### SUBROUTINEdo_special_diag(scf_env, mos, matrix_ks, scf_control, scf_section, diis_step)^

the inner loop of scf, specific to diagonalization without S matrix basically, in goes the ks matrix out goes a new p matrix

##### Arguments:
 TYPE(qs_scf_env_type), POINTER :: scf_env ... TYPE(mo_set_p_type), POINTER :: mos(:) ... TYPE(dbcsr_p_type), POINTER :: matrix_ks(:) ... TYPE(scf_control_type), POINTER :: scf_control ... TYPE(section_vals_type), POINTER :: scf_section ... LOGICAL, INTENT(inout) :: diis_step ...

#### SUBROUTINEgeneral_eigenproblem(scf_env, mos, matrix_ks, matrix_s, scf_control, scf_section, diis_step)^

the inner loop of scf, specific to diagonalization with S matrix basically, in goes the ks matrix out goes a new p matrix

##### Arguments:
 TYPE(qs_scf_env_type), POINTER :: scf_env ... TYPE(mo_set_p_type), POINTER :: mos(:) ... TYPE(dbcsr_p_type), POINTER :: matrix_ks(:) ... TYPE(dbcsr_p_type), POINTER :: matrix_s(:) ... TYPE(scf_control_type), POINTER :: scf_control ... TYPE(section_vals_type), POINTER :: scf_section ... LOGICAL, INTENT(inout) :: diis_step ...