29#include "./base/base_uses.f90"
33 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'qs_block_davidson_types'
39 INTEGER :: max_iter = -1, prec_type = -1, solver_type = -1, niter_new_prec = -1, first_prec = -1
40 LOGICAL :: use_sparse_mos = .false.
41 REAL(kind=
dp) :: conv_percent = -1.0_dp, energy_gap = -1.0_dp, eps_iter = -1.0_dp, &
42 noise_scale = 100.0_dp
46 REAL(kind=
dp) :: eps_iter_prev = huge(1.0_dp), eps_iter_used = 0.0_dp
47 TYPE(
cp_fm_type),
POINTER :: h_block_mat => null(), h_block_vec => null(), &
48 matrix_z => null(), matrix_pz => null(), s_block_mat => null(), w_block_mat => null()
66 INTEGER,
INTENT(IN) :: nchannels
72 cpassert(.NOT.
ASSOCIATED(bdav_env))
76 i_val=settings%prec_type)
78 i_val=settings%solver_type)
80 r_val=settings%energy_gap)
82 i_val=settings%niter_new_prec)
84 i_val=settings%max_iter)
86 r_val=settings%eps_iter)
88 i_val=settings%first_prec)
90 r_val=settings%conv_percent)
92 r_val=settings%noise_scale)
94 l_val=settings%use_sparse_mos)
96 ALLOCATE (bdav_env(nchannels))
97 DO ichannel = 1, nchannels
100 bdav_env(ichannel) = settings
117 INTEGER,
INTENT(IN) :: nao, nmo
119 CHARACTER(len=*),
PARAMETER :: routinen =
'block_davidson_allocate'
121 INTEGER :: handle, nmox2
124 CALL timeset(routinen, handle)
125 NULLIFY (fm_struct_tmp)
130 para_env=mo_coeff%matrix_struct%para_env, &
131 context=mo_coeff%matrix_struct%context)
132 NULLIFY (bdav_env%matrix_z, bdav_env%matrix_pz)
133 ALLOCATE (bdav_env%matrix_z, bdav_env%matrix_pz)
134 CALL cp_fm_create(bdav_env%matrix_z, fm_struct_tmp, name=
"Z_mat")
135 CALL cp_fm_create(bdav_env%matrix_pz, fm_struct_tmp, name=
"Z_mat")
138 CALL timestop(handle)
150 INTEGER :: ichannel, nchannels
152 IF (
ASSOCIATED(bdav_env))
THEN
154 nchannels =
SIZE(bdav_env)
155 DO ichannel = 1, nchannels
159 IF (
ASSOCIATED(bdav_env(ichannel)%matrix_z))
THEN
161 DEALLOCATE (bdav_env(ichannel)%matrix_z)
163 IF (
ASSOCIATED(bdav_env(ichannel)%matrix_pz))
THEN
165 DEALLOCATE (bdav_env(ichannel)%matrix_pz)
167 NULLIFY (bdav_env(ichannel)%matrix_z, bdav_env(ichannel)%matrix_pz)
183 INTEGER :: ispin, nspins
185 IF (
ASSOCIATED(bdav_env))
THEN
187 nspins =
SIZE(bdav_env)
190 IF (
ASSOCIATED(bdav_env(ispin)%matrix_z))
THEN
193 DEALLOCATE (bdav_env(ispin)%matrix_z, bdav_env(ispin)%matrix_pz)
194 NULLIFY (bdav_env(ispin)%matrix_z, bdav_env(ispin)%matrix_pz)
198 DEALLOCATE (bdav_env)
represent the structure of a full matrix
subroutine, public cp_fm_struct_create(fmstruct, para_env, context, nrow_global, ncol_global, nrow_block, ncol_block, descriptor, first_p_pos, local_leading_dimension, template_fmstruct, square_blocks, force_block)
allocates and initializes a full matrix structure
subroutine, public cp_fm_struct_release(fmstruct)
releases a full matrix structure
represent a full matrix distributed on many processors
subroutine, public cp_fm_create(matrix, matrix_struct, name, nrow, ncol, set_zero)
creates a new full matrix with the given structure
Defines the basic variable types.
integer, parameter, public dp
module that contains the algorithms to perform an iterative diagonalization by the block-Davidson app...
subroutine, public block_davidson_env_create(bdav_env, nchannels, scf_section)
creates one Davidson environment per solver channel: for Gamma-point runs a channel is a spin,...
subroutine, public block_davidson_allocate(bdav_env, mo_coeff, nao, nmo)
...
subroutine, public block_davidson_release(bdav_env)
...
subroutine, public block_davidson_deallocate(bdav_env)
...
keeps the information about the structure of a full matrix