(git:8dea62c)
Loading...
Searching...
No Matches
tblite_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 types for tblite
10!> \author JVP
11!> \history creation 09.2024
12! **************************************************************************************************
13
15
16#if defined(__TBLITE)
17 USE mctc_io, ONLY: structure_type, new
18 USE tblite_xtb_calculator, ONLY: xtb_calculator
19 USE tblite_container, ONLY: container_cache
20 USE tblite_scf_mixer, ONLY: mixer_type
21 USE tblite_wavefunction_type, ONLY: wavefunction_type
22 USE tblite_scf_potential, ONLY: potential_type
23 USE tblite_param, ONLY: param_record
24#endif
25
26 USE cp_dbcsr_api, ONLY: dbcsr_p_type
35 USE kinds, ONLY: dp
36
37#include "./base/base_uses.f90"
38 IMPLICIT NONE
39
40 PRIVATE
41
42 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'tblite_types'
43
45
47
48 LOGICAL :: use_virial = .false.
49 INTEGER, ALLOCATABLE :: el_num(:)
50
51 REAL(kind=dp) :: accuracy = 1.0_dp
52 REAL(kind=dp), DIMENSION(3, 3) :: sigma = -1.0_dp
53 REAL(kind=dp), ALLOCATABLE :: e_hal(:)
54 REAL(kind=dp), ALLOCATABLE :: e_rep(:)
55 REAL(kind=dp), ALLOCATABLE :: e_disp(:)
56 REAL(kind=dp), ALLOCATABLE :: e_scd(:)
57 REAL(kind=dp), ALLOCATABLE :: e_es(:)
58 REAL(kind=dp), ALLOCATABLE :: e_int(:)
59 REAL(kind=dp), ALLOCATABLE :: selfenergy(:)
60 REAL(kind=dp), ALLOCATABLE :: cn(:)
61
62 REAL(kind=dp), ALLOCATABLE :: grad(:, :)
63 !derivatives w. r. t. coordination number
64 REAL(kind=dp), ALLOCATABLE :: dsedcn(:)
65 REAL(kind=dp), ALLOCATABLE :: dcndr(:, :, :)
66 REAL(kind=dp), ALLOCATABLE :: dcndl(:, :, :)
67
68 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: dipbra => null(), &
69 dipket => null()
70 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: quadbra => null(), &
71 quadket => null()
72 TYPE(dbcsr_p_type), DIMENSION(:, :), POINTER :: rho_ao_kp_ref => null()
73 INTEGER :: mixer_memory = tblite_mixer_iterations_default
74 INTEGER :: mixer_solver = tblite_solver_gvd
75 REAL(kind=dp) :: mixer_damping = tblite_mixer_damping_default
76 REAL(kind=dp) :: mixer_max_weight = tblite_mixer_max_weight_default
77 REAL(kind=dp) :: mixer_min_weight = tblite_mixer_min_weight_default
78 REAL(kind=dp) :: mixer_omega0 = tblite_mixer_omega0_default
79 REAL(kind=dp) :: mixer_weight_factor = tblite_mixer_weight_factor_default
80
81#if defined(__TBLITE)
82 TYPE(structure_type) :: mol = structure_type()
83 TYPE(xtb_calculator) :: calc = xtb_calculator()
84 TYPE(container_cache) :: cache = container_cache()
85 TYPE(container_cache) :: dcache = container_cache()
86 TYPE(container_cache) :: icache = container_cache()
87 TYPE(wavefunction_type) :: wfn = wavefunction_type()
88 TYPE(potential_type) :: pot = potential_type()
89 CLASS(mixer_type), ALLOCATABLE :: mixer
90 TYPE(param_record), ALLOCATABLE :: param
91#endif
92
93 END TYPE tblite_type
94
95CONTAINS
96
97! **************************************************************************************************
98!> \brief ...
99!> \param tb_tblite ...
100! **************************************************************************************************
101 SUBROUTINE allocate_tblite_type(tb_tblite)
102
103 TYPE(tblite_type), POINTER :: tb_tblite
104
105 CALL deallocate_tblite_type(tb_tblite)
106
107 ALLOCATE (tb_tblite)
108
109 END SUBROUTINE allocate_tblite_type
110
111! **************************************************************************************************
112!> \brief ...
113!> \param tb_tblite ...
114! **************************************************************************************************
115 SUBROUTINE deallocate_tblite_type(tb_tblite)
116
117 TYPE(tblite_type), POINTER :: tb_tblite
118
119 IF (ASSOCIATED(tb_tblite)) THEN
120 IF (ALLOCATED(tb_tblite%el_num)) DEALLOCATE (tb_tblite%el_num)
121
122 IF (ALLOCATED(tb_tblite%e_hal)) DEALLOCATE (tb_tblite%e_hal)
123 IF (ALLOCATED(tb_tblite%e_rep)) DEALLOCATE (tb_tblite%e_rep)
124 IF (ALLOCATED(tb_tblite%e_disp)) DEALLOCATE (tb_tblite%e_disp)
125 IF (ALLOCATED(tb_tblite%e_scd)) DEALLOCATE (tb_tblite%e_scd)
126 IF (ALLOCATED(tb_tblite%e_es)) DEALLOCATE (tb_tblite%e_es)
127 IF (ALLOCATED(tb_tblite%e_int)) DEALLOCATE (tb_tblite%e_int)
128 IF (ALLOCATED(tb_tblite%selfenergy)) DEALLOCATE (tb_tblite%selfenergy)
129 IF (ALLOCATED(tb_tblite%cn)) DEALLOCATE (tb_tblite%cn)
130
131 IF (ALLOCATED(tb_tblite%grad)) DEALLOCATE (tb_tblite%grad)
132 IF (ALLOCATED(tb_tblite%dsedcn)) DEALLOCATE (tb_tblite%dsedcn)
133 IF (ALLOCATED(tb_tblite%dcndr)) DEALLOCATE (tb_tblite%dcndr)
134 IF (ALLOCATED(tb_tblite%dcndL)) DEALLOCATE (tb_tblite%dcndL)
135
136 IF (ASSOCIATED(tb_tblite%dipbra)) &
137 CALL dbcsr_deallocate_matrix_set(tb_tblite%dipbra)
138 IF (ASSOCIATED(tb_tblite%dipket)) &
139 CALL dbcsr_deallocate_matrix_set(tb_tblite%dipket)
140 IF (ASSOCIATED(tb_tblite%quadbra)) &
141 CALL dbcsr_deallocate_matrix_set(tb_tblite%quadbra)
142 IF (ASSOCIATED(tb_tblite%quadket)) &
143 CALL dbcsr_deallocate_matrix_set(tb_tblite%quadket)
144 IF (ASSOCIATED(tb_tblite%rho_ao_kp_ref)) &
145 CALL dbcsr_deallocate_matrix_set(tb_tblite%rho_ao_kp_ref)
146#if defined(__TBLITE)
147 IF (ALLOCATED(tb_tblite%mixer)) DEALLOCATE (tb_tblite%mixer)
148 IF (ALLOCATED(tb_tblite%param)) DEALLOCATE (tb_tblite%param)
149#endif
150
151 DEALLOCATE (tb_tblite)
152 END IF
153
154 END SUBROUTINE deallocate_tblite_type
155
156END MODULE tblite_types
DBCSR operations in CP2K.
collects all constants needed in input so that they can be used without circular dependencies
integer, parameter, public tblite_solver_gvd
real(kind=dp), parameter, public tblite_mixer_damping_default
integer, parameter, public tblite_mixer_iterations_default
real(kind=dp), parameter, public tblite_mixer_max_weight_default
real(kind=dp), parameter, public tblite_mixer_omega0_default
real(kind=dp), parameter, public tblite_mixer_weight_factor_default
real(kind=dp), parameter, public tblite_mixer_min_weight_default
Defines the basic variable types.
Definition kinds.F:23
integer, parameter, public dp
Definition kinds.F:34
types for tblite
subroutine, public allocate_tblite_type(tb_tblite)
...
subroutine, public deallocate_tblite_type(tb_tblite)
...