84#include "./base/base_uses.f90"
90 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'bse_util'
112 SUBROUTINE mult_b_with_w(fm_mat_S_ij_bse, fm_mat_S_ia_bse, fm_mat_S_bar_ia_bse, &
113 fm_mat_S_bar_ij_bse, fm_mat_Q_static_bse_gemm, &
114 dimen_RI, homo, virtual)
116 TYPE(
cp_fm_type),
INTENT(IN) :: fm_mat_s_ij_bse, fm_mat_s_ia_bse
117 TYPE(
cp_fm_type),
INTENT(OUT) :: fm_mat_s_bar_ia_bse, fm_mat_s_bar_ij_bse
118 TYPE(
cp_fm_type),
INTENT(IN) :: fm_mat_q_static_bse_gemm
119 INTEGER,
INTENT(IN) :: dimen_ri, homo, virtual
121 CHARACTER(LEN=*),
PARAMETER :: routinen =
'mult_B_with_W'
123 INTEGER :: handle, i_global, iib, info_chol, &
124 j_global, jjb, ncol_local, nrow_local
125 INTEGER,
DIMENSION(:),
POINTER :: col_indices, row_indices
128 CALL timeset(routinen, handle)
130 CALL cp_fm_create(fm_mat_s_bar_ia_bse, fm_mat_s_ia_bse%matrix_struct)
133 CALL cp_fm_create(fm_mat_s_bar_ij_bse, fm_mat_s_ij_bse%matrix_struct)
136 CALL cp_fm_create(fm_work, fm_mat_q_static_bse_gemm%matrix_struct)
141 nrow_local=nrow_local, &
142 ncol_local=ncol_local, &
143 row_indices=row_indices, &
144 col_indices=col_indices)
146 DO jjb = 1, ncol_local
147 j_global = col_indices(jjb)
148 DO iib = 1, nrow_local
149 i_global = row_indices(iib)
150 IF (j_global == i_global .AND. i_global <= dimen_ri)
THEN
151 fm_mat_q_static_bse_gemm%local_data(iib, jjb) = fm_mat_q_static_bse_gemm%local_data(iib, jjb) + 1.0_dp
159 IF (info_chol /= 0)
THEN
160 CALL cp_abort(__location__,
'Cholesky decomposition failed for static polarization in BSE')
169 CALL parallel_gemm(transa=
"N", transb=
"N", m=dimen_ri, n=homo**2, k=dimen_ri, alpha=1.0_dp, &
170 matrix_a=fm_mat_q_static_bse_gemm, matrix_b=fm_mat_s_ij_bse, beta=0.0_dp, &
171 matrix_c=fm_mat_s_bar_ij_bse)
175 CALL parallel_gemm(transa=
"N", transb=
"N", m=dimen_ri, n=homo*virtual, k=dimen_ri, alpha=1.0_dp, &
176 matrix_a=fm_mat_q_static_bse_gemm, matrix_b=fm_mat_s_ia_bse, beta=0.0_dp, &
177 matrix_c=fm_mat_s_bar_ia_bse)
181 CALL timestop(handle)
202 nrow_secidx_out, ncol_secidx_out, unit_nr, reordering, mp2_env, &
203 row_offset, col_offset)
207 REAL(kind=
dp) :: beta
208 INTEGER,
INTENT(IN) :: nrow_secidx_in, ncol_secidx_in, &
209 nrow_secidx_out, ncol_secidx_out
211 INTEGER,
DIMENSION(4) :: reordering
212 TYPE(
mp2_type),
INTENT(IN) :: mp2_env
213 INTEGER,
INTENT(IN),
OPTIONAL :: row_offset, col_offset
215 CHARACTER(LEN=*),
PARAMETER :: routinen =
'fm_general_add_bse'
217 INTEGER :: col_idx_loc, dummy, handle, handle2, i_entry_rec, idx_col_out, idx_row_out, ii, &
218 iproc, jj, my_col_offset, my_row_offset, ncol_block_in, ncol_block_out, ncol_local_in, &
219 ncol_local_out, nprocs, nrow_block_in, nrow_block_out, nrow_local_in, nrow_local_out, &
220 proc_send, row_idx_loc, send_pcol, send_prow
221 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: entry_counter, num_entries_rec, &
223 INTEGER,
DIMENSION(4) :: indices_in
224 INTEGER,
DIMENSION(:),
POINTER :: col_indices_in, col_indices_out, &
225 row_indices_in, row_indices_out
227 DIMENSION(:) :: buffer_rec, buffer_send
236 IF (
PRESENT(row_offset)) my_row_offset = row_offset
237 IF (
PRESENT(col_offset)) my_col_offset = col_offset
239 CALL timeset(routinen, handle)
240 CALL timeset(routinen//
"_1_setup", handle2)
242 para_env_out => fm_out%matrix_struct%para_env
246 nrow_local=nrow_local_out, &
247 ncol_local=ncol_local_out, &
248 row_indices=row_indices_out, &
249 col_indices=col_indices_out, &
250 nrow_block=nrow_block_out, &
251 ncol_block=ncol_block_out)
253 ALLOCATE (num_entries_rec(0:para_env_out%num_pe - 1))
254 ALLOCATE (num_entries_send(0:para_env_out%num_pe - 1))
256 num_entries_rec(:) = 0
257 num_entries_send(:) = 0
262 nrow_local=nrow_local_in, &
263 ncol_local=ncol_local_in, &
264 row_indices=row_indices_in, &
265 col_indices=col_indices_in, &
266 nrow_block=nrow_block_in, &
267 ncol_block=ncol_block_in)
269 IF (unit_nr > 0 .AND. mp2_env%bse%bse_debug_print)
THEN
270 WRITE (unit_nr,
'(T2,A10,T13,A14,A10,T71,I10)')
'BSE|DEBUG|',
'Row number of ', fm_out%name, &
271 fm_out%matrix_struct%nrow_global
272 WRITE (unit_nr,
'(T2,A10,T13,A17,A10,T71,I10)')
'BSE|DEBUG|',
'Column number of ', fm_out%name, &
273 fm_out%matrix_struct%ncol_global
275 WRITE (unit_nr,
'(T2,A10,T13,A18,A10,T71,I10)')
'BSE|DEBUG|',
'Row block size of ', fm_out%name, nrow_block_out
276 WRITE (unit_nr,
'(T2,A10,T13,A21,A10,T71,I10)')
'BSE|DEBUG|',
'Column block size of ', fm_out%name, ncol_block_out
278 WRITE (unit_nr,
'(T2,A10,T13,A14,A10,T71,I10)')
'BSE|DEBUG|',
'Row number of ', fm_in%name, &
279 fm_in%matrix_struct%nrow_global
280 WRITE (unit_nr,
'(T2,A10,T13,A17,A10,T71,I10)')
'BSE|DEBUG|',
'Column number of ', fm_in%name, &
281 fm_in%matrix_struct%ncol_global
283 WRITE (unit_nr,
'(T2,A10,T13,A18,A10,T71,I10)')
'BSE|DEBUG|',
'Row block size of ', fm_in%name, nrow_block_in
284 WRITE (unit_nr,
'(T2,A10,T13,A21,A10,T71,I10)')
'BSE|DEBUG|',
'Column block size of ', fm_in%name, ncol_block_in
290 DO row_idx_loc = 1, nrow_local_in
291 indices_in(1) = (row_indices_in(row_idx_loc) - 1)/nrow_secidx_in + 1
292 indices_in(2) = mod(row_indices_in(row_idx_loc) - 1, nrow_secidx_in) + 1
293 DO col_idx_loc = 1, ncol_local_in
294 indices_in(3) = (col_indices_in(col_idx_loc) - 1)/ncol_secidx_in + 1
295 indices_in(4) = mod(col_indices_in(col_idx_loc) - 1, ncol_secidx_in) + 1
297 idx_row_out = my_row_offset + indices_in(reordering(2)) + (indices_in(reordering(1)) - 1)*nrow_secidx_out
298 idx_col_out = my_col_offset + indices_in(reordering(4)) + (indices_in(reordering(3)) - 1)*ncol_secidx_out
300 send_prow = fm_out%matrix_struct%g2p_row(idx_row_out)
301 send_pcol = fm_out%matrix_struct%g2p_col(idx_col_out)
303 proc_send = fm_out%matrix_struct%context%blacs2mpi(send_prow, send_pcol)
305 num_entries_send(proc_send) = num_entries_send(proc_send) + 1
310 CALL timestop(handle2)
312 CALL timeset(routinen//
"_2_comm_entry_nums", handle2)
313 IF (unit_nr > 0 .AND. mp2_env%bse%bse_debug_print)
THEN
314 WRITE (unit_nr,
'(T2,A10,T13,A27)')
'BSE|DEBUG|',
'Communicating entry numbers'
317 CALL para_env_out%alltoall(num_entries_send, num_entries_rec, 1)
319 CALL timestop(handle2)
321 CALL timeset(routinen//
"_3_alloc_buffer", handle2)
322 IF (unit_nr > 0 .AND. mp2_env%bse%bse_debug_print)
THEN
323 WRITE (unit_nr,
'(T2,A10,T13,A18)')
'BSE|DEBUG|',
'Allocating buffers'
327 ALLOCATE (buffer_rec(0:para_env_out%num_pe - 1))
328 ALLOCATE (buffer_send(0:para_env_out%num_pe - 1))
331 DO iproc = 0, para_env_out%num_pe - 1
333 ALLOCATE (buffer_rec(iproc)%msg(num_entries_rec(iproc)))
334 buffer_rec(iproc)%msg = 0.0_dp
338 DO iproc = 0, para_env_out%num_pe - 1
340 ALLOCATE (buffer_send(iproc)%msg(num_entries_send(iproc)))
341 buffer_send(iproc)%msg = 0.0_dp
345 DO iproc = 0, para_env_out%num_pe - 1
347 ALLOCATE (buffer_rec(iproc)%indx(num_entries_rec(iproc), 2))
348 buffer_rec(iproc)%indx = 0
352 DO iproc = 0, para_env_out%num_pe - 1
354 ALLOCATE (buffer_send(iproc)%indx(num_entries_send(iproc), 2))
355 buffer_send(iproc)%indx = 0
359 CALL timestop(handle2)
361 CALL timeset(routinen//
"_4_buf_from_fmin_"//fm_out%name, handle2)
362 IF (unit_nr > 0 .AND. mp2_env%bse%bse_debug_print)
THEN
363 WRITE (unit_nr,
'(T2,A10,T13,A18,A10,A13)')
'BSE|DEBUG|',
'Writing data from ', fm_in%name,
' into buffers'
366 ALLOCATE (entry_counter(0:para_env_out%num_pe - 1))
370 DO row_idx_loc = 1, nrow_local_in
371 indices_in(1) = (row_indices_in(row_idx_loc) - 1)/nrow_secidx_in + 1
372 indices_in(2) = mod(row_indices_in(row_idx_loc) - 1, nrow_secidx_in) + 1
373 DO col_idx_loc = 1, ncol_local_in
374 indices_in(3) = (col_indices_in(col_idx_loc) - 1)/ncol_secidx_in + 1
375 indices_in(4) = mod(col_indices_in(col_idx_loc) - 1, ncol_secidx_in) + 1
377 idx_row_out = my_row_offset + indices_in(reordering(2)) + (indices_in(reordering(1)) - 1)*nrow_secidx_out
378 idx_col_out = my_col_offset + indices_in(reordering(4)) + (indices_in(reordering(3)) - 1)*ncol_secidx_out
380 send_prow = fm_out%matrix_struct%g2p_row(idx_row_out)
381 send_pcol = fm_out%matrix_struct%g2p_col(idx_col_out)
383 proc_send = fm_out%matrix_struct%context%blacs2mpi(send_prow, send_pcol)
384 entry_counter(proc_send) = entry_counter(proc_send) + 1
386 buffer_send(proc_send)%msg(entry_counter(proc_send)) = &
387 fm_in%local_data(row_idx_loc, col_idx_loc)
389 buffer_send(proc_send)%indx(entry_counter(proc_send), 1) = idx_row_out
390 buffer_send(proc_send)%indx(entry_counter(proc_send), 2) = idx_col_out
395 ALLOCATE (req_array(1:para_env_out%num_pe, 4))
397 CALL timestop(handle2)
399 CALL timeset(routinen//
"_5_comm_buffer", handle2)
400 IF (unit_nr > 0 .AND. mp2_env%bse%bse_debug_print)
THEN
401 WRITE (unit_nr,
'(T2,A10,T13,A21)')
'BSE|DEBUG|',
'Communicating buffers'
405 CALL communicate_buffer(para_env_out, num_entries_rec, num_entries_send, buffer_rec, &
406 buffer_send, req_array)
408 CALL timestop(handle2)
410 CALL timeset(routinen//
"_6_buffer_to_fmout"//fm_out%name, handle2)
411 IF (unit_nr > 0 .AND. mp2_env%bse%bse_debug_print)
THEN
412 WRITE (unit_nr,
'(T2,A10,T13,A24,A10)')
'BSE|DEBUG|',
'Writing from buffers to ', fm_out%name
416 nprocs = para_env_out%num_pe
421 DO iproc = 0, nprocs - 1
422 DO i_entry_rec = 1, num_entries_rec(iproc)
423 ii = fm_out%matrix_struct%g2l_row(buffer_rec(iproc)%indx(i_entry_rec, 1))
424 jj = fm_out%matrix_struct%g2l_col(buffer_rec(iproc)%indx(i_entry_rec, 2))
426 fm_out%local_data(ii, jj) = fm_out%local_data(ii, jj) + beta*buffer_rec(iproc)%msg(i_entry_rec)
431 CALL timestop(handle2)
433 CALL timeset(routinen//
"_7_cleanup", handle2)
434 IF (unit_nr > 0 .AND. mp2_env%bse%bse_debug_print)
THEN
435 WRITE (unit_nr,
'(T2,A10,T13,A41)')
'BSE|DEBUG|',
'Starting cleanup of communication buffers'
439 DO iproc = 0, para_env_out%num_pe - 1
440 DEALLOCATE (buffer_rec(iproc)%msg)
441 DEALLOCATE (buffer_rec(iproc)%indx)
442 DEALLOCATE (buffer_send(iproc)%msg)
443 DEALLOCATE (buffer_send(iproc)%indx)
445 DEALLOCATE (buffer_rec, buffer_send)
446 DEALLOCATE (req_array)
447 DEALLOCATE (entry_counter)
448 DEALLOCATE (num_entries_rec, num_entries_send)
450 CALL timestop(handle2)
451 CALL timestop(handle)
471 nrow_out, ncol_out, unit_nr, mp2_env, &
472 nrow_offset, ncol_offset)
476 INTEGER :: ncol_in, nrow_out, ncol_out, unit_nr
477 TYPE(
mp2_type),
INTENT(INOUT) :: mp2_env
478 INTEGER,
INTENT(IN),
OPTIONAL :: nrow_offset, ncol_offset
480 CHARACTER(LEN=*),
PARAMETER :: routinen =
'truncate_fm'
482 INTEGER :: col_idx_loc, dummy, handle, handle2, i_entry_rec, idx_col_first, idx_col_in, &
483 idx_col_out, idx_col_sec, idx_row_in, ii, iproc, jj, ncol_block_in, ncol_block_out, &
484 ncol_local_in, ncol_local_out, nprocs, nrow_block_in, nrow_block_out, nrow_local_in, &
485 nrow_local_out, proc_send, row_idx_loc, send_pcol, send_prow
486 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: entry_counter, num_entries_rec, &
488 INTEGER,
DIMENSION(:),
POINTER :: col_indices_in, col_indices_out, &
489 row_indices_in, row_indices_out
490 LOGICAL :: correct_ncol, correct_nrow
492 DIMENSION(:) :: buffer_rec, buffer_send
496 CALL timeset(routinen, handle)
497 CALL timeset(routinen//
"_1_setup", handle2)
499 correct_nrow = .false.
500 correct_ncol = .false.
502 IF (
PRESENT(nrow_offset))
THEN
503 correct_nrow = .true.
505 IF (
PRESENT(ncol_offset))
THEN
506 correct_ncol = .true.
509 para_env_out => fm_out%matrix_struct%para_env
512 nrow_local=nrow_local_out, &
513 ncol_local=ncol_local_out, &
514 row_indices=row_indices_out, &
515 col_indices=col_indices_out, &
516 nrow_block=nrow_block_out, &
517 ncol_block=ncol_block_out)
519 ALLOCATE (num_entries_rec(0:para_env_out%num_pe - 1))
520 ALLOCATE (num_entries_send(0:para_env_out%num_pe - 1))
522 num_entries_rec(:) = 0
523 num_entries_send(:) = 0
528 nrow_local=nrow_local_in, &
529 ncol_local=ncol_local_in, &
530 row_indices=row_indices_in, &
531 col_indices=col_indices_in, &
532 nrow_block=nrow_block_in, &
533 ncol_block=ncol_block_in)
535 IF (unit_nr > 0 .AND. mp2_env%bse%bse_debug_print)
THEN
536 WRITE (unit_nr,
'(T2,A10,T13,A14,A10,T71,I10)')
'BSE|DEBUG|',
'Row number of ', fm_out%name, &
537 fm_out%matrix_struct%nrow_global
538 WRITE (unit_nr,
'(T2,A10,T13,A17,A10,T71,I10)')
'BSE|DEBUG|',
'Column number of ', fm_out%name, &
539 fm_out%matrix_struct%ncol_global
541 WRITE (unit_nr,
'(T2,A10,T13,A18,A10,T71,I10)')
'BSE|DEBUG|',
'Row block size of ', fm_out%name, nrow_block_out
542 WRITE (unit_nr,
'(T2,A10,T13,A21,A10,T71,I10)')
'BSE|DEBUG|',
'Column block size of ', fm_out%name, ncol_block_out
544 WRITE (unit_nr,
'(T2,A10,T13,A14,A10,T71,I10)')
'BSE|DEBUG|',
'Row number of ', fm_in%name, &
545 fm_in%matrix_struct%nrow_global
546 WRITE (unit_nr,
'(T2,A10,T13,A17,A10,T71,I10)')
'BSE|DEBUG|',
'Column number of ', fm_in%name, &
547 fm_in%matrix_struct%ncol_global
549 WRITE (unit_nr,
'(T2,A10,T13,A18,A10,T71,I10)')
'BSE|DEBUG|',
'Row block size of ', fm_in%name, nrow_block_in
550 WRITE (unit_nr,
'(T2,A10,T13,A21,A10,T71,I10)')
'BSE|DEBUG|',
'Column block size of ', fm_in%name, ncol_block_in
554 DO col_idx_loc = 1, ncol_local_in
555 idx_col_in = col_indices_in(col_idx_loc)
557 idx_col_first = (idx_col_in - 1)/ncol_in + 1
558 idx_col_sec = mod(idx_col_in - 1, ncol_in) + 1
562 IF (correct_nrow)
THEN
563 idx_col_first = idx_col_first - nrow_offset + 1
564 IF (idx_col_first <= 0) cycle
566 IF (idx_col_first > nrow_out)
EXIT
568 IF (correct_ncol)
THEN
569 idx_col_sec = idx_col_sec - ncol_offset + 1
570 IF (idx_col_sec <= 0) cycle
572 IF (idx_col_sec > ncol_out) cycle
575 idx_col_out = idx_col_sec + (idx_col_first - 1)*ncol_out
577 DO row_idx_loc = 1, nrow_local_in
578 idx_row_in = row_indices_in(row_idx_loc)
580 send_prow = fm_out%matrix_struct%g2p_row(idx_row_in)
581 send_pcol = fm_out%matrix_struct%g2p_col(idx_col_out)
583 proc_send = fm_out%matrix_struct%context%blacs2mpi(send_prow, send_pcol)
585 num_entries_send(proc_send) = num_entries_send(proc_send) + 1
590 CALL timestop(handle2)
592 CALL timeset(routinen//
"_2_comm_entry_nums", handle2)
593 IF (unit_nr > 0 .AND. mp2_env%bse%bse_debug_print)
THEN
594 WRITE (unit_nr,
'(T2,A10,T13,A27)')
'BSE|DEBUG|',
'Communicating entry numbers'
597 CALL para_env_out%alltoall(num_entries_send, num_entries_rec, 1)
599 CALL timestop(handle2)
601 CALL timeset(routinen//
"_3_alloc_buffer", handle2)
602 IF (unit_nr > 0 .AND. mp2_env%bse%bse_debug_print)
THEN
603 WRITE (unit_nr,
'(T2,A10,T13,A18)')
'BSE|DEBUG|',
'Allocating buffers'
607 ALLOCATE (buffer_rec(0:para_env_out%num_pe - 1))
608 ALLOCATE (buffer_send(0:para_env_out%num_pe - 1))
611 DO iproc = 0, para_env_out%num_pe - 1
613 ALLOCATE (buffer_rec(iproc)%msg(num_entries_rec(iproc)))
614 buffer_rec(iproc)%msg = 0.0_dp
618 DO iproc = 0, para_env_out%num_pe - 1
620 ALLOCATE (buffer_send(iproc)%msg(num_entries_send(iproc)))
621 buffer_send(iproc)%msg = 0.0_dp
625 DO iproc = 0, para_env_out%num_pe - 1
627 ALLOCATE (buffer_rec(iproc)%indx(num_entries_rec(iproc), 2))
628 buffer_rec(iproc)%indx = 0
632 DO iproc = 0, para_env_out%num_pe - 1
634 ALLOCATE (buffer_send(iproc)%indx(num_entries_send(iproc), 2))
635 buffer_send(iproc)%indx = 0
639 CALL timestop(handle2)
641 CALL timeset(routinen//
"_4_buf_from_fmin_"//fm_out%name, handle2)
642 IF (unit_nr > 0 .AND. mp2_env%bse%bse_debug_print)
THEN
643 WRITE (unit_nr,
'(T2,A10,T13,A18,A10,A13)')
'BSE|DEBUG|',
'Writing data from ', fm_in%name,
' into buffers'
646 ALLOCATE (entry_counter(0:para_env_out%num_pe - 1))
650 DO col_idx_loc = 1, ncol_local_in
651 idx_col_in = col_indices_in(col_idx_loc)
653 idx_col_first = (idx_col_in - 1)/ncol_in + 1
654 idx_col_sec = mod(idx_col_in - 1, ncol_in) + 1
658 IF (correct_nrow)
THEN
659 idx_col_first = idx_col_first - nrow_offset + 1
660 IF (idx_col_first <= 0) cycle
662 IF (idx_col_first > nrow_out)
EXIT
664 IF (correct_ncol)
THEN
665 idx_col_sec = idx_col_sec - ncol_offset + 1
666 IF (idx_col_sec <= 0) cycle
668 IF (idx_col_sec > ncol_out) cycle
671 idx_col_out = idx_col_sec + (idx_col_first - 1)*ncol_out
673 DO row_idx_loc = 1, nrow_local_in
674 idx_row_in = row_indices_in(row_idx_loc)
676 send_prow = fm_out%matrix_struct%g2p_row(idx_row_in)
678 send_pcol = fm_out%matrix_struct%g2p_col(idx_col_out)
680 proc_send = fm_out%matrix_struct%context%blacs2mpi(send_prow, send_pcol)
681 entry_counter(proc_send) = entry_counter(proc_send) + 1
683 buffer_send(proc_send)%msg(entry_counter(proc_send)) = &
684 fm_in%local_data(row_idx_loc, col_idx_loc)
687 buffer_send(proc_send)%indx(entry_counter(proc_send), 1) = idx_row_in
688 buffer_send(proc_send)%indx(entry_counter(proc_send), 2) = idx_col_out
693 ALLOCATE (req_array(1:para_env_out%num_pe, 4))
695 CALL timestop(handle2)
697 CALL timeset(routinen//
"_5_comm_buffer", handle2)
698 IF (unit_nr > 0 .AND. mp2_env%bse%bse_debug_print)
THEN
699 WRITE (unit_nr,
'(T2,A10,T13,A21)')
'BSE|DEBUG|',
'Communicating buffers'
703 CALL communicate_buffer(para_env_out, num_entries_rec, num_entries_send, buffer_rec, &
704 buffer_send, req_array)
706 CALL timestop(handle2)
708 CALL timeset(routinen//
"_6_buffer_to_fmout"//fm_out%name, handle2)
709 IF (unit_nr > 0 .AND. mp2_env%bse%bse_debug_print)
THEN
710 WRITE (unit_nr,
'(T2,A10,T13,A24,A10)')
'BSE|DEBUG|',
'Writing from buffers to ', fm_out%name
714 nprocs = para_env_out%num_pe
719 DO iproc = 0, nprocs - 1
720 DO i_entry_rec = 1, num_entries_rec(iproc)
721 ii = fm_out%matrix_struct%g2l_row(buffer_rec(iproc)%indx(i_entry_rec, 1))
722 jj = fm_out%matrix_struct%g2l_col(buffer_rec(iproc)%indx(i_entry_rec, 2))
724 fm_out%local_data(ii, jj) = fm_out%local_data(ii, jj) + buffer_rec(iproc)%msg(i_entry_rec)
729 CALL timestop(handle2)
731 CALL timeset(routinen//
"_7_cleanup", handle2)
732 IF (unit_nr > 0 .AND. mp2_env%bse%bse_debug_print)
THEN
733 WRITE (unit_nr,
'(T2,A10,T13,A41)')
'BSE|DEBUG|',
'Starting cleanup of communication buffers'
737 DO iproc = 0, para_env_out%num_pe - 1
738 DEALLOCATE (buffer_rec(iproc)%msg)
739 DEALLOCATE (buffer_rec(iproc)%indx)
740 DEALLOCATE (buffer_send(iproc)%msg)
741 DEALLOCATE (buffer_send(iproc)%indx)
743 DEALLOCATE (buffer_rec, buffer_send)
744 DEALLOCATE (req_array)
745 DEALLOCATE (entry_counter)
746 DEALLOCATE (num_entries_rec, num_entries_send)
748 CALL timestop(handle2)
749 CALL timestop(handle)
764 fm_mat_S_trunc, fm_mat_S_ij_trunc, fm_mat_S_ab_trunc, &
765 fm_mat_Q_static_bse_gemm, mp2_env)
767 TYPE(
cp_fm_type),
INTENT(INOUT) :: fm_mat_s_bar_ia_bse, fm_mat_s_bar_ij_bse, fm_mat_s_trunc, &
768 fm_mat_s_ij_trunc, fm_mat_s_ab_trunc, fm_mat_q_static_bse_gemm
771 CHARACTER(LEN=*),
PARAMETER :: routinen =
'deallocate_matrices_bse'
775 CALL timeset(routinen, handle)
783 IF (mp2_env%bse%do_nto_analysis)
THEN
784 DEALLOCATE (mp2_env%bse%bse_nto_state_list_final)
787 CALL timestop(handle)
803 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
804 INTENT(IN) :: eig_vals
805 REAL(kind=
dp),
INTENT(IN) :: beta
806 REAL(kind=
dp),
INTENT(IN),
OPTIONAL ::
gamma
807 LOGICAL,
INTENT(IN),
OPTIONAL :: do_transpose
809 CHARACTER(LEN=*),
PARAMETER :: routinen =
'comp_eigvec_coeff_BSE'
811 INTEGER :: handle, i_row_global, ii, j_col_global, &
812 jj, ncol_local, nrow_local
813 INTEGER,
DIMENSION(:),
POINTER :: col_indices, row_indices
814 LOGICAL :: my_do_transpose
815 REAL(kind=
dp) :: coeff, my_gamma
817 CALL timeset(routinen, handle)
819 IF (
PRESENT(
gamma))
THEN
825 IF (
PRESENT(do_transpose))
THEN
826 my_do_transpose = do_transpose
828 my_do_transpose = .false.
832 nrow_local=nrow_local, &
833 ncol_local=ncol_local, &
834 row_indices=row_indices, &
835 col_indices=col_indices)
837 IF (my_do_transpose)
THEN
838 DO jj = 1, ncol_local
839 j_col_global = col_indices(jj)
840 DO ii = 1, nrow_local
841 coeff = (eig_vals(j_col_global)**beta)/my_gamma
842 fm_work%local_data(ii, jj) = fm_work%local_data(ii, jj)*coeff
846 DO jj = 1, ncol_local
847 DO ii = 1, nrow_local
848 i_row_global = row_indices(ii)
849 coeff = (eig_vals(i_row_global)**beta)/my_gamma
850 fm_work%local_data(ii, jj) = fm_work%local_data(ii, jj)*coeff
855 CALL timestop(handle)
869 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: idx_prim, idx_sec
870 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: eigvec_entries
871 INTEGER,
ALLOCATABLE,
DIMENSION(:),
OPTIONAL :: idx_spin
873 CHARACTER(LEN=*),
PARAMETER :: routinen =
'sort_excitations'
875 INTEGER :: handle, ii, kk, num_entries, num_mults
876 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: idx_prim_work, idx_sec_work, &
877 idx_spin_work, tmp_index
878 LOGICAL :: unique_entries
879 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: eigvec_entries_work
881 CALL timeset(routinen, handle)
883 num_entries =
SIZE(idx_prim)
885 ALLOCATE (tmp_index(num_entries))
887 CALL sort(idx_prim, num_entries, tmp_index)
889 ALLOCATE (idx_sec_work(num_entries))
890 ALLOCATE (eigvec_entries_work(num_entries))
891 IF (
PRESENT(idx_spin))
ALLOCATE (idx_spin_work(num_entries))
893 DO ii = 1, num_entries
894 idx_sec_work(ii) = idx_sec(tmp_index(ii))
895 eigvec_entries_work(ii) = eigvec_entries(tmp_index(ii))
896 IF (
PRESENT(idx_spin)) idx_spin_work(ii) = idx_spin(tmp_index(ii))
899 DEALLOCATE (tmp_index)
901 DEALLOCATE (eigvec_entries)
903 CALL move_alloc(idx_sec_work, idx_sec)
904 CALL move_alloc(eigvec_entries_work, eigvec_entries)
905 IF (
PRESENT(idx_spin))
THEN
906 DEALLOCATE (idx_spin)
907 CALL move_alloc(idx_spin_work, idx_spin)
912 IF (.NOT. unique_entries)
THEN
913 ALLOCATE (idx_prim_work(num_entries))
914 idx_prim_work(:) = idx_prim(:)
916 DO ii = 1, num_entries
917 IF (idx_prim_work(ii) == 0) cycle
918 num_mults = count(idx_prim_work == idx_prim_work(ii))
919 IF (num_mults > 1)
THEN
921 idx_prim_work(ii:ii + num_mults - 1) = 0
923 ALLOCATE (idx_sec_work(num_mults))
924 ALLOCATE (eigvec_entries_work(num_mults))
925 idx_sec_work(:) = idx_sec(ii:ii + num_mults - 1)
926 eigvec_entries_work(:) = eigvec_entries(ii:ii + num_mults - 1)
927 IF (
PRESENT(idx_spin))
THEN
928 ALLOCATE (idx_spin_work(num_mults))
929 idx_spin_work(:) = idx_spin(ii:ii + num_mults - 1)
931 ALLOCATE (tmp_index(num_mults))
932 CALL sort(idx_sec_work, num_mults, tmp_index)
935 DO kk = ii, ii + num_mults - 1
936 idx_sec(kk) = idx_sec_work(kk - ii + 1)
937 eigvec_entries(kk) = eigvec_entries_work(tmp_index(kk - ii + 1))
938 IF (
PRESENT(idx_spin)) idx_spin(kk) = idx_spin_work(tmp_index(kk - ii + 1))
941 DEALLOCATE (tmp_index)
942 DEALLOCATE (idx_sec_work)
943 DEALLOCATE (eigvec_entries_work)
944 IF (
PRESENT(idx_spin))
DEALLOCATE (idx_spin_work)
946 idx_prim_work(ii) = idx_prim(ii)
948 DEALLOCATE (idx_prim_work)
951 CALL timestop(handle)
964 para_env, diag_runtime_est)
966 INTEGER,
INTENT(IN) :: n_ov_joint, unit_nr
969 REAL(kind=
dp) :: diag_runtime_est
971 CHARACTER(LEN=*),
PARAMETER :: routinen =
'estimate_BSE_resources'
973 INTEGER :: handle, num_bse_matrices
974 INTEGER(KIND=int_8) :: full_dim
975 REAL(kind=
dp) :: mem_est, mem_est_per_rank
977 CALL timeset(routinen, handle)
984 num_bse_matrices = 10
987 full_dim = int(n_ov_joint, kind=
int_8)**2*int(num_bse_matrices, kind=
int_8)
988 mem_est = real(8*full_dim, kind=
dp)/real(1024**3, kind=
dp)
989 mem_est_per_rank = real(mem_est/para_env%num_pe, kind=
dp)
991 IF (unit_nr > 0)
THEN
994 WRITE (unit_nr,
'(T2,A4,T7,A40,T68,ES13.3)')
'BSE|',
'Total peak memory estimate from BSE [GB]', &
996 WRITE (unit_nr,
'(T2,A4,T7,A47,T68,F13.3)')
'BSE|',
'Peak memory estimate per MPI rank from BSE [GB]', &
998 WRITE (unit_nr,
'(T2,A4)')
'BSE|'
1002 diag_runtime_est = real(int(n_ov_joint, kind=
int_8)/11000_int_8, kind=
dp)**3* &
1003 10*32/real(para_env%num_pe, kind=
dp)
1005 CALL timestop(handle)
1025 i_exc, virtual, num_entries, mp2_env, &
1026 offsets, virtual_per_spin, idx_spin)
1029 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: idx_homo, idx_virt
1030 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: eigvec_entries
1031 INTEGER :: i_exc, virtual, num_entries
1032 TYPE(
mp2_type),
INTENT(INOUT) :: mp2_env
1033 INTEGER,
DIMENSION(:),
INTENT(IN),
OPTIONAL :: offsets, virtual_per_spin
1034 INTEGER,
ALLOCATABLE,
DIMENSION(:),
OPTIONAL :: idx_spin
1036 CHARACTER(LEN=*),
PARAMETER :: routinen =
'filter_eigvec_contrib'
1038 INTEGER :: eigvec_idx, handle, ii, iproc, isp, jj, &
1039 kk, ksp, ncol_local, nrow_local, &
1040 num_entries_local, r_local, v_local
1041 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: num_entries_to_comm
1042 INTEGER,
DIMENSION(:),
POINTER :: col_indices, row_indices
1043 REAL(kind=
dp) :: eigvec_entry
1045 DIMENSION(:) :: buffer_entries
1048 CALL timeset(routinen, handle)
1050 para_env => fm_eigvec%matrix_struct%para_env
1053 nrow_local=nrow_local, &
1054 ncol_local=ncol_local, &
1055 row_indices=row_indices, &
1056 col_indices=col_indices)
1058 ALLOCATE (num_entries_to_comm(0:para_env%num_pe - 1))
1059 num_entries_to_comm(:) = 0
1061 DO jj = 1, ncol_local
1063 IF (col_indices(jj) /= i_exc)
THEN
1066 DO ii = 1, nrow_local
1067 eigvec_idx = row_indices(ii)
1068 eigvec_entry = fm_eigvec%local_data(ii, jj)
1069 IF (abs(eigvec_entry) > mp2_env%bse%eps_x)
THEN
1070 num_entries_to_comm(para_env%mepos) = num_entries_to_comm(para_env%mepos) + 1
1076 CALL para_env%sum(num_entries_to_comm)
1078 num_entries_local = num_entries_to_comm(para_env%mepos)
1080 ALLOCATE (buffer_entries(0:para_env%num_pe - 1))
1082 DO iproc = 0, para_env%num_pe - 1
1083 ALLOCATE (buffer_entries(iproc)%msg(num_entries_to_comm(iproc)))
1084 ALLOCATE (buffer_entries(iproc)%indx(num_entries_to_comm(iproc), 3))
1085 buffer_entries(iproc)%msg = 0.0_dp
1086 buffer_entries(iproc)%indx = 0
1090 DO jj = 1, ncol_local
1092 IF (col_indices(jj) /= i_exc)
THEN
1095 DO ii = 1, nrow_local
1096 eigvec_idx = row_indices(ii)
1097 eigvec_entry = fm_eigvec%local_data(ii, jj)
1098 IF (abs(eigvec_entry) > mp2_env%bse%eps_x)
THEN
1102 r_local = eigvec_idx
1104 IF (
PRESENT(offsets))
THEN
1105 DO ksp =
SIZE(offsets), 1, -1
1106 IF (eigvec_idx > offsets(ksp))
THEN
1111 r_local = eigvec_idx - offsets(isp)
1112 v_local = virtual_per_spin(isp)
1114 buffer_entries(para_env%mepos)%indx(kk, 1) = (r_local - 1)/v_local + 1
1115 buffer_entries(para_env%mepos)%indx(kk, 2) = mod(r_local - 1, v_local) + 1
1116 buffer_entries(para_env%mepos)%indx(kk, 3) = isp
1117 buffer_entries(para_env%mepos)%msg(kk) = eigvec_entry
1123 DO iproc = 0, para_env%num_pe - 1
1124 CALL para_env%sum(buffer_entries(iproc)%msg)
1125 CALL para_env%sum(buffer_entries(iproc)%indx)
1129 num_entries = sum(num_entries_to_comm)
1130 ALLOCATE (idx_homo(num_entries))
1131 ALLOCATE (idx_virt(num_entries))
1132 ALLOCATE (eigvec_entries(num_entries))
1133 IF (
PRESENT(idx_spin))
ALLOCATE (idx_spin(num_entries))
1136 DO iproc = 0, para_env%num_pe - 1
1137 IF (num_entries_to_comm(iproc) /= 0)
THEN
1138 DO ii = 1, num_entries_to_comm(iproc)
1139 idx_homo(kk) = buffer_entries(iproc)%indx(ii, 1)
1140 idx_virt(kk) = buffer_entries(iproc)%indx(ii, 2)
1141 IF (
PRESENT(idx_spin)) idx_spin(kk) = buffer_entries(iproc)%indx(ii, 3)
1142 eigvec_entries(kk) = buffer_entries(iproc)%msg(ii)
1149 DO iproc = 0, para_env%num_pe - 1
1150 DEALLOCATE (buffer_entries(iproc)%msg)
1151 DEALLOCATE (buffer_entries(iproc)%indx)
1153 DEALLOCATE (buffer_entries)
1154 DEALLOCATE (num_entries_to_comm)
1155 NULLIFY (row_indices)
1156 NULLIFY (col_indices)
1160 IF (
PRESENT(idx_spin))
THEN
1166 CALL timestop(handle)
1180 INTEGER,
DIMENSION(:),
INTENT(IN) :: homo_red, virt_red
1181 INTEGER,
DIMENSION(:),
INTENT(OUT) :: n_ov, offsets
1182 INTEGER,
INTENT(OUT) :: n_ov_joint
1187 DO isp = 1,
SIZE(homo_red)
1188 offsets(isp) = n_ov_joint
1189 n_ov(isp) = homo_red(isp)*virt_red(isp)
1190 n_ov_joint = n_ov_joint + n_ov(isp)
1218 fm_mat_S_trunc, fm_mat_S_ij_trunc, fm_mat_S_ab_trunc, &
1219 Eigenval_scf, Eigenval, Eigenval_reduced, &
1220 homo, virtual, dimen_RI, unit_nr, &
1222 homo_red, virt_red, &
1224 window, print_window)
1226 TYPE(
cp_fm_type),
INTENT(IN) :: fm_mat_s_ia_bse, fm_mat_s_ij_bse, &
1228 TYPE(
cp_fm_type),
INTENT(INOUT) :: fm_mat_s_trunc, fm_mat_s_ij_trunc, &
1230 REAL(kind=
dp),
DIMENSION(:) :: eigenval_scf, eigenval
1231 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: eigenval_reduced
1232 INTEGER,
INTENT(IN) :: homo, virtual, dimen_ri, unit_nr, &
1234 INTEGER,
INTENT(OUT) :: homo_red, virt_red
1235 TYPE(
mp2_type),
INTENT(INOUT) :: mp2_env
1237 LOGICAL,
INTENT(IN) :: print_window
1239 CHARACTER(LEN=*),
PARAMETER :: routinen =
'truncate_BSE_matrices'
1241 INTEGER :: handle, homo_incl, virt_incl
1246 CALL timeset(routinen, handle)
1248 homo_incl = window%first_mo
1249 virt_incl = window%last_mo - homo
1250 homo_red = homo - homo_incl + 1
1251 virt_red = virt_incl
1253 IF (print_window .AND. unit_nr > 0)
THEN
1254 IF (mp2_env%bse%bse_cutoff_occ > 0)
THEN
1255 WRITE (unit_nr,
'(T2,A4,T7,A29,T71,F10.3)')
'BSE|',
'Cutoff occupied orbitals [eV]', &
1256 mp2_env%bse%bse_cutoff_occ*
evolt
1258 WRITE (unit_nr,
'(T2,A4,T7,A37)')
'BSE|',
'No cutoff given for occupied orbitals'
1260 IF (mp2_env%bse%bse_cutoff_empty > 0)
THEN
1261 WRITE (unit_nr,
'(T2,A4,T7,A26,T71,F10.3)')
'BSE|',
'Cutoff empty orbitals [eV]', &
1262 mp2_env%bse%bse_cutoff_empty*
evolt
1264 WRITE (unit_nr,
'(T2,A4,T7,A34)')
'BSE|',
'No cutoff given for empty orbitals'
1266 WRITE (unit_nr,
'(T2,A4,T7,A20,T71,I10)')
'BSE|',
'First occupied index', homo_incl
1267 WRITE (unit_nr,
'(T2,A4,T7,A32,T71,I10)')
'BSE|',
'Last empty index (not MO index!)', virt_incl
1268 WRITE (unit_nr,
'(T2,A4,T7,A35,T71,F10.3)')
'BSE|',
'Energy of first occupied index [eV]', &
1269 eigenval(homo_incl)*
evolt
1270 WRITE (unit_nr,
'(T2,A4,T7,A31,T71,F10.3)')
'BSE|',
'Energy of last empty index [eV]', &
1271 eigenval(homo + virt_incl)*
evolt
1272 WRITE (unit_nr,
'(T2,A4,T7,A54,T71,F10.3)')
'BSE|', &
1273 'Energy difference of first occupied index to HOMO [eV]', &
1274 -(eigenval(homo_incl) - eigenval(homo))*
evolt
1275 WRITE (unit_nr,
'(T2,A4,T7,A50,T71,F10.3)')
'BSE|', &
1276 'Energy difference of last empty index to LUMO [eV]', &
1277 (eigenval(homo + virt_incl) - eigenval(homo + 1))*
evolt
1278 WRITE (unit_nr,
'(T2,A4,T7,A35,T71,I10)')
'BSE|',
'Number of GW-corrected occupied MOs', &
1279 mp2_env%ri_g0w0%corr_mos_occ
1280 WRITE (unit_nr,
'(T2,A4,T7,A32,T71,I10)')
'BSE|',
'Number of GW-corrected empty MOs', &
1282 WRITE (unit_nr,
'(T2,A4)')
'BSE|'
1284 IF (unit_nr > 0)
THEN
1285 IF (homo - homo_incl + 1 > mp2_env%ri_g0w0%corr_mos_occ)
THEN
1286 cpabort(
"Number of GW-corrected occupied MOs too small for chosen BSE cutoff")
1288 IF (virt_incl > bse_lev_virt)
THEN
1289 cpabort(
"Number of GW-corrected virtual MOs too small for chosen BSE cutoff")
1294 para_env => fm_mat_s_ia_bse%matrix_struct%para_env
1295 context => fm_mat_s_ia_bse%matrix_struct%context
1301 CALL cp_fm_create(fm_mat_s_trunc, fm_struct_ia, name=
"fm_S_trunc", set_zero=.true.)
1302 CALL cp_fm_create(fm_mat_s_ij_trunc, fm_struct_ij, name=
"fm_S_ij_trunc", set_zero=.true.)
1303 CALL cp_fm_create(fm_mat_s_ab_trunc, fm_struct_ab, name=
"fm_S_ab_trunc", set_zero=.true.)
1306 IF (mp2_env%bse%bse_cutoff_occ > 0 .OR. mp2_env%bse%bse_cutoff_empty > 0)
THEN
1308 ALLOCATE (eigenval_reduced(homo_red + virt_red))
1310 IF (mp2_env%bse%use_ks_energies)
THEN
1311 eigenval_reduced(:) = eigenval_scf(homo_incl:homo + virt_incl)
1313 eigenval_reduced(:) = eigenval(homo_incl:homo + virt_incl)
1316 CALL truncate_fm(fm_mat_s_trunc, fm_mat_s_ia_bse, virtual, &
1317 homo_red, virt_red, unit_nr, mp2_env, &
1318 nrow_offset=homo_incl)
1319 CALL truncate_fm(fm_mat_s_ij_trunc, fm_mat_s_ij_bse, homo, &
1320 homo_red, homo_red, unit_nr, mp2_env, &
1321 homo_incl, homo_incl)
1322 CALL truncate_fm(fm_mat_s_ab_trunc, fm_mat_s_ab_bse, bse_lev_virt, &
1323 virt_red, virt_red, unit_nr, mp2_env)
1326 IF (unit_nr > 0)
THEN
1327 WRITE (unit_nr,
'(T2,A4,T7,A37)')
'BSE|',
'No truncation of BSE matrices applied'
1328 WRITE (unit_nr,
'(T2,A4)')
'BSE|'
1330 ALLOCATE (eigenval_reduced(homo_red + virt_red))
1332 IF (mp2_env%bse%use_ks_energies)
THEN
1333 eigenval_reduced(:) = eigenval_scf(:)
1335 eigenval_reduced(:) = eigenval(:)
1338 1, 1, 1, 1, context)
1340 1, 1, 1, 1, context)
1342 1, 1, 1, 1, context)
1352 CALL timestop(handle)
1367 SUBROUTINE reshuffle_eigvec(fm_eigvec, fm_eigvec_reshuffled, homo, virtual, n_exc, do_transpose, &
1371 TYPE(
cp_fm_type),
INTENT(INOUT) :: fm_eigvec_reshuffled
1372 INTEGER,
INTENT(IN) :: homo, virtual, n_exc
1373 LOGICAL,
INTENT(IN) :: do_transpose
1374 INTEGER,
INTENT(IN) :: unit_nr
1375 TYPE(
mp2_type),
INTENT(INOUT) :: mp2_env
1377 CHARACTER(LEN=*),
PARAMETER :: routinen =
'reshuffle_eigvec'
1379 INTEGER :: handle, my_m_col, my_n_row
1380 INTEGER,
DIMENSION(4) :: reordering
1382 fm_struct_eigvec_reshuffled
1385 CALL timeset(routinen, handle)
1390 IF (do_transpose)
THEN
1391 reordering = [2, 3, 1, 4]
1395 reordering = [1, 3, 2, 4]
1401 fm_eigvec%matrix_struct%para_env, fm_eigvec%matrix_struct%context, &
1404 fm_eigvec%matrix_struct%para_env, fm_eigvec%matrix_struct%context, &
1408 CALL cp_fm_create(fm_eigvec_col, fm_struct_eigvec_col, name=
"BSE_column_vector")
1410 CALL cp_fm_create(fm_eigvec_reshuffled, fm_struct_eigvec_reshuffled, name=
"BSE_reshuffled_eigenvector")
1421 unit_nr, reordering, mp2_env)
1427 CALL timestop(handle)
1442 stride, append_cube, print_section)
1445 TYPE(
mo_set_type),
DIMENSION(:),
INTENT(IN) :: mos
1446 INTEGER,
INTENT(IN) :: istate
1447 CHARACTER(LEN=10) :: info_approximation
1448 INTEGER,
DIMENSION(:),
POINTER :: stride
1449 LOGICAL,
INTENT(IN) :: append_cube
1452 CHARACTER(LEN=*),
PARAMETER :: routinen =
'print_bse_nto_cubes'
1454 CHARACTER(LEN=default_path_length) :: filename, info_approx_trunc, &
1456 INTEGER :: handle, i, iset, nmo, unit_nr_cube
1470 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
1474 CALL timeset(routinen, handle)
1476 CALL get_qs_env(qs_env=qs_env, dft_control=dft_control, pw_env=pw_env)
1477 CALL pw_env_get(pw_env, auxbas_pw_pool=auxbas_pw_pool, pw_pools=pw_pools)
1478 CALL auxbas_pw_pool%create_pw(wf_r)
1479 CALL auxbas_pw_pool%create_pw(wf_g)
1484 my_pos_cube =
"REWIND"
1485 IF (append_cube)
THEN
1486 my_pos_cube =
"APPEND"
1490 atomic_kind_set=atomic_kind_set, &
1491 qs_kind_set=qs_kind_set, &
1493 particle_set=particle_set)
1496 CALL get_mo_set(mo_set=mos(iset), mo_coeff=mo_coeff, nmo=nmo)
1499 cell, dft_control, particle_set, pw_env)
1501 WRITE (filename,
'(A6,I3.3,A5,I2.2,a11)')
"_NEXC_", istate,
"_NTO_", i,
"_Hole_State"
1502 ELSE IF (iset == 2)
THEN
1503 WRITE (filename,
'(A6,I3.3,A5,I2.2,a15)')
"_NEXC_", istate,
"_NTO_", i,
"_Particle_State"
1505 info_approx_trunc = trim(adjustl(info_approximation))
1506 info_approx_trunc = info_approx_trunc(2:len_trim(info_approx_trunc) - 1)
1507 filename = trim(info_approx_trunc)//trim(filename)
1510 middle_name=trim(filename), file_position=my_pos_cube, &
1511 log_filename=.false., ignore_should_output=.true., mpi_io=mpi_io)
1513 WRITE (title, *)
"Natural Transition Orbital Hole State", i
1514 ELSE IF (iset == 2)
THEN
1515 WRITE (title, *)
"Natural Transition Orbital Particle State", i
1517 CALL cp_pw_to_cube(wf_r, unit_nr_cube, title, particles=particles, stride=stride, mpi_io=mpi_io)
1519 ignore_should_output=.true., mpi_io=mpi_io)
1523 CALL auxbas_pw_pool%give_back_pw(wf_g)
1524 CALL auxbas_pw_pool%give_back_pw(wf_r)
1526 CALL timestop(handle)
1539 INTEGER,
INTENT(IN) :: homo, virtual, unit_nr
1543 CHARACTER(LEN=*),
PARAMETER :: routinen =
'adapt_BSE_input_params'
1545 INTEGER :: handle, i, j, n, ndim_periodic_cell, &
1546 ndim_periodic_poisson, &
1547 num_state_list_exceptions
1552 CALL timeset(routinen, handle)
1554 NULLIFY (pw_env, cell_ref, poisson_env)
1555 CALL get_qs_env(qs_env, pw_env=pw_env, cell_ref=cell_ref)
1556 CALL pw_env_get(pw_env, poisson_env=poisson_env)
1557 ndim_periodic_poisson = count(poisson_env%parameters%periodic == 1)
1558 ndim_periodic_cell = sum(cell_ref%perd(1:3))
1561 IF (mp2_env%bse%num_print_exc < 0 .OR. &
1562 mp2_env%bse%num_print_exc > homo*virtual)
THEN
1563 mp2_env%bse%num_print_exc = homo*virtual
1564 IF (unit_nr > 0)
THEN
1565 CALL cp_hint(__location__, &
1566 "Keyword NUM_PRINT_EXC is either negative or too large. "// &
1567 "Printing all computed excitations.")
1577 IF (mp2_env%bse%do_nto_analysis)
THEN
1578 IF (mp2_env%bse%explicit_nto_list)
THEN
1579 IF (mp2_env%bse%num_print_exc_ntos > 0)
THEN
1580 IF (unit_nr > 0)
THEN
1581 CALL cp_hint(__location__, &
1582 "Keywords NUM_PRINT_EXC_NTOS and STATE_LIST are both given in input. "// &
1583 "Overriding NUM_PRINT_EXC_NTOS.")
1588 num_state_list_exceptions = 0
1589 DO i = 1,
SIZE(mp2_env%bse%bse_nto_state_list)
1590 IF (mp2_env%bse%bse_nto_state_list(i) < 1 .OR. &
1591 mp2_env%bse%bse_nto_state_list(i) > mp2_env%bse%num_print_exc)
THEN
1592 num_state_list_exceptions = num_state_list_exceptions + 1
1595 IF (num_state_list_exceptions > 0)
THEN
1596 IF (unit_nr > 0)
THEN
1597 CALL cp_hint(__location__, &
1598 "STATE_LIST contains indices outside the range of included excitation levels. "// &
1599 "Ignoring these states.")
1602 n =
SIZE(mp2_env%bse%bse_nto_state_list) - num_state_list_exceptions
1603 ALLOCATE (mp2_env%bse%bse_nto_state_list_final(n))
1604 mp2_env%bse%bse_nto_state_list_final(:) = 0
1606 DO j = 1,
SIZE(mp2_env%bse%bse_nto_state_list)
1607 IF (mp2_env%bse%bse_nto_state_list(j) >= 1 .AND. &
1608 mp2_env%bse%bse_nto_state_list(j) <= mp2_env%bse%num_print_exc)
THEN
1609 mp2_env%bse%bse_nto_state_list_final(i) = mp2_env%bse%bse_nto_state_list(j)
1614 mp2_env%bse%num_print_exc_ntos =
SIZE(mp2_env%bse%bse_nto_state_list_final)
1616 IF (mp2_env%bse%num_print_exc_ntos > mp2_env%bse%num_print_exc .OR. &
1617 mp2_env%bse%num_print_exc_ntos < 0)
THEN
1618 mp2_env%bse%num_print_exc_ntos = mp2_env%bse%num_print_exc
1620 ALLOCATE (mp2_env%bse%bse_nto_state_list_final(mp2_env%bse%num_print_exc_ntos))
1621 DO i = 1, mp2_env%bse%num_print_exc_ntos
1622 mp2_env%bse%bse_nto_state_list_final(i) = i
1628 IF (mp2_env%bse%bse_spin_config /= 0 .AND. &
1629 mp2_env%bse%eps_nto_osc_str > 0)
THEN
1630 IF (unit_nr > 0)
THEN
1631 CALL cp_warn(__location__, &
1632 "Cannot apply EPS_OSC_STR for Triplet excitations. "// &
1633 "Resetting EPS_OSC_STR to default.")
1635 mp2_env%bse%eps_nto_osc_str = -1.0_dp
1639 IF (mp2_env%bse%num_print_exc_descr < 0 .OR. &
1640 mp2_env%bse%num_print_exc_descr > mp2_env%bse%num_print_exc)
THEN
1641 IF (unit_nr > 0)
THEN
1642 CALL cp_hint(__location__, &
1643 "Keyword NUM_PRINT_EXC_DESCR is either negative or too large. "// &
1644 "Printing exciton descriptors up to NUM_PRINT_EXC.")
1646 mp2_env%bse%num_print_exc_descr = mp2_env%bse%num_print_exc
1650 IF (mp2_env%BSE%screening_factor > 0.0_dp)
THEN
1652 IF (unit_nr > 0)
THEN
1653 CALL cp_warn(__location__, &
1654 "Screening factor is only supported for &SCREENING_IN_W ALPHA. "// &
1655 "Resetting SCREENING_IN_W to ALPHA.")
1659 IF (mp2_env%BSE%screening_factor > 1.0_dp)
THEN
1660 IF (unit_nr > 0)
THEN
1661 CALL cp_warn(__location__, &
1662 "Screening factor is larger than 1.0. ")
1667 IF (mp2_env%BSE%screening_factor < 0.0_dp .AND. &
1669 IF (unit_nr > 0)
THEN
1670 CALL cp_warn(__location__, &
1671 "Screening factor is negative. Defaulting to 0.25")
1673 mp2_env%BSE%screening_factor = 0.25_dp
1676 IF (mp2_env%BSE%screening_factor == 0.0_dp)
THEN
1680 IF (mp2_env%BSE%screening_factor == 1.0_dp)
THEN
1686 IF (mp2_env%bse%use_ks_energies)
THEN
1687 IF (unit_nr > 0)
THEN
1688 CALL cp_warn(__location__, &
1689 "Using KS energies for BSE calculations. Therefore, no quantities "// &
1690 "of the preceeding GW calculation enter the BSE.")
1695 IF (ndim_periodic_poisson /= 0)
THEN
1696 IF (unit_nr > 0)
THEN
1697 CALL cp_warn(__location__, &
1698 "Poisson solver should be invoked by PERIODIC NONE. "// &
1699 "The applied length gauge might give misleading results for "// &
1700 "oscillator strengths.")
1703 IF (ndim_periodic_cell /= 0)
THEN
1704 IF (unit_nr > 0)
THEN
1705 CALL cp_warn(__location__, &
1706 "CELL in SUBSYS should be invoked with PERIODIC NONE. "// &
1707 "The applied length gauge might give misleading results for "// &
1708 "oscillator strengths.")
1712 CALL timestop(handle)
1732 qs_env, mo_coeff, rpoint, n_moments, &
1733 homo_red, virtual_red, context_BSE, ispin)
1735 TYPE(
cp_fm_type),
ALLOCATABLE,
DIMENSION(:), &
1736 INTENT(INOUT) :: fm_multipole_ai_trunc, &
1737 fm_multipole_ij_trunc, &
1738 fm_multipole_ab_trunc
1740 TYPE(
cp_fm_type),
DIMENSION(:),
INTENT(IN) :: mo_coeff
1741 REAL(
dp),
ALLOCATABLE,
DIMENSION(:),
INTENT(INOUT) :: rpoint
1742 INTEGER,
INTENT(IN) :: n_moments, homo_red, virtual_red
1744 INTEGER,
INTENT(IN),
OPTIONAL :: ispin
1746 CHARACTER(LEN=*),
PARAMETER :: routinen =
'get_multipoles_mo'
1748 INTEGER :: handle, idir, my_ispin, n_multipole, &
1749 n_occ, n_virt, nao, nmo_mp2
1750 REAL(kind=
dp),
DIMENSION(:),
POINTER :: ref_point
1751 TYPE(
cp_fm_struct_type),
POINTER :: fm_struct_mp_ab_trunc, fm_struct_mp_ai_trunc, &
1752 fm_struct_mp_ij_trunc, fm_struct_multipoles_ao, fm_struct_nao_nmo, fm_struct_nmo_nmo
1754 TYPE(
cp_fm_type),
ALLOCATABLE,
DIMENSION(:) :: fm_multipole_per_dir
1755 TYPE(
dbcsr_p_type),
DIMENSION(:),
POINTER :: matrix_multipole, matrix_s
1761 CALL timeset(routinen, handle)
1764 IF (
PRESENT(ispin)) my_ispin = ispin
1767 NULLIFY (sab_orb, matrix_s)
1770 matrix_s=matrix_s, &
1774 fm_struct_multipoles_ao => mos(my_ispin)%mo_coeff%matrix_struct
1776 para_env_bse => context_bse%para_env
1778 n_multipole = (6 + 11*n_moments + 6*n_moments**2 + n_moments**3)/6 - 1
1779 NULLIFY (matrix_multipole)
1781 ALLOCATE (fm_multipole_per_dir(n_multipole))
1782 DO idir = 1, n_multipole
1784 CALL dbcsr_create(matrix_multipole(idir)%matrix, name=
"ao_multipole", &
1785 template=matrix_s(1)%matrix, matrix_type=dbcsr_type_symmetric)
1787 CALL dbcsr_set(matrix_multipole(idir)%matrix, 0._dp)
1800 CALL get_mo_set(mo_set=mos(my_ispin), homo=n_occ, nao=nao)
1802 nmo_mp2 = mo_coeff(1)%matrix_struct%ncol_global
1803 n_virt = nmo_mp2 - n_occ
1816 fm_struct_multipoles_ao%para_env, fm_struct_multipoles_ao%context, &
1819 fm_struct_multipoles_ao%para_env, fm_struct_multipoles_ao%context, &
1824 context_bse, virtual_red, homo_red)
1826 context_bse, homo_red, homo_red)
1828 context_bse, virtual_red, virtual_red)
1829 DO idir = 1, n_multipole
1830 CALL cp_fm_create(fm_multipole_ai_trunc(idir), matrix_struct=fm_struct_mp_ai_trunc, &
1831 name=
"dipoles_mo_ai_trunc")
1833 CALL cp_fm_create(fm_multipole_ij_trunc(idir), matrix_struct=fm_struct_mp_ij_trunc, &
1834 name=
"dipoles_mo_ij_trunc")
1836 CALL cp_fm_create(fm_multipole_ab_trunc(idir), matrix_struct=fm_struct_mp_ab_trunc, &
1837 name=
"dipoles_mo_ab_trunc")
1843 CALL cp_fm_create(fm_work, matrix_struct=fm_struct_nao_nmo, name=
"multipole_work")
1846 DO idir = 1, n_multipole
1848 CALL cp_fm_create(fm_multipole_per_dir(idir), matrix_struct=fm_struct_nmo_nmo, name=
"multipoles_mo")
1852 fm_work, ncol=nmo_mp2)
1855 CALL parallel_gemm(
'T',
'N', nmo_mp2, nmo_mp2, nao, 1.0_dp, mo_coeff(1), fm_work, 0.0_dp, fm_multipole_per_dir(idir))
1860 fm_multipole_ai_trunc(idir), &
1864 n_occ - homo_red + 1, &
1867 fm_multipole_per_dir(idir)%matrix_struct%context)
1870 fm_multipole_ij_trunc(idir), &
1873 n_occ - homo_red + 1, &
1874 n_occ - homo_red + 1, &
1877 fm_multipole_per_dir(idir)%matrix_struct%context)
1880 fm_multipole_ab_trunc(idir), &
1887 fm_multipole_per_dir(idir)%matrix_struct%context)
1891 NULLIFY (fm_struct_multipoles_ao)
1897 DO idir = 1, n_multipole
1900 DEALLOCATE (fm_multipole_per_dir)
1904 CALL timestop(handle)
1917 TYPE(
cp_fm_type),
INTENT(IN) :: fm_a, fm_b, fm_c
1918 REAL(kind=
dp),
INTENT(OUT) :: alpha
1920 CHARACTER(LEN=*),
PARAMETER :: routinen =
'trace_exciton_descr'
1922 INTEGER :: handle, ncol_a, ncol_b, ncol_c, nrow_a, &
1926 CALL timeset(routinen, handle)
1929 CALL cp_fm_get_info(fm_a, nrow_global=nrow_a, ncol_global=ncol_a)
1930 CALL cp_fm_get_info(fm_b, nrow_global=nrow_b, ncol_global=ncol_b)
1931 CALL cp_fm_get_info(fm_c, nrow_global=nrow_c, ncol_global=ncol_c)
1934 cpassert(nrow_a == nrow_b .AND. ncol_a == ncol_c .AND. ncol_b == nrow_c)
1938 CALL parallel_gemm(
"N",
"N", nrow_a, ncol_a, nrow_c, 1.0_dp, &
1939 fm_b, fm_c, 0.0_dp, fm_work_ia)
1945 CALL timestop(handle)
1960 TYPE(
cp_fm_type),
DIMENSION(:),
INTENT(IN) :: fm_s_ia
1961 INTEGER,
DIMENSION(:),
INTENT(IN) :: offsets, n_ov
1962 INTEGER,
INTENT(IN) :: dimen_ri
1963 TYPE(
cp_fm_type),
INTENT(INOUT) :: fm_s_joint
1965 CHARACTER(LEN=*),
PARAMETER :: routinen =
'assemble_joint_ov_slab'
1967 INTEGER :: handle, isp
1969 CALL timeset(routinen, handle)
1970 DO isp = 1,
SIZE(fm_s_ia)
1971 CALL cp_fm_to_fm_submat(fm_s_ia(isp), fm_s_joint, dimen_ri, n_ov(isp), 1, 1, 1, offsets(isp) + 1)
1973 CALL timestop(handle)
Define the atomic kind types and their sub types.
Auxiliary routines for GW + Bethe-Salpeter for computing electronic excitations.
subroutine, public assemble_joint_ov_slab(fm_s_ia, offsets, n_ov, dimen_ri, fm_s_joint)
Column-concatenate per-spin ia-slabs into the joint dimen_RI x n_ov_joint slab. Sigma-block of spin i...
subroutine, public estimate_bse_resources(n_ov_joint, unit_nr, bse_abba, para_env, diag_runtime_est)
Roughly estimates the needed runtime and memory during the BSE run.
subroutine, public trace_exciton_descr(fm_a, fm_b, fm_c, alpha)
Computes trace of form Tr{A^T B C} for exciton descriptors.
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, row_offset, col_offset)
Adds and reorders full matrices with a combined index structure, e.g. adding W_ij,...
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, ispin)
...
subroutine, public truncate_fm(fm_out, fm_in, ncol_in, nrow_out, ncol_out, unit_nr, mp2_env, nrow_offset, ncol_offset)
Routine for truncating a full matrix as given by the energy cutoffs in the input file....
subroutine, public deallocate_matrices_bse(fm_mat_s_bar_ia_bse, fm_mat_s_bar_ij_bse, fm_mat_s_trunc, fm_mat_s_ij_trunc, fm_mat_s_ab_trunc, fm_mat_q_static_bse_gemm, mp2_env)
...
subroutine, public filter_eigvec_contrib(fm_eigvec, idx_homo, idx_virt, eigvec_entries, i_exc, virtual, num_entries, mp2_env, offsets, virtual_per_spin, idx_spin)
Filters eigenvector entries above a given threshold to describe excitations in the singleparticle bas...
subroutine, public reshuffle_eigvec(fm_eigvec, fm_eigvec_reshuffled, homo, virtual, n_exc, do_transpose, unit_nr, mp2_env)
...
subroutine, public mult_b_with_w(fm_mat_s_ij_bse, fm_mat_s_ia_bse, fm_mat_s_bar_ia_bse, fm_mat_s_bar_ij_bse, fm_mat_q_static_bse_gemm, dimen_ri, homo, virtual)
Multiplies B-matrix (RI-3c-Integrals) with W (screening) to obtain \bar{B}.
subroutine, public adapt_bse_input_params(homo, virtual, unit_nr, mp2_env, qs_env)
Checks BSE input section and adapts them if necessary.
subroutine, public get_bse_spin_block_layout(homo_red, virt_red, n_ov, offsets, n_ov_joint)
Spin-block layout for the open-shell (joint) BSE matrix: per-spin OV-pair counts and the block offset...
subroutine, public sort_excitations(idx_prim, idx_sec, eigvec_entries, idx_spin)
Sorts excitation entries by ascending primary index, reordering the secondary index,...
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...
subroutine, public print_bse_nto_cubes(qs_env, mos, istate, info_approximation, stride, append_cube, print_section)
Borrowed from the tddfpt module with slight adaptions.
subroutine, public truncate_bse_matrices(fm_mat_s_ia_bse, fm_mat_s_ij_bse, fm_mat_s_ab_bse, fm_mat_s_trunc, fm_mat_s_ij_trunc, fm_mat_s_ab_trunc, eigenval_scf, eigenval, eigenval_reduced, homo, virtual, dimen_ri, unit_nr, bse_lev_virt, homo_red, virt_red, mp2_env, window, print_window)
Determines indices within the given energy cutoffs and truncates Eigenvalues and matrices.
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_init_p(matrix)
...
subroutine, public dbcsr_set(matrix, alpha)
...
Routines that link DBCSR and CP2K concepts together.
subroutine, public cp_dbcsr_alloc_block_from_nbl(matrix, sab_orb, desymmetrize)
allocate the blocks of a dbcsr based on the neighbor list
DBCSR operations in CP2K.
subroutine, public cp_dbcsr_sm_fm_multiply(matrix, fm_in, fm_out, ncol, alpha, beta)
multiply a dbcsr with a fm matrix
Basic linear algebra operations for full matrices.
subroutine, public cp_fm_uplo_to_full(matrix, work, uplo)
given a triangular matrix according to uplo, computes the corresponding full matrix
various cholesky decomposition related routines
subroutine, public cp_fm_cholesky_invert(matrix, n, info_out)
used to replace the cholesky decomposition by the inverse
subroutine, public cp_fm_cholesky_decompose(matrix, n, info_out)
used to replace a symmetric positive def. matrix M with its cholesky decomposition U: M = U^T * U,...
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_to_fm_submat(msource, mtarget, nrow, ncol, s_firstrow, s_firstcol, t_firstrow, t_firstcol)
copy just a part ot the 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, nrow, ncol, set_zero)
creates a new full matrix with the given structure
various routines to log and control the output. The idea is that decisions about where to log should ...
type(cp_logger_type) function, pointer, public cp_get_default_logger()
returns the default logger
routines to handle the output, The idea is to remove the decision of wheter to output and what to out...
integer function, public cp_print_key_unit_nr(logger, basis_section, print_key_path, extension, middle_name, local, log_filename, ignore_should_output, file_form, file_position, file_action, file_status, do_backup, on_file, is_new_file, mpi_io, fout)
...
subroutine, public cp_print_key_finished_output(unit_nr, logger, basis_section, print_key_path, local, ignore_should_output, on_file, mpi_io)
should be called after you finish working with a unit obtained with cp_print_key_unit_nr,...
A wrapper around pw_to_cube() which accepts particle_list_type.
subroutine, public cp_pw_to_cube(pw, unit_nr, title, particles, zeff, stride, max_file_size_mb, zero_tails, silent, mpi_io)
...
Calculation of the incomplete Gamma function F_n(t) for multi-center integrals over Cartesian Gaussia...
Defines the basic variable types.
integer, parameter, public int_8
integer, parameter, public dp
integer, parameter, public default_path_length
Interface to the message passing library MPI.
Common selection and union operations for contiguous molecular-orbital windows.
Calculates the moment integrals <a|r^m|b>.
subroutine, public get_reference_point(rpoint, drpoint, qs_env, fist_env, reference, ref_point, ifirst, ilast)
...
Types needed for MP2 calculations.
basic linear algebra operations for full matrixes
represent a simple array based list of the given type
Define the data structure for the particle information.
Definition of physical constants:
real(kind=dp), parameter, public evolt
container for various plainwaves related things
subroutine, public pw_env_get(pw_env, pw_pools, cube_info, gridlevel_info, auxbas_pw_pool, auxbas_grid, auxbas_rs_desc, auxbas_rs_grid, rs_descs, rs_grids, xc_pw_pool, vdw_pw_pool, poisson_env, interp_section)
returns the various attributes of the pw env
functions related to the poisson solver on regular grids
Manages a pool of grids (to be used for example as tmp objects), but can also be used to instantiate ...
Calculate the plane wave density by collocating the primitive Gaussian functions (pgf).
subroutine, public calculate_wavefunction(mo_vectors, ivector, rho, rho_gspace, atomic_kind_set, qs_kind_set, cell, dft_control, particle_set, pw_env, basis_type)
maps a given wavefunction on the grid
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.
Definition and initialisation of the mo data type.
subroutine, public get_mo_set(mo_set, maxocc, homo, lfomo, nao, nelectron, n_el_f, nmo, eigenvalues, occupation_numbers, mo_coeff, mo_coeff_b, uniform_occupation, kts, mu, flexible_electron_count)
Get the components of a MO set data structure.
Calculates the moment integrals <a|r^m|b> and <a|r x d/dr|b>.
subroutine, public build_local_moment_matrix(qs_env, moments, nmoments, ref_point, ref_points, basis_type, all_images, minimum_image, neighbor_image, first_component)
...
Define the neighbor list data types and the corresponding functionality.
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 necessary to redistribute an fm_matrix from a given blacs_env to another.
subroutine, public communicate_buffer(para_env, num_entries_rec, num_entries_send, buffer_rec, buffer_send, req_array, do_indx, do_msg)
...
All kind of helpful little routines.
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...
keeps the information about the structure of a full matrix
type of a logger, at the moment it contains just a print level starting at which level it should be l...
stores all the informations relevant to an mpi environment
represent a list of objects
contained for different pw related things
environment for the poisson solver
to create arrays of pools
Manages a pool of grids (to be used for example as tmp objects), but can also be used to instantiate ...
Provides all information about a quickstep kind.