Line data Source code
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 : ! **************************************************************************************************
13 : MODULE gw_auto_ri_types
14 : USE base_hooks, ONLY: timeset,&
15 : timestop
16 : USE cp_fm_types, ONLY: cp_fm_release,&
17 : cp_fm_type
18 : USE kinds, ONLY: dp
19 :
20 : IMPLICIT NONE
21 : PRIVATE
22 :
23 : CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'gw_auto_ri_types'
24 :
25 : PUBLIC :: auto_ri_release, auto_ri_type
26 :
27 : TYPE auto_ri_type
28 :
29 : ! Input parameters.
30 : REAL(KIND=dp) :: occ_energy_window = -1.0_dp
31 : LOGICAL :: enabled = .FALSE.
32 : REAL(KIND=dp) :: ri_ao_ratio = -1.0_dp
33 :
34 : ! Two-center matrices M_pq and V_pq of optimized RI basis set
35 : TYPE(cp_fm_type) :: V_pq = cp_fm_type()
36 : TYPE(cp_fm_type) :: M_pq_inv = cp_fm_type()
37 : LOGICAL :: ready = .FALSE.
38 : INTEGER, ALLOCATABLE :: sizes_opt_RI(:)
39 : INTEGER, ALLOCATABLE :: sizes_ref_RI(:)
40 : REAL(KIND=dp), ALLOCATABLE :: U_Pp_atom(:)
41 : INTEGER, ALLOCATABLE :: U_Pp_atom_offset(:)
42 :
43 : END TYPE auto_ri_type
44 :
45 : CONTAINS
46 :
47 : ! **************************************************************************************************
48 : !> \brief Releases all data owned by an optimized AUTO_RI basis.
49 : !> \param auto_ri AUTO_RI input and optimized-basis data
50 : ! **************************************************************************************************
51 158 : SUBROUTINE auto_ri_release(auto_ri)
52 : TYPE(auto_ri_type), INTENT(INOUT) :: auto_ri
53 :
54 : CHARACTER(LEN=*), PARAMETER :: routineN = 'auto_ri_release'
55 :
56 : INTEGER :: handle
57 :
58 158 : CALL timeset(routineN, handle)
59 :
60 158 : IF (ALLOCATED(auto_ri%sizes_opt_RI)) DEALLOCATE (auto_ri%sizes_opt_RI)
61 158 : IF (ALLOCATED(auto_ri%sizes_ref_RI)) DEALLOCATE (auto_ri%sizes_ref_RI)
62 158 : IF (ALLOCATED(auto_ri%U_Pp_atom)) DEALLOCATE (auto_ri%U_Pp_atom)
63 158 : IF (ALLOCATED(auto_ri%U_Pp_atom_offset)) DEALLOCATE (auto_ri%U_Pp_atom_offset)
64 158 : CALL cp_fm_release(auto_ri%V_pq)
65 158 : CALL cp_fm_release(auto_ri%M_pq_inv)
66 158 : auto_ri%ready = .FALSE.
67 :
68 158 : CALL timestop(handle)
69 :
70 158 : END SUBROUTINE auto_ri_release
71 :
72 0 : END MODULE gw_auto_ri_types
|