(git:374b731)
Loading...
Searching...
No Matches
rpa_axk.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! **************************************************************************************************
9!> \brief Auxiliary routines needed for RPA-AXK
10!> given blacs_env to another
11!> \par History
12!> 09.2016 created [Vladimir Rybkin]
13!> 03.2019 Renamed [Frederick Stein]
14!> 03.2019 Moved Functions from rpa_ri_gpw.F [Frederick Stein]
15!> \author Vladimir Rybkin
16! **************************************************************************************************
17MODULE rpa_axk
19 USE cell_types, ONLY: cell_type
28 USE cp_fm_types, ONLY: cp_fm_create,&
35 USE dbcsr_api, ONLY: &
36 dbcsr_copy, dbcsr_create, dbcsr_init_p, dbcsr_multiply, dbcsr_p_type, dbcsr_release, &
37 dbcsr_set, dbcsr_trace, dbcsr_type, dbcsr_type_no_symmetry
39 USE hfx_ri, ONLY: hfx_ri_update_ks
40 USE hfx_types, ONLY: hfx_create,&
46 USE kinds, ONLY: dp
48 USE mp2_types, ONLY: mp2_type
58 USE rpa_util, ONLY: calc_fm_mat_s_rpa,&
61 USE util, ONLY: get_limit
62#include "./base/base_uses.f90"
63
64 IMPLICIT NONE
65
66 PRIVATE
67
68 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'rpa_axk'
69
70 PUBLIC :: compute_axk_ener
71
72CONTAINS
73
74! **************************************************************************************************
75!> \brief Main driver for RPA-AXK energies
76!> \param qs_env ...
77!> \param fm_mat_Q ...
78!> \param fm_mat_Q_gemm ...
79!> \param dimen_RI ...
80!> \param dimen_ia ...
81!> \param para_env_sub ...
82!> \param para_env_RPA ...
83!> \param eig ...
84!> \param fm_mat_S ...
85!> \param homo ...
86!> \param virtual ...
87!> \param omega ...
88!> \param mp2_env ...
89!> \param mat_munu ...
90!> \param unit_nr ...
91!> \param e_axk_corr ... AXK energy correctrion for a quadrature point
92!> \author Vladimir Rybkin, 07/2016
93! **************************************************************************************************
94 SUBROUTINE compute_axk_ener(qs_env, fm_mat_Q, fm_mat_Q_gemm, dimen_RI, dimen_ia, &
95 para_env_sub, para_env_RPA, &
96 eig, fm_mat_S, homo, virtual, omega, &
97 mp2_env, mat_munu, unit_nr, e_axk_corr)
98 TYPE(qs_environment_type), POINTER :: qs_env
99 TYPE(cp_fm_type), INTENT(IN) :: fm_mat_q, fm_mat_q_gemm
100 INTEGER, INTENT(IN) :: dimen_ri, dimen_ia
101 TYPE(mp_para_env_type), POINTER :: para_env_sub, para_env_rpa
102 REAL(kind=dp), DIMENSION(:), INTENT(IN) :: eig
103 TYPE(cp_fm_type), INTENT(IN) :: fm_mat_s
104 INTEGER, INTENT(IN) :: homo, virtual
105 REAL(kind=dp), INTENT(IN) :: omega
106 TYPE(mp2_type) :: mp2_env
107 TYPE(dbcsr_p_type), INTENT(IN) :: mat_munu
108 INTEGER, INTENT(IN) :: unit_nr
109 REAL(kind=dp), INTENT(INOUT) :: e_axk_corr
110
111 CHARACTER(LEN=*), PARAMETER :: routinen = 'compute_axk_ener'
112 REAL(kind=dp), PARAMETER :: thresh = 0.0000001_dp
113
114 INTEGER :: color_sub, handle, iib, iitmp(2), kkb, l_counter, my_group_l_end, &
115 my_group_l_size, my_group_l_start, ncol_local, ngroup
116 INTEGER, DIMENSION(:), POINTER :: col_indices
117 REAL(kind=dp) :: eps_filter, trace_corr
118 REAL(kind=dp), ALLOCATABLE, DIMENSION(:) :: eigenval
119 TYPE(cp_fm_struct_type), POINTER :: fm_struct
120 TYPE(cp_fm_type) :: fm_mat_gamma_3, fm_mat_q_tmp, &
121 fm_mat_r_half, fm_mat_r_half_gemm, &
122 fm_mat_u
123 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: dbcsr_gamma_3, dbcsr_gamma_inu_p, &
124 dbcsr_gamma_munu_p
125 TYPE(dbcsr_type), POINTER :: mo_coeff_o, mo_coeff_v
126
127 CALL timeset(routinen, handle)
128
129 ! Eigenvalues
130 ALLOCATE (eigenval(dimen_ri))
131 eigenval = 0.0_dp
132 ! create the R_half and U matrices with a different blacs env similar to Q
133 ! and a tmp_Q needed for diagonalization
134
135 NULLIFY (fm_struct)
136
137 CALL cp_fm_get_info(matrix=fm_mat_q, &
138 matrix_struct=fm_struct)
139 CALL cp_fm_create(fm_mat_u, fm_struct, name="fm_mat_U")
140 CALL cp_fm_create(fm_mat_r_half, fm_struct, name="fm_mat_R_half")
141 CALL cp_fm_create(fm_mat_q_tmp, fm_struct, name="fm_mat_Q_tmp")
142 CALL cp_fm_set_all(matrix=fm_mat_q_tmp, alpha=0.0_dp)
143 CALL cp_fm_set_all(matrix=fm_mat_u, alpha=0.0_dp)
144 CALL cp_fm_set_all(matrix=fm_mat_r_half, alpha=0.0_dp)
145
146 ! Copy Q to Q_tmp
147 CALL cp_fm_to_fm(fm_mat_q, fm_mat_q_tmp)
148
149 CALL cp_fm_scale(0.50_dp, fm_mat_q_tmp)
150 ! Diagonalize Q
151 CALL choose_eigv_solver(fm_mat_q_tmp, fm_mat_u, eigenval)
152
153 !Calculate diagonal matrix for R_half
154
155 ! U*diag stored in U, whereas eigenvectors are in fm_mat_Q_tmp
156 !CALL cp_fm_to_fm(fm_mat_Q_tmp, fm_mat_U)
157 CALL cp_fm_to_fm(fm_mat_u, fm_mat_q_tmp)
158
159 ! Manipulate eigenvalues to get diagonal matrix
160 DO iib = 1, dimen_ri
161 IF (abs(eigenval(iib)) .GE. thresh) THEN
162 eigenval(iib) = &
163 sqrt((1.0_dp/(eigenval(iib)**2))*log(1.0_dp + eigenval(iib)) &
164 - 1.0_dp/(eigenval(iib)*(eigenval(iib) + 1.0_dp)))
165 ELSE
166 eigenval(iib) = 0.707_dp
167 END IF
168 END DO
169
170 CALL cp_fm_column_scale(fm_mat_u, eigenval)
171
172 ! Release memory
173 DEALLOCATE (eigenval)
174
175 ! Get R_half by multiplication
176 CALL parallel_gemm(transa="N", transb="T", m=dimen_ri, n=dimen_ri, k=dimen_ri, alpha=1.0_dp, &
177 matrix_a=fm_mat_u, matrix_b=fm_mat_q_tmp, beta=0.0_dp, &
178 matrix_c=fm_mat_r_half)
179
180 ! get info of fm_mat_S and initialize Gamma_3
181 NULLIFY (fm_struct)
182 CALL cp_fm_struct_create(fm_struct, template_fmstruct=fm_mat_s%matrix_struct, nrow_global=dimen_ia, ncol_global=dimen_ri)
183 CALL cp_fm_create(fm_mat_gamma_3, fm_struct)
184 CALL cp_fm_struct_release(fm_struct)
185 CALL cp_fm_set_all(matrix=fm_mat_gamma_3, alpha=0.0_dp)
186 CALL cp_fm_get_info(matrix=fm_mat_s, &
187 ncol_local=ncol_local, &
188 col_indices=col_indices)
189
190 ! Update G with a new value of Omega: in practice, it is G*S
191
192 ! Here eig are orbital energies, don't confuse with eigenval, which are eigenvalues of Q!
193
194 ! Scale fm_work_iaP
195 CALL calc_fm_mat_s_rpa(fm_mat_s, .true., virtual, eig, &
196 homo, omega, 0.0_dp)
197
198 ! Redistribute fm_mat_R_half for "rectangular" multiplication: ia*P P*P
199 CALL cp_fm_create(fm_mat_r_half_gemm, fm_mat_q_gemm%matrix_struct)
200 CALL cp_fm_set_all(matrix=fm_mat_r_half_gemm, alpha=0.0_dp)
201
202 CALL cp_fm_to_fm_submat_general(fm_mat_r_half, fm_mat_r_half_gemm, dimen_ri, dimen_ri, 1, 1, 1, 1, &
203 fm_mat_r_half%matrix_struct%context)
204
205 ! Calculate Gamma_3: Gamma_3 = G*S*R^(1/2) = G*S*R^(1/2) )
206 CALL parallel_gemm(transa="T", transb="N", m=dimen_ia, n=dimen_ri, k=dimen_ri, alpha=1.0_dp, &
207 matrix_a=fm_mat_s, matrix_b=fm_mat_r_half_gemm, beta=0.0_dp, &
208 matrix_c=fm_mat_gamma_3)
209
210 ! Remove extra factor from S after the multiplication
211 CALL remove_scaling_factor_rpa(fm_mat_s, virtual, eig, homo, omega)
212
213 ! Release full matrix stuff
214 CALL cp_fm_release(fm_mat_q_tmp)
215 CALL cp_fm_release(fm_mat_u)
216 CALL cp_fm_release(fm_mat_r_half)
217 CALL cp_fm_release(fm_mat_r_half_gemm)
218
219 ! Retrieve mo coefficients in dbcsr format
220 NULLIFY (mo_coeff_o, mo_coeff_v)
221 mo_coeff_o => mp2_env%ri_rpa%mo_coeff_o
222 mo_coeff_v => mp2_env%ri_rpa%mo_coeff_v
223
224 ! Get aux sizes
225 ngroup = para_env_rpa%num_pe/para_env_sub%num_pe
226
227 color_sub = para_env_rpa%mepos/para_env_sub%num_pe
228
229 iitmp = get_limit(dimen_ri, ngroup, color_sub)
230 my_group_l_start = iitmp(1)
231 my_group_l_end = iitmp(2)
232 my_group_l_size = iitmp(2) - iitmp(1) + 1
233
234 ! Copy Gamma_ia_P^3 to dbcsr matrix set
235 CALL gamma_fm_to_dbcsr(fm_mat_gamma_3, dbcsr_gamma_3, para_env_rpa, para_env_sub, &
236 homo, virtual, mo_coeff_o, ngroup, my_group_l_start, &
237 my_group_l_end, my_group_l_size)
238
239 ! Create more dbcsr matrices
240
241 NULLIFY (dbcsr_gamma_inu_p)
242 !CALL dbcsr_allocate_matrix_set(dbcsr_Gamma_inu_P, ncol_local)
243 CALL dbcsr_allocate_matrix_set(dbcsr_gamma_inu_p, my_group_l_size)
244 NULLIFY (dbcsr_gamma_munu_p)
245 !CALL dbcsr_allocate_matrix_set(dbcsr_Gamma_munu_P, ncol_local)
246 CALL dbcsr_allocate_matrix_set(dbcsr_gamma_munu_p, my_group_l_size)
247 eps_filter = mp2_env%mp2_gpw%eps_filter
248
249 l_counter = 0
250 DO kkb = my_group_l_start, my_group_l_end
251 l_counter = l_counter + 1
252 ! One-index transformed Gamma_3
253 ALLOCATE (dbcsr_gamma_inu_p(l_counter)%matrix)
254 CALL dbcsr_init_p(dbcsr_gamma_inu_p(l_counter)%matrix)
255 CALL dbcsr_create(dbcsr_gamma_inu_p(l_counter)%matrix, template=mo_coeff_o)
256 CALL dbcsr_copy(dbcsr_gamma_inu_p(l_counter)%matrix, mo_coeff_o)
257 CALL dbcsr_set(dbcsr_gamma_inu_p(l_counter)%matrix, 0.0_dp)
258 ! Init Gamma_3 in AO basis
259 ALLOCATE (dbcsr_gamma_munu_p(l_counter)%matrix)
260 CALL dbcsr_init_p(dbcsr_gamma_munu_p(l_counter)%matrix)
261 CALL dbcsr_create(dbcsr_gamma_munu_p(l_counter)%matrix, template=mat_munu%matrix, &
262 matrix_type=dbcsr_type_no_symmetry)
263 CALL dbcsr_copy(dbcsr_gamma_munu_p(l_counter)%matrix, mat_munu%matrix)
264 CALL dbcsr_set(dbcsr_gamma_munu_p(l_counter)%matrix, 0.0_dp)
265 END DO
266
267 !! Loup over auxiliary basis functions: multiplication
268 l_counter = 0
269 DO kkb = my_group_l_start, my_group_l_end
270 l_counter = l_counter + 1
271 ! Do dbcsr multiplication: transform the virtual index
272 CALL dbcsr_multiply("N", "T", 1.0_dp, mo_coeff_v, dbcsr_gamma_3(l_counter)%matrix, &
273 0.0_dp, dbcsr_gamma_inu_p(l_counter)%matrix, filter_eps=eps_filter)
274
275 !Do dbcsr multiplication: transform the occupied index
276 CALL dbcsr_multiply("N", "T", 1.0_dp, dbcsr_gamma_inu_p(l_counter)%matrix, mo_coeff_o, &
277 0.0_dp, dbcsr_gamma_munu_p(l_counter)%matrix, filter_eps=eps_filter)
278 !
279 CALL dbcsr_trace(dbcsr_gamma_munu_p(l_counter)%matrix, trace_corr)
280 END DO
281
282 ! Gamma_3 not needed anymore
283 l_counter = 0
284 DO kkb = my_group_l_start, my_group_l_end
285 l_counter = l_counter + 1
286 CALL dbcsr_release(dbcsr_gamma_3(l_counter)%matrix)
287 DEALLOCATE (dbcsr_gamma_3(l_counter)%matrix)
288 END DO
289 DEALLOCATE (dbcsr_gamma_3)
290
291 ! Contract DM with exchange integrals
292 !CALL integrate_exchange(qs_env, dbcsr_Gamma_munu_P, mat_munu, para_env_sub, ncol_local, eps_filter, e_axk_corr)
293 CALL integrate_exchange(qs_env, dbcsr_gamma_munu_p, mat_munu, para_env_sub, my_group_l_size, eps_filter, e_axk_corr, &
294 my_group_l_start, my_group_l_end)
295
296 !CALL para_env_RPA%sum(e_axk_corr)
297
298 ! Print AXK correlation energy to the file
299 IF (unit_nr > 0) WRITE (unit_nr, '(T3,A,T68,F25.14,A4)') 'AXK correlation energy for a quadrature point:', &
300 e_axk_corr, ' a.u.'
301
302 l_counter = 0
303 DO kkb = my_group_l_start, my_group_l_end
304 l_counter = l_counter + 1
305 CALL dbcsr_release(dbcsr_gamma_inu_p(l_counter)%matrix)
306 CALL dbcsr_release(dbcsr_gamma_munu_p(l_counter)%matrix)
307 DEALLOCATE (dbcsr_gamma_inu_p(l_counter)%matrix)
308 DEALLOCATE (dbcsr_gamma_munu_p(l_counter)%matrix)
309 END DO
310 DEALLOCATE (dbcsr_gamma_inu_p)
311 DEALLOCATE (dbcsr_gamma_munu_p)
312
313 CALL timestop(handle)
314
315 END SUBROUTINE compute_axk_ener
316
317! **************************************************************************************************
318!> \brief Contract RPA-AXK density matrix with HF exchange integrals and evaluate the correction
319!> \param qs_env ...
320!> \param dbcsr_Gamma_munu_P ... AXK density matrix in AO basis to be contracted
321!> \param mat_munu ...
322!> \param para_env_sub ...
323!> \param P_stack_size ...
324!> \param eps_filter ...
325!> \param axk_corr ... The AXK energy correction
326!> \param my_group_L_start ...
327!> \param my_group_L_end ...
328!> \author Vladimir Rybkin, 08/2016
329! **************************************************************************************************
330 SUBROUTINE integrate_exchange(qs_env, dbcsr_Gamma_munu_P, mat_munu, para_env_sub, P_stack_size, &
331 eps_filter, axk_corr, &
332 my_group_L_start, my_group_L_end)
333 TYPE(qs_environment_type), POINTER :: qs_env
334 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: dbcsr_gamma_munu_p
335 TYPE(dbcsr_p_type), INTENT(IN) :: mat_munu
336 TYPE(mp_para_env_type), POINTER :: para_env_sub
337 INTEGER, INTENT(INOUT) :: p_stack_size
338 REAL(kind=dp), INTENT(IN) :: eps_filter
339 REAL(kind=dp), INTENT(OUT) :: axk_corr
340 INTEGER, INTENT(IN) :: my_group_l_start, my_group_l_end
341
342 CHARACTER(LEN=*), PARAMETER :: routinen = 'integrate_exchange'
343
344 INTEGER :: aux, handle, irep, kkb, n_rep_hf, ns
345 LOGICAL :: my_recalc_hfx_integrals
346 REAL(kind=dp) :: e_axk_p, ehfx
347 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: rho_work_ao
348 TYPE(dbcsr_p_type), DIMENSION(:, :), POINTER :: mat_2d, rho_ao_2d
349 TYPE(hfx_type), DIMENSION(:, :), POINTER :: x_data
350 TYPE(qs_energy_type), POINTER :: energy
351 TYPE(section_vals_type), POINTER :: hfx_sections
352
353 CALL timeset(routinen, handle)
354
355 ! Get qs environment
356 NULLIFY (energy)
357 CALL get_qs_env(qs_env, &
358 energy=energy)
359
360 ! hfx section
361 CALL hfx_create_subgroup(qs_env, para_env_sub, hfx_sections, x_data, n_rep_hf)
362
363 ! create a working rho environment
364 NULLIFY (rho_work_ao)
365 CALL dbcsr_allocate_matrix_set(rho_work_ao, 1)
366 ALLOCATE (rho_work_ao(1)%matrix)
367 CALL dbcsr_init_p(rho_work_ao(1)%matrix)
368 CALL dbcsr_create(rho_work_ao(1)%matrix, template=mat_munu%matrix)
369
370 ! For the first aux function in the group we recalculate integrals, but only for the first
371 my_recalc_hfx_integrals = .true.
372
373 NULLIFY (mat_2d)
374 CALL dbcsr_allocate_matrix_set(mat_2d, 1, 1)
375 ALLOCATE (mat_2d(1, 1)%matrix)
376 CALL dbcsr_init_p(mat_2d(1, 1)%matrix)
377 CALL dbcsr_create(mat_2d(1, 1)%matrix, template=mat_munu%matrix, &
378 matrix_type=dbcsr_type_no_symmetry)
379 CALL dbcsr_copy(mat_2d(1, 1)%matrix, mat_munu%matrix)
380
381 ! The loop over auxiliary basis functions
382 axk_corr = 0.0_dp
383 !DO aux = 1, P_stack_size
384 p_stack_size = p_stack_size
385 aux = 0
386 DO kkb = my_group_l_start, my_group_l_end
387 aux = aux + 1
388
389 CALL dbcsr_copy(rho_work_ao(1)%matrix, dbcsr_gamma_munu_p(aux)%matrix)
390
391 DO irep = 1, n_rep_hf
392 ns = SIZE(rho_work_ao)
393 rho_ao_2d(1:ns, 1:1) => rho_work_ao(1:ns)
394
395 CALL dbcsr_set(mat_2d(1, 1)%matrix, 0.0_dp)
396
397 IF (x_data(irep, 1)%do_hfx_ri) THEN
398 CALL hfx_ri_update_ks(qs_env, x_data(irep, 1)%ri_data, mat_2d, ehfx, &
399 rho_ao=rho_ao_2d, geometry_did_change=my_recalc_hfx_integrals, &
400 nspins=ns, hf_fraction=x_data(irep, 1)%general_parameter%fraction)
401
402 ELSE
403 CALL integrate_four_center(qs_env, x_data, mat_2d, ehfx, rho_ao_2d, hfx_sections, &
404 para_env_sub, my_recalc_hfx_integrals, irep, .true., &
405 ispin=1)
406 END IF
407 END DO
408
409 my_recalc_hfx_integrals = .false.
410 ! One more dbcsr multiplication and trace
411 CALL dbcsr_multiply("T", "N", 1.0_dp, mat_2d(1, 1)%matrix, rho_work_ao(1)%matrix, &
412 0.0_dp, dbcsr_gamma_munu_p(aux)%matrix, filter_eps=eps_filter)
413 CALL dbcsr_trace(dbcsr_gamma_munu_p(aux)%matrix, e_axk_p)
414 axk_corr = axk_corr + e_axk_p
415 END DO
416
417 CALL dbcsr_release(mat_2d(1, 1)%matrix)
418 ! release rho stuff
419 CALL dbcsr_release(mat_2d(1, 1)%matrix)
420 DEALLOCATE (mat_2d(1, 1)%matrix)
421 DEALLOCATE (mat_2d)
422 CALL dbcsr_release(rho_work_ao(1)%matrix)
423 DEALLOCATE (rho_work_ao(1)%matrix)
424 DEALLOCATE (rho_work_ao)
425 CALL hfx_release(x_data)
426
427 CALL timestop(handle)
428
429 END SUBROUTINE integrate_exchange
430
431! **************************************************************************************************
432!> \brief ... Initializes x_data on a subgroup
433!> \param qs_env ...
434!> \param para_env_sub ...
435!> \param hfx_section ...
436!> \param x_data ...
437!> \param n_rep_hf ...
438!> \author Vladimir Rybkin
439! **************************************************************************************************
440 SUBROUTINE hfx_create_subgroup(qs_env, para_env_sub, hfx_section, x_data, n_rep_hf)
441 TYPE(qs_environment_type), POINTER :: qs_env
442 TYPE(mp_para_env_type), POINTER :: para_env_sub
443 TYPE(section_vals_type), POINTER :: hfx_section
444 TYPE(hfx_type), DIMENSION(:, :), POINTER :: x_data
445 INTEGER, INTENT(OUT) :: n_rep_hf
446
447 CHARACTER(LEN=*), PARAMETER :: routinen = 'hfx_create_subgroup'
448
449 INTEGER :: handle, nelectron_total
450 LOGICAL :: do_hfx
451 TYPE(atomic_kind_type), DIMENSION(:), POINTER :: atomic_kind_set
452 TYPE(cell_type), POINTER :: my_cell
453 TYPE(dft_control_type), POINTER :: dft_control
454 TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
455 TYPE(qs_kind_type), DIMENSION(:), POINTER :: qs_kind_set
456 TYPE(qs_subsys_type), POINTER :: subsys
457 TYPE(scf_control_type), POINTER :: scf_control
458 TYPE(section_vals_type), POINTER :: input
459
460 CALL timeset(routinen, handle)
461
462 NULLIFY (my_cell, atomic_kind_set, particle_set, dft_control, x_data, qs_kind_set, scf_control)
463
464 CALL get_qs_env(qs_env, &
465 subsys=subsys, &
466 input=input, &
467 scf_control=scf_control, &
468 nelectron_total=nelectron_total)
469
470 CALL qs_subsys_get(subsys, &
471 cell=my_cell, &
472 atomic_kind_set=atomic_kind_set, &
473 qs_kind_set=qs_kind_set, &
474 particle_set=particle_set)
475
476 do_hfx = .true.
477 hfx_section => section_vals_get_subs_vals(input, "DFT%XC%WF_CORRELATION%RI_RPA%HF")
478 !hfx_section => section_vals_get_subs_vals(input, "DFT%XC%HF")
479 CALL section_vals_get(hfx_section, explicit=do_hfx, n_repetition=n_rep_hf)
480 CALL get_qs_env(qs_env, dft_control=dft_control)
481
482 IF (do_hfx) THEN
483 ! Retrieve particle_set and atomic_kind_set
484 CALL hfx_create(x_data, para_env_sub, hfx_section, atomic_kind_set, &
485 qs_kind_set, particle_set, dft_control, my_cell, orb_basis='ORB', &
486 nelectron_total=nelectron_total)
487 END IF
488
489 CALL timestop(handle)
490
491 END SUBROUTINE hfx_create_subgroup
492
493END MODULE rpa_axk
Define the atomic kind types and their sub types.
Handles all functions related to the CELL.
Definition cell_types.F:15
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
DBCSR operations in CP2K.
basic linear algebra operations for full matrices
subroutine, public cp_fm_column_scale(matrixa, scaling)
scales column i of matrix a with scaling(i)
subroutine, public cp_fm_scale(alpha, matrix_a)
scales a matrix matrix_a = alpha * matrix_b
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 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:208
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_to_fm_submat_general(source, destination, nrows, ncols, s_firstrow, s_firstcol, d_firstrow, d_firstcol, global_context)
General copy of a submatrix of fm matrix to a submatrix of another fm matrix. The two matrices can ha...
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
Routines to calculate HFX energy and potential.
subroutine, public integrate_four_center(qs_env, x_data, ks_matrix, ehfx, rho_ao, hfx_section, para_env, geometry_did_change, irep, distribute_fock_matrix, ispin)
computes four center integrals for a full basis set and updates the Kohn-Sham-Matrix and energy....
RI-methods for HFX.
Definition hfx_ri.F:12
subroutine, public hfx_ri_update_ks(qs_env, ri_data, ks_matrix, ehfx, mos, rho_ao, geometry_did_change, nspins, hf_fraction)
...
Definition hfx_ri.F:1033
Types and set/get functions for HFX.
Definition hfx_types.F:15
subroutine, public hfx_create(x_data, para_env, hfx_section, atomic_kind_set, qs_kind_set, particle_set, dft_control, cell, orb_basis, ri_basis, nelectron_total, nkp_grid)
This routine allocates and initializes all types in hfx_data
Definition hfx_types.F:594
subroutine, public hfx_release(x_data)
This routine deallocates all data structures
Definition hfx_types.F:1905
objects that represent the structure of input sections and the data contained in an input section
recursive type(section_vals_type) function, pointer, public section_vals_get_subs_vals(section_vals, subsection_name, i_rep_section, can_return_null)
returns the values of the requested subsection
subroutine, public section_vals_get(section_vals, ref_count, n_repetition, n_subs_vals_rep, section, explicit)
returns various attributes about the section_vals
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
Define the data structure for the particle information.
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.
Define the quickstep kind type and their sub types.
types that represent a quickstep subsys
subroutine, public qs_subsys_get(subsys, atomic_kinds, atomic_kind_set, particles, particle_set, local_particles, molecules, molecule_set, molecule_kinds, molecule_kind_set, local_molecules, para_env, colvar_p, shell_particles, core_particles, gci, multipoles, natom, nparticle, ncore, nshell, nkind, atprop, virial, results, cell, cell_ref, use_ref_cell, energy, force, qs_kind_set, cp_subsys, nelectron_total, nelectron_spin)
...
Auxiliary routines needed for RPA-AXK given blacs_env to another.
Definition rpa_axk.F:17
subroutine, public compute_axk_ener(qs_env, fm_mat_q, fm_mat_q_gemm, dimen_ri, dimen_ia, para_env_sub, para_env_rpa, eig, fm_mat_s, homo, virtual, omega, mp2_env, mat_munu, unit_nr, e_axk_corr)
Main driver for RPA-AXK energies.
Definition rpa_axk.F:98
Auxiliary routines necessary to redistribute an fm_matrix from a given blacs_env to another.
subroutine, public gamma_fm_to_dbcsr(fm_mat_gamma_3, dbcsr_gamma_3, para_env_rpa, para_env_sub, homo, virtual, mo_coeff_o, ngroup, my_group_l_start, my_group_l_end, my_group_l_size)
Redistribute RPA-AXK Gamma_3 density matrices: from fm to dbcsr.
Utility functions for RPA calculations.
Definition rpa_util.F:13
subroutine, public remove_scaling_factor_rpa(fm_mat_s, virtual, eigenval_last, homo, omega_old)
...
Definition rpa_util.F:716
subroutine, public calc_fm_mat_s_rpa(fm_mat_s, first_cycle, virtual, eigenval, homo, omega, omega_old)
...
Definition rpa_util.F:766
parameters that control an scf iteration
All kind of helpful little routines.
Definition util.F:14
pure integer function, dimension(2), public get_limit(m, n, me)
divide m entries into n parts, return size of part me
Definition util.F:333
Provides all information about an atomic kind.
Type defining parameters related to the simulation cell.
Definition cell_types.F:55
keeps the information about the structure of a full matrix
represent a full matrix
stores some data used in construction of Kohn-Sham matrix
Definition hfx_types.F:509
stores all the informations relevant to an mpi environment
Provides all information about a quickstep kind.