(git:c641773)
Loading...
Searching...
No Matches
qs_dispersion_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 Definition of disperson types for DFT calculations
10!> \author JGH (20.10.2008)
11! **************************************************************************************************
13
14 USE eeq_input, ONLY: eeq_solver_type
16 USE kinds, ONLY: default_path_length,&
18 dp
21#include "./base/base_uses.f90"
22
23 IMPLICIT NONE
24
25 PRIVATE
26
27 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'qs_dispersion_types'
28
29! **************************************************************************************************
30 INTEGER, PARAMETER :: dftd2_pp = 1
31 INTEGER, PARAMETER :: dftd3_pp = 2
32 INTEGER, PARAMETER :: dftd4_pp = 3
33
35 INTEGER :: TYPE = -1
36 INTEGER :: pp_type = -1
37 INTEGER :: nl_type = -1
38 CHARACTER(LEN=default_string_length) :: ref_functional = ""
39 REAL(kind=dp) :: scaling = -1.0_dp
40 REAL(kind=dp) :: rc_disp = -1.0_dp
41 REAL(kind=dp) :: rc_d4 = -1.0_dp
42 REAL(kind=dp) :: rc_cn = -1.0_dp
43 REAL(kind=dp) :: d4_cutoff_width = 0.05_dp
44 REAL(kind=dp) :: d4_3b_cutoff_width = 0.0_dp
45 REAL(kind=dp) :: exp_pre = -1.0_dp
46 TYPE(section_vals_type), POINTER :: dftd_section => null()
47 LOGICAL :: verbose = .false. !extended output
48 CHARACTER(LEN=default_path_length) :: parameter_file_name = ""
49 CHARACTER(LEN=default_path_length) :: kernel_file_name = ""
50 !charges
51 LOGICAL :: ext_charges = .false.
52 REAL(kind=dp), DIMENSION(:), POINTER :: charges => null() !charges for D4
53 REAL(kind=dp), DIMENSION(:), POINTER :: dcharges => null() !derivatives of D4 energy wrt charges
54 TYPE(eeq_solver_type) :: eeq_sparam ! parameters for EEQ solver
55 !DFT-D3 global parameters
56 INTEGER :: max_elem = -1 !elements parametrized
57 INTEGER :: maxc = -1 !max coordination number references per element
58 REAL(kind=dp) :: k1 = -1.0_dp, k2 = -1.0_dp, k3 = -1.0_dp !ad hoc parameters
59 REAL(kind=dp) :: alp = -1.0_dp !ad hoc parameters
60 REAL(kind=dp) :: s6 = -1.0_dp, s8 = -1.0_dp, sr6 = -1.0_dp !scaling parameters
61 REAL(kind=dp) :: sr8 = 1.0_dp !D3(0) C8 damping parameter
62 REAL(kind=dp) :: a1 = -1.0_dp, a2 = -1.0_dp !BJ scaling parameters
63 REAL(kind=dp) :: eps_cn = -1.0_dp
64 LOGICAL :: d4_reference_code = .false. !Use D4 calculation from ext. library
65 LOGICAL :: d4_debug = .false. !Output debug information for D4
66 LOGICAL :: d3_reference_code = .false. !Use D3 parameters from s-dftd3 library
67 LOGICAL :: d3_scaling_explicit = .false. !Scaling parameters were explicitly set
68 LOGICAL :: doabc = .false. !neglect C9 terms
69 LOGICAL :: c9cnst = .false. !use constant c9 terms
70 LOGICAL :: lrc = .false. !calculate a long range correction
71 LOGICAL :: srb = .false. !calculate a short range bond correction
72 REAL(kind=dp), DIMENSION(4) :: srb_params = -1.0_dp ! parameters for SRB (s,g,t1,t2)
73 REAL(kind=dp) :: s9 = -1.0_dp !scale the many-body dispersion energy (default=1.0), dftd4
75 DIMENSION(:), POINTER :: sab_vdw => null(), sab_cn => null() ! neighborlists for pair interactions
76 REAL(kind=dp), DIMENSION(:, :, :, :, :), POINTER &
77 :: c6ab => null()
78 INTEGER, DIMENSION(:), POINTER :: maxci => null()
79 REAL(kind=dp), DIMENSION(:, :), POINTER :: r0ab => null()
80 REAL(kind=dp), DIMENSION(:), POINTER :: rcov => null() !covalent radii
81 REAL(kind=dp), DIMENSION(:), POINTER :: eneg => null() !electronegativity
82 REAL(kind=dp), DIMENSION(:), POINTER :: r2r4 => null() !atomic <r^2>/<r^4> values
83 INTEGER :: cnfun = 1 ! CN function to be used
84 REAL(kind=dp), DIMENSION(:), POINTER :: cn => null()
85 TYPE(cn_kind_list), DIMENSION(:), POINTER :: cnkind => null()
86 TYPE(cn_atom_list), DIMENSION(:), POINTER :: cnlist => null()
87 ! KG molecular corrections
88 LOGICAL :: domol = .false.
89 REAL(kind=dp) :: kgc8 = -1.0_dp !s8 scaling parameter
90 !vdW-DF variables
91 REAL(kind=dp) :: pw_cutoff = -1.0_dp
92 !parameters for the rVV10 functional
93 REAL(kind=dp) :: b_value = -1.0_dp, c_value = -1.0_dp, scale_rvv10 = -1.0_dp
94 INTEGER :: nqs = -1, nr_points = -1
95 !! The number of q points and radial points
96 !! used in generating the kernel phi(q1*r, q2*r)
97 !! (see DION 14-16 and SOLER 3)
98 REAL(kind=dp) :: r_max = -1.0_dp, q_cut = -1.0_dp, q_min = -1.0_dp, dk = -1.0_dp
99 !! The maximum value of r, the maximum and minimum
100 !! values of q and the k-space spacing of grid points.
101 !! Note that, during a vdW run, values of q0 found
102 !! larger than q_cut will be saturated (SOLER 6-7) to
103 !! q_cut
104 REAL(kind=dp), DIMENSION(:), POINTER :: q_mesh => null() !! The values of all the q points used
105 REAL(kind=dp), DIMENSION(:, :, :), POINTER &
106 :: kernel_table => null() !! Fourier transformed kernel and its second radial derivatives
107 !! kernel_table(q1*(q1 - 1)/2 + q2, k_point, itable), with q2 <= q1 and k_point starting at zero.
108 !! itable = 1 for kernel values and 2 for second derivatives.
109 REAL(kind=dp), DIMENSION(:, :), POINTER :: d2y_dx2 => null() !! 2nd derivatives of q_mesh for interpolation
110 INTEGER, DIMENSION(:, :), POINTER :: d3_exclude_pair => null()
111 INTEGER :: nd3_exclude_pair = -1
112 END TYPE qs_dispersion_type
113
115 INTEGER :: TYPE = -1
116 LOGICAL :: defined = .false.
117 REAL(kind=dp) :: vdw_radii = -1.0_dp !van der Waals radii
118 REAL(kind=dp) :: c6 = -1.0_dp !c6 coefficients
120
121 TYPE cn_kind_list
122 REAL(kind=dp) :: cnum = -1.0_dp
123 INTEGER :: kind = -1
124 END TYPE cn_kind_list
125 TYPE cn_atom_list
126 REAL(kind=dp) :: cnum = -1.0_dp
127 INTEGER :: natom = -1
128 INTEGER, DIMENSION(:), POINTER :: atom => null()
129 END TYPE cn_atom_list
130
131! **************************************************************************************************
132
134 PUBLIC :: dftd2_pp, dftd3_pp, dftd4_pp
135 PUBLIC :: qs_dispersion_release
136
137! **************************************************************************************************
138CONTAINS
139! **************************************************************************************************
140!> \brief ...
141!> \param dispersion_env ...
142! **************************************************************************************************
143 SUBROUTINE qs_dispersion_release(dispersion_env)
144
145 TYPE(qs_dispersion_type), POINTER :: dispersion_env
146
147 INTEGER :: i
148
149 IF (ASSOCIATED(dispersion_env)) THEN
150 ! DFT-D3 arrays
151 IF (ASSOCIATED(dispersion_env%maxci)) THEN
152 DEALLOCATE (dispersion_env%maxci)
153 END IF
154 IF (ASSOCIATED(dispersion_env%c6ab)) THEN
155 DEALLOCATE (dispersion_env%c6ab)
156 END IF
157 IF (ASSOCIATED(dispersion_env%r0ab)) THEN
158 DEALLOCATE (dispersion_env%r0ab)
159 END IF
160 IF (ASSOCIATED(dispersion_env%rcov)) THEN
161 DEALLOCATE (dispersion_env%rcov)
162 END IF
163 IF (ASSOCIATED(dispersion_env%eneg)) THEN
164 DEALLOCATE (dispersion_env%eneg)
165 END IF
166 IF (ASSOCIATED(dispersion_env%r2r4)) THEN
167 DEALLOCATE (dispersion_env%r2r4)
168 END IF
169 IF (ASSOCIATED(dispersion_env%cn)) THEN
170 DEALLOCATE (dispersion_env%cn)
171 END IF
172 IF (ASSOCIATED(dispersion_env%cnkind)) THEN
173 DEALLOCATE (dispersion_env%cnkind)
174 END IF
175 IF (ASSOCIATED(dispersion_env%cnlist)) THEN
176 DO i = 1, SIZE(dispersion_env%cnlist)
177 DEALLOCATE (dispersion_env%cnlist(i)%atom)
178 END DO
179 DEALLOCATE (dispersion_env%cnlist)
180 END IF
181 ! vdD-DF
182 IF (ASSOCIATED(dispersion_env%q_mesh)) THEN
183 DEALLOCATE (dispersion_env%q_mesh)
184 END IF
185 IF (ASSOCIATED(dispersion_env%kernel_table)) THEN
186 DEALLOCATE (dispersion_env%kernel_table)
187 END IF
188 IF (ASSOCIATED(dispersion_env%d2y_dx2)) THEN
189 DEALLOCATE (dispersion_env%d2y_dx2)
190 END IF
191 IF (ASSOCIATED(dispersion_env%d3_exclude_pair)) THEN
192 DEALLOCATE (dispersion_env%d3_exclude_pair)
193 END IF
194 ! neighborlists
195 CALL release_neighbor_list_sets(dispersion_env%sab_vdw)
196 CALL release_neighbor_list_sets(dispersion_env%sab_cn)
197 ! charges
198 IF (ASSOCIATED(dispersion_env%charges)) THEN
199 DEALLOCATE (dispersion_env%charges)
200 END IF
201 IF (ASSOCIATED(dispersion_env%dcharges)) THEN
202 DEALLOCATE (dispersion_env%dcharges)
203 END IF
204
205 DEALLOCATE (dispersion_env)
206
207 END IF
208
209 END SUBROUTINE qs_dispersion_release
210
211END MODULE qs_dispersion_types
Definition atom.F:9
Input definition and setup for EEQ model.
Definition eeq_input.F:12
objects that represent the structure of input sections and the data contained in an input section
Defines the basic variable types.
Definition kinds.F:23
integer, parameter, public dp
Definition kinds.F:34
integer, parameter, public default_string_length
Definition kinds.F:57
integer, parameter, public default_path_length
Definition kinds.F:58
Definition of disperson types for DFT calculations.
integer, parameter, public dftd2_pp
integer, parameter, public dftd4_pp
subroutine, public qs_dispersion_release(dispersion_env)
...
integer, parameter, public dftd3_pp
Define the neighbor list data types and the corresponding functionality.
subroutine, public release_neighbor_list_sets(nlists)
releases an array of neighbor_list_sets