(git:691081d)
Loading...
Searching...
No Matches
gw_auto_ri_types.F
Go to the documentation of this file.
1!--------------------------------------------------------------------------------------------------!
2! CP2K: A general program to perform molecular dynamics simulations !
3! Copyright 2000-2026 CP2K developers group <https://cp2k.org> !
4! !
5! SPDX-License-Identifier: GPL-2.0-or-later !
6!--------------------------------------------------------------------------------------------------!
7
8! **************************************************************************************************
9!> \brief Input and persistent data for automatic RI basis optimization.
10!> \par History
11!> 09.2026 created [Jan Wilhelm]
12! **************************************************************************************************
14 USE base_hooks, ONLY: timeset,&
16 USE cp_fm_types, ONLY: cp_fm_release,&
18 USE kinds, ONLY: dp
19
20 IMPLICIT NONE
21 PRIVATE
22
23 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'gw_auto_ri_types'
24
26
28
29 ! Input parameters.
30 REAL(kind=dp) :: occ_energy_window = -1.0_dp
31 REAL(kind=dp) :: neighbor_radius = -1.0_dp
32 LOGICAL :: enabled = .false.
33 REAL(kind=dp) :: ri_ao_ratio = -1.0_dp
34
35 ! Two-center matrices M_pq and V_pq of optimized RI basis set
36 TYPE(cp_fm_type) :: v_pq = cp_fm_type()
37 TYPE(cp_fm_type) :: m_pq_inv = cp_fm_type()
38 LOGICAL :: ready = .false.
39 INTEGER, ALLOCATABLE :: sizes_opt_ri(:)
40
41 ! U_Pp_AB contains the RI-basis contraction coefficients:
42 ! for A=B: φ_p^A(r) = Σ_P U_Pp^AA φ_P^A(r) (φ_P^A(r): large ref. RI basis)
43 ! for A≠B: φ_p^AB(r) = Σ_P U_Pp^AB φ_P^AB^⊥(r) (see forthcoming paper)
44 ! RI basis contains contractions of Gaussians on neighboring atoms!!
45 REAL(kind=dp), ALLOCATABLE :: u_pp_ab(:)
46 INTEGER :: ab_block_count = 0
47 INTEGER, ALLOCATABLE :: ab_atom_a(:), ab_atom_b(:)
48 INTEGER, ALLOCATABLE :: ab_first_p_a(:), ab_first_p_b(:)
49 INTEGER, ALLOCATABLE :: ab_size_opt_ri_to_a(:)
50 INTEGER, ALLOCATABLE :: ab_size_ref_ri(:)
51 INTEGER, ALLOCATABLE :: ab_size_opt_ri(:)
52 INTEGER, ALLOCATABLE :: u_pp_ab_offset(:)
53
54 END TYPE auto_ri_type
55
56CONTAINS
57
58! **************************************************************************************************
59!> \brief Releases all data owned by an optimized AUTO_RI basis.
60!> \param auto_ri AUTO_RI input and optimized-basis data
61! **************************************************************************************************
62 SUBROUTINE auto_ri_release(auto_ri)
63 TYPE(auto_ri_type), INTENT(INOUT) :: auto_ri
64
65 CHARACTER(LEN=*), PARAMETER :: routinen = 'auto_ri_release'
66
67 INTEGER :: handle
68
69 CALL timeset(routinen, handle)
70
71 IF (ALLOCATED(auto_ri%sizes_opt_RI)) DEALLOCATE (auto_ri%sizes_opt_RI)
72 IF (ALLOCATED(auto_ri%AB_atom_A)) DEALLOCATE (auto_ri%AB_atom_A)
73 IF (ALLOCATED(auto_ri%AB_atom_B)) DEALLOCATE (auto_ri%AB_atom_B)
74 IF (ALLOCATED(auto_ri%AB_first_p_A)) DEALLOCATE (auto_ri%AB_first_p_A)
75 IF (ALLOCATED(auto_ri%AB_first_p_B)) DEALLOCATE (auto_ri%AB_first_p_B)
76 IF (ALLOCATED(auto_ri%AB_size_opt_RI_to_A)) DEALLOCATE (auto_ri%AB_size_opt_RI_to_A)
77 IF (ALLOCATED(auto_ri%AB_size_ref_RI)) DEALLOCATE (auto_ri%AB_size_ref_RI)
78 IF (ALLOCATED(auto_ri%AB_size_opt_RI)) DEALLOCATE (auto_ri%AB_size_opt_RI)
79 IF (ALLOCATED(auto_ri%U_Pp_AB_offset)) DEALLOCATE (auto_ri%U_Pp_AB_offset)
80 IF (ALLOCATED(auto_ri%U_Pp_AB)) DEALLOCATE (auto_ri%U_Pp_AB)
81 CALL cp_fm_release(auto_ri%V_pq)
82 CALL cp_fm_release(auto_ri%M_pq_inv)
83 auto_ri%AB_block_count = 0
84 auto_ri%ready = .false.
85
86 CALL timestop(handle)
87
88 END SUBROUTINE auto_ri_release
89
90END MODULE gw_auto_ri_types
Central dispatch for basic hooks.
Definition base_hooks.F:12
subroutine, public timeset(routinen, handle)
Start timer.
Definition base_hooks.F:127
subroutine, public timestop(handle)
Stop timer.
Definition base_hooks.F:143
represent a full matrix distributed on many processors
Definition cp_fm_types.F:15
Input and persistent data for automatic RI basis optimization.
subroutine, public auto_ri_release(auto_ri)
Releases all data owned by an optimized AUTO_RI basis.
Defines the basic variable types.
Definition kinds.F:23
integer, parameter, public dp
Definition kinds.F:34
represent a full matrix