(git:b5558c7)
Loading...
Searching...
No Matches
bse_full_diag.F
Go to the documentation of this file.
1!--------------------------------------------------------------------------------------------------!
2! CP2K: A general program to perform molecular dynamics simulations !
3! Copyright 2000-2025 CP2K developers group <https://cp2k.org> !
4! !
5! SPDX-License-Identifier: GPL-2.0-or-later !
6!--------------------------------------------------------------------------------------------------!
7
8! **************************************************************************************************
9!> \brief Routines for the full diagonalization of GW + Bethe-Salpeter for computing
10!> electronic excitations
11!> \par History
12!> 10.2023 created [Maximilian Graml]
13! **************************************************************************************************
15
40 USE cp_fm_types, ONLY: cp_fm_create,&
51 USE kinds, ONLY: dp
53 USE mp2_types, ONLY: mp2_type
57#include "./base/base_uses.f90"
58
59 IMPLICIT NONE
60
61 PRIVATE
62
63 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'bse_full_diag'
64
67
68CONTAINS
69
70! **************************************************************************************************
71!> \brief Matrix A constructed from GW energies and 3c-B-matrices (cf. subroutine mult_B_with_W)
72!> A_ia,jb = (ε_a-ε_i) δ_ij δ_ab + α * v_ia,jb - W_ij,ab
73!> ε_a, ε_i are GW singleparticle energies from Eigenval_reduced
74!> α is a spin-dependent factor
75!> v_ia,jb = \sum_P B^P_ia B^P_jb (unscreened Coulomb interaction)
76!> W_ij,ab = \sum_P \bar{B}^P_ij B^P_ab (screened Coulomb interaction)
77!> \param fm_mat_S_ia_bse ...
78!> \param fm_mat_S_bar_ij_bse ...
79!> \param fm_mat_S_ab_bse ...
80!> \param fm_A ...
81!> \param Eigenval ...
82!> \param unit_nr ...
83!> \param homo ...
84!> \param virtual ...
85!> \param dimen_RI ...
86!> \param mp2_env ...
87!> \param para_env ...
88!> \param qs_env ...
89! **************************************************************************************************
90 SUBROUTINE create_a(fm_mat_S_ia_bse, fm_mat_S_bar_ij_bse, fm_mat_S_ab_bse, &
91 fm_A, Eigenval, unit_nr, &
92 homo, virtual, dimen_RI, mp2_env, &
93 para_env, qs_env)
94
95 TYPE(cp_fm_type), INTENT(IN) :: fm_mat_s_ia_bse, fm_mat_s_bar_ij_bse, &
96 fm_mat_s_ab_bse
97 TYPE(cp_fm_type), INTENT(INOUT) :: fm_a
98 REAL(kind=dp), DIMENSION(:) :: eigenval
99 INTEGER, INTENT(IN) :: unit_nr, homo, virtual, dimen_ri
100 TYPE(mp2_type), INTENT(INOUT) :: mp2_env
101 TYPE(mp_para_env_type), INTENT(INOUT) :: para_env
102 TYPE(qs_environment_type), POINTER :: qs_env
103
104 CHARACTER(LEN=*), PARAMETER :: routinen = 'create_A'
105
106 INTEGER :: a_virt_row, handle, i_occ_row, &
107 i_row_global, ii, j_col_global, jj, &
108 ncol_local_a, nrow_local_a, sizeeigen
109 INTEGER, DIMENSION(4) :: reordering
110 INTEGER, DIMENSION(:), POINTER :: col_indices_a, row_indices_a
111 REAL(kind=dp) :: alpha, alpha_screening, eigen_diff
112 TYPE(cp_blacs_env_type), POINTER :: blacs_env
113 TYPE(cp_fm_struct_type), POINTER :: fm_struct_a, fm_struct_w
114 TYPE(cp_fm_type) :: fm_w
115 TYPE(dft_control_type), POINTER :: dft_control
116 TYPE(excited_energy_type), POINTER :: ex_env
117 TYPE(tddfpt2_control_type), POINTER :: tddfpt_control
118
119 CALL timeset(routinen, handle)
120
121 NULLIFY (dft_control, tddfpt_control)
122 CALL get_qs_env(qs_env, dft_control=dft_control)
123 tddfpt_control => dft_control%tddfpt2_control
124
125 IF (unit_nr > 0 .AND. mp2_env%bse%bse_debug_print) THEN
126 WRITE (unit_nr, '(T2,A10,T13,A10)') 'BSE|DEBUG|', 'Creating A'
127 END IF
128
129 !Determines factor of exchange term, depending on requested spin configuration (cf. input_constants.F)
130 SELECT CASE (mp2_env%bse%bse_spin_config)
131 CASE (bse_singlet)
132 alpha = 2.0_dp
133 CASE (bse_triplet)
134 alpha = 0.0_dp
135 END SELECT
136
137 IF (mp2_env%bse%screening_method == bse_screening_alpha) THEN
138 alpha_screening = mp2_env%bse%screening_factor
139 ELSE
140 alpha_screening = 1.0_dp
141 END IF
142
143 ! create the blacs env for ij matrices (NOT fm_mat_S_ia_bse%matrix_struct related parallel_gemms!)
144 NULLIFY (blacs_env)
145 CALL cp_blacs_env_create(blacs_env=blacs_env, para_env=para_env)
146
147 ! We have to use the same blacs_env for A as for the matrices fm_mat_S_ia_bse from RPA
148 ! Logic: A_ia,jb = (ε_a-ε_i) δ_ij δ_ab + α * v_ia,jb - W_ij,ab
149 ! We create v_ia,jb and W_ij,ab, then we communicate entries from local W_ij,ab
150 ! to the full matrix v_ia,jb. By adding these and the energy diffenences: v_ia,jb -> A_ia,jb
151 ! We use the A matrix already from the start instead of v
152 CALL cp_fm_struct_create(fm_struct_a, context=fm_mat_s_ia_bse%matrix_struct%context, nrow_global=homo*virtual, &
153 ncol_global=homo*virtual, para_env=fm_mat_s_ia_bse%matrix_struct%para_env)
154 CALL cp_fm_create(fm_a, fm_struct_a, name="fm_A_iajb")
155 CALL cp_fm_set_all(fm_a, 0.0_dp)
156
157 CALL cp_fm_struct_create(fm_struct_w, context=fm_mat_s_ab_bse%matrix_struct%context, nrow_global=homo**2, &
158 ncol_global=virtual**2, para_env=fm_mat_s_ab_bse%matrix_struct%para_env)
159 CALL cp_fm_create(fm_w, fm_struct_w, name="fm_W_ijab")
160 CALL cp_fm_set_all(fm_w, 0.0_dp)
161
162 ! Create A matrix from GW Energies, v_ia,jb and W_ij,ab (different blacs_env!)
163 ! v_ia,jb, which is directly initialized in A (with a factor of alpha)
164 ! v_ia,jb = \sum_P B^P_ia B^P_jb
165 CALL parallel_gemm(transa="T", transb="N", m=homo*virtual, n=homo*virtual, k=dimen_ri, alpha=alpha, &
166 matrix_a=fm_mat_s_ia_bse, matrix_b=fm_mat_s_ia_bse, beta=0.0_dp, &
167 matrix_c=fm_a)
168
169 IF (unit_nr > 0 .AND. mp2_env%bse%bse_debug_print) THEN
170 WRITE (unit_nr, '(T2,A10,T13,A16)') 'BSE|DEBUG|', 'Allocated A_iajb'
171 END IF
172
173 ! If infinite screening is applied, fm_W is simply 0 - Otherwise it needs to be computed from 3c integrals
174 IF (mp2_env%bse%screening_method /= bse_screening_rpa) THEN
175 !W_ij,ab = \sum_P \bar{B}^P_ij B^P_ab
176 CALL parallel_gemm(transa="T", transb="N", m=homo**2, n=virtual**2, k=dimen_ri, alpha=alpha_screening, &
177 matrix_a=fm_mat_s_bar_ij_bse, matrix_b=fm_mat_s_ab_bse, beta=0.0_dp, &
178 matrix_c=fm_w)
179 END IF
180
181 IF (unit_nr > 0 .AND. mp2_env%bse%bse_debug_print) THEN
182 WRITE (unit_nr, '(T2,A10,T13,A16)') 'BSE|DEBUG|', 'Allocated W_ijab'
183 END IF
184
185 ! We start by moving data from local parts of W_ij,ab to the full matrix A_ia,jb using buffers
186 CALL cp_fm_get_info(matrix=fm_a, &
187 nrow_local=nrow_local_a, &
188 ncol_local=ncol_local_a, &
189 row_indices=row_indices_a, &
190 col_indices=col_indices_a)
191 ! Writing -1.0_dp * W_ij,ab to A_ia,jb, i.e. beta = -1.0_dp,
192 ! W_ij,ab: nrow_secidx_in = homo, ncol_secidx_in = virtual
193 ! A_ia,jb: nrow_secidx_out = virtual, ncol_secidx_out = virtual
194
195 ! If infinite screening is applied, fm_W is simply 0 - Otherwise it needs to be computed from 3c integrals
196 IF (mp2_env%bse%screening_method /= bse_screening_rpa) THEN
197 reordering = (/1, 3, 2, 4/)
198 CALL fm_general_add_bse(fm_a, fm_w, -1.0_dp, homo, virtual, &
199 virtual, virtual, unit_nr, reordering, mp2_env)
200 END IF
201 !full matrix W is not needed anymore, release it to save memory
202 IF (tddfpt_control%do_bse) THEN
203 NULLIFY (ex_env)
204 CALL get_qs_env(qs_env, exstate_env=ex_env)
205 ALLOCATE (ex_env%bse_w_matrix_MO(1, 1)) ! for now only closed-shell
206 CALL cp_fm_create(ex_env%bse_w_matrix_MO(1, 1), fm_struct_w)
207 CALL cp_fm_to_fm(fm_w, ex_env%bse_w_matrix_MO(1, 1))
208 END IF
209 CALL cp_fm_release(fm_w)
210
211 !Now add the energy differences (ε_a-ε_i) on the diagonal (i.e. δ_ij δ_ab) of A_ia,jb
212 DO ii = 1, nrow_local_a
213
214 i_row_global = row_indices_a(ii)
215
216 DO jj = 1, ncol_local_a
217
218 j_col_global = col_indices_a(jj)
219
220 IF (i_row_global == j_col_global) THEN
221 i_occ_row = (i_row_global - 1)/virtual + 1
222 a_virt_row = mod(i_row_global - 1, virtual) + 1
223 eigen_diff = eigenval(a_virt_row + homo) - eigenval(i_occ_row)
224 fm_a%local_data(ii, jj) = fm_a%local_data(ii, jj) + eigen_diff
225
226 END IF
227 END DO
228 END DO
229
230 IF (tddfpt_control%do_bse) THEN
231 sizeeigen = SIZE(eigenval)
232 ALLOCATE (ex_env%gw_eigen(sizeeigen)) ! for now only closed-shell
233 ex_env%gw_eigen(:) = eigenval(:)
234 END IF
235
236 CALL cp_fm_struct_release(fm_struct_a)
237 CALL cp_fm_struct_release(fm_struct_w)
238
239 CALL cp_blacs_env_release(blacs_env)
240
241 CALL timestop(handle)
242
243 END SUBROUTINE create_a
244
245! **************************************************************************************************
246!> \brief Matrix B constructed from 3c-B-matrices (cf. subroutine mult_B_with_W)
247!> B_ia,jb = α * v_ia,jb - W_ib,aj
248!> α is a spin-dependent factor
249!> v_ia,jb = \sum_P B^P_ia B^P_jb (unscreened Coulomb interaction)
250!> W_ib,aj = \sum_P \bar{B}^P_ib B^P_aj (screened Coulomb interaction)
251!> \param fm_mat_S_ia_bse ...
252!> \param fm_mat_S_bar_ia_bse ...
253!> \param fm_B ...
254!> \param homo ...
255!> \param virtual ...
256!> \param dimen_RI ...
257!> \param unit_nr ...
258!> \param mp2_env ...
259! **************************************************************************************************
260 SUBROUTINE create_b(fm_mat_S_ia_bse, fm_mat_S_bar_ia_bse, fm_B, &
261 homo, virtual, dimen_RI, unit_nr, mp2_env)
262
263 TYPE(cp_fm_type), INTENT(IN) :: fm_mat_s_ia_bse, fm_mat_s_bar_ia_bse
264 TYPE(cp_fm_type), INTENT(INOUT) :: fm_b
265 INTEGER, INTENT(IN) :: homo, virtual, dimen_ri, unit_nr
266 TYPE(mp2_type), INTENT(INOUT) :: mp2_env
267
268 CHARACTER(LEN=*), PARAMETER :: routinen = 'create_B'
269
270 INTEGER :: handle
271 INTEGER, DIMENSION(4) :: reordering
272 REAL(kind=dp) :: alpha, alpha_screening
273 TYPE(cp_fm_struct_type), POINTER :: fm_struct_v
274 TYPE(cp_fm_type) :: fm_w
275
276 CALL timeset(routinen, handle)
277
278 IF (unit_nr > 0 .AND. mp2_env%bse%bse_debug_print) THEN
279 WRITE (unit_nr, '(T2,A10,T13,A10)') 'BSE|DEBUG|', 'Creating B'
280 END IF
281
282 ! Determines factor of exchange term, depending on requested spin configuration (cf. input_constants.F)
283 SELECT CASE (mp2_env%bse%bse_spin_config)
284 CASE (bse_singlet)
285 alpha = 2.0_dp
286 CASE (bse_triplet)
287 alpha = 0.0_dp
288 END SELECT
289
290 IF (mp2_env%bse%screening_method == bse_screening_alpha) THEN
291 alpha_screening = mp2_env%bse%screening_factor
292 ELSE
293 alpha_screening = 1.0_dp
294 END IF
295
296 CALL cp_fm_struct_create(fm_struct_v, context=fm_mat_s_ia_bse%matrix_struct%context, nrow_global=homo*virtual, &
297 ncol_global=homo*virtual, para_env=fm_mat_s_ia_bse%matrix_struct%para_env)
298 CALL cp_fm_create(fm_b, fm_struct_v, name="fm_B_iajb")
299 CALL cp_fm_set_all(fm_b, 0.0_dp)
300
301 CALL cp_fm_create(fm_w, fm_struct_v, name="fm_W_ibaj")
302 CALL cp_fm_set_all(fm_w, 0.0_dp)
303
304 IF (unit_nr > 0 .AND. mp2_env%bse%bse_debug_print) THEN
305 WRITE (unit_nr, '(T2,A10,T13,A16)') 'BSE|DEBUG|', 'Allocated B_iajb'
306 END IF
307 ! v_ia,jb = \sum_P B^P_ia B^P_jb
308 CALL parallel_gemm(transa="T", transb="N", m=homo*virtual, n=homo*virtual, k=dimen_ri, alpha=alpha, &
309 matrix_a=fm_mat_s_ia_bse, matrix_b=fm_mat_s_ia_bse, beta=0.0_dp, &
310 matrix_c=fm_b)
311
312 ! If infinite screening is applied, fm_W is simply 0 - Otherwise it needs to be computed from 3c integrals
313 IF (mp2_env%bse%screening_method /= bse_screening_rpa) THEN
314 ! W_ib,aj = \sum_P \bar{B}^P_ib B^P_aj
315 CALL parallel_gemm(transa="T", transb="N", m=homo*virtual, n=homo*virtual, k=dimen_ri, alpha=alpha_screening, &
316 matrix_a=fm_mat_s_bar_ia_bse, matrix_b=fm_mat_s_ia_bse, beta=0.0_dp, &
317 matrix_c=fm_w)
318
319 ! from W_ib,ja to A_ia,jb (formally: W_ib,aj, but our internal indexorder is different)
320 ! Writing -1.0_dp * W_ib,ja to A_ia,jb, i.e. beta = -1.0_dp,
321 ! W_ib,ja: nrow_secidx_in = virtual, ncol_secidx_in = virtual
322 ! A_ia,jb: nrow_secidx_out = virtual, ncol_secidx_out = virtual
323 reordering = (/1, 4, 3, 2/)
324 CALL fm_general_add_bse(fm_b, fm_w, -1.0_dp, virtual, virtual, &
325 virtual, virtual, unit_nr, reordering, mp2_env)
326 END IF
327
328 CALL cp_fm_release(fm_w)
329 CALL cp_fm_struct_release(fm_struct_v)
330 CALL timestop(handle)
331
332 END SUBROUTINE create_b
333
334 ! **************************************************************************************************
335!> \brief Construct Matrix C=(A-B)^0.5 (A+B) (A-B)^0.5 to solve full BSE matrix as a hermitian problem
336!> (cf. Eq. (A7) in F. Furche J. Chem. Phys., Vol. 114, No. 14, (2001)).
337!> We keep fm_sqrt_A_minus_B and fm_inv_sqrt_A_minus_B for print of singleparticle transitions
338!> of ABBA as described in Eq. (A10) in F. Furche J. Chem. Phys., Vol. 114, No. 14, (2001).
339!> \param fm_A ...
340!> \param fm_B ...
341!> \param fm_C ...
342!> \param fm_sqrt_A_minus_B ...
343!> \param fm_inv_sqrt_A_minus_B ...
344!> \param homo ...
345!> \param virtual ...
346!> \param unit_nr ...
347!> \param mp2_env ...
348!> \param diag_est ...
349! **************************************************************************************************
350 SUBROUTINE create_hermitian_form_of_abba(fm_A, fm_B, fm_C, &
351 fm_sqrt_A_minus_B, fm_inv_sqrt_A_minus_B, &
352 homo, virtual, unit_nr, mp2_env, diag_est)
353
354 TYPE(cp_fm_type), INTENT(IN) :: fm_a, fm_b
355 TYPE(cp_fm_type), INTENT(INOUT) :: fm_c, fm_sqrt_a_minus_b, &
356 fm_inv_sqrt_a_minus_b
357 INTEGER, INTENT(IN) :: homo, virtual, unit_nr
358 TYPE(mp2_type), INTENT(INOUT) :: mp2_env
359 REAL(kind=dp), INTENT(IN) :: diag_est
360
361 CHARACTER(LEN=*), PARAMETER :: routinen = 'create_hermitian_form_of_ABBA'
362
363 INTEGER :: dim_mat, handle, n_dependent
364 REAL(kind=dp), DIMENSION(2) :: eigvals_ab_diff
365 TYPE(cp_fm_type) :: fm_a_minus_b, fm_a_plus_b, fm_dummy, &
366 fm_work_product
367
368 CALL timeset(routinen, handle)
369
370 IF (unit_nr > 0) THEN
371 WRITE (unit_nr, '(T2,A4,T7,A25,A39,ES6.0,A3)') 'BSE|', 'Diagonalizing aux. matrix', &
372 ' with size of A. This will take around ', diag_est, " s."
373 END IF
374
375 ! Create work matrices, which will hold A+B and A-B and their powers
376 ! C is created afterwards to save memory
377 ! Final result: C = (A-B)^0.5 (A+B) (A-B)^0.5 EQ.I
378 ! \_______/ \___/ \______/
379 ! fm_sqrt_A_minus_B fm_A_plus_B fm_sqrt_A_minus_B
380 ! (EQ.Ia) (EQ.Ib) (EQ.Ia)
381 ! Intermediate work matrices:
382 ! fm_inv_sqrt_A_minus_B: (A-B)^-0.5 EQ.II
383 ! fm_A_minus_B: (A-B) EQ.III
384 ! fm_work_product: (A-B)^0.5 (A+B) from (EQ.Ia) and (EQ.Ib) EQ.IV
385 CALL cp_fm_create(fm_a_plus_b, fm_a%matrix_struct)
386 CALL cp_fm_to_fm(fm_a, fm_a_plus_b)
387 CALL cp_fm_create(fm_a_minus_b, fm_a%matrix_struct)
388 CALL cp_fm_to_fm(fm_a, fm_a_minus_b)
389 CALL cp_fm_create(fm_sqrt_a_minus_b, fm_a%matrix_struct)
390 CALL cp_fm_set_all(fm_sqrt_a_minus_b, 0.0_dp)
391 CALL cp_fm_create(fm_inv_sqrt_a_minus_b, fm_a%matrix_struct)
392 CALL cp_fm_set_all(fm_inv_sqrt_a_minus_b, 0.0_dp)
393
394 CALL cp_fm_create(fm_work_product, fm_a%matrix_struct)
395
396 IF (unit_nr > 0 .AND. mp2_env%bse%bse_debug_print) THEN
397 WRITE (unit_nr, '(T2,A10,T13,A19)') 'BSE|DEBUG|', 'Created work arrays'
398 END IF
399
400 ! Add/Substract B (cf. EQs. Ib and III)
401 CALL cp_fm_scale_and_add(1.0_dp, fm_a_plus_b, 1.0_dp, fm_b)
402 CALL cp_fm_scale_and_add(1.0_dp, fm_a_minus_b, -1.0_dp, fm_b)
403
404 ! cp_fm_power will overwrite matrix, therefore we create copies
405 CALL cp_fm_to_fm(fm_a_minus_b, fm_inv_sqrt_a_minus_b)
406
407 ! In order to avoid a second diagonalization (cp_fm_power), we create (A-B)^0.5 (EQ.Ia)
408 ! from (A-B)^-0.5 (EQ.II) by multiplication with (A-B) (EQ.III) afterwards.
409
410 ! Raise A-B to -0.5_dp, no quenching of eigenvectors, hence threshold=0.0_dp
411 CALL cp_fm_create(fm_dummy, fm_a%matrix_struct)
412 ! Create (A-B)^-0.5 (cf. EQ.II)
413 CALL cp_fm_power(fm_inv_sqrt_a_minus_b, fm_dummy, -0.5_dp, 0.0_dp, n_dependent, eigvals=eigvals_ab_diff)
414 CALL cp_fm_release(fm_dummy)
415 ! Raise an error in case the the matrix A-B is not positive definite (i.e. negative eigenvalues)
416 ! In this case, the procedure for hermitian form of ABBA is not applicable
417 IF (eigvals_ab_diff(1) < 0) THEN
418 CALL cp_abort(__location__, &
419 "Matrix (A-B) is not positive definite. "// &
420 "Hermitian diagonalization of full ABBA matrix is ill-defined.")
421 END IF
422
423 ! We keep fm_inv_sqrt_A_minus_B for print of singleparticle transitions of ABBA
424 ! We further create (A-B)^0.5 for the singleparticle transitions of ABBA
425 ! Create (A-B)^0.5= (A-B)^-0.5 * (A-B) (EQ.Ia)
426 dim_mat = homo*virtual
427 CALL parallel_gemm("N", "N", dim_mat, dim_mat, dim_mat, 1.0_dp, fm_inv_sqrt_a_minus_b, fm_a_minus_b, 0.0_dp, &
428 fm_sqrt_a_minus_b)
429
430 ! Compute and store LHS of C, i.e. (A-B)^0.5 (A+B) (EQ.IV)
431 CALL parallel_gemm("N", "N", dim_mat, dim_mat, dim_mat, 1.0_dp, fm_sqrt_a_minus_b, fm_a_plus_b, 0.0_dp, &
432 fm_work_product)
433
434 ! Release to save memory
435 CALL cp_fm_release(fm_a_plus_b)
436 CALL cp_fm_release(fm_a_minus_b)
437
438 ! Now create full
439 CALL cp_fm_create(fm_c, fm_a%matrix_struct)
440 CALL cp_fm_set_all(fm_c, 0.0_dp)
441 ! Compute C=(A-B)^0.5 (A+B) (A-B)^0.5 (EQ.I)
442 CALL parallel_gemm("N", "N", dim_mat, dim_mat, dim_mat, 1.0_dp, fm_work_product, fm_sqrt_a_minus_b, 0.0_dp, &
443 fm_c)
444 CALL cp_fm_release(fm_work_product)
445
446 IF (unit_nr > 0 .AND. mp2_env%bse%bse_debug_print) THEN
447 WRITE (unit_nr, '(T2,A10,T13,A36)') 'BSE|DEBUG|', 'Filled C=(A-B)^0.5 (A+B) (A-B)^0.5'
448 END IF
449
450 CALL timestop(handle)
451 END SUBROUTINE
452
453! **************************************************************************************************
454!> \brief Solving eigenvalue equation C Z^n = (Ω^n)^2 Z^n .
455!> Here, the eigenvectors Z^n relate to X^n via
456!> Eq. (A10) in F. Furche J. Chem. Phys., Vol. 114, No. 14, (2001).
457!> \param fm_C ...
458!> \param homo ...
459!> \param virtual ...
460!> \param homo_irred ...
461!> \param fm_sqrt_A_minus_B ...
462!> \param fm_inv_sqrt_A_minus_B ...
463!> \param unit_nr ...
464!> \param diag_est ...
465!> \param mp2_env ...
466!> \param qs_env ...
467!> \param mo_coeff ...
468! **************************************************************************************************
469 SUBROUTINE diagonalize_c(fm_C, homo, virtual, homo_irred, &
470 fm_sqrt_A_minus_B, fm_inv_sqrt_A_minus_B, &
471 unit_nr, diag_est, mp2_env, qs_env, mo_coeff)
472
473 TYPE(cp_fm_type), INTENT(INOUT) :: fm_c
474 INTEGER, INTENT(IN) :: homo, virtual, homo_irred
475 TYPE(cp_fm_type), INTENT(INOUT) :: fm_sqrt_a_minus_b, fm_inv_sqrt_a_minus_b
476 INTEGER, INTENT(IN) :: unit_nr
477 REAL(kind=dp), INTENT(IN) :: diag_est
478 TYPE(mp2_type), INTENT(INOUT) :: mp2_env
479 TYPE(qs_environment_type), POINTER :: qs_env
480 TYPE(cp_fm_type), DIMENSION(:), INTENT(IN) :: mo_coeff
481
482 CHARACTER(LEN=*), PARAMETER :: routinen = 'diagonalize_C'
483
484 INTEGER :: diag_info, handle
485 REAL(kind=dp), ALLOCATABLE, DIMENSION(:) :: exc_ens
486 TYPE(cp_fm_type) :: fm_eigvec_x, fm_eigvec_y, fm_eigvec_z, &
487 fm_mat_eigvec_transform_diff, &
488 fm_mat_eigvec_transform_sum
489
490 CALL timeset(routinen, handle)
491
492 IF (unit_nr > 0) THEN
493 WRITE (unit_nr, '(T2,A4,T7,A17,A22,ES6.0,A3)') 'BSE|', 'Diagonalizing C. ', &
494 'This will take around ', diag_est, ' s.'
495 END IF
496
497 !We have now the full matrix C=(A-B)^0.5 (A+B) (A-B)^0.5
498 !Now: Diagonalize it
499 CALL cp_fm_create(fm_eigvec_z, fm_c%matrix_struct)
500
501 ALLOCATE (exc_ens(homo*virtual))
502
503 CALL choose_eigv_solver(fm_c, fm_eigvec_z, exc_ens, diag_info)
504
505 IF (diag_info /= 0) THEN
506 CALL cp_abort(__location__, &
507 "Diagonalization of C=(A-B)^0.5 (A+B) (A-B)^0.5 failed in BSE")
508 END IF
509
510 ! C could have negative eigenvalues, since we do not explicitly check A+B
511 ! for positive definiteness (would make another O(N^6) Diagon. necessary)
512 ! Instead, we include a check here
513 IF (exc_ens(1) < 0) THEN
514 IF (unit_nr > 0) THEN
515 CALL cp_abort(__location__, &
516 "Matrix C=(A-B)^0.5 (A+B) (A-B)^0.5 has negative eigenvalues, i.e. "// &
517 "(A+B) is not positive definite.")
518 END IF
519 END IF
520 exc_ens = sqrt(exc_ens)
521
522 ! Prepare eigenvector for interpretation of singleparticle transitions
523 ! Compare: F. Furche J. Chem. Phys., Vol. 114, No. 14, (2001)
524 ! We aim for the upper part of the vector (X,Y) for a direct comparison with the TDA result
525
526 ! Following Furche, we basically use Eqs. (A10): First, we multiply
527 ! the (A-B)^+-0.5 with eigenvectors and then the eigenvalues
528 ! One has to be careful about the index structure, since the eigenvector matrix is not symmetric anymore!
529
530 ! First, Eq. I from (A10) from Furche: (X+Y)_n = (Ω_n)^-0.5 (A-B)^0.5 T_n
531 CALL cp_fm_create(fm_mat_eigvec_transform_sum, fm_c%matrix_struct)
532 CALL cp_fm_set_all(fm_mat_eigvec_transform_sum, 0.0_dp)
533 CALL parallel_gemm(transa="N", transb="N", m=homo*virtual, n=homo*virtual, k=homo*virtual, alpha=1.0_dp, &
534 matrix_a=fm_sqrt_a_minus_b, matrix_b=fm_eigvec_z, beta=0.0_dp, &
535 matrix_c=fm_mat_eigvec_transform_sum)
536 CALL cp_fm_release(fm_sqrt_a_minus_b)
537 ! This normalizes the eigenvectors
538 CALL comp_eigvec_coeff_bse(fm_mat_eigvec_transform_sum, exc_ens, -0.5_dp, gamma=2.0_dp, do_transpose=.true.)
539
540 ! Second, Eq. II from (A10) from Furche: (X-Y)_n = (Ω_n)^0.5 (A-B)^-0.5 T_n
541 CALL cp_fm_create(fm_mat_eigvec_transform_diff, fm_c%matrix_struct)
542 CALL cp_fm_set_all(fm_mat_eigvec_transform_diff, 0.0_dp)
543 CALL parallel_gemm(transa="N", transb="N", m=homo*virtual, n=homo*virtual, k=homo*virtual, alpha=1.0_dp, &
544 matrix_a=fm_inv_sqrt_a_minus_b, matrix_b=fm_eigvec_z, beta=0.0_dp, &
545 matrix_c=fm_mat_eigvec_transform_diff)
546 CALL cp_fm_release(fm_inv_sqrt_a_minus_b)
547 CALL cp_fm_release(fm_eigvec_z)
548
549 ! This normalizes the eigenvectors
550 CALL comp_eigvec_coeff_bse(fm_mat_eigvec_transform_diff, exc_ens, 0.5_dp, gamma=2.0_dp, do_transpose=.true.)
551
552 ! Now, we add the two equations to obtain X_n
553 ! Add overwrites the first argument, therefore we copy it beforehand
554 CALL cp_fm_create(fm_eigvec_x, fm_c%matrix_struct)
555 CALL cp_fm_to_fm(fm_mat_eigvec_transform_sum, fm_eigvec_x)
556 CALL cp_fm_scale_and_add(1.0_dp, fm_eigvec_x, 1.0_dp, fm_mat_eigvec_transform_diff)
557
558 ! Now, we subtract the two equations to obtain Y_n
559 ! Add overwrites the first argument, therefore we copy it beforehand
560 CALL cp_fm_create(fm_eigvec_y, fm_c%matrix_struct)
561 CALL cp_fm_to_fm(fm_mat_eigvec_transform_sum, fm_eigvec_y)
562 CALL cp_fm_scale_and_add(1.0_dp, fm_eigvec_y, -1.0_dp, fm_mat_eigvec_transform_diff)
563
564 !Cleanup
565 CALL cp_fm_release(fm_mat_eigvec_transform_diff)
566 CALL cp_fm_release(fm_mat_eigvec_transform_sum)
567
568 CALL postprocess_bse(exc_ens, fm_eigvec_x, mp2_env, qs_env, mo_coeff, &
569 homo, virtual, homo_irred, unit_nr, &
570 .false., fm_eigvec_y)
571
572 DEALLOCATE (exc_ens)
573 CALL cp_fm_release(fm_eigvec_x)
574 CALL cp_fm_release(fm_eigvec_y)
575
576 CALL timestop(handle)
577
578 END SUBROUTINE diagonalize_c
579
580! **************************************************************************************************
581!> \brief Solving hermitian eigenvalue equation A X^n = Ω^n X^n
582!> \param fm_A ...
583!> \param homo ...
584!> \param virtual ...
585!> \param homo_irred ...
586!> \param unit_nr ...
587!> \param diag_est ...
588!> \param mp2_env ...
589!> \param qs_env ...
590!> \param mo_coeff ...
591! **************************************************************************************************
592 SUBROUTINE diagonalize_a(fm_A, homo, virtual, homo_irred, &
593 unit_nr, diag_est, mp2_env, qs_env, mo_coeff)
594
595 TYPE(cp_fm_type), INTENT(INOUT) :: fm_a
596 INTEGER, INTENT(IN) :: homo, virtual, homo_irred, unit_nr
597 REAL(kind=dp), INTENT(IN) :: diag_est
598 TYPE(mp2_type), INTENT(INOUT) :: mp2_env
599 TYPE(qs_environment_type), POINTER :: qs_env
600 TYPE(cp_fm_type), DIMENSION(:), INTENT(IN) :: mo_coeff
601
602 CHARACTER(LEN=*), PARAMETER :: routinen = 'diagonalize_A'
603
604 INTEGER :: diag_info, handle
605 REAL(kind=dp), ALLOCATABLE, DIMENSION(:) :: exc_ens
606 TYPE(cp_fm_type) :: fm_eigvec
607
608 CALL timeset(routinen, handle)
609
610 !Continue with formatting of subroutine create_A
611 IF (unit_nr > 0) THEN
612 WRITE (unit_nr, '(T2,A4,T7,A17,A22,ES6.0,A3)') 'BSE|', 'Diagonalizing A. ', &
613 'This will take around ', diag_est, ' s.'
614 END IF
615
616 !We have now the full matrix A_iajb, distributed over all ranks
617 !Now: Diagonalize it
618 CALL cp_fm_create(fm_eigvec, fm_a%matrix_struct)
619
620 ALLOCATE (exc_ens(homo*virtual))
621
622 CALL choose_eigv_solver(fm_a, fm_eigvec, exc_ens, diag_info)
623
624 IF (diag_info /= 0) THEN
625 CALL cp_abort(__location__, &
626 "Diagonalization of A failed in TDA-BSE")
627 END IF
628
629 CALL postprocess_bse(exc_ens, fm_eigvec, mp2_env, qs_env, mo_coeff, &
630 homo, virtual, homo_irred, unit_nr, .true.)
631
632 CALL cp_fm_release(fm_eigvec)
633 DEALLOCATE (exc_ens)
634
635 CALL timestop(handle)
636
637 END SUBROUTINE diagonalize_a
638
639! **************************************************************************************************
640!> \brief Prints the success message (incl. energies) for full diag of BSE (TDA/full ABBA via flag)
641!> \param Exc_ens ...
642!> \param fm_eigvec_X ...
643!> \param mp2_env ...
644!> \param qs_env ...
645!> \param mo_coeff ...
646!> \param homo ...
647!> \param virtual ...
648!> \param homo_irred ...
649!> \param unit_nr ...
650!> \param flag_TDA ...
651!> \param fm_eigvec_Y ...
652! **************************************************************************************************
653 SUBROUTINE postprocess_bse(Exc_ens, fm_eigvec_X, mp2_env, qs_env, mo_coeff, &
654 homo, virtual, homo_irred, unit_nr, &
655 flag_TDA, fm_eigvec_Y)
656
657 REAL(kind=dp), ALLOCATABLE, DIMENSION(:) :: exc_ens
658 TYPE(cp_fm_type), INTENT(IN) :: fm_eigvec_x
659 TYPE(mp2_type), INTENT(INOUT) :: mp2_env
660 TYPE(qs_environment_type), POINTER :: qs_env
661 TYPE(cp_fm_type), DIMENSION(:), INTENT(IN) :: mo_coeff
662 INTEGER :: homo, virtual, homo_irred, unit_nr
663 LOGICAL, OPTIONAL :: flag_tda
664 TYPE(cp_fm_type), INTENT(IN), OPTIONAL :: fm_eigvec_y
665
666 CHARACTER(LEN=*), PARAMETER :: routinen = 'postprocess_bse'
667
668 CHARACTER(LEN=10) :: info_approximation, multiplet
669 INTEGER :: handle, i_exc, idir, n_moments_di, &
670 n_moments_quad
671 REAL(kind=dp) :: alpha
672 REAL(kind=dp), ALLOCATABLE, DIMENSION(:) :: oscill_str, ref_point_multipole
673 REAL(kind=dp), ALLOCATABLE, DIMENSION(:, :, :) :: polarizability_residues, trans_mom_bse
674 TYPE(cp_fm_type) :: fm_x_ia, fm_y_ia
675 TYPE(cp_fm_type), ALLOCATABLE, DIMENSION(:) :: fm_dipole_ab_trunc, fm_dipole_ai_trunc, &
676 fm_dipole_ij_trunc, fm_quadpole_ab_trunc, fm_quadpole_ai_trunc, fm_quadpole_ij_trunc
677 TYPE(exciton_descr_type), ALLOCATABLE, &
678 DIMENSION(:) :: exc_descr
679
680 CALL timeset(routinen, handle)
681
682 !Prepare variables for printing
683 IF (mp2_env%bse%bse_spin_config == 0) THEN
684 multiplet = "Singlet"
685 alpha = 2.0_dp
686 ELSE
687 multiplet = "Triplet"
688 alpha = 0.0_dp
689 END IF
690 IF (.NOT. PRESENT(flag_tda)) THEN
691 flag_tda = .false.
692 END IF
693 IF (flag_tda) THEN
694 info_approximation = " -TDA- "
695 ELSE
696 info_approximation = "-ABBA-"
697 END IF
698
699 n_moments_di = 3
700 n_moments_quad = 9
701 ! Compute BSE dipoles and oscillator strengths - Keep in memory for later usage
702 ! Need dipoles also for spatial expectation values, which are well-defined also for triplets
703 ALLOCATE (fm_dipole_ij_trunc(n_moments_di))
704 ALLOCATE (fm_dipole_ab_trunc(n_moments_di))
705 ALLOCATE (fm_dipole_ai_trunc(n_moments_di))
706 ALLOCATE (ref_point_multipole(3))
707 ! Obtain dipoles in MO basis
708 CALL get_multipoles_mo(fm_dipole_ai_trunc, fm_dipole_ij_trunc, fm_dipole_ab_trunc, &
709 qs_env, mo_coeff, ref_point_multipole, 1, &
710 homo, virtual, fm_eigvec_x%matrix_struct%context)
711 ! Compute exciton descriptors from these multipoles
712 IF (mp2_env%bse%num_print_exc_descr > 0) THEN
713 ! Obtain quadrupoles in MO basis
714 ALLOCATE (fm_quadpole_ij_trunc(n_moments_quad))
715 ALLOCATE (fm_quadpole_ab_trunc(n_moments_quad))
716 ALLOCATE (fm_quadpole_ai_trunc(n_moments_quad))
717 CALL get_multipoles_mo(fm_quadpole_ai_trunc, fm_quadpole_ij_trunc, fm_quadpole_ab_trunc, &
718 qs_env, mo_coeff, ref_point_multipole, 2, &
719 homo, virtual, fm_eigvec_x%matrix_struct%context)
720 ! Iterate over excitation index outside of routine to make it compatible with tddft module
721 ALLOCATE (exc_descr(mp2_env%bse%num_print_exc_descr))
722 DO i_exc = 1, mp2_env%bse%num_print_exc_descr
723 CALL reshuffle_eigvec(fm_eigvec_x, fm_x_ia, homo, virtual, i_exc, &
724 .false., unit_nr, mp2_env)
725 IF (.NOT. flag_tda) THEN
726 CALL reshuffle_eigvec(fm_eigvec_y, fm_y_ia, homo, virtual, i_exc, &
727 .false., unit_nr, mp2_env)
728
729 CALL get_exciton_descriptors(exc_descr, fm_x_ia, &
730 fm_quadpole_ij_trunc, fm_quadpole_ab_trunc, &
731 fm_quadpole_ai_trunc, &
732 i_exc, homo, virtual, &
733 fm_y_ia)
734 ELSE
735 CALL get_exciton_descriptors(exc_descr, fm_x_ia, &
736 fm_quadpole_ij_trunc, fm_quadpole_ab_trunc, &
737 fm_quadpole_ai_trunc, &
738 i_exc, homo, virtual)
739 END IF
740 CALL cp_fm_release(fm_x_ia)
741 IF (.NOT. flag_tda) THEN
742 CALL cp_fm_release(fm_y_ia)
743 END IF
744 END DO
745 END IF
746
747 IF (mp2_env%bse%bse_spin_config == 0) THEN
748 CALL get_oscillator_strengths(fm_eigvec_x, exc_ens, fm_dipole_ai_trunc, &
749 trans_mom_bse, oscill_str, polarizability_residues, &
750 mp2_env, homo, virtual, unit_nr, &
751 fm_eigvec_y)
752 END IF
753
754 ! Prints basic definitions used in BSE calculation
755 CALL print_output_header(homo, virtual, homo_irred, flag_tda, &
756 multiplet, alpha, mp2_env, unit_nr)
757
758 ! Prints excitation energies up to user-specified number
759 CALL print_excitation_energies(exc_ens, homo, virtual, flag_tda, multiplet, &
760 info_approximation, mp2_env, unit_nr)
761
762 ! Print single particle transition amplitudes, i.e. components of eigenvectors X and Y
763 CALL print_transition_amplitudes(fm_eigvec_x, homo, virtual, homo_irred, &
764 info_approximation, mp2_env, unit_nr, fm_eigvec_y)
765
766 ! Prints optical properties, if state is a singlet
767 CALL print_optical_properties(exc_ens, oscill_str, trans_mom_bse, polarizability_residues, &
768 homo, virtual, homo_irred, flag_tda, &
769 info_approximation, mp2_env, unit_nr)
770 ! Print exciton descriptors if keyword is invoked
771 IF (mp2_env%bse%num_print_exc_descr > 0) THEN
772 CALL print_exciton_descriptors(exc_descr, ref_point_multipole, unit_nr, &
773 mp2_env%bse%num_print_exc_descr, mp2_env%bse%bse_debug_print, &
774 mp2_env%bse%print_directional_exc_descr, &
775 'BSE|', qs_env)
776 END IF
777
778 ! Compute and print excitation wavefunctions
779 IF (mp2_env%bse%do_nto_analysis) THEN
780 IF (unit_nr > 0) THEN
781 WRITE (unit_nr, '(T2,A4)') 'BSE|'
782 WRITE (unit_nr, '(T2,A4,T7,A47)') &
783 'BSE|', "Calculating Natural Transition Orbitals (NTOs)."
784 WRITE (unit_nr, '(T2,A4)') 'BSE|'
785 END IF
786 CALL calculate_ntos(fm_eigvec_x, fm_eigvec_y, &
787 mo_coeff, homo, virtual, &
788 info_approximation, &
789 oscill_str, &
790 qs_env, unit_nr, mp2_env)
791 END IF
792
793 DO idir = 1, n_moments_di
794 CALL cp_fm_release(fm_dipole_ai_trunc(idir))
795 CALL cp_fm_release(fm_dipole_ij_trunc(idir))
796 CALL cp_fm_release(fm_dipole_ab_trunc(idir))
797 END DO
798 IF (mp2_env%bse%num_print_exc_descr > 0) THEN
799 DO idir = 1, n_moments_quad
800 CALL cp_fm_release(fm_quadpole_ai_trunc(idir))
801 CALL cp_fm_release(fm_quadpole_ij_trunc(idir))
802 CALL cp_fm_release(fm_quadpole_ab_trunc(idir))
803 END DO
804 DEALLOCATE (fm_quadpole_ai_trunc, fm_quadpole_ij_trunc, fm_quadpole_ab_trunc)
805 DEALLOCATE (exc_descr)
806 END IF
807 DEALLOCATE (fm_dipole_ai_trunc, fm_dipole_ij_trunc, fm_dipole_ab_trunc)
808 DEALLOCATE (ref_point_multipole)
809 IF (mp2_env%bse%bse_spin_config == 0) THEN
810 DEALLOCATE (oscill_str, trans_mom_bse, polarizability_residues)
811 END IF
812 IF (unit_nr > 0) THEN
813 WRITE (unit_nr, '(T2,A4)') 'BSE|'
814 WRITE (unit_nr, '(T2,A4)') 'BSE|'
815 END IF
816
817 CALL timestop(handle)
818
819 END SUBROUTINE postprocess_bse
820
821END MODULE bse_full_diag
Routines for the full diagonalization of GW + Bethe-Salpeter for computing electronic excitations.
subroutine, public diagonalize_a(fm_a, homo, virtual, homo_irred, unit_nr, diag_est, mp2_env, qs_env, mo_coeff)
Solving hermitian eigenvalue equation A X^n = Ω^n X^n.
subroutine, public diagonalize_c(fm_c, homo, virtual, homo_irred, fm_sqrt_a_minus_b, fm_inv_sqrt_a_minus_b, unit_nr, diag_est, mp2_env, qs_env, mo_coeff)
Solving eigenvalue equation C Z^n = (Ω^n)^2 Z^n . Here, the eigenvectors Z^n relate to X^n via Eq....
subroutine, public create_b(fm_mat_s_ia_bse, fm_mat_s_bar_ia_bse, fm_b, homo, virtual, dimen_ri, unit_nr, mp2_env)
Matrix B constructed from 3c-B-matrices (cf. subroutine mult_B_with_W) B_ia,jb = α * v_ia,...
subroutine, public create_hermitian_form_of_abba(fm_a, fm_b, fm_c, fm_sqrt_a_minus_b, fm_inv_sqrt_a_minus_b, homo, virtual, unit_nr, mp2_env, diag_est)
Construct Matrix C=(A-B)^0.5 (A+B) (A-B)^0.5 to solve full BSE matrix as a hermitian problem (cf....
subroutine, public create_a(fm_mat_s_ia_bse, fm_mat_s_bar_ij_bse, fm_mat_s_ab_bse, fm_a, eigenval, unit_nr, homo, virtual, dimen_ri, mp2_env, para_env, qs_env)
Matrix A constructed from GW energies and 3c-B-matrices (cf. subroutine mult_B_with_W) A_ia,...
Routines for printing information in context of the BSE calculation.
Definition bse_print.F:13
subroutine, public print_output_header(homo, virtual, homo_irred, flag_tda, multiplet, alpha, mp2_env, unit_nr)
...
Definition bse_print.F:98
subroutine, public print_optical_properties(exc_ens, oscill_str, trans_mom_bse, polarizability_residues, homo, virtual, homo_irred, flag_tda, info_approximation, mp2_env, unit_nr)
...
Definition bse_print.F:339
subroutine, public print_exciton_descriptors(exc_descr, ref_point_multipole, unit_nr, num_print_exc_descr, print_checkvalue, print_directional_exc_descr, prefix_output, qs_env)
Prints exciton descriptors, cf. Mewes et al., JCTC 14, 710-725 (2018)
Definition bse_print.F:507
subroutine, public print_transition_amplitudes(fm_eigvec_x, homo, virtual, homo_irred, info_approximation, mp2_env, unit_nr, fm_eigvec_y)
...
Definition bse_print.F:264
subroutine, public print_excitation_energies(exc_ens, homo, virtual, flag_tda, multiplet, info_approximation, mp2_env, unit_nr)
...
Definition bse_print.F:215
Routines for computing excitonic properties, e.g. exciton diameter, from the BSE.
subroutine, public get_oscillator_strengths(fm_eigvec_x, exc_ens, fm_dipole_ai_trunc, trans_mom_bse, oscill_str, polarizability_residues, mp2_env, homo_red, virtual_red, unit_nr, fm_eigvec_y)
Compute and return BSE dipoles d_r^n = sqrt(2) sum_ia < ψ_i | r | ψ_a > ( X_ia^n + Y_ia^n ) and oscil...
subroutine, public get_exciton_descriptors(exc_descr, fm_x_ia, fm_multipole_ij_trunc, fm_multipole_ab_trunc, fm_multipole_ai_trunc, i_exc, homo, virtual, fm_y_ia)
...
subroutine, public calculate_ntos(fm_x, fm_y, mo_coeff, homo, virtual, info_approximation, oscill_str, qs_env, unit_nr, mp2_env)
...
Auxiliary routines for GW + Bethe-Salpeter for computing electronic excitations.
Definition bse_util.F:13
subroutine, public get_multipoles_mo(fm_multipole_ai_trunc, fm_multipole_ij_trunc, fm_multipole_ab_trunc, qs_env, mo_coeff, rpoint, n_moments, homo_red, virtual_red, context_bse)
...
Definition bse_util.F:1715
subroutine, public reshuffle_eigvec(fm_eigvec, fm_eigvec_reshuffled, homo, virtual, n_exc, do_transpose, unit_nr, mp2_env)
...
Definition bse_util.F:1351
subroutine, public comp_eigvec_coeff_bse(fm_work, eig_vals, beta, gamma, do_transpose)
Routine for computing the coefficients of the eigenvectors of the BSE matrix from a multiplication wi...
Definition bse_util.F:787
subroutine, public fm_general_add_bse(fm_out, fm_in, beta, nrow_secidx_in, ncol_secidx_in, nrow_secidx_out, ncol_secidx_out, unit_nr, reordering, mp2_env)
Adds and reorders full matrices with a combined index structure, e.g. adding W_ij,...
Definition bse_util.F:199
methods related to the blacs parallel environment
subroutine, public cp_blacs_env_release(blacs_env)
releases the given blacs_env
subroutine, public cp_blacs_env_create(blacs_env, para_env, blacs_grid_layout, blacs_repeatable, row_major, grid_2d)
allocates and initializes a type that represent a blacs context
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
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....
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_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...
Definition cp_fm_diag.F:236
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_info(matrix, name, nrow_global, ncol_global, nrow_block, ncol_block, nrow_local, ncol_local, row_indices, col_indices, local_data, context, nrow_locals, ncol_locals, matrix_struct, para_env)
returns all kind of information about the full matrix
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_create(matrix, matrix_struct, name, use_sp)
creates a new full matrix with the given structure
Types for excited states potential energies.
Calculation of the incomplete Gamma function F_n(t) for multi-center integrals over Cartesian Gaussia...
Definition gamma.F:15
collects all constants needed in input so that they can be used without circular dependencies
integer, parameter, public bse_singlet
integer, parameter, public bse_triplet
integer, parameter, public bse_screening_alpha
integer, parameter, public bse_screening_rpa
Defines the basic variable types.
Definition kinds.F:23
integer, parameter, public dp
Definition kinds.F:34
Interface to the message passing library MPI.
Types needed for MP2 calculations.
Definition mp2_types.F:14
basic linear algebra operations for full matrixes
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_pp, sab_xtb_nonbond, sab_almo, sab_kp, sab_kp_nosym, sab_cneo, 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, rhoz_cneo_set, ecoul_1c, rho0_s_rs, rho0_s_gs, rhoz_cneo_s_rs, rhoz_cneo_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, harris_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, eeq, rhs, do_rixs, tb_tblite)
Get the QUICKSTEP environment.
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
Contains information on the excited states energy.
stores all the informations relevant to an mpi environment