(git:374b731)
Loading...
Searching...
No Matches
semi_empirical_utils.F
Go to the documentation of this file.
1!--------------------------------------------------------------------------------------------------!
2! CP2K: A general program to perform molecular dynamics simulations !
3! Copyright 2000-2024 CP2K developers group <https://cp2k.org> !
4! !
5! SPDX-License-Identifier: GPL-2.0-or-later !
6!--------------------------------------------------------------------------------------------------!
7
8! **************************************************************************************************
9!> \brief Working with the semi empirical parameter types.
10!> \author JGH (14.08.2004)
11! **************************************************************************************************
17 USE cell_types, ONLY: cell_type,&
20 USE input_constants, ONLY: &
25 USE kinds, ONLY: dp
29 USE semi_empirical_parameters, ONLY: &
35#include "./base/base_uses.f90"
36
37 IMPLICIT NONE
38
39 PRIVATE
40
41 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'semi_empirical_utils'
42
45
46CONTAINS
47! **************************************************************************************************
48!> \brief Reset cutoffs trying to be somehow a bit smarter
49!> \param se_control ...
50!> \param se_section ...
51!> \param cell ...
52!> \param output_unit ...
53!> \author Teodoro Laino [tlaino] - 03.2009
54! **************************************************************************************************
55 SUBROUTINE se_cutoff_compatible(se_control, se_section, cell, output_unit)
56 TYPE(semi_empirical_control_type), POINTER :: se_control
57 TYPE(section_vals_type), POINTER :: se_section
58 TYPE(cell_type), POINTER :: cell
59 INTEGER, INTENT(IN) :: output_unit
60
61 LOGICAL :: explicit1, explicit2
62 REAL(kind=dp) :: rc
63
64! Coulomb Cutoff Taper
65
66 CALL section_vals_val_get(se_section, "COULOMB%CUTOFF", explicit=explicit1)
67 CALL section_vals_val_get(se_section, "COULOMB%RC_TAPER", explicit=explicit2)
68 IF ((.NOT. explicit1) .AND. se_control%do_ewald_gks) THEN
69 rc = max(0.5*plane_distance(1, 0, 0, cell), &
70 0.5*plane_distance(0, 1, 0, cell), &
71 0.5*plane_distance(0, 0, 1, cell))
72 IF (rc /= se_control%cutoff_cou) THEN
73 IF (output_unit > 0) THEN
74 WRITE (output_unit, *)
75 WRITE (output_unit, '(A,T37,A)') " SEMIEMPIRICAL|", &
76 " Coulomb Integral cutoff/taper was redefined"
77 WRITE (output_unit, '(A,T71,F10.3)') " SEMIEMPIRICAL| Old value [a.u.]", &
78 se_control%cutoff_cou
79 WRITE (output_unit, '(A,T71,F10.3)') " SEMIEMPIRICAL| New value [a.u.]", rc
80 WRITE (output_unit, *)
81 END IF
82 END IF
83 se_control%cutoff_cou = rc
84 IF (.NOT. explicit2) se_control%taper_cou = rc
85 ELSE IF ((.NOT. explicit1) .AND. (all(cell%perd == 0))) THEN
86 rc = max(plane_distance(1, 0, 0, cell), &
87 plane_distance(0, 1, 0, cell), &
88 plane_distance(0, 0, 1, cell))
89 IF (rc /= se_control%cutoff_cou) THEN
90 IF (output_unit > 0) THEN
91 WRITE (output_unit, *)
92 WRITE (output_unit, '(A,T37,A)') " SEMIEMPIRICAL|", &
93 " Coulomb Integral cutoff/taper was redefined"
94 WRITE (output_unit, '(A,T71,F10.3)') " SEMIEMPIRICAL| Old value [a.u.]", &
95 se_control%cutoff_cou
96 WRITE (output_unit, '(A,T71,F10.3)') " SEMIEMPIRICAL| New value [a.u.]", rc
97 WRITE (output_unit, *)
98 END IF
99 END IF
100 se_control%cutoff_cou = rc
101 IF (.NOT. explicit2) se_control%taper_cou = rc
102 END IF
103 IF (output_unit > 0) THEN
104 WRITE (output_unit, *)
105 WRITE (output_unit, '(A,T44,A)') " SEMIEMPIRICAL|", &
106 " Coulomb Integral cutoff/taper values"
107 WRITE (output_unit, '(A,T71,F10.3)') " SEMIEMPIRICAL| Cutoff [a.u.]", &
108 se_control%cutoff_cou
109 WRITE (output_unit, '(A,T71,F10.3)') " SEMIEMPIRICAL| Taper [a.u.]", &
110 se_control%taper_cou
111 WRITE (output_unit, '(A,T71,F10.3)') " SEMIEMPIRICAL| Range [a.u.]", &
112 se_control%range_cou
113 WRITE (output_unit, *)
114 END IF
115 ! Exchange Cutoff Taper
116 CALL section_vals_val_get(se_section, "EXCHANGE%CUTOFF", explicit=explicit1)
117 CALL section_vals_val_get(se_section, "EXCHANGE%RC_TAPER", explicit=explicit2)
118 rc = se_control%cutoff_exc
119 IF (.NOT. explicit1) THEN
120 rc = min(rc, max(0.25_dp*plane_distance(1, 0, 0, cell), &
121 0.25_dp*plane_distance(0, 1, 0, cell), &
122 0.25_dp*plane_distance(0, 0, 1, cell)))
123
124 IF (rc /= se_control%cutoff_exc) THEN
125 IF (output_unit > 0) THEN
126 WRITE (output_unit, *)
127 WRITE (output_unit, '(A,T36,A)') " SEMIEMPIRICAL|", &
128 " Exchange Integral cutoff/taper was redefined"
129 WRITE (output_unit, '(A,T71,F10.3)') " SEMIEMPIRICAL| Default value [a.u.]", &
130 se_control%cutoff_exc
131 WRITE (output_unit, '(A,T71,F10.3)') " SEMIEMPIRICAL| New value [a.u.]", rc
132 WRITE (output_unit, *)
133 END IF
134 END IF
135 END IF
136 se_control%cutoff_exc = rc
137 IF (.NOT. explicit2) se_control%taper_exc = rc
138
139 IF (output_unit > 0) THEN
140 WRITE (output_unit, *)
141 WRITE (output_unit, '(A,T43,A)') " SEMIEMPIRICAL|", &
142 " Exchange Integral cutoff/taper values"
143 WRITE (output_unit, '(A,T71,F10.3)') " SEMIEMPIRICAL| Cutoff [a.u.]", &
144 se_control%cutoff_exc
145 WRITE (output_unit, '(A,T71,F10.3)') " SEMIEMPIRICAL| Taper [a.u.]", &
146 se_control%taper_exc
147 WRITE (output_unit, '(A,T71,F10.3)') " SEMIEMPIRICAL| Range [a.u.]", &
148 se_control%range_exc
149 WRITE (output_unit, *)
150 END IF
151
152 END SUBROUTINE se_cutoff_compatible
153
154! **************************************************************************************************
155!> \brief Initializes the semi-empirical taper for a chunk calculation
156!> \param se_taper ...
157!> \param coulomb ...
158!> \param exchange ...
159!> \param lr_corr ...
160!> \author Teodoro Laino [tlaino] - 03.2009
161! **************************************************************************************************
162 SUBROUTINE initialize_se_taper(se_taper, coulomb, exchange, lr_corr)
163 TYPE(se_taper_type), POINTER :: se_taper
164 LOGICAL, INTENT(IN), OPTIONAL :: coulomb, exchange, lr_corr
165
166 LOGICAL :: check, l_coulomb, l_exchange, l_lrc
167
168 check = .NOT. ASSOCIATED(se_taper%taper)
169 cpassert(check)
170 l_coulomb = .false.
171 l_exchange = .false.
172 l_lrc = .false.
173 IF (PRESENT(coulomb)) l_coulomb = coulomb
174 IF (PRESENT(exchange)) l_exchange = exchange
175 IF (PRESENT(lr_corr)) l_lrc = lr_corr
176 IF (l_coulomb) THEN
177 check = (.NOT. l_exchange) .AND. (.NOT. l_lrc)
178 cpassert(check)
179 se_taper%taper => se_taper%taper_cou
180 END IF
181 IF (l_exchange) THEN
182 check = (.NOT. l_coulomb) .AND. (.NOT. l_lrc)
183 cpassert(check)
184 se_taper%taper => se_taper%taper_exc
185 END IF
186 IF (l_lrc) THEN
187 check = (.NOT. l_coulomb) .AND. (.NOT. l_exchange)
188 cpassert(check)
189 se_taper%taper => se_taper%taper_lrc
190 END IF
191 END SUBROUTINE initialize_se_taper
192
193! **************************************************************************************************
194!> \brief Finalizes the semi-empirical taper for a chunk calculation
195!> \param se_taper ...
196!> \author Teodoro Laino [tlaino] - 03.2009
197! **************************************************************************************************
198 SUBROUTINE finalize_se_taper(se_taper)
199 TYPE(se_taper_type), POINTER :: se_taper
200
201 LOGICAL :: check
202
203 check = ASSOCIATED(se_taper%taper)
204 cpassert(check)
205 NULLIFY (se_taper%taper)
206 END SUBROUTINE finalize_se_taper
207
208! **************************************************************************************************
209!> \brief Initialize semi_empirical type
210!> \param sep ...
211!> \param orb_basis_set ...
212!> \param ngauss ...
213! **************************************************************************************************
214 SUBROUTINE init_se_param(sep, orb_basis_set, ngauss)
215 TYPE(semi_empirical_type), POINTER :: sep
216 TYPE(gto_basis_set_type), POINTER :: orb_basis_set
217 INTEGER, INTENT(IN) :: ngauss
218
219 CHARACTER(LEN=6), DIMENSION(:), POINTER :: symbol
220 INTEGER :: l, nshell
221 INTEGER, DIMENSION(:), POINTER :: lq, nq
222 REAL(kind=dp), DIMENSION(:), POINTER :: zet
223
224 IF (ASSOCIATED(sep)) THEN
225 CALL allocate_sto_basis_set(sep%basis)
226 nshell = 0
227 IF (sep%natorb == 1) nshell = 1
228 IF (sep%natorb == 4) nshell = 2
229 IF (sep%natorb == 9) nshell = 3
230 ALLOCATE (nq(0:3), lq(0:3), zet(0:3))
231
232 ALLOCATE (symbol(0:3))
233
234 symbol = ""
235 nq = 0
236 lq = 0
237 zet = 0._dp
238 DO l = 0, nshell - 1
239 nq(l) = get_se_basis(sep, l)
240 lq(l) = l
241 zet(l) = sep%sto_exponents(l)
242 IF (l == 0) WRITE (symbol(0), '(I1,A1)') nq(l), "S"
243 IF (l == 1) WRITE (symbol(1), '(I1,A1)') nq(l), "P"
244 IF (l == 2) WRITE (symbol(2), '(I1,A1)') nq(l), "D"
245 END DO
246
247 IF (nshell > 0) THEN
248 sep%ngauss = ngauss
249 CALL set_sto_basis_set(sep%basis, name=sep%name, nshell=nshell, symbol=symbol, &
250 nq=nq, lq=lq, zet=zet)
251 CALL create_gto_from_sto_basis(sep%basis, orb_basis_set, sep%ngauss)
252 END IF
253
254 DEALLOCATE (nq)
255 DEALLOCATE (lq)
256 DEALLOCATE (zet)
257 DEALLOCATE (symbol)
258 ELSE
259 cpabort("The pointer sep is not associated")
260 END IF
261
262 END SUBROUTINE init_se_param
263
264! **************************************************************************************************
265!> \brief Initialize parameter for a semi_empirival type
266!> \param sep ...
267!> \param z ...
268!> \param method ...
269! **************************************************************************************************
270 SUBROUTINE se_param_set_default(sep, z, method)
271
272 TYPE(semi_empirical_type), POINTER :: sep
273 INTEGER, INTENT(IN) :: z, method
274
275 IF (ASSOCIATED(sep)) THEN
276 IF (z < 0) THEN
277 cpabort("Atomic number < 0")
278 END IF
279 SELECT CASE (method)
280 CASE (do_method_am1)
281 CALL am1_default_parameter(sep, z)
282 CASE (do_method_rm1)
283 CALL rm1_default_parameter(sep, z)
284 CASE (do_method_pm3)
285 CALL pm3_default_parameter(sep, z)
286 CASE (do_method_pm6)
287 CALL pm6_default_parameter(sep, z)
288 CASE (do_method_pm6fm)
289 CALL pm6fm_default_parameter(sep, z)
290 CASE (do_method_pdg)
291 CALL pdg_default_parameter(sep, z)
292 CASE (do_method_mndo)
294 CASE (do_method_mndod)
296 CASE (do_method_pnnl)
297 CALL pnnl_default_parameter(sep, z)
298 CASE (do_method_pchg)
299 CALL pcharge_default_parameter(sep, z)
300 CASE DEFAULT
301 cpabort("Semiempirical method unknown")
302 END SELECT
303 ELSE
304 cpabort("The pointer sep is not associated")
305 END IF
306
307 ! Check if the element has been defined..
308 IF (.NOT. sep%defined) &
309 CALL cp_abort(__location__, &
310 "Semiempirical type ("//trim(sep%name)//") cannot be defined for "// &
311 "the requested parameterization.")
312
313 ! Fill 1 center - 2 electron integrals
314 CALL setup_1c_2el_int(sep)
315
316 ! Fill multipolar expansion of atomic orbitals charge distributions
317 CALL semi_empirical_mpole_p_setup(sep%w_mpole, sep, method)
318
319 ! Get the value of the size of CORE integral array
320 sep%core_size = 0
321 IF (sep%natorb > 0) sep%core_size = 1
322 IF (sep%natorb > 1) sep%core_size = 4
323 IF (sep%dorb) sep%core_size = 10
324
325 ! Get size of the all possible combinations of atomic orbitals
326 sep%atm_int_size = (sep%natorb + 1)*sep%natorb/2
327
328 END SUBROUTINE se_param_set_default
329
330! **************************************************************************************************
331!> \brief Gives back the unique semi_empirical METHOD type
332!> \param se_method ...
333!> \return ...
334! **************************************************************************************************
335 FUNCTION get_se_type(se_method) RESULT(se_type)
336
337 INTEGER, INTENT(IN) :: se_method
338 INTEGER :: se_type
339
340 SELECT CASE (se_method)
341 CASE DEFAULT
342 se_type = se_method
344 se_type = do_method_am1
345 END SELECT
346
347 END FUNCTION get_se_type
348
349END MODULE semi_empirical_utils
350
subroutine, public allocate_sto_basis_set(sto_basis_set)
...
subroutine, public create_gto_from_sto_basis(sto_basis_set, gto_basis_set, ngauss, ortho)
...
subroutine, public set_sto_basis_set(sto_basis_set, name, nshell, symbol, nq, lq, zet)
...
Handles all functions related to the CELL.
Definition cell_types.F:15
real(kind=dp) function, public plane_distance(h, k, l, cell)
Calculate the distance between two lattice planes as defined by a triple of Miller indices (hkl).
Definition cell_types.F:252
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
collects all constants needed in input so that they can be used without circular dependencies
integer, parameter, public do_method_pchg
integer, parameter, public do_method_pdg
integer, parameter, public do_method_pnnl
integer, parameter, public do_method_rm1
integer, parameter, public do_method_pm3
integer, parameter, public do_method_mndo
integer, parameter, public do_method_mndod
integer, parameter, public do_method_am1
integer, parameter, public do_method_pm6fm
integer, parameter, public do_method_pm6
objects that represent the structure of input sections and the data contained in an input section
subroutine, public section_vals_val_get(section_vals, keyword_name, i_rep_section, i_rep_val, n_rep_val, val, l_val, i_val, r_val, c_val, l_vals, i_vals, r_vals, c_vals, explicit)
returns the requested value
Defines the basic variable types.
Definition kinds.F:23
integer, parameter, public dp
Definition kinds.F:34
Setup and Methods for semi-empirical multipole types.
subroutine, public semi_empirical_mpole_p_setup(mpoles, se_parameter, method)
Setup semi-empirical mpole type This function setup for each semi-empirical type a structure containi...
Utilities to post-process semi-empirical parameters.
subroutine, public setup_1c_2el_int(sep)
Fills the 1 center 2 electron integrals for the construction of the one-electron fock matrix.
integer function, public get_se_basis(sep, l)
Gives back the number of basis function for each l.
Default parameter sets for semi empirical models: sep%... ass, asp, app, a.u. parameters for the SCP-...
subroutine, public pdg_default_parameter(sep, z)
Default parameter sets for semi empirical models: PDDG.
subroutine, public am1_default_parameter(sep, z)
Default parameter sets for semi empirical models: AM1.
subroutine, public pcharge_default_parameter(sep, z)
Default parameter sets for semi empirical models: POINT_CHARGE.
subroutine, public pm6fm_default_parameter(sep, z)
Default parameter sets for semi empirical models: PM6-FM.
subroutine, public rm1_default_parameter(sep, z)
Default parameter sets for semi empirical models: RM1.
subroutine, public pm6_default_parameter(sep, z)
Default parameter sets for semi empirical models: PM6.
subroutine, public pnnl_default_parameter(sep, z)
Default parameter sets for semi empirical models developed at PNNL.
subroutine, public pm3_default_parameter(sep, z)
Default parameter sets for semi empirical models: PM3.
subroutine, public mndo_default_parameter(sep, z, itype)
Default parameter sets for semi empirical models: MNDO.
Definition of the semi empirical parameter types.
Working with the semi empirical parameter types.
subroutine, public finalize_se_taper(se_taper)
Finalizes the semi-empirical taper for a chunk calculation.
integer function, public get_se_type(se_method)
Gives back the unique semi_empirical METHOD type.
subroutine, public initialize_se_taper(se_taper, coulomb, exchange, lr_corr)
Initializes the semi-empirical taper for a chunk calculation.
subroutine, public se_param_set_default(sep, z, method)
Initialize parameter for a semi_empirival type.
subroutine, public se_cutoff_compatible(se_control, se_section, cell, output_unit)
Reset cutoffs trying to be somehow a bit smarter.
subroutine, public init_se_param(sep, orb_basis_set, ngauss)
Initialize semi_empirical type.
Type defining parameters related to the simulation cell.
Definition cell_types.F:55
Taper type use in semi-empirical calculations.