37 USE dbcsr_api,
ONLY: dbcsr_get_info,&
41 #include "base/base_uses.f90"
47 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'cp_dbcsr_diag'
66 SUBROUTINE cp_dbcsr_syevd(matrix, eigenvectors, eigenvalues, para_env, blacs_env)
73 TYPE(dbcsr_type) :: matrix, eigenvectors
74 REAL(kind=
dp),
DIMENSION(:),
INTENT(OUT) :: eigenvalues
75 TYPE(mp_para_env_type),
POINTER :: para_env
76 TYPE(cp_blacs_env_type),
POINTER :: blacs_env
78 CHARACTER(len=*),
PARAMETER :: routinen =
'cp_dbcsr_syevd'
80 INTEGER :: handle, nfullrows_total
81 TYPE(cp_fm_struct_type),
POINTER :: fm_struct
82 TYPE(cp_fm_type) :: fm_eigenvectors, fm_matrix
84 CALL timeset(routinen, handle)
87 CALL dbcsr_get_info(matrix, nfullrows_total=nfullrows_total)
90 ncol_global=nfullrows_total, para_env=para_env)
91 CALL cp_fm_create(fm_matrix, fm_struct, name=
"fm_matrix")
92 CALL cp_fm_create(fm_eigenvectors, fm_struct, name=
"fm_eigenvectors")
101 CALL cp_fm_release(fm_matrix)
102 CALL cp_fm_release(fm_eigenvectors)
104 CALL timestop(handle)
129 TYPE(dbcsr_type),
POINTER :: matrix
130 TYPE(dbcsr_type),
OPTIONAL,
POINTER :: eigenvectors
131 REAL(kind=
dp),
DIMENSION(:),
INTENT(OUT) :: eigenvalues
132 INTEGER,
INTENT(IN),
OPTIONAL :: neig
133 REAL(kind=
dp),
INTENT(IN),
OPTIONAL :: work_syevx
134 TYPE(mp_para_env_type),
POINTER :: para_env
135 TYPE(cp_blacs_env_type),
POINTER :: blacs_env
137 CHARACTER(LEN=*),
PARAMETER :: routinen =
'cp_dbcsr_syevx'
139 INTEGER :: handle, n, neig_local
140 TYPE(cp_fm_struct_type),
POINTER :: fm_struct
141 TYPE(cp_fm_type) :: fm_eigenvectors, fm_matrix
143 CALL timeset(routinen, handle)
146 CALL dbcsr_get_info(matrix, nfullrows_total=n)
148 IF (
PRESENT(neig)) neig_local = neig
149 IF (neig_local == 0)
RETURN
153 ncol_global=n, para_env=para_env)
154 CALL cp_fm_create(fm_matrix, fm_struct, name=
"fm_matrix")
158 IF (
PRESENT(eigenvectors))
THEN
159 CALL cp_fm_create(fm_eigenvectors, fm_struct, name=
"fm_eigenvectors")
160 CALL cp_fm_syevx(fm_matrix, fm_eigenvectors, eigenvalues, neig, work_syevx)
162 CALL cp_fm_release(fm_eigenvectors)
164 CALL cp_fm_syevx(fm_matrix, eigenvalues=eigenvalues, neig=neig, work_syevx=work_syevx)
168 CALL cp_fm_release(fm_matrix)
170 CALL timestop(handle)
182 SUBROUTINE cp_dbcsr_heevd(matrix, eigenvectors, eigenvalues, para_env, blacs_env)
184 TYPE(dbcsr_type) :: matrix
185 TYPE(dbcsr_type),
OPTIONAL,
POINTER :: eigenvectors
186 REAL(kind=
dp),
DIMENSION(:),
INTENT(OUT) :: eigenvalues
187 TYPE(mp_para_env_type),
POINTER :: para_env
188 TYPE(cp_blacs_env_type),
POINTER :: blacs_env
190 CHARACTER(len=*),
PARAMETER :: routinen =
'cp_dbcsr_heevd'
192 INTEGER :: handle, nfullrows_total
193 TYPE(cp_cfm_type) :: fm_eigenvectors, fm_matrix
194 TYPE(cp_fm_struct_type),
POINTER :: fm_struct
196 CALL timeset(routinen, handle)
199 CALL dbcsr_get_info(matrix, nfullrows_total=nfullrows_total)
202 ncol_global=nfullrows_total, para_env=para_env)
204 CALL cp_cfm_create(fm_eigenvectors, fm_struct, name=
"fm_eigenvectors")
209 CALL cp_cfm_heevd(fm_matrix, fm_eigenvectors, eigenvalues)
216 CALL timestop(handle)
232 SUBROUTINE cp_dbcsr_power(matrix, exponent, threshold, n_dependent, para_env, blacs_env, verbose, eigenvectors, eigenvalues)
233 TYPE(dbcsr_type),
INTENT(INOUT) :: matrix
234 REAL(
dp),
INTENT(IN) :: exponent, threshold
235 INTEGER,
INTENT(OUT) :: n_dependent
236 TYPE(mp_para_env_type),
POINTER :: para_env
237 TYPE(cp_blacs_env_type),
POINTER :: blacs_env
238 LOGICAL,
INTENT(IN),
OPTIONAL :: verbose
239 TYPE(dbcsr_type),
INTENT(INOUT),
OPTIONAL :: eigenvectors
240 REAL(kind=
dp),
DIMENSION(2),
INTENT(OUT),
OPTIONAL :: eigenvalues
242 CHARACTER(len=*),
PARAMETER :: routinen =
'cp_dbcsr_power'
244 INTEGER :: handle, nfullrows_total
245 REAL(kind=
dp),
DIMENSION(2) :: eigenvalues_prv
246 TYPE(cp_fm_struct_type),
POINTER :: fm_struct
247 TYPE(cp_fm_type) :: fm_eigenvectors, fm_matrix
249 CALL timeset(routinen, handle)
252 CALL dbcsr_get_info(matrix, nfullrows_total=nfullrows_total)
255 ncol_global=nfullrows_total, para_env=para_env)
256 CALL cp_fm_create(fm_matrix, fm_struct, name=
"fm_matrix")
257 CALL cp_fm_create(fm_eigenvectors, fm_struct, name=
"fm_eigenvectors")
262 CALL cp_fm_power(fm_matrix, fm_eigenvectors, exponent, threshold, n_dependent, verbose, eigenvalues_prv)
265 CALL cp_fm_release(fm_matrix)
267 IF (
PRESENT(eigenvalues)) eigenvalues(:) = eigenvalues_prv
268 IF (
PRESENT(eigenvectors))
CALL copy_fm_to_dbcsr(fm_eigenvectors, eigenvectors)
270 CALL cp_fm_release(fm_eigenvectors)
272 CALL timestop(handle)
methods related to the blacs parallel environment
used for collecting diagonalization schemes available for cp_cfm_type
subroutine, public cp_cfm_heevd(matrix, eigenvectors, eigenvalues)
Perform a diagonalisation of a complex matrix.
Represents a complex full matrix distributed on many processors.
subroutine, public cp_cfm_create(matrix, matrix_struct, name)
Creates a new full matrix with the given structure.
subroutine, public cp_cfm_release(matrix)
Releases a full matrix.
Interface to (sca)lapack for the Cholesky based procedures.
subroutine, public cp_dbcsr_heevd(matrix, eigenvectors, eigenvalues, para_env, blacs_env)
...
subroutine, public cp_dbcsr_syevx(matrix, eigenvectors, eigenvalues, neig, work_syevx, para_env, blacs_env)
compute eigenvalues and optionally eigenvectors of a real symmetric matrix using scalapack....
subroutine, public cp_dbcsr_syevd(matrix, eigenvectors, eigenvalues, para_env, blacs_env)
...
subroutine, public cp_dbcsr_power(matrix, exponent, threshold, n_dependent, para_env, blacs_env, verbose, eigenvectors, eigenvalues)
...
DBCSR operations in CP2K.
subroutine, public copy_cfm_to_dbcsr(fm, matrix, keep_sparsity)
Copy a BLACS matrix to a dbcsr matrix.
subroutine, public copy_dbcsr_to_fm(matrix, fm)
Copy a DBCSR matrix to a BLACS matrix.
subroutine, public copy_dbcsr_to_cfm(matrix, fm)
Copy a DBCSR matrix to a BLACS matrix.
subroutine, public copy_fm_to_dbcsr(fm, matrix, keep_sparsity)
Copy a BLACS matrix to a dbcsr matrix.
used for collecting some of the diagonalization schemes available for cp_fm_type. cp_fm_power also mo...
subroutine, public cp_fm_power(matrix, work, exponent, threshold, n_dependent, verbose, eigvals)
...
subroutine, public choose_eigv_solver(matrix, eigenvectors, eigenvalues, info)
Choose the Eigensolver depending on which library is available ELPA seems to be unstable for small sy...
subroutine, public cp_fm_syevx(matrix, eigenvectors, eigenvalues, neig, work_syevx)
compute eigenvalues and optionally eigenvectors of a real symmetric matrix using scalapack....
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, use_sp)
creates a new full matrix with the given structure
Defines the basic variable types.
integer, parameter, public dp
Interface to the message passing library MPI.