(git:374b731)
Loading...
Searching...
No Matches
qs_tddfpt_eigensolver.F
Go to the documentation of this file.
1!--------------------------------------------------------------------------------------------------!
2! CP2K: A general program to perform molecular dynamics simulations !
3! Copyright 2000-2024 CP2K developers group <https://cp2k.org> !
4! !
5! SPDX-License-Identifier: GPL-2.0-or-later !
6!--------------------------------------------------------------------------------------------------!
7
8! **************************************************************************************************
18 USE cp_fm_diag, ONLY: cp_fm_syevd
26 USE cp_fm_types, ONLY: cp_fm_create,&
35 USE dbcsr_api, ONLY: dbcsr_p_type,&
36 dbcsr_set
39 USE kinds, ONLY: default_string_length,&
40 dp
42 USE physcon, ONLY: evolt
46 USE qs_p_env_methods, ONLY: p_op_l1,&
47 p_op_l2,&
53 normalize,&
55#include "./base/base_uses.f90"
56
57 IMPLICIT NONE
58
59 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'qs_tddfpt_eigensolver'
60
61 PRIVATE
62
63 PUBLIC :: eigensolver
64
65CONTAINS
66
67! **************************************************************************************************
68!> \brief ...
69!> \param p_env ...
70!> \param qs_env ...
71!> \param t_env ...
72! **************************************************************************************************
73 SUBROUTINE eigensolver(p_env, qs_env, t_env)
74
75 TYPE(qs_p_env_type) :: p_env
76 TYPE(qs_environment_type), POINTER :: qs_env
77 TYPE(tddfpt_env_type), INTENT(INOUT) :: t_env
78
79 CHARACTER(len=*), PARAMETER :: routinen = 'eigensolver'
80
81 INTEGER :: handle, n_ev, nspins, output_unit, &
82 restarts
83 LOGICAL :: do_kernel_save
84 REAL(kind=dp), ALLOCATABLE, DIMENSION(:) :: ievals
85 TYPE(dft_control_type), POINTER :: dft_control
86
87 CALL timeset(routinen, handle)
88
89 NULLIFY (dft_control)
90
91 output_unit = cp_logger_get_default_io_unit()
92
93 CALL get_qs_env(qs_env, dft_control=dft_control)
94 n_ev = dft_control%tddfpt_control%n_ev
95 nspins = dft_control%nspins
96
97 ALLOCATE (ievals(n_ev))
98
99 !---------------!
100 ! initial guess !
101 !---------------!
102 do_kernel_save = dft_control%tddfpt_control%do_kernel
103 dft_control%tddfpt_control%do_kernel = .false.
104 IF (output_unit > 0) THEN
105 WRITE (output_unit, *) " Generating initial guess"
106 WRITE (output_unit, *)
107 END IF
108 IF (ASSOCIATED(dft_control%tddfpt_control%lumos)) THEN
109 CALL co_initial_guess(t_env%evecs, ievals, n_ev, qs_env)
110 ELSE
111 IF (output_unit > 0) WRITE (output_unit, *) "LUMOS are needed in TDDFPT!"
112 cpabort("")
113 END IF
114 DO restarts = 1, dft_control%tddfpt_control%n_restarts
115 IF (iterative_solver(ievals, t_env, p_env, qs_env, ievals)) EXIT
116 IF (output_unit > 0) THEN
117 WRITE (output_unit, *) " Restarting"
118 WRITE (output_unit, *)
119 END IF
120 END DO
121 dft_control%tddfpt_control%do_kernel = do_kernel_save
122
123 !-----------------!
124 ! call the solver !
125 !-----------------!
126 IF (output_unit > 0) THEN
127 WRITE (output_unit, *)
128 WRITE (output_unit, *) " Doing TDDFPT calculation"
129 WRITE (output_unit, *)
130 END IF
131 DO restarts = 1, dft_control%tddfpt_control%n_restarts
132 IF (iterative_solver(ievals, t_env, p_env, qs_env, t_env%evals)) EXIT
133 IF (output_unit > 0) THEN
134 WRITE (output_unit, *) " Restarting"
135 WRITE (output_unit, *)
136 END IF
137 END DO
138
139 !---------!
140 ! cleanup !
141 !---------!
142 DEALLOCATE (ievals)
143
144 CALL timestop(handle)
145
146 END SUBROUTINE eigensolver
147
148 ! in_evals : approximations to the eigenvalues for the preconditioner
149 ! t_env : TD-DFT environment values
150 ! p_env : perturbation environment values
151 ! qs_env : general Quickstep environment values
152 ! out_evals : the resulting eigenvalues
153 ! error : used for error handling
154 !
155 ! res : the function will return wheter the eigenvalues are converged or not
156
157! **************************************************************************************************
158!> \brief ...
159!> \param in_evals ...
160!> \param t_env ...
161!> \param p_env ...
162!> \param qs_env ...
163!> \param out_evals ...
164!> \return ...
165! **************************************************************************************************
166 FUNCTION iterative_solver(in_evals, &
167 t_env, p_env, qs_env, &
168 out_evals) RESULT(res)
169
170 REAL(kind=dp), DIMENSION(:) :: in_evals
171 TYPE(tddfpt_env_type), INTENT(INOUT) :: t_env
172 TYPE(qs_p_env_type) :: p_env
173 TYPE(qs_environment_type), POINTER :: qs_env
174 REAL(kind=dp), DIMENSION(:), OPTIONAL :: out_evals
175 LOGICAL :: res
176
177 CHARACTER(len=*), PARAMETER :: routinen = 'iterative_solver', &
178 routinep = modulen//':'//routinen
179
180 CHARACTER :: mode
181 INTEGER :: col, handle, i, iev, iter, j, k, &
182 max_krylovspace_dim, max_kv, n_ev, &
183 n_kv, nspins, output_unit, row, spin
184 INTEGER, ALLOCATABLE, DIMENSION(:) :: must_improve
185 REAL(dp) :: atilde_ij, convergence, tmp, tmp2
186 REAL(kind=dp), ALLOCATABLE, DIMENSION(:) :: evals_difference, evals_tmp
187 REAL(kind=dp), ALLOCATABLE, DIMENSION(:, :) :: evals
188 TYPE(cp_blacs_env_type), POINTER :: blacs_env
189 TYPE(cp_fm_pool_p_type), DIMENSION(:), POINTER :: ao_mo_fm_pools
190 TYPE(cp_fm_struct_p_type), ALLOCATABLE, &
191 DIMENSION(:) :: kv_fm_struct
192 TYPE(cp_fm_struct_type), POINTER :: tilde_fm_struct
193 TYPE(cp_fm_type) :: atilde, us
194 TYPE(cp_fm_type), ALLOCATABLE, DIMENSION(:) :: r, x
195 TYPE(cp_fm_type), ALLOCATABLE, DIMENSION(:, :) :: ab, b, sb
196 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: matrix_s
197 TYPE(dft_control_type), POINTER :: dft_control
198 TYPE(mp_para_env_type), POINTER :: para_env
199 TYPE(tddfpt_control_type), POINTER :: tddfpt_control
200
201 res = .false.
202
203 CALL timeset(routinen, handle)
204
205 NULLIFY (ao_mo_fm_pools, tddfpt_control, &
206 tilde_fm_struct, matrix_s, dft_control, &
207 para_env, blacs_env)
208
209 CALL get_qs_env(qs_env, &
210 matrix_s=matrix_s, &
211 dft_control=dft_control, &
212 para_env=para_env, &
213 blacs_env=blacs_env)
214
215 tddfpt_control => dft_control%tddfpt_control
216 output_unit = cp_logger_get_default_io_unit()
217 n_ev = tddfpt_control%n_ev
218 nspins = dft_control%nspins
219
220 IF (dft_control%tddfpt_control%diag_method == tddfpt_lanczos) THEN
221 mode = 'L'
222 ELSE IF (dft_control%tddfpt_control%diag_method == tddfpt_davidson) THEN
223 mode = 'D'
224 END IF
225
226 !-----------------------------------------!
227 ! determine the size of the problem !
228 ! and how many krylov space vetors to use !
229 !-----------------------------------------!
230 max_krylovspace_dim = sum(p_env%n_ao(1:nspins)*p_env%n_mo(1:nspins))
231 max_kv = tddfpt_control%max_kv
232 IF (max_krylovspace_dim <= max_kv) THEN
233 max_kv = max_krylovspace_dim
234 IF (output_unit > 0) THEN
235 WRITE (output_unit, *) " Setting the maximum number of krylov vectors to ", max_kv, "!!"
236 END IF
237 END IF
238
239 !----------------------!
240 ! allocate the vectors !
241 !----------------------!
242 CALL mpools_get(qs_env%mpools, ao_mo_fm_pools=ao_mo_fm_pools)
243 CALL fm_pools_create_fm_vect(ao_mo_fm_pools, x, name=routinep//":X")
244 CALL fm_pools_create_fm_vect(ao_mo_fm_pools, r, name=routinep//":R")
245
246 ALLOCATE (evals_difference(n_ev))
247
248 ALLOCATE (must_improve(n_ev))
249
250 ALLOCATE (evals(max_kv, 0:max_kv))
251 ALLOCATE (evals_tmp(max_kv))
252
253 ALLOCATE (b(max_kv, nspins), ab(max_kv, nspins), &
254 sb(max_kv, nspins))
255
256 ALLOCATE (kv_fm_struct(nspins))
257
258 DO spin = 1, nspins
259 CALL cp_fm_struct_create(kv_fm_struct(spin)%struct, para_env, blacs_env, &
260 p_env%n_ao(spin), p_env%n_mo(spin))
261 END DO
262
263 IF (output_unit > 0) THEN
264 WRITE (output_unit, '(2X,A,T69,A)') &
265 "nvec", "Convergence"
266 WRITE (output_unit, '(2X,A)') &
267 "-----------------------------------------------------------------------------"
268 END IF
269
270 iter = 1
271 k = 0
272 n_kv = n_ev
273 iteration: DO
274
275 CALL allocate_krylov_vectors(b, "b-", k + 1, n_kv, nspins, kv_fm_struct)
276 CALL allocate_krylov_vectors(ab, "Ab-", k + 1, n_kv, nspins, kv_fm_struct)
277 CALL allocate_krylov_vectors(sb, "Sb-", k + 1, n_kv, nspins, kv_fm_struct)
278
279 DO i = 1, n_kv
280 k = k + 1
281
282 IF (k <= SIZE(t_env%evecs, 1)) THEN ! the first iteration
283
284 ! take the initial guess
285 DO spin = 1, nspins
286 CALL cp_fm_to_fm(t_env%evecs(k, spin), b(k, spin))
287 END DO
288
289 ELSE
290
291 ! create a new vector
292 IF (mode == 'L') THEN
293
294 DO spin = 1, nspins
295 IF (tddfpt_control%invert_S) THEN
296 CALL cp_fm_symm('L', 'U', p_env%n_ao(spin), p_env%n_mo(spin), &
297 1.0_dp, t_env%invS(spin), ab(k - 1, spin), &
298 0.0_dp, b(k, spin))
299 ELSE
300 CALL cp_fm_to_fm(ab(k - 1, spin), b(k, spin))
301 END IF
302 END DO
303
304 ELSE IF (mode == 'D') THEN
305
306 iev = must_improve(i)
307 ! create the new davidson vector
308 DO spin = 1, nspins
309
310 CALL cp_fm_set_all(r(spin), 0.0_dp)
311 DO j = 1, k - i
312 CALL cp_fm_to_fm(ab(j, spin), x(spin))
313 CALL cp_fm_scale_and_add(1.0_dp, x(spin), &
314 -evals(iev, iter - 1), sb(j, spin))
315 CALL cp_fm_get_element(us, j, iev, tmp)
316 CALL cp_fm_scale_and_add(1.0_dp, r(spin), &
317 tmp, x(spin))
318 END DO
319
320 IF (tddfpt_control%invert_S) THEN
321 CALL cp_fm_symm('L', 'U', p_env%n_ao(spin), p_env%n_mo(spin), &
322 1.0_dp, t_env%invS(spin), r(spin), &
323 0.0_dp, x(spin))
324 ELSE
325 CALL cp_fm_to_fm(r(spin), x(spin))
326 END IF
327
328 !----------------!
329 ! preconditioner !
330 !----------------!
331 IF (dft_control%tddfpt_control%precond) THEN
332 DO col = 1, p_env%n_mo(spin)
333 IF (col <= n_ev) THEN
334 tmp2 = abs(evals(iev, iter - 1) - in_evals(col))
335 ELSE
336 tmp2 = abs(evals(iev, iter - 1) - (in_evals(n_ev) + 10.0_dp))
337 END IF
338 ! protect against division by 0 by a introducing a cutoff.
339 tmp2 = max(tmp2, 100*epsilon(1.0_dp))
340 DO row = 1, p_env%n_ao(spin)
341 CALL cp_fm_get_element(x(spin), row, col, tmp)
342 CALL cp_fm_set_element(b(k, spin), row, col, tmp/tmp2)
343 END DO
344 END DO
345 ELSE
346 CALL cp_fm_to_fm(x(spin), b(k, spin))
347 END IF
348
349 END DO
350
351 ELSE
352 IF (output_unit > 0) WRITE (output_unit, *) "unknown mode"
353 cpabort("")
354 END IF
355
356 END IF
357
358 CALL p_preortho(p_env, qs_env, b(k, :))
359 DO j = 1, tddfpt_control%n_reortho
360 CALL reorthogonalize(b(k, :), b, sb, r, k - 1) ! R is temp
361 END DO
362 CALL normalize(b(k, :), r, matrix_s) ! R is temp
363 DO spin = 1, nspins
364 CALL cp_fm_to_fm(b(k, spin), x(spin))
365 END DO
366 CALL apply_op(x, ab(k, :), p_env, qs_env, &
367 dft_control%tddfpt_control%do_kernel)
368 CALL p_postortho(p_env, qs_env, ab(k, :))
369 DO spin = 1, nspins
370 CALL cp_dbcsr_sm_fm_multiply(matrix_s(1)%matrix, &
371 b(k, spin), &
372 sb(k, spin), &
373 p_env%n_mo(spin))
374 END DO
375 END DO
376
377 !--------------------------------------------!
378 ! deallocate memory for the reduced matrices !
379 !--------------------------------------------!
380 CALL cp_fm_release(atilde)
381 CALL cp_fm_release(us)
382 IF (ASSOCIATED(tilde_fm_struct)) CALL cp_fm_struct_release(tilde_fm_struct)
383
384 !------------------------------------------!
385 ! allocate memory for the reduced matrices !
386 !------------------------------------------!
387 CALL cp_fm_struct_create(tilde_fm_struct, para_env, blacs_env, k, k)
388 CALL cp_fm_create(atilde, &
389 tilde_fm_struct, &
390 routinep//"Atilde")
391 CALL cp_fm_create(us, &
392 tilde_fm_struct, &
393 routinep//"Us")
394
395 !---------------------------------------!
396 ! calc the matrix Atilde = transp(b)*Ab !
397 !---------------------------------------!
398 DO i = 1, k
399 DO j = 1, k
400 atilde_ij = 0.0_dp
401 DO spin = 1, nspins
402 CALL cp_fm_trace(b(i, spin), ab(j, spin), tmp)
403 atilde_ij = atilde_ij + tmp
404 END DO
405 CALL cp_fm_set_element(atilde, i, j, atilde_ij)
406 END DO
407 END DO
408
409 !--------------------!
410 ! diagonalize Atilde !
411 !--------------------!
412 evals_tmp(:) = evals(:, iter)
413 CALL cp_fm_syevd(atilde, us, evals_tmp(:))
414 evals(:, iter) = evals_tmp(:)
415
416 !-------------------!
417 ! check convergence !
418 !-------------------!
419 evals_difference = 1.0_dp
420 IF (iter /= 1) THEN
421
422 evals_difference(:) = abs((evals(1:n_ev, iter - 1) - evals(1:n_ev, iter)))
423 ! For debugging
424 IF (output_unit > 0) THEN
425 WRITE (output_unit, *)
426 DO i = 1, n_ev
427 WRITE (output_unit, '(2X,F10.7,T69,ES11.4)') evals(i, iter)*evolt, evals_difference(i)
428 END DO
429 WRITE (output_unit, *)
430 END IF
431
432 convergence = maxval(evals_difference)
433 IF (output_unit > 0) WRITE (output_unit, '(2X,I4,T69,ES11.4)') k, convergence
434
435 IF (convergence < tddfpt_control%tolerance) THEN
436 res = .true.
437 EXIT iteration
438 END IF
439 END IF
440
441 IF (mode == 'L') THEN
442 n_kv = 1
443 ELSE
444 must_improve = 0
445 DO i = 1, n_ev
446 IF (evals_difference(i) > tddfpt_control%tolerance) must_improve(i) = 1
447 END DO
448!! Set must_improve to 1 if all the vectors should
449!! be updated in one iteration.
450!! must_improve = 1
451 n_kv = sum(must_improve)
452 j = 1
453 DO i = 1, n_ev
454 IF (must_improve(i) == 1) THEN
455 must_improve(j) = i
456 j = j + 1
457 END IF
458 END DO
459 END IF
460
461 IF (k + n_kv > max_kv) EXIT iteration
462
463 iter = iter + 1
464
465 END DO iteration
466
467 IF (PRESENT(out_evals)) THEN
468 out_evals(1:n_ev) = evals(1:n_ev, iter)
469 END IF
470
471 DO spin = 1, nspins
472 DO j = 1, n_ev
473 CALL cp_fm_set_all(t_env%evecs(j, spin), 0.0_dp)
474 DO i = 1, k
475 CALL cp_fm_get_element(us, i, j, tmp)
476 CALL cp_fm_scale_and_add(1.0_dp, t_env%evecs(j, spin), &
477 tmp, b(i, spin))
478 END DO
479 END DO
480 END DO
481
482 !----------!
483 ! clean up !
484 !----------!
485 CALL cp_fm_release(atilde)
486 CALL cp_fm_release(us)
487 IF (ASSOCIATED(tilde_fm_struct)) CALL cp_fm_struct_release(tilde_fm_struct)
488 CALL fm_pools_give_back_fm_vect(ao_mo_fm_pools, x)
489 CALL fm_pools_give_back_fm_vect(ao_mo_fm_pools, r)
490 DO spin = 1, nspins
491 CALL cp_fm_struct_release(kv_fm_struct(spin)%struct)
492 END DO
493 CALL cp_fm_release(b)
494 CALL cp_fm_release(ab)
495 CALL cp_fm_release(sb)
496 DEALLOCATE (evals, evals_tmp, evals_difference, must_improve, kv_fm_struct)
497
498 CALL timestop(handle)
499
500 END FUNCTION iterative_solver
501
502 ! X : the vector on which to apply the op
503 ! R : the result
504 ! t_env : td-dft environment (mainly control information)
505 ! p_env : perturbation environment (variables)
506 ! both of these carry info for the tddfpt calculation
507 ! qs_env : info about a quickstep ground state calculation
508
509! **************************************************************************************************
510!> \brief ...
511!> \param X ...
512!> \param R ...
513!> \param p_env ...
514!> \param qs_env ...
515!> \param do_kernel ...
516! **************************************************************************************************
517 SUBROUTINE apply_op(X, R, p_env, qs_env, do_kernel)
518
519 TYPE(cp_fm_type), DIMENSION(:), INTENT(INOUT) :: x, r
520 TYPE(qs_p_env_type) :: p_env
521 TYPE(qs_environment_type), POINTER :: qs_env
522 LOGICAL, INTENT(IN) :: do_kernel
523
524 CHARACTER(LEN=*), PARAMETER :: routinen = 'apply_op'
525
526 INTEGER :: handle, nspins, spin
527 INTEGER, SAVE :: counter = 0
528 TYPE(dft_control_type), POINTER :: dft_control
529
530 NULLIFY (dft_control)
531
532 CALL timeset(routinen, handle)
533
534 counter = counter + 1
535 CALL get_qs_env(qs_env, dft_control=dft_control)
536 nspins = dft_control%nspins
537
538 !------------!
539 ! R = HX-SXL !
540 !------------!
541 CALL p_op_l1(p_env, qs_env, x, r) ! acts on both spins, result in R
542
543 !-----------------!
544 ! calc P1 and !
545 ! R = R + K(P1)*C !
546 !-----------------!
547 IF (do_kernel) THEN
548 DO spin = 1, nspins
549 CALL dbcsr_set(p_env%p1(spin)%matrix, 0.0_dp) ! optimize?
550 CALL cp_dbcsr_plus_fm_fm_t(p_env%p1(spin)%matrix, &
551 matrix_v=p_env%psi0d(spin), &
552 matrix_g=x(spin), &
553 ncol=p_env%n_mo(spin), &
554 symmetry_mode=1)
555 END DO
556 DO spin = 1, nspins
557 CALL cp_fm_set_all(x(spin), 0.0_dp)
558 END DO
559 CALL p_op_l2(p_env, qs_env, p_env%p1, x, &
560 alpha=1.0_dp, beta=0.0_dp) ! X = beta*X + alpha*K(P1)*C
561 DO spin = 1, nspins
562 CALL cp_fm_scale_and_add(1.0_dp, r(spin), &
563 1.0_dp, x(spin)) ! add X to R
564 END DO
565 END IF
566
567 CALL timestop(handle)
568
569 END SUBROUTINE apply_op
570
571! **************************************************************************************************
572!> \brief ...
573!> \param vectors ...
574!> \param vectors_name ...
575!> \param startv ...
576!> \param n_v ...
577!> \param nspins ...
578!> \param fm_struct ...
579! **************************************************************************************************
580 SUBROUTINE allocate_krylov_vectors(vectors, vectors_name, &
581 startv, n_v, nspins, fm_struct)
582
583 TYPE(cp_fm_type), ALLOCATABLE, DIMENSION(:, :) :: vectors
584 CHARACTER(LEN=*), INTENT(IN) :: vectors_name
585 INTEGER, INTENT(IN) :: startv, n_v, nspins
586 TYPE(cp_fm_struct_p_type), DIMENSION(:), &
587 INTENT(IN) :: fm_struct
588
589 CHARACTER(LEN=*), PARAMETER :: routinen = 'allocate_krylov_vectors', &
590 routinep = modulen//':'//routinen
591
592 CHARACTER(LEN=default_string_length) :: mat_name
593 INTEGER :: index, spin
594
595 DO spin = 1, nspins
596 DO index = startv, startv + n_v - 1
597 mat_name = routinep//vectors_name//trim(cp_to_string(index)) &
598 //","//trim(cp_to_string(spin))
599 CALL cp_fm_create(vectors(index, spin), &
600 fm_struct(spin)%struct, mat_name)
601 IF (.NOT. ASSOCIATED(vectors(index, spin)%matrix_struct)) &
602 cpabort("Could not allocate "//trim(mat_name)//".")
603 END DO
604 END DO
605
606 END SUBROUTINE allocate_krylov_vectors
607
608END MODULE qs_tddfpt_eigensolver
methods related to the blacs parallel environment
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
DBCSR operations in CP2K.
subroutine, public cp_dbcsr_sm_fm_multiply(matrix, fm_in, fm_out, ncol, alpha, beta)
multiply a dbcsr with a fm matrix
subroutine, public cp_dbcsr_plus_fm_fm_t(sparse_matrix, matrix_v, matrix_g, ncol, alpha, keep_sparsity, symmetry_mode)
performs the multiplication sparse_matrix+dense_mat*dens_mat^T if matrix_g is not explicitly given,...
basic linear algebra operations for full matrices
subroutine, public cp_fm_scale_and_add(alpha, matrix_a, beta, matrix_b)
calc A <- alpha*A + beta*B optimized for alpha == 1.0 (just add beta*B) and beta == 0....
subroutine, public cp_fm_symm(side, uplo, m, n, alpha, matrix_a, matrix_b, beta, matrix_c)
computes matrix_c = beta * matrix_c + alpha * matrix_a * matrix_b computes matrix_c = beta * matrix_c...
used for collecting some of the diagonalization schemes available for cp_fm_type. cp_fm_power also mo...
Definition cp_fm_diag.F:17
subroutine, public cp_fm_syevd(matrix, eigenvectors, eigenvalues, info)
Computes all eigenvalues and vectors of a real symmetric matrix significantly faster than syevx,...
Definition cp_fm_diag.F:413
pool for for elements that are retained and released
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
Definition cp_fm_types.F:15
subroutine, public cp_fm_get_element(matrix, irow_global, icol_global, alpha, local)
returns an element of a fm this value is valid on every cpu using this call is expensive
subroutine, public cp_fm_set_all(matrix, alpha, beta)
set all elements of a matrix to the same value, and optionally the diagonal to a different one
subroutine, public cp_fm_set_element(matrix, irow_global, icol_global, alpha)
sets an element of a matrix
subroutine, public cp_fm_create(matrix, matrix_struct, name, use_sp)
creates a new full matrix with the given structure
various routines to log and control the output. The idea is that decisions about where to log should ...
integer function, public cp_logger_get_default_io_unit(logger)
returns the unit nr for the ionode (-1 on all other processors) skips as well checks if the procs cal...
collects all constants needed in input so that they can be used without circular dependencies
integer, parameter, public tddfpt_lanczos
integer, parameter, public tddfpt_davidson
Defines the basic variable types.
Definition kinds.F:23
integer, parameter, public dp
Definition kinds.F:34
integer, parameter, public default_string_length
Definition kinds.F:57
Interface to the message passing library MPI.
Definition of physical constants:
Definition physcon.F:68
real(kind=dp), parameter, public evolt
Definition physcon.F:183
subroutine, public get_qs_env(qs_env, atomic_kind_set, qs_kind_set, cell, super_cell, cell_ref, use_ref_cell, kpoints, dft_control, mos, sab_orb, sab_all, qmmm, qmmm_periodic, sac_ae, sac_ppl, sac_lri, sap_ppnl, sab_vdw, sab_scp, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, sab_xb, sab_xtb_nonbond, sab_almo, sab_kp, sab_kp_nosym, particle_set, energy, force, matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, run_rtp, rtp, matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_ks_im_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, matrix_s_ri_aux_kp, matrix_s, matrix_s_ri_aux, matrix_w, matrix_p_mp2, matrix_p_mp2_admm, rho, rho_xc, pw_env, ewald_env, ewald_pw, active_space, mpools, input, para_env, blacs_env, scf_control, rel_control, kinetic, qs_charges, vppl, rho_core, rho_nlcc, rho_nlcc_g, ks_env, ks_qmmm_env, wf_history, scf_env, local_particles, local_molecules, distribution_2d, dbcsr_dist, molecule_kind_set, molecule_set, subsys, cp_subsys, oce, local_rho_set, rho_atom_set, task_list, task_list_soft, rho0_atom_set, rho0_mpole, rhoz_set, ecoul_1c, rho0_s_rs, rho0_s_gs, do_kpoints, has_unit_metric, requires_mo_derivs, mo_derivs, mo_loc_history, nkind, natom, nelectron_total, nelectron_spin, efield, neighbor_list_id, linres_control, xas_env, virial, cp_ddapc_env, cp_ddapc_ewald, outer_scf_history, outer_scf_ihistory, x_data, et_coupling, dftb_potential, results, se_taper, se_store_int_env, se_nddo_mpole, se_nonbond_env, admm_env, lri_env, lri_density, exstate_env, ec_env, dispersion_env, gcp_env, vee, rho_external, external_vxc, mask, mp2_env, bs_env, kg_env, wanniercentres, atprop, ls_scf_env, do_transport, transport_env, v_hartree_rspace, s_mstruct_changed, rho_changed, potential_changed, forces_up_to_date, mscfg_env, almo_scf_env, gradient_history, variable_history, embed_pot, spin_embed_pot, polar_env, mos_last_converged, rhs)
Get the QUICKSTEP environment.
wrapper for the pools of matrixes
subroutine, public mpools_get(mpools, ao_mo_fm_pools, ao_ao_fm_pools, mo_mo_fm_pools, ao_mosub_fm_pools, mosub_mosub_fm_pools, maxao_maxmo_fm_pool, maxao_maxao_fm_pool, maxmo_maxmo_fm_pool)
returns various attributes of the mpools (notably the pools contained in it)
Utility functions for the perturbation calculations.
subroutine, public p_op_l1(p_env, qs_env, v, res)
Evaluates Fv (S_mo)^-1 - Sv(epsilon) and stores it in res.
subroutine, public p_postortho(p_env, qs_env, v, n_cols)
does a postorthogonalization on the given matrix vector: v = (I-SP) v
subroutine, public p_op_l2(p_env, qs_env, p1, res, alpha, beta)
evaluates res = alpha kpp1(v)*psi0 + beta res with kpp1 evaluated with p=qs_envrhorho_ao,...
subroutine, public p_preortho(p_env, qs_env, v, n_cols)
does a preorthogonalization of the given matrix: v = (I-PS)v
basis types for the calculation of the perturbation of density theory.
subroutine, public eigensolver(p_env, qs_env, t_env)
...
subroutine, public reorthogonalize(x, v_set, sv_set, work, n)
...
subroutine, public normalize(x, tmp_vec, metric)
...
subroutine, public co_initial_guess(matrices, energies, n_v, qs_env)
...
represent a blacs multidimensional parallel environment (for the mpi corrispective see cp_paratypes/m...
keeps the information about the structure of a full matrix
represent a full matrix
stores all the informations relevant to an mpi environment
Represent a qs system that is perturbed. Can calculate the linear operator and the rhs of the system ...