74#include "./base/base_uses.f90"
80 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'rpa_exchange'
84 TYPE rpa_exchange_env_type
86 TYPE(qs_environment_type),
POINTER :: qs_env => null()
87 TYPE(dbcsr_p_type),
DIMENSION(:),
POINTER :: mat_hfx => null()
88 TYPE(dbcsr_p_type),
DIMENSION(:),
POINTER :: dbcsr_Gamma_munu_P => null()
89 TYPE(dbcsr_type),
ALLOCATABLE,
DIMENSION(:) :: dbcsr_Gamma_inu_P
91 TYPE(dbcsr_type),
DIMENSION(:),
POINTER :: mo_coeff_o => null()
92 TYPE(dbcsr_type),
DIMENSION(:),
POINTER :: mo_coeff_v => null()
93 TYPE(dbcsr_type) :: work_ao
94 TYPE(hfx_type),
DIMENSION(:, :),
POINTER :: x_data => null()
95 TYPE(mp_para_env_type),
POINTER :: para_env => null()
96 TYPE(section_vals_type),
POINTER :: hfx_sections => null()
97 LOGICAL :: my_recalc_hfx_integrals = .false.
98 REAL(KIND=
dp) :: eps_filter = 0.0_dp
99 TYPE(cp_fm_struct_p_type),
DIMENSION(:),
ALLOCATABLE :: struct_Gamma
101 PROCEDURE, PASS(exchange_env), NON_OVERRIDABLE :: create => hfx_create_subgroup
103 PROCEDURE, PASS(exchange_env), NON_OVERRIDABLE :: release => hfx_release_subgroup
104 END TYPE rpa_exchange_env_type
106 TYPE dbcsr_matrix_p_set
107 TYPE(dbcsr_type),
ALLOCATABLE,
DIMENSION(:) :: matrix_set
108 END TYPE dbcsr_matrix_p_set
113 TYPE(rpa_exchange_env_type) :: exchange_env
114 INTEGER,
DIMENSION(:),
ALLOCATABLE :: homo, virtual, dimen_ia
116 INTEGER,
DIMENSION(:),
ALLOCATABLE :: aux2send
117 INTEGER :: dimen_ri = 0
118 INTEGER :: block_size = 0
119 INTEGER :: color_sub = 0
120 INTEGER :: ngroup = 0
126 PROCEDURE,
PUBLIC, pass(exchange_work), non_overridable :: create => rpa_exchange_work_create
127 PROCEDURE,
PUBLIC, pass(exchange_work), non_overridable :: compute => rpa_exchange_work_compute
128 PROCEDURE,
PUBLIC, pass(exchange_work), non_overridable :: release => rpa_exchange_work_release
129 PROCEDURE,
PRIVATE, pass(exchange_work), non_overridable :: redistribute_into_subgroups
130 PROCEDURE,
PRIVATE, pass(exchange_work), non_overridable :: compute_fm => rpa_exchange_work_compute_fm
131 PROCEDURE,
PRIVATE, pass(exchange_work), non_overridable :: compute_hfx => rpa_exchange_work_compute_hfx
147 TYPE(
mp2_type),
INTENT(IN) :: mp2_env
148 INTEGER,
DIMENSION(:),
INTENT(IN) :: homo, virtual
149 INTEGER,
INTENT(IN) :: dimen_ri
151 REAL(kind=
dp),
INTENT(INOUT) :: mem_per_rank, mem_per_repl
153 INTEGER :: block_size
156 block_size = mp2_env%ri_rpa%exchange_block_size
157 IF (block_size <= 0) block_size = max(1, (dimen_ri + para_env%num_pe - 1)/para_env%num_pe)
160 mem_per_rank = mem_per_rank + real(maxval(homo), kind=
dp)**2*block_size**2*8.0_dp/(1024_dp**2)
163 mem_per_repl = mem_per_repl + 3.0_dp*dimen_ri*dimen_ri*8.0_dp/(1024_dp**2) &
164 + 3.0_dp*maxval(homo*virtual)*dimen_ri*8.0_dp/(1024_dp**2)
180 SUBROUTINE rpa_exchange_work_create(exchange_work, qs_env, para_env_sub, mat_munu, dimen_RI, &
181 fm_mat_S, fm_mat_Q, fm_mat_Q_gemm, homo, virtual)
186 INTEGER,
INTENT(IN) :: dimen_ri
187 TYPE(
cp_fm_type),
DIMENSION(:),
INTENT(IN) :: fm_mat_s
188 TYPE(
cp_fm_type),
INTENT(IN) :: fm_mat_q, fm_mat_q_gemm
189 INTEGER,
DIMENSION(SIZE(fm_mat_S)),
INTENT(IN) :: homo, virtual
191 INTEGER :: nspins, aux_global, aux_local, my_process_row, proc, ispin
192 INTEGER,
DIMENSION(:),
POINTER :: row_indices, aux_distribution_fm
195 exchange_work%exchange_correction = qs_env%mp2_env%ri_rpa%exchange_correction
199 associate(para_env => fm_mat_s(1)%matrix_struct%para_env)
200 exchange_work%para_env_sub => para_env_sub
201 exchange_work%ngroup = para_env%num_pe/para_env_sub%num_pe
202 exchange_work%color_sub = para_env%mepos/para_env_sub%num_pe
205 CALL cp_fm_get_info(fm_mat_s(1), row_indices=row_indices, nrow_locals=aux_distribution_fm, context=context)
206 CALL context%get(my_process_row=my_process_row)
208 CALL create_group_dist(exchange_work%aux_func_dist, exchange_work%ngroup, dimen_ri)
209 ALLOCATE (exchange_work%aux2send(0:exchange_work%ngroup - 1))
210 exchange_work%aux2send = 0
211 DO aux_local = 1, aux_distribution_fm(my_process_row)
212 aux_global = row_indices(aux_local)
214 exchange_work%aux2send(proc) = exchange_work%aux2send(proc) + 1
217 nspins =
SIZE(fm_mat_s)
219 ALLOCATE (exchange_work%homo(nspins), exchange_work%virtual(nspins), exchange_work%dimen_ia(nspins))
220 exchange_work%homo(:) = homo
221 exchange_work%virtual(:) = virtual
222 exchange_work%dimen_ia(:) = homo*virtual
223 exchange_work%dimen_RI = dimen_ri
225 exchange_work%block_size = qs_env%mp2_env%ri_rpa%exchange_block_size
226 IF (exchange_work%block_size <= 0) exchange_work%block_size = dimen_ri
228 CALL cp_fm_create(exchange_work%fm_mat_U, fm_mat_q%matrix_struct, name=
"fm_mat_U")
229 CALL cp_fm_create(exchange_work%fm_mat_Q_tmp, fm_mat_q%matrix_struct, name=
"fm_mat_Q_tmp")
230 CALL cp_fm_create(exchange_work%fm_mat_R_half_gemm, fm_mat_q_gemm%matrix_struct)
232 IF (qs_env%mp2_env%ri_rpa%use_hfx_implementation)
THEN
233 CALL exchange_work%exchange_env%create(qs_env, mat_munu%matrix, para_env_sub, fm_mat_s)
236 IF (
ASSOCIATED(qs_env%mp2_env%ri_rpa%mo_coeff_o))
THEN
237 DO ispin = 1,
SIZE(qs_env%mp2_env%ri_rpa%mo_coeff_o)
240 DEALLOCATE (qs_env%mp2_env%ri_rpa%mo_coeff_o)
243 IF (
ASSOCIATED(qs_env%mp2_env%ri_rpa%mo_coeff_v))
THEN
244 DO ispin = 1,
SIZE(qs_env%mp2_env%ri_rpa%mo_coeff_v)
247 DEALLOCATE (qs_env%mp2_env%ri_rpa%mo_coeff_v)
249 END SUBROUTINE rpa_exchange_work_create
260 SUBROUTINE hfx_create_subgroup(exchange_env, qs_env, mat_munu, para_env_sub, fm_mat_S)
261 CLASS(rpa_exchange_env_type),
INTENT(INOUT) :: exchange_env
262 TYPE(dbcsr_type),
INTENT(IN) :: mat_munu
263 TYPE(qs_environment_type),
POINTER :: qs_env
264 TYPE(mp_para_env_type),
POINTER,
INTENT(IN) :: para_env_sub
265 TYPE(cp_fm_type),
DIMENSION(:),
INTENT(IN) :: fm_mat_s
267 CHARACTER(LEN=*),
PARAMETER :: routinen =
'hfx_create_subgroup'
269 INTEGER :: handle, nelectron_total, ispin, &
270 number_of_aos, nspins, dimen_ri, dimen_ia
271 TYPE(atomic_kind_type),
DIMENSION(:),
POINTER :: atomic_kind_set
272 TYPE(cell_type),
POINTER :: my_cell
273 TYPE(dft_control_type),
POINTER :: dft_control
274 TYPE(particle_type),
DIMENSION(:),
POINTER :: particle_set
275 TYPE(qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
276 TYPE(qs_subsys_type),
POINTER :: subsys
277 TYPE(scf_control_type),
POINTER :: scf_control
278 TYPE(section_vals_type),
POINTER :: input
280 CALL timeset(routinen, handle)
282 exchange_env%mo_coeff_o => qs_env%mp2_env%ri_rpa%mo_coeff_o
283 exchange_env%mo_coeff_v => qs_env%mp2_env%ri_rpa%mo_coeff_v
284 NULLIFY (qs_env%mp2_env%ri_rpa%mo_coeff_o, qs_env%mp2_env%ri_rpa%mo_coeff_v)
286 nspins =
SIZE(exchange_env%mo_coeff_o)
288 exchange_env%qs_env => qs_env
289 exchange_env%para_env => para_env_sub
290 exchange_env%eps_filter = qs_env%mp2_env%mp2_gpw%eps_filter
292 NULLIFY (my_cell, atomic_kind_set, particle_set, dft_control, qs_kind_set, scf_control)
294 CALL get_qs_env(qs_env, &
297 scf_control=scf_control, &
298 nelectron_total=nelectron_total)
300 CALL qs_subsys_get(subsys, &
302 atomic_kind_set=atomic_kind_set, &
303 qs_kind_set=qs_kind_set, &
304 particle_set=particle_set)
306 exchange_env%hfx_sections => section_vals_get_subs_vals(input,
"DFT%XC%WF_CORRELATION%RI_RPA%HF")
307 CALL get_qs_env(qs_env, dft_control=dft_control)
310 CALL hfx_create(exchange_env%x_data, para_env_sub, exchange_env%hfx_sections, atomic_kind_set, &
311 qs_kind_set, particle_set, dft_control, my_cell, orb_basis=
'ORB', &
312 nelectron_total=nelectron_total)
314 exchange_env%my_recalc_hfx_integrals = .true.
316 CALL dbcsr_allocate_matrix_set(exchange_env%mat_hfx, nspins)
318 ALLOCATE (exchange_env%mat_hfx(ispin)%matrix)
319 CALL dbcsr_init_p(exchange_env%mat_hfx(ispin)%matrix)
320 CALL dbcsr_create(exchange_env%mat_hfx(ispin)%matrix, template=mat_munu, &
321 matrix_type=dbcsr_type_no_symmetry)
322 CALL dbcsr_copy(exchange_env%mat_hfx(ispin)%matrix, mat_munu)
325 CALL dbcsr_get_info(mat_munu, nfullcols_total=number_of_aos)
327 CALL dbcsr_create(exchange_env%work_ao, template=mat_munu, &
328 matrix_type=dbcsr_type_no_symmetry)
330 ALLOCATE (exchange_env%dbcsr_Gamma_inu_P(nspins))
331 CALL dbcsr_allocate_matrix_set(exchange_env%dbcsr_Gamma_munu_P, nspins)
333 ALLOCATE (exchange_env%dbcsr_Gamma_munu_P(ispin)%matrix)
334 CALL dbcsr_create(exchange_env%dbcsr_Gamma_munu_P(ispin)%matrix, template=mat_munu, &
335 matrix_type=dbcsr_type_no_symmetry)
336 CALL dbcsr_copy(exchange_env%dbcsr_Gamma_munu_P(ispin)%matrix, mat_munu)
337 CALL dbcsr_set(exchange_env%dbcsr_Gamma_munu_P(ispin)%matrix, 0.0_dp)
339 CALL dbcsr_create(exchange_env%dbcsr_Gamma_inu_P(ispin), template=exchange_env%mo_coeff_o(ispin))
340 CALL dbcsr_copy(exchange_env%dbcsr_Gamma_inu_P(ispin), exchange_env%mo_coeff_o(ispin))
341 CALL dbcsr_set(exchange_env%dbcsr_Gamma_inu_P(ispin), 0.0_dp)
344 ALLOCATE (exchange_env%struct_Gamma(nspins))
346 CALL cp_fm_get_info(fm_mat_s(ispin), nrow_global=dimen_ri, ncol_global=dimen_ia)
347 CALL cp_fm_struct_create(exchange_env%struct_Gamma(ispin)%struct, template_fmstruct=fm_mat_s(ispin)%matrix_struct, &
348 nrow_global=dimen_ia, ncol_global=dimen_ri)
351 CALL timestop(handle)
353 END SUBROUTINE hfx_create_subgroup
359 SUBROUTINE rpa_exchange_work_release(exchange_work)
362 IF (
ALLOCATED(exchange_work%homo))
DEALLOCATE (exchange_work%homo)
363 IF (
ALLOCATED(exchange_work%virtual))
DEALLOCATE (exchange_work%virtual)
364 IF (
ALLOCATED(exchange_work%dimen_ia))
DEALLOCATE (exchange_work%dimen_ia)
365 NULLIFY (exchange_work%para_env_sub)
366 CALL release_group_dist(exchange_work%aux_func_dist)
367 IF (
ALLOCATED(exchange_work%aux2send))
DEALLOCATE (exchange_work%aux2send)
368 CALL cp_fm_release(exchange_work%fm_mat_Q_tmp)
369 CALL cp_fm_release(exchange_work%fm_mat_U)
370 CALL cp_fm_release(exchange_work%fm_mat_R_half_gemm)
372 CALL exchange_work%exchange_env%release()
373 END SUBROUTINE rpa_exchange_work_release
379 SUBROUTINE hfx_release_subgroup(exchange_env)
380 CLASS(rpa_exchange_env_type),
INTENT(INOUT) :: exchange_env
384 NULLIFY (exchange_env%para_env, exchange_env%hfx_sections)
386 IF (
ASSOCIATED(exchange_env%x_data))
THEN
387 CALL hfx_release(exchange_env%x_data)
388 NULLIFY (exchange_env%x_data)
391 CALL dbcsr_release(exchange_env%work_ao)
393 IF (
ASSOCIATED(exchange_env%dbcsr_Gamma_munu_P))
THEN
394 DO ispin = 1,
SIZE(exchange_env%mat_hfx, 1)
395 CALL dbcsr_release(exchange_env%dbcsr_Gamma_munu_P(ispin)%matrix)
396 CALL dbcsr_release(exchange_env%mat_hfx(ispin)%matrix)
397 CALL dbcsr_release(exchange_env%dbcsr_Gamma_inu_P(ispin))
398 CALL dbcsr_release(exchange_env%mo_coeff_o(ispin))
399 CALL dbcsr_release(exchange_env%mo_coeff_v(ispin))
400 DEALLOCATE (exchange_env%mat_hfx(ispin)%matrix)
401 DEALLOCATE (exchange_env%dbcsr_Gamma_munu_P(ispin)%matrix)
403 DEALLOCATE (exchange_env%mat_hfx, exchange_env%dbcsr_Gamma_munu_P)
404 DEALLOCATE (exchange_env%dbcsr_Gamma_inu_P, exchange_env%mo_coeff_o, exchange_env%mo_coeff_v)
405 NULLIFY (exchange_env%mat_hfx, exchange_env%dbcsr_Gamma_munu_P)
407 IF (
ALLOCATED(exchange_env%struct_Gamma))
THEN
408 DO ispin = 1,
SIZE(exchange_env%struct_Gamma)
409 CALL cp_fm_struct_release(exchange_env%struct_Gamma(ispin)%struct)
411 DEALLOCATE (exchange_env%struct_Gamma)
413 END SUBROUTINE hfx_release_subgroup
426 SUBROUTINE rpa_exchange_work_compute(exchange_work, fm_mat_Q, eig, fm_mat_S, omega, &
427 e_exchange_corr, mp2_env)
429 TYPE(cp_fm_type),
INTENT(IN) :: fm_mat_q
430 REAL(kind=dp),
DIMENSION(:, :),
INTENT(IN) :: eig
431 TYPE(cp_fm_type),
DIMENSION(:),
INTENT(INOUT) :: fm_mat_s
432 REAL(kind=dp),
INTENT(IN) :: omega
433 REAL(kind=dp),
INTENT(INOUT) :: e_exchange_corr
434 TYPE(mp2_type),
INTENT(INOUT) :: mp2_env
436 CHARACTER(LEN=*),
PARAMETER :: routinen =
'rpa_exchange_work_compute'
437 REAL(kind=dp),
PARAMETER :: thresh = 0.0000001_dp
439 INTEGER :: handle, nspins, dimen_ri, iib
440 REAL(kind=dp),
ALLOCATABLE,
DIMENSION(:) :: eigenval
442 IF (exchange_work%exchange_correction == rpa_exchange_none)
RETURN
444 CALL timeset(routinen, handle)
446 CALL cp_fm_get_info(fm_mat_q, ncol_global=dimen_ri)
448 nspins =
SIZE(fm_mat_s)
451 ALLOCATE (eigenval(dimen_ri))
454 CALL cp_fm_set_all(matrix=exchange_work%fm_mat_Q_tmp, alpha=0.0_dp)
455 CALL cp_fm_set_all(matrix=exchange_work%fm_mat_U, alpha=0.0_dp)
458 CALL cp_fm_to_fm(fm_mat_q, exchange_work%fm_mat_Q_tmp)
460 CALL choose_eigv_solver(exchange_work%fm_mat_Q_tmp, exchange_work%fm_mat_U, eigenval)
465 IF (exchange_work%exchange_correction == rpa_exchange_axk)
THEN
467 IF (abs(eigenval(iib)) >= thresh)
THEN
469 sqrt((1.0_dp/(eigenval(iib)**2))*log(1.0_dp + eigenval(iib)) &
470 - 1.0_dp/(eigenval(iib)*(eigenval(iib) + 1.0_dp)))
472 eigenval(iib) = sqrthalf
475 ELSE IF (exchange_work%exchange_correction == rpa_exchange_sosex)
THEN
477 IF (abs(eigenval(iib)) >= thresh)
THEN
479 sqrt(-(1.0_dp/(eigenval(iib)**2))*log(1.0_dp + eigenval(iib)) &
480 + 1.0_dp/eigenval(iib))
482 eigenval(iib) = sqrthalf
486 cpabort(
"Unknown RPA exchange correction")
490 CALL cp_fm_column_scale(exchange_work%fm_mat_U, eigenval)
493 DEALLOCATE (eigenval)
496 CALL cp_fm_set_all(matrix=exchange_work%fm_mat_R_half_gemm, alpha=0.0_dp)
498 CALL cp_fm_to_fm_submat_general(exchange_work%fm_mat_U, exchange_work%fm_mat_R_half_gemm, dimen_ri, &
499 dimen_ri, 1, 1, 1, 1, exchange_work%fm_mat_U%matrix_struct%context)
501 IF (mp2_env%ri_rpa%use_hfx_implementation)
THEN
502 CALL exchange_work%compute_hfx(fm_mat_s, eig, omega, e_exchange_corr)
504 CALL exchange_work%compute_fm(fm_mat_s, eig, omega, e_exchange_corr, mp2_env)
507 CALL timestop(handle)
509 END SUBROUTINE rpa_exchange_work_compute
521 SUBROUTINE rpa_exchange_work_compute_fm(exchange_work, fm_mat_S, eig, omega, &
522 e_exchange_corr, mp2_env)
524 TYPE(cp_fm_type),
DIMENSION(:),
INTENT(IN) :: fm_mat_s
525 REAL(kind=dp),
DIMENSION(:, :),
INTENT(IN) :: eig
526 REAL(kind=dp),
INTENT(IN) :: omega
527 REAL(kind=dp),
INTENT(INOUT) :: e_exchange_corr
528 TYPE(mp2_type),
INTENT(INOUT) :: mp2_env
530 CHARACTER(LEN=*),
PARAMETER :: routinen =
'rpa_exchange_work_compute_fm'
532 INTEGER :: handle, ispin, nspins, p, q, l_size_gamma, hom, virt, i, &
533 send_proc, recv_proc, recv_size, max_aux_size, proc_shift, dimen_ia, &
534 block_size, p_start, p_end, p_size, q_start, q_size, q_end, handle2, my_aux_size, my_virt
535 REAL(kind=dp),
ALLOCATABLE,
DIMENSION(:, :, :),
TARGET :: mat_gamma_3_3d
536 REAL(kind=dp),
POINTER,
DIMENSION(:),
CONTIGUOUS :: mat_gamma_3_1d
537 REAL(kind=dp),
POINTER,
DIMENSION(:, :),
CONTIGUOUS :: mat_gamma_3_2d
538 REAL(kind=dp),
ALLOCATABLE,
TARGET,
DIMENSION(:) :: recv_buffer_1d
539 REAL(kind=dp),
POINTER,
DIMENSION(:, :),
CONTIGUOUS :: recv_buffer_2d
540 REAL(kind=dp),
POINTER,
DIMENSION(:, :, :),
CONTIGUOUS :: recv_buffer_3d
541 REAL(kind=dp),
ALLOCATABLE,
DIMENSION(:, :, :) :: mat_b_iap
542 REAL(kind=dp),
ALLOCATABLE,
DIMENSION(:),
TARGET :: product_matrix_1d
543 REAL(kind=dp),
POINTER,
DIMENSION(:, :),
CONTIGUOUS :: product_matrix_2d
544 REAL(kind=dp),
POINTER,
DIMENSION(:, :, :, :),
CONTIGUOUS :: product_matrix_4d
545 TYPE(cp_fm_type) :: fm_mat_gamma_3
546 TYPE(mp_para_env_type),
POINTER :: para_env
547 TYPE(group_dist_d1_type) :: virt_dist
549 CALL timeset(routinen, handle)
551 nspins =
SIZE(fm_mat_s)
553 CALL get_group_dist(exchange_work%aux_func_dist, exchange_work%color_sub, sizes=my_aux_size)
555 e_exchange_corr = 0.0_dp
556 max_aux_size = maxsize(exchange_work%aux_func_dist)
560 CALL mp2_env%local_gemm_ctx%create(local_gemm_pu_gpu)
561 CALL mp2_env%local_gemm_ctx%set_op_threshold_gpu(128*128*128*2)
564 hom = exchange_work%homo(ispin)
565 virt = exchange_work%virtual(ispin)
567 IF (hom < 1 .OR. virt < 1) cycle
569 CALL cp_fm_get_info(fm_mat_s(ispin), para_env=para_env)
571 CALL cp_fm_create(fm_mat_gamma_3, fm_mat_s(ispin)%matrix_struct)
572 CALL cp_fm_set_all(matrix=fm_mat_gamma_3, alpha=0.0_dp)
577 CALL calc_fm_mat_s_rpa(fm_mat_s(ispin), .true., virt, eig(:, ispin), &
581 CALL parallel_gemm(transa=
"T", transb=
"N", m=exchange_work%dimen_RI, n=dimen_ia, k=exchange_work%dimen_RI, alpha=1.0_dp, &
582 matrix_a=exchange_work%fm_mat_R_half_gemm, matrix_b=fm_mat_s(ispin), beta=0.0_dp, &
583 matrix_c=fm_mat_gamma_3)
585 CALL create_group_dist(virt_dist, exchange_work%para_env_sub%num_pe, virt)
588 CALL remove_scaling_factor_rpa(fm_mat_s(ispin), virt, eig(:, ispin), hom, omega)
590 CALL exchange_work%redistribute_into_subgroups(fm_mat_gamma_3, mat_gamma_3_3d, ispin, virt_dist)
591 CALL cp_fm_release(fm_mat_gamma_3)
594 CALL remove_scaling_factor_rpa(fm_mat_s(ispin), virt, eig(:, ispin), hom, omega)
597 CALL exchange_work%redistribute_into_subgroups(fm_mat_s(ispin), mat_b_iap, ispin, virt_dist)
600 CALL calc_fm_mat_s_rpa(fm_mat_s(ispin), .true., virt, eig(:, ispin), hom, omega, 0.0_dp)
602 l_size_gamma =
SIZE(mat_gamma_3_3d, 3)
603 my_virt =
SIZE(mat_gamma_3_3d, 1)
604 block_size = exchange_work%block_size
606 mat_gamma_3_1d(1:int(my_virt, kind=int_8)*hom*my_aux_size) => mat_gamma_3_3d(:, :, 1:my_aux_size)
607 mat_gamma_3_2d(1:my_virt, 1:hom*my_aux_size) => mat_gamma_3_1d(1:int(my_virt, kind=int_8)*hom*my_aux_size)
609 ALLOCATE (product_matrix_1d(int(hom*min(block_size, l_size_gamma), kind=int_8)* &
610 int(hom*min(block_size, max_aux_size), kind=int_8)))
611 ALLOCATE (recv_buffer_1d(int(virt, kind=int_8)*hom*max_aux_size))
612 recv_buffer_2d(1:my_virt, 1:hom*max_aux_size) => recv_buffer_1d(1:int(virt, kind=int_8)*hom*max_aux_size)
613 recv_buffer_3d(1:my_virt, 1:hom, 1:max_aux_size) => recv_buffer_1d(1:int(virt, kind=int_8)*hom*max_aux_size)
614 DO proc_shift = 0, para_env%num_pe - 1, exchange_work%para_env_sub%num_pe
615 send_proc =
modulo(para_env%mepos + proc_shift, para_env%num_pe)
616 recv_proc =
modulo(para_env%mepos - proc_shift, para_env%num_pe)
618 CALL get_group_dist(exchange_work%aux_func_dist, recv_proc/exchange_work%para_env_sub%num_pe, sizes=recv_size)
620 IF (recv_size == 0) recv_proc = mp_proc_null
622 CALL para_env%sendrecv(mat_b_iap, send_proc, recv_buffer_3d(:, :, 1:recv_size), recv_proc)
624 IF (recv_size == 0) cycle
626 DO p_start = 1, l_size_gamma, block_size
627 p_end = min(l_size_gamma, p_start + block_size - 1)
628 p_size = p_end - p_start + 1
629 DO q_start = 1, recv_size, block_size
630 q_end = min(recv_size, q_start + block_size - 1)
631 q_size = q_end - q_start + 1
634 product_matrix_2d(1:hom*p_size, 1:hom*q_size) => &
635 product_matrix_1d(1:int(hom*p_size, kind=int_8)*int(hom*q_size, kind=int_8))
636 product_matrix_4d(1:hom, 1:p_size, 1:hom, 1:q_size) => &
637 product_matrix_1d(1:int(hom*p_size, kind=int_8)*int(hom*q_size, kind=int_8))
639 CALL timeset(routinen//
"_gemm", handle2)
640 CALL mp2_env%local_gemm_ctx%gemm(
"T",
"N", hom*p_size, hom*q_size, my_virt, 1.0_dp, &
641 mat_gamma_3_2d(:, hom*(p_start - 1) + 1:hom*p_end), my_virt, &
642 recv_buffer_2d(:, hom*(q_start - 1) + 1:hom*q_end), my_virt, &
643 0.0_dp, product_matrix_2d, hom*p_size)
644 CALL timestop(handle2)
646 CALL timeset(routinen//
"_energy", handle2)
652 e_exchange_corr = e_exchange_corr + dot_product(product_matrix_4d(i, p, :, q), product_matrix_4d(:, p, i, q))
656 CALL timestop(handle2)
661 CALL release_group_dist(virt_dist)
662 IF (
ALLOCATED(mat_b_iap))
DEALLOCATE (mat_b_iap)
663 IF (
ALLOCATED(mat_gamma_3_3d))
DEALLOCATE (mat_gamma_3_3d)
664 IF (
ALLOCATED(product_matrix_1d))
DEALLOCATE (product_matrix_1d)
665 IF (
ALLOCATED(recv_buffer_1d))
DEALLOCATE (recv_buffer_1d)
668 CALL mp2_env%local_gemm_ctx%destroy()
670 IF (nspins == 2) e_exchange_corr = e_exchange_corr*2.0_dp
671 IF (nspins == 1) e_exchange_corr = e_exchange_corr*4.0_dp
673 CALL timestop(handle)
675 END SUBROUTINE rpa_exchange_work_compute_fm
686 SUBROUTINE rpa_exchange_work_compute_hfx(exchange_work, fm_mat_S, eig, omega, e_exchange_corr)
688 TYPE(cp_fm_type),
DIMENSION(:),
INTENT(INOUT) :: fm_mat_s
689 REAL(kind=dp),
DIMENSION(:, :),
INTENT(IN) :: eig
690 REAL(kind=dp),
INTENT(IN) :: omega
691 REAL(kind=dp),
INTENT(OUT) :: e_exchange_corr
693 CHARACTER(LEN=*),
PARAMETER :: routinen =
'rpa_exchange_work_compute_hfx'
695 INTEGER :: handle, ispin, my_aux_start, my_aux_end, &
696 my_aux_size, nspins, l_counter, dimen_ia, hom, virt
697 REAL(kind=dp) :: e_exchange_p
698 TYPE(dbcsr_matrix_p_set),
DIMENSION(:),
ALLOCATABLE :: dbcsr_gamma_3
699 TYPE(cp_fm_type) :: fm_mat_gamma_3
700 TYPE(mp_para_env_type),
POINTER :: para_env
702 CALL timeset(routinen, handle)
704 e_exchange_corr = 0.0_dp
706 nspins =
SIZE(fm_mat_s)
708 CALL get_group_dist(exchange_work%aux_func_dist, exchange_work%color_sub, my_aux_start, my_aux_end, my_aux_size)
710 ALLOCATE (dbcsr_gamma_3(nspins))
712 hom = exchange_work%homo(ispin)
713 virt = exchange_work%virtual(ispin)
715 IF (hom < 1 .OR. virt < 1) cycle
717 CALL cp_fm_get_info(fm_mat_s(ispin), para_env=para_env)
719 CALL cp_fm_create(fm_mat_gamma_3, exchange_work%exchange_env%struct_Gamma(ispin)%struct)
720 CALL cp_fm_set_all(matrix=fm_mat_gamma_3, alpha=0.0_dp)
725 CALL calc_fm_mat_s_rpa(fm_mat_s(ispin), .true., virt, eig(:, ispin), &
729 CALL parallel_gemm(transa=
"T", transb=
"N", m=dimen_ia, n=exchange_work%dimen_RI, &
730 k=exchange_work%dimen_RI, alpha=1.0_dp, &
731 matrix_a=fm_mat_s(ispin), matrix_b=exchange_work%fm_mat_R_half_gemm, beta=0.0_dp, &
732 matrix_c=fm_mat_gamma_3)
735 CALL remove_scaling_factor_rpa(fm_mat_s(ispin), virt, eig(:, ispin), hom, omega)
739 INTEGER :: first_row, last_row, nlocal
740 REAL(kind=dp),
ALLOCATABLE :: slices(:, :)
741 TYPE(group_dist_d1_type) :: row_distribution
743 CALL create_group_dist(row_distribution, exchange_work%para_env_sub%num_pe, dimen_ia)
744 CALL get_group_dist(row_distribution, exchange_work%para_env_sub%mepos, first_row, last_row, nlocal)
745 CALL cp_fm_to_array(slices, first_row, last_row, my_aux_start, my_aux_end, fm_mat_gamma_3)
746 ALLOCATE (dbcsr_gamma_3(ispin)%matrix_set(my_aux_size))
747 CALL cp_array_to_dbcsr_slices(slices, hom, virt, exchange_work%para_env_sub, first_row, last_row, &
748 exchange_work%exchange_env%mo_coeff_o(ispin), &
749 matrices=dbcsr_gamma_3(ispin)%matrix_set)
750 CALL release_group_dist(row_distribution)
754 DO l_counter = 1, my_aux_size
757 CALL dbcsr_multiply(
"N",
"T", 1.0_dp, exchange_work%exchange_env%mo_coeff_v(ispin), &
758 dbcsr_gamma_3(ispin)%matrix_set(l_counter), &
759 0.0_dp, exchange_work%exchange_env%dbcsr_Gamma_inu_P(ispin), &
760 filter_eps=exchange_work%exchange_env%eps_filter)
762 CALL dbcsr_release(dbcsr_gamma_3(ispin)%matrix_set(l_counter))
765 CALL dbcsr_multiply(
"N",
"T", 0.5_dp, exchange_work%exchange_env%dbcsr_Gamma_inu_P(ispin), &
766 exchange_work%exchange_env%mo_coeff_o(ispin), &
767 0.0_dp, exchange_work%exchange_env%dbcsr_Gamma_munu_P(ispin)%matrix, &
768 filter_eps=exchange_work%exchange_env%eps_filter)
769 CALL dbcsr_multiply(
"N",
"T", 0.5_dp, exchange_work%exchange_env%mo_coeff_o(ispin), &
770 exchange_work%exchange_env%dbcsr_Gamma_inu_P(ispin), &
771 1.0_dp, exchange_work%exchange_env%dbcsr_Gamma_munu_P(ispin)%matrix, &
772 filter_eps=exchange_work%exchange_env%eps_filter)
774 CALL dbcsr_set(exchange_work%exchange_env%mat_hfx(ispin)%matrix, 0.0_dp)
777 CALL tddft_hfx_matrix(exchange_work%exchange_env%mat_hfx, exchange_work%exchange_env%dbcsr_Gamma_munu_P, &
778 exchange_work%exchange_env%qs_env, .false., &
779 exchange_work%exchange_env%my_recalc_hfx_integrals, &
780 exchange_work%exchange_env%hfx_sections, exchange_work%exchange_env%x_data, &
781 exchange_work%exchange_env%para_env)
783 exchange_work%exchange_env%my_recalc_hfx_integrals = .false.
785 CALL dbcsr_multiply(
"N",
"T", 1.0_dp, exchange_work%exchange_env%mat_hfx(ispin)%matrix, &
786 exchange_work%exchange_env%dbcsr_Gamma_munu_P(ispin)%matrix, &
787 0.0_dp, exchange_work%exchange_env%work_ao, filter_eps=exchange_work%exchange_env%eps_filter)
788 CALL dbcsr_trace(exchange_work%exchange_env%work_ao, e_exchange_p)
789 e_exchange_corr = e_exchange_corr - e_exchange_p
793 IF (nspins == 2) e_exchange_corr = e_exchange_corr
794 IF (nspins == 1) e_exchange_corr = e_exchange_corr*4.0_dp
796 CALL timestop(handle)
798 END SUBROUTINE rpa_exchange_work_compute_hfx
808 SUBROUTINE redistribute_into_subgroups(exchange_work, fm_mat, mat, ispin, virt_dist)
810 TYPE(cp_fm_type),
INTENT(IN) :: fm_mat
811 REAL(kind=dp),
ALLOCATABLE,
DIMENSION(:, :, :), &
813 INTEGER,
INTENT(IN) :: ispin
814 TYPE(group_dist_d1_type),
INTENT(IN) :: virt_dist
816 CHARACTER(LEN=*),
PARAMETER :: routinen =
'redistribute_into_subgroups'
818 INTEGER :: aux_counter, aux_global, aux_local, aux_proc, avirt, dimen_ri, handle, handle2, &
819 ia_global, ia_local, iocc, max_number_recv, max_number_send, my_aux_end, my_aux_size, &
820 my_aux_start, my_process_column, my_process_row, my_virt_end, my_virt_size, &
821 my_virt_start, proc, proc_shift, recv_proc, send_proc, virt_counter, virt_proc, group_size
822 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: data2send, recv_col_indices, &
823 recv_row_indices, send_aux_indices, send_virt_indices, virt2send
824 INTEGER,
DIMENSION(2) :: recv_shape
825 INTEGER,
DIMENSION(:),
POINTER :: aux_distribution_fm, col_indices, &
826 ia_distribution_fm, row_indices
827 INTEGER,
DIMENSION(:, :),
POINTER :: mpi2blacs
828 REAL(kind=dp),
ALLOCATABLE,
DIMENSION(:),
TARGET :: recv_buffer, send_buffer
829 REAL(kind=dp),
CONTIGUOUS,
DIMENSION(:, :), &
830 POINTER :: recv_ptr, send_ptr
831 TYPE(cp_blacs_env_type),
POINTER :: context
832 TYPE(mp_para_env_type),
POINTER :: para_env
834 CALL timeset(routinen, handle)
836 CALL cp_fm_get_info(matrix=fm_mat, &
837 nrow_locals=aux_distribution_fm, &
838 col_indices=col_indices, &
839 row_indices=row_indices, &
840 ncol_locals=ia_distribution_fm, &
842 nrow_global=dimen_ri, &
845 IF (exchange_work%homo(ispin) <= 0 .OR. exchange_work%virtual(ispin) <= 0)
THEN
846 CALL get_group_dist(virt_dist, exchange_work%para_env_sub%mepos, my_virt_start, my_virt_end, my_virt_size)
847 ALLOCATE (mat(exchange_work%homo(ispin), my_virt_size, dimen_ri))
848 CALL timestop(handle)
852 group_size = exchange_work%para_env_sub%num_pe
854 CALL timeset(routinen//
"_prep", handle2)
855 CALL get_group_dist(exchange_work%aux_func_dist, exchange_work%color_sub, my_aux_start, my_aux_end, my_aux_size)
856 CALL get_group_dist(virt_dist, exchange_work%para_env_sub%mepos, my_virt_start, my_virt_end, my_virt_size)
857 CALL context%get(my_process_column=my_process_column, my_process_row=my_process_row, mpi2blacs=mpi2blacs)
860 ALLOCATE (send_aux_indices(maxval(exchange_work%aux2send)))
861 ALLOCATE (virt2send(0:group_size - 1))
863 DO ia_local = 1, ia_distribution_fm(my_process_column)
864 ia_global = col_indices(ia_local)
865 avirt = mod(ia_global - 1, exchange_work%virtual(ispin)) + 1
866 proc = group_dist_proc(virt_dist, avirt)
867 virt2send(proc) = virt2send(proc) + 1
870 ALLOCATE (data2send(0:para_env%num_pe - 1))
871 DO aux_proc = 0, exchange_work%ngroup - 1
872 DO virt_proc = 0, group_size - 1
873 data2send(aux_proc*group_size + virt_proc) = exchange_work%aux2send(aux_proc)*virt2send(virt_proc)
877 ALLOCATE (send_virt_indices(maxval(virt2send)))
878 max_number_send = maxval(data2send)
880 ALLOCATE (send_buffer(int(max_number_send, kind=int_8)*exchange_work%homo(ispin)))
881 max_number_recv = max_number_send
882 CALL para_env%max(max_number_recv)
883 ALLOCATE (recv_buffer(max_number_recv))
885 ALLOCATE (mat(my_virt_size, exchange_work%homo(ispin), my_aux_size))
887 CALL timestop(handle2)
889 CALL timeset(routinen//
"_own", handle2)
891 DO aux_local = 1, aux_distribution_fm(my_process_row)
892 aux_global = row_indices(aux_local)
893 IF (aux_global < my_aux_start .OR. aux_global > my_aux_end) cycle
894 DO ia_local = 1, ia_distribution_fm(my_process_column)
895 ia_global = fm_mat%matrix_struct%col_indices(ia_local)
897 iocc = (ia_global - 1)/exchange_work%virtual(ispin) + 1
898 avirt = mod(ia_global - 1, exchange_work%virtual(ispin)) + 1
900 IF (my_virt_start > avirt .OR. my_virt_end < avirt) cycle
902 mat(avirt - my_virt_start + 1, iocc, aux_global - my_aux_start + 1) = fm_mat%local_data(aux_local, ia_local)
905 CALL timestop(handle2)
907 DO proc_shift = 1, para_env%num_pe - 1
908 send_proc =
modulo(para_env%mepos + proc_shift, para_env%num_pe)
909 recv_proc =
modulo(para_env%mepos - proc_shift, para_env%num_pe)
911 CALL timeset(routinen//
"_pack_buffer", handle2)
912 send_ptr(1:virt2send(mod(send_proc, group_size)), &
913 1:exchange_work%aux2send(send_proc/group_size)) => &
914 send_buffer(1:int(virt2send(mod(send_proc, group_size)), kind=int_8)* &
915 exchange_work%aux2send(send_proc/group_size))
918 DO aux_local = 1, aux_distribution_fm(my_process_row)
919 aux_global = row_indices(aux_local)
920 proc = group_dist_proc(exchange_work%aux_func_dist, aux_global)
921 IF (proc /= send_proc/group_size) cycle
922 aux_counter = aux_counter + 1
924 DO ia_local = 1, ia_distribution_fm(my_process_column)
925 ia_global = col_indices(ia_local)
926 avirt = mod(ia_global - 1, exchange_work%virtual(ispin)) + 1
928 proc = group_dist_proc(virt_dist, avirt)
929 IF (proc /= mod(send_proc, group_size)) cycle
930 virt_counter = virt_counter + 1
931 send_ptr(virt_counter, aux_counter) = fm_mat%local_data(aux_local, ia_local)
932 send_virt_indices(virt_counter) = ia_global
934 send_aux_indices(aux_counter) = aux_global
936 CALL timestop(handle2)
938 CALL timeset(routinen//
"_ex_size", handle2)
940 CALL para_env%sendrecv(shape(send_ptr), send_proc, recv_shape, recv_proc)
941 CALL timestop(handle2)
943 IF (
SIZE(send_ptr) == 0) send_proc = mp_proc_null
944 IF (product(recv_shape) == 0) recv_proc = mp_proc_null
946 CALL timeset(routinen//
"_ex_idx", handle2)
947 ALLOCATE (recv_row_indices(recv_shape(1)), recv_col_indices(recv_shape(2)))
948 CALL para_env%sendrecv(send_virt_indices(1:virt_counter), send_proc, recv_row_indices, recv_proc)
949 CALL para_env%sendrecv(send_aux_indices(1:aux_counter), send_proc, recv_col_indices, recv_proc)
950 CALL timestop(handle2)
953 recv_ptr(1:recv_shape(1), 1:max(1, recv_shape(2))) => recv_buffer(1:recv_shape(1)*max(1, recv_shape(2)))
955 CALL timeset(routinen//
"_sendrecv", handle2)
957 CALL para_env%sendrecv(send_ptr, send_proc, recv_ptr, recv_proc)
958 CALL timestop(handle2)
960 IF (recv_proc == mp_proc_null)
THEN
961 DEALLOCATE (recv_row_indices, recv_col_indices)
965 CALL timeset(routinen//
"_unpack", handle2)
967 DO aux_local = 1,
SIZE(recv_col_indices)
968 aux_global = recv_col_indices(aux_local)
970 DO ia_local = 1,
SIZE(recv_row_indices)
971 ia_global = recv_row_indices(ia_local)
973 iocc = (ia_global - 1)/exchange_work%virtual(ispin) + 1
974 avirt = mod(ia_global - 1, exchange_work%virtual(ispin)) + 1
976 mat(avirt - my_virt_start + 1, iocc, aux_global - my_aux_start + 1) = recv_ptr(ia_local, aux_local)
979 CALL timestop(handle2)
981 IF (
ALLOCATED(recv_row_indices))
DEALLOCATE (recv_row_indices)
982 IF (
ALLOCATED(recv_col_indices))
DEALLOCATE (recv_col_indices)
985 DEALLOCATE (send_aux_indices, send_virt_indices)
987 CALL timestop(handle)
989 END SUBROUTINE redistribute_into_subgroups
static GRID_HOST_DEVICE int modulo(int a, int m)
Equivalent of Fortran's MODULO, which always return a positive number. https://gcc....
Define the atomic kind types and their sub types.
Handles all functions related to the CELL.
methods related to the blacs parallel environment
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
subroutine, public dbcsr_copy(matrix_b, matrix_a, name, keep_sparsity, keep_imaginary)
...
subroutine, public dbcsr_multiply(transa, transb, alpha, matrix_a, matrix_b, beta, matrix_c, first_row, last_row, first_column, last_column, first_k, last_k, retain_sparsity, filter_eps, flop)
...
subroutine, public dbcsr_get_info(matrix, nblkrows_total, nblkcols_total, nfullrows_total, nfullcols_total, nblkrows_local, nblkcols_local, nfullrows_local, nfullcols_local, my_prow, my_pcol, local_rows, local_cols, proc_row_dist, proc_col_dist, row_blk_size, col_blk_size, row_blk_offset, col_blk_offset, distribution, name, matrix_type, group)
...
subroutine, public dbcsr_init_p(matrix)
...
subroutine, public dbcsr_set(matrix, alpha)
...
subroutine, public dbcsr_release(matrix)
...
subroutine, public dbcsr_trace(matrix, trace)
Computes the trace of the given matrix, also known as the sum of its diagonal elements.
DBCSR operations in CP2K.
Redistribution of DBCSR blocks and distributed matrix slices.
subroutine, public cp_array_to_dbcsr_slices(array, nrows, ncols, para_env_sub, first_row, last_row, template, matrices, matrix_ptrs)
Consume a distributed flattened array and create a DBCSR matrix per slice.
Basic linear algebra operations for full matrices.
subroutine, public cp_fm_column_scale(matrixa, scaling, first_col, source)
Scales columns of the full matrix by corresponding factors.
used for collecting some of the diagonalization schemes available for cp_fm_type. cp_fm_power also mo...
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...
Redistribution of full matrices and distributed arrays.
subroutine, public cp_fm_to_array(mat2d, my_start_row, my_end_row, my_start_col, my_end_col, fm_mat)
Extract distributed rectangular array tiles from a full matrix.
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_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, nrow, ncol, set_zero)
creates a new full matrix with the given structure
Types to describe group distributions.
elemental integer function, public maxsize(this)
...
elemental integer function, public group_dist_proc(this, pos)
...
Utilities for hfx and admm methods.
subroutine, public tddft_hfx_matrix(matrix_ks, rho_ao, qs_env, update_energy, recalc_integrals, external_hfx_sections, external_x_data, external_para_env)
Add the hfx contributions to the Hamiltonian.
Types and set/get functions for HFX.
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
subroutine, public hfx_release(x_data)
This routine deallocates all data structures
Defines the basic variable types.
integer, parameter, public int_8
integer, parameter, public dp
integer, parameter, public local_gemm_pu_gpu
Definition of mathematical constants and functions.
real(kind=dp), parameter, public sqrthalf
Interface to the message passing library MPI.
integer, parameter, public mp_proc_null
Types needed for MP2 calculations.
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, mimic, 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, matrix_vhxc, 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, xcint_weights, 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.
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-exchange given blacs_env to another.
subroutine, public rpa_exchange_needed_mem(mp2_env, homo, virtual, dimen_ri, para_env, mem_per_rank, mem_per_repl)
...
Utility functions for RPA calculations.
subroutine, public remove_scaling_factor_rpa(fm_mat_s, virtual, eigenval_last, homo, omega_old)
...
subroutine, public calc_fm_mat_s_rpa(fm_mat_s, first_cycle, virtual, eigenval, homo, omega, omega_old)
...
parameters that control an scf iteration
Provides all information about an atomic kind.
Type defining parameters related to the simulation cell.
represent a blacs multidimensional parallel environment (for the mpi corrispective see cp_paratypes/m...
stores some data used in construction of Kohn-Sham matrix
stores all the informations relevant to an mpi environment
Provides all information about a quickstep kind.