(git:27c966b)
Loading...
Searching...
No Matches
qs_dispersion_pairpot.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 Calculation of dispersion using pair potentials
10!> \author JGH
11! **************************************************************************************************
13
19 USE bibliography, ONLY: &
21 cite_reference, grimme2006, grimme2010, grimme2011
22 USE cell_types, ONLY: cell_type
33 USE eeq_input, ONLY: read_eeq_param
43 USE kinds, ONLY: default_path_length,&
45 dp
47 USE physcon, ONLY: bohr,&
48 kcalmol,&
49 kjmol
51 setcn,&
52 seten,&
53 setr0ab,&
61 USE qs_dispersion_types, ONLY: dftd2_pp,&
62 dftd3_pp,&
63 dftd4_pp,&
69 USE qs_kind_types, ONLY: get_qs_kind,&
72 USE virial_types, ONLY: virial_type
73#include "./base/base_uses.f90"
74
75 IMPLICIT NONE
76
77 PRIVATE
78
79 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'qs_dispersion_pairpot'
80
82
83! **************************************************************************************************
84
85CONTAINS
86
87! **************************************************************************************************
88!> \brief ...
89!> \param atomic_kind_set ...
90!> \param qs_kind_set ...
91!> \param dispersion_env ...
92!> \param pp_section ...
93!> \param para_env ...
94! **************************************************************************************************
95 SUBROUTINE qs_dispersion_pairpot_init(atomic_kind_set, qs_kind_set, dispersion_env, pp_section, para_env)
96 TYPE(atomic_kind_type), DIMENSION(:), POINTER :: atomic_kind_set
97 TYPE(qs_kind_type), DIMENSION(:), POINTER :: qs_kind_set
98 TYPE(qs_dispersion_type), POINTER :: dispersion_env
99 TYPE(section_vals_type), OPTIONAL, POINTER :: pp_section
100 TYPE(mp_para_env_type), POINTER :: para_env
101
102 CHARACTER(len=*), PARAMETER :: routinen = 'qs_dispersion_pairpot_init'
103
104 CHARACTER(LEN=2) :: symbol
105 CHARACTER(LEN=default_path_length) :: filename
106 CHARACTER(LEN=default_string_length) :: aname, error_msg
107 CHARACTER(LEN=default_string_length), &
108 DIMENSION(:), POINTER :: tmpstringlist
109 INTEGER :: elem, handle, i, ikind, j, max_elem, &
110 maxc, n_rep, nkind, nl, vdw_pp_type, &
111 vdw_type
112 INTEGER, DIMENSION(:), POINTER :: exlist
113 LOGICAL :: at_end, explicit, found, is_available
114 REAL(kind=dp) :: dum
115 TYPE(qs_atom_dispersion_type), POINTER :: disp
116 TYPE(section_vals_type), POINTER :: eeq_section
117
118 CALL timeset(routinen, handle)
119
120 nkind = SIZE(atomic_kind_set)
121
122 vdw_type = dispersion_env%type
123 SELECT CASE (vdw_type)
124 CASE DEFAULT
125 ! do nothing
126 CASE (xc_vdw_fun_pairpot)
127 ! setup information on pair potentials
128 vdw_pp_type = dispersion_env%type
129 SELECT CASE (dispersion_env%pp_type)
130 CASE DEFAULT
131 ! do nothing
133 CALL cite_reference(grimme2006)
134 IF (dispersion_env%pp_type == vdw_pairpot_dftd2chg) CALL cite_reference(chai2008)
135 DO ikind = 1, nkind
136 CALL get_atomic_kind(atomic_kind_set(ikind), element_symbol=symbol, z=elem)
137 ALLOCATE (disp)
138 disp%type = dftd2_pp
139 ! get filename of parameter file
140 filename = dispersion_env%parameter_file_name
141 ! check for local parameters
142 found = .false.
143 IF (PRESENT(pp_section)) THEN
144 CALL section_vals_val_get(pp_section, "ATOMPARM", n_rep_val=n_rep)
145 DO i = 1, n_rep
146 CALL section_vals_val_get(pp_section, "ATOMPARM", i_rep_val=i, &
147 c_vals=tmpstringlist)
148 IF (trim(tmpstringlist(1)) == trim(symbol)) THEN
149 ! we assume the parameters are in atomic units!
150 READ (tmpstringlist(2), *) disp%c6
151 READ (tmpstringlist(3), *) disp%vdw_radii
152 found = .true.
153 EXIT
154 END IF
155 END DO
156 END IF
157 IF (.NOT. found) THEN
158 ! check for internal parameters
159 CALL dftd2_param(elem, disp%c6, disp%vdw_radii, found)
160 END IF
161 IF (.NOT. found) THEN
162 ! check on file
163 INQUIRE (file=filename, exist=is_available)
164 IF (is_available) THEN
165 block
166 TYPE(cp_parser_type) :: parser
167 CALL parser_create(parser, filename, para_env=para_env)
168 DO
169 at_end = .false.
170 CALL parser_get_next_line(parser, 1, at_end)
171 IF (at_end) EXIT
172 CALL parser_get_object(parser, aname)
173 IF (trim(aname) == trim(symbol)) THEN
174 CALL parser_get_object(parser, disp%c6)
175 ! we have to change the units J*nm^6*mol^-1 -> Hartree*Bohr^6
176 disp%c6 = disp%c6*1000._dp*bohr**6/kjmol
177 CALL parser_get_object(parser, disp%vdw_radii)
178 disp%vdw_radii = disp%vdw_radii*bohr
179 found = .true.
180 EXIT
181 END IF
182 END DO
183 CALL parser_release(parser)
184 END block
185 END IF
186 END IF
187 IF (found) THEN
188 disp%defined = .true.
189 ELSE
190 disp%defined = .false.
191 END IF
192 ! Check if the parameter is defined
193 IF (.NOT. disp%defined) THEN
194 CALL cp_abort(__location__, &
195 "Dispersion parameters for element ("//trim(symbol)//") are not defined! "// &
196 "Please provide a valid set of parameters through the input section or "// &
197 "through an external file! ")
198 END IF
199 CALL set_qs_kind(qs_kind_set(ikind), dispersion=disp)
200 END DO
202 !DFT-D3 Method initial setup
203 CALL cite_reference(grimme2010)
204 CALL cite_reference(grimme2011)
205 CALL cite_reference(goerigk2017)
206 CALL cite_reference(wittmann2024)
207 max_elem = 103
208 maxc = 7
209 dispersion_env%max_elem = max_elem
210 dispersion_env%maxc = maxc
211 ALLOCATE (dispersion_env%maxci(max_elem))
212 ALLOCATE (dispersion_env%c6ab(max_elem, max_elem, maxc, maxc, 3))
213 ALLOCATE (dispersion_env%r0ab(max_elem, max_elem))
214 ALLOCATE (dispersion_env%rcov(max_elem))
215 ALLOCATE (dispersion_env%eneg(max_elem))
216 ALLOCATE (dispersion_env%r2r4(max_elem))
217 ALLOCATE (dispersion_env%cn(max_elem))
218
219 IF (dispersion_env%d3_reference_code) THEN
220 CALL dftd3_param_from_library(dispersion_env%c6ab, dispersion_env%maxci, &
221 dispersion_env%r0ab, dispersion_env%rcov, &
222 dispersion_env%r2r4, &
223 dispersion_env%pp_type, dispersion_env%ref_functional, &
224 dispersion_env%s6, dispersion_env%s8, &
225 dispersion_env%a1, dispersion_env%a2, &
226 dispersion_env%sr6, dispersion_env%sr8, &
227 para_env, error=error_msg, &
228 calc_scaling=.NOT. dispersion_env%d3_scaling_explicit)
229 IF (error_msg /= "") THEN
230 CALL cp_abort(__location__, error_msg)
231 END IF
232 ELSE
233 filename = dispersion_env%parameter_file_name
234 CALL dftd3_c6_param(dispersion_env%c6ab, dispersion_env%maxci, filename, para_env)
235 CALL setrcov(dispersion_env%rcov)
236 CALL setr0ab(dispersion_env%r0ab, dispersion_env%rcov, dispersion_env%r2r4)
237 END IF
238 ! Electronegativity
239 CALL seten(dispersion_env%eneg)
240 ! the default coordination numbers
241 CALL setcn(dispersion_env%cn)
242 ! scale r4/r2 values of the atoms by sqrt(Z)
243 ! sqrt is also globally close to optimum
244 ! together with the factor 1/2 this yield reasonable
245 ! c8 for he, ne and ar. for larger Z, C8 becomes too large
246 ! which effectively mimics higher R^n terms neglected due
247 ! to stability reasons
248 IF (.NOT. dispersion_env%d3_reference_code) THEN
249 DO i = 1, max_elem
250 dum = 0.5_dp*dispersion_env%r2r4(i)*real(i, dp)**0.5_dp
251 ! store it as sqrt because the geom. av. is taken
252 dispersion_env%r2r4(i) = sqrt(dum)
253 END DO
254 END IF
255 ! parameters
256 dispersion_env%k1 = 16.0_dp
257 dispersion_env%k2 = 4._dp/3._dp
258 ! reasonable choices are between 3 and 5
259 ! this gives smoth curves with maxima around the integer values
260 ! k3=3 give for CN=0 a slightly smaller value than computed
261 ! for the free atom. This also yields to larger CN for atoms
262 ! in larger molecules but with the same chem. environment
263 ! which is physically not right
264 ! values >5 might lead to bumps in the potential
265 dispersion_env%k3 = -4._dp
266 IF (.NOT. dispersion_env%d3_reference_code) THEN
267 dispersion_env%rcov = dispersion_env%k2*dispersion_env%rcov*bohr
268 END IF
269 ! alpha default parameter
270 dispersion_env%alp = 14._dp
271 !
272 DO ikind = 1, nkind
273 CALL get_atomic_kind(atomic_kind_set(ikind), element_symbol=symbol, z=elem)
274 ALLOCATE (disp)
275 disp%type = dftd3_pp
276 IF (elem <= max_elem) THEN
277 disp%defined = .true.
278 ELSE
279 disp%defined = .false.
280 END IF
281 IF (.NOT. disp%defined) THEN
282 CALL cp_abort(__location__, &
283 "Dispersion parameters for element ("//trim(symbol)//") are not defined! "// &
284 "Please provide a valid set of parameters through the input section or "// &
285 "through an external file! ")
286 END IF
287 CALL set_qs_kind(qs_kind_set(ikind), dispersion=disp)
288 END DO
289
290 IF (PRESENT(pp_section)) THEN
291 ! Check for coordination numbers
292 CALL section_vals_val_get(pp_section, "KIND_COORDINATION_NUMBERS", n_rep_val=n_rep)
293 IF (n_rep > 0) THEN
294 ALLOCATE (dispersion_env%cnkind(n_rep))
295 DO i = 1, n_rep
296 CALL section_vals_val_get(pp_section, "KIND_COORDINATION_NUMBERS", i_rep_val=i, &
297 c_vals=tmpstringlist)
298 READ (tmpstringlist(1), *) dispersion_env%cnkind(i)%cnum
299 READ (tmpstringlist(2), *) dispersion_env%cnkind(i)%kind
300 END DO
301 END IF
302 CALL section_vals_val_get(pp_section, "ATOM_COORDINATION_NUMBERS", n_rep_val=n_rep)
303 IF (n_rep > 0) THEN
304 ALLOCATE (dispersion_env%cnlist(n_rep))
305 DO i = 1, n_rep
306 CALL section_vals_val_get(pp_section, "ATOM_COORDINATION_NUMBERS", i_rep_val=i, &
307 c_vals=tmpstringlist)
308 nl = SIZE(tmpstringlist)
309 ALLOCATE (dispersion_env%cnlist(i)%atom(nl - 1))
310 dispersion_env%cnlist(i)%natom = nl - 1
311 READ (tmpstringlist(1), *) dispersion_env%cnlist(i)%cnum
312 DO j = 1, nl - 1
313 READ (tmpstringlist(j + 1), *) dispersion_env%cnlist(i)%atom(j)
314 END DO
315 END DO
316 END IF
317 ! Check for exclusion lists
318 CALL section_vals_val_get(pp_section, "D3_EXCLUDE_KIND", explicit=explicit)
319 IF (explicit) THEN
320 CALL section_vals_val_get(pp_section, "D3_EXCLUDE_KIND", i_vals=exlist)
321 DO j = 1, SIZE(exlist)
322 ikind = exlist(j)
323 CALL get_qs_kind(qs_kind_set(ikind), dispersion=disp)
324 disp%defined = .false.
325 END DO
326 END IF
327 CALL section_vals_val_get(pp_section, "D3_EXCLUDE_KIND_PAIR", n_rep_val=n_rep)
328 dispersion_env%nd3_exclude_pair = n_rep
329 IF (n_rep > 0) THEN
330 ALLOCATE (dispersion_env%d3_exclude_pair(n_rep, 2))
331 DO i = 1, n_rep
332 CALL section_vals_val_get(pp_section, "D3_EXCLUDE_KIND_PAIR", i_rep_val=i, &
333 i_vals=exlist)
334 dispersion_env%d3_exclude_pair(i, :) = exlist
335 END DO
336 END IF
337 END IF
338 CASE (vdw_pairpot_dftd4)
339 !most checks are done by the library
340 CALL cite_reference(caldeweyher2017)
341 CALL cite_reference(caldeweyher2019)
342 CALL cite_reference(caldeweyher2020)
343 DO ikind = 1, nkind
344 CALL get_atomic_kind(atomic_kind_set(ikind), element_symbol=symbol, z=elem)
345 ALLOCATE (disp)
346 disp%type = dftd4_pp
347 disp%defined = .true.
348 CALL set_qs_kind(qs_kind_set(ikind), dispersion=disp)
349 END DO
350 ! maybe needed in cnumber calculations
351 max_elem = 103
352 maxc = 7
353 dispersion_env%max_elem = max_elem
354 dispersion_env%maxc = maxc
355 ALLOCATE (dispersion_env%maxci(max_elem))
356 ALLOCATE (dispersion_env%rcov(max_elem))
357 ALLOCATE (dispersion_env%eneg(max_elem))
358 ALLOCATE (dispersion_env%cn(max_elem))
359 ! the default covalent radii
360 CALL setrcov(dispersion_env%rcov)
361 ! the default coordination numbers
362 CALL setcn(dispersion_env%cn)
363 ! Electronegativity
364 CALL seten(dispersion_env%eneg)
365 ! parameters
366 dispersion_env%k1 = 16.0_dp
367 dispersion_env%k2 = 4._dp/3._dp
368 dispersion_env%k3 = -4._dp
369 dispersion_env%rcov = dispersion_env%k2*dispersion_env%rcov*bohr
370 dispersion_env%alp = 14._dp
371 !
372 dispersion_env%cnfun = 3
373 IF (dispersion_env%rc_cn < 0.0_dp) THEN
374 dispersion_env%rc_cn = get_cn_radius(dispersion_env)
375 END IF
376 IF (PRESENT(pp_section)) THEN
377 eeq_section => section_vals_get_subs_vals(pp_section, "EEQ")
378 CALL read_eeq_param(eeq_section, dispersion_env%eeq_sparam)
379 END IF
380 END SELECT
381 END SELECT
382
383 CALL timestop(handle)
384
385 END SUBROUTINE qs_dispersion_pairpot_init
386
387! **************************************************************************************************
388!> \brief ...
389!> \param qs_env ...
390!> \param dispersion_env ...
391!> \param energy ...
392!> \param calculate_forces ...
393!> \param atevdw ...
394! **************************************************************************************************
395 SUBROUTINE calculate_dispersion_pairpot(qs_env, dispersion_env, energy, calculate_forces, atevdw)
396
397 TYPE(qs_environment_type), POINTER :: qs_env
398 TYPE(qs_dispersion_type), POINTER :: dispersion_env
399 REAL(kind=dp), INTENT(INOUT) :: energy
400 LOGICAL, INTENT(IN) :: calculate_forces
401 REAL(kind=dp), DIMENSION(:), OPTIONAL :: atevdw
402
403 CHARACTER(LEN=*), PARAMETER :: routinen = 'calculate_dispersion_pairpot'
404
405 INTEGER :: atom_a, handle, iatom, ikind, iw, natom, &
406 nkind, unit_nr
407 INTEGER, ALLOCATABLE, DIMENSION(:) :: atom_of_kind, kind_of
408 LOGICAL :: atenergy, atex, debugall, use_virial
409 REAL(kind=dp) :: evdw, gnorm
410 REAL(kind=dp), ALLOCATABLE, DIMENSION(:) :: atomic_energy
411 REAL(kind=dp), DIMENSION(3) :: fdij
412 REAL(kind=dp), DIMENSION(3, 3) :: dvirial, pv_loc, pv_virial_thread
413 TYPE(atomic_kind_type), DIMENSION(:), POINTER :: atomic_kind_set
414 TYPE(atprop_type), POINTER :: atprop
415 TYPE(cell_type), POINTER :: cell
416 TYPE(cp_logger_type), POINTER :: logger
417 TYPE(mp_para_env_type), POINTER :: para_env
418 TYPE(qs_force_type), DIMENSION(:), POINTER :: force
419 TYPE(virial_type), POINTER :: virial
420
421 energy = 0._dp
422 ! make valgrind happy
423 use_virial = .false.
424
425 IF (dispersion_env%type /= xc_vdw_fun_pairpot) THEN
426 RETURN
427 END IF
428
429 CALL timeset(routinen, handle)
430
431 NULLIFY (atomic_kind_set)
432
433 CALL get_qs_env(qs_env=qs_env, nkind=nkind, natom=natom, atomic_kind_set=atomic_kind_set, &
434 cell=cell, virial=virial, para_env=para_env, atprop=atprop)
435
436 debugall = dispersion_env%verbose
437
438 NULLIFY (logger)
439 logger => cp_get_default_logger()
440 IF (ASSOCIATED(dispersion_env%dftd_section)) THEN
441 unit_nr = cp_print_key_unit_nr(logger, dispersion_env%dftd_section, "PRINT_DFTD", &
442 extension=".dftd")
443 ELSE
444 unit_nr = -1
445 END IF
446
447 ! atomic energy and stress arrays
448 atenergy = atprop%energy
449 ! external atomic energy
450 atex = .false.
451 IF (PRESENT(atevdw)) THEN
452 atex = .true.
453 END IF
454
455 IF (unit_nr > 0) THEN
456 WRITE (unit_nr, *)
457 WRITE (unit_nr, *) " Pair potential vdW calculation"
458 IF (dispersion_env%pp_type == vdw_pairpot_dftd2) THEN
459 WRITE (unit_nr, *) " Dispersion potential type: DFT-D2"
460 WRITE (unit_nr, *) " Scaling parameter (s6) ", dispersion_env%scaling
461 WRITE (unit_nr, *) " Exponential prefactor ", dispersion_env%exp_pre
462 ELSE IF (dispersion_env%pp_type == vdw_pairpot_dftd2chg) THEN
463 WRITE (unit_nr, *) " Dispersion potential type: DFT-D2(CHG)"
464 WRITE (unit_nr, *) " Scaling parameter (s6) ", dispersion_env%scaling
465 WRITE (unit_nr, *) " CHG damping: a=6, alpha=12"
466 ELSE IF (dispersion_env%pp_type == vdw_pairpot_dftd3) THEN
467 WRITE (unit_nr, *) " Dispersion potential type: DFT-D3"
468 ELSE IF (dispersion_env%pp_type == vdw_pairpot_dftd3bj) THEN
469 WRITE (unit_nr, *) " Dispersion potential type: DFT-D3(BJ)"
470 ELSE IF (dispersion_env%pp_type == vdw_pairpot_dftd4) THEN
471 WRITE (unit_nr, *) " Dispersion potential type: DFT-D4"
472 END IF
473 END IF
474
475 CALL get_qs_env(qs_env=qs_env, force=force)
476 use_virial = virial%pv_availability .AND. (.NOT. virial%pv_numer)
477 IF (use_virial .AND. debugall) THEN
478 dvirial = virial%pv_virial
479 END IF
480 IF (use_virial) THEN
481 pv_loc = virial%pv_virial
482 END IF
483
484 evdw = 0._dp
485 pv_virial_thread(:, :) = 0._dp
486
487 CALL get_atomic_kind_set(atomic_kind_set, atom_of_kind=atom_of_kind, kind_of=kind_of)
488
489 IF (dispersion_env%pp_type == vdw_pairpot_dftd2 .OR. &
490 dispersion_env%pp_type == vdw_pairpot_dftd2chg) THEN
491 CALL calculate_dispersion_d2_pairpot(qs_env, dispersion_env, evdw, calculate_forces, atevdw)
492 ELSE IF (dispersion_env%pp_type == vdw_pairpot_dftd3 .OR. &
493 dispersion_env%pp_type == vdw_pairpot_dftd3bj) THEN
494 CALL calculate_dispersion_d3_pairpot(qs_env, dispersion_env, evdw, calculate_forces, &
495 unit_nr, atevdw)
496 ELSE IF (dispersion_env%pp_type == vdw_pairpot_dftd4) THEN
497 IF (dispersion_env%lrc) THEN
498 cpabort("Long range correction with DFTD4 not implemented")
499 END IF
500 IF (dispersion_env%srb) THEN
501 cpabort("Short range bond correction with DFTD4 not implemented")
502 END IF
503 IF (dispersion_env%domol) THEN
504 cpabort("Molecular approximation with DFTD4 not implemented")
505 END IF
506 !
507 iw = -1
508 IF (dispersion_env%verbose) iw = cp_logger_get_default_io_unit(logger)
509 !
510 IF (atenergy .OR. atex) THEN
511 ALLOCATE (atomic_energy(natom))
512 CALL calculate_dispersion_d4_pairpot(qs_env, dispersion_env, evdw, calculate_forces, &
513 iw, atomic_energy=atomic_energy)
514 ELSE
515 CALL calculate_dispersion_d4_pairpot(qs_env, dispersion_env, evdw, calculate_forces, iw)
516 END IF
517 !
518 IF (atex) THEN
519 atevdw(1:natom) = atomic_energy(1:natom)
520 END IF
521 IF (atenergy) THEN
522 CALL atprop_array_init(atprop%atevdw, natom)
523 atprop%atevdw(1:natom) = atomic_energy(1:natom)
524 END IF
525 IF (atenergy .OR. atex) THEN
526 DEALLOCATE (atomic_energy)
527 END IF
528 END IF
529
530 ! set dispersion energy
531 CALL para_env%sum(evdw)
532 energy = evdw
533 IF (unit_nr > 0) THEN
534 WRITE (unit_nr, *) " Total vdW energy [au] :", evdw
535 WRITE (unit_nr, *) " Total vdW energy [kcal] :", evdw*kcalmol
536 WRITE (unit_nr, *)
537 END IF
538 IF (calculate_forces .AND. debugall) THEN
539 IF (unit_nr > 0) THEN
540 WRITE (unit_nr, *) " Dispersion Forces "
541 WRITE (unit_nr, *) " Atom Kind Forces "
542 END IF
543 gnorm = 0._dp
544 DO iatom = 1, natom
545 ikind = kind_of(iatom)
546 atom_a = atom_of_kind(iatom)
547 fdij(1:3) = force(ikind)%dispersion(:, atom_a)
548 CALL para_env%sum(fdij)
549 gnorm = gnorm + sum(abs(fdij))
550 IF (unit_nr > 0) WRITE (unit_nr, "(i5,i7,3F20.14)") iatom, ikind, fdij
551 END DO
552 IF (unit_nr > 0) THEN
553 WRITE (unit_nr, *)
554 WRITE (unit_nr, *) "|G| = ", gnorm
555 WRITE (unit_nr, *)
556 END IF
557 IF (use_virial) THEN
558 dvirial = virial%pv_virial - dvirial
559 CALL para_env%sum(dvirial)
560 IF (unit_nr > 0) THEN
561 WRITE (unit_nr, *) "Stress Tensor (dispersion)"
562 WRITE (unit_nr, "(3G20.12)") dvirial
563 WRITE (unit_nr, *) " Tr(P)/3 : ", (dvirial(1, 1) + dvirial(2, 2) + dvirial(3, 3))/3._dp
564 WRITE (unit_nr, *)
565 END IF
566 END IF
567 END IF
568
569 IF (calculate_forces .AND. use_virial) THEN
570 virial%pv_vdw = virial%pv_vdw + (virial%pv_virial - pv_loc)
571 END IF
572
573 IF (ASSOCIATED(dispersion_env%dftd_section)) THEN
574 CALL cp_print_key_finished_output(unit_nr, logger, dispersion_env%dftd_section, "PRINT_DFTD")
575 END IF
576
577 CALL timestop(handle)
578
579 END SUBROUTINE calculate_dispersion_pairpot
580
581END MODULE qs_dispersion_pairpot
Define the atomic kind types and their sub types.
subroutine, public get_atomic_kind_set(atomic_kind_set, atom_of_kind, kind_of, natom_of_kind, maxatom, natom, nshell, fist_potential_present, shell_present, shell_adiabatic, shell_check_distance, damping_present)
Get attributes of an atomic kind set.
subroutine, public get_atomic_kind(atomic_kind, fist_potential, element_symbol, name, mass, kind_number, natom, atom_list, rcov, rvdw, z, qeff, apol, cpol, mm_radius, shell, shell_active, damping)
Get attributes of an atomic kind.
Holds information on atomic properties.
subroutine, public atprop_array_init(atarray, natom)
...
collects all references to literature in CP2K as new algorithms / method are included from literature...
integer, save, public chai2008
integer, save, public caldeweyher2020
integer, save, public grimme2006
integer, save, public caldeweyher2019
integer, save, public caldeweyher2017
integer, save, public goerigk2017
integer, save, public wittmann2024
integer, save, public grimme2011
integer, save, public grimme2010
Handles all functions related to the CELL.
Definition cell_types.F:15
various routines to log and control the output. The idea is that decisions about where to log should ...
integer function, public cp_logger_get_default_io_unit(logger)
returns the unit nr for the ionode (-1 on all other processors) skips as well checks if the procs cal...
type(cp_logger_type) function, pointer, public cp_get_default_logger()
returns the default logger
routines to handle the output, The idea is to remove the decision of wheter to output and what to out...
subroutine, public cp_print_key_finished_output(unit_nr, logger, basis_section, print_key_path, local, ignore_should_output, on_file, mpi_io)
should be called after you finish working with a unit obtained with cp_print_key_unit_nr,...
integer function, public cp_print_key_unit_nr(logger, basis_section, print_key_path, extension, middle_name, local, log_filename, ignore_should_output, file_form, file_position, file_action, file_status, do_backup, on_file, is_new_file, mpi_io, fout, file_access)
...
Utility routines to read data from files. Kept as close as possible to the old parser because.
subroutine, public parser_get_next_line(parser, nline, at_end)
Read the next input line and broadcast the input information. Skip (nline-1) lines and skip also all ...
Utility routines to read data from files. Kept as close as possible to the old parser because.
subroutine, public parser_release(parser)
releases the parser
subroutine, public parser_create(parser, file_name, unit_nr, para_env, end_section_label, separator_chars, comment_char, continuation_char, quote_char, section_char, parse_white_lines, initial_variables, apply_preprocessing)
Start a parser run. Initial variables allow to @SET stuff before opening the file.
Input definition and setup for EEQ model.
Definition eeq_input.F:12
subroutine, public read_eeq_param(eeq_section, eeq_sparam)
...
Definition eeq_input.F:123
collects all constants needed in input so that they can be used without circular dependencies
integer, parameter, public vdw_pairpot_dftd3
integer, parameter, public vdw_pairpot_dftd2chg
integer, parameter, public vdw_pairpot_dftd4
integer, parameter, public vdw_pairpot_dftd2
integer, parameter, public xc_vdw_fun_pairpot
integer, parameter, public vdw_pairpot_dftd3bj
objects that represent the structure of input sections and the data contained in an input section
recursive type(section_vals_type) function, pointer, public section_vals_get_subs_vals(section_vals, subsection_name, i_rep_section, can_return_null)
returns the values of the requested subsection
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
integer, parameter, public default_string_length
Definition kinds.F:57
integer, parameter, public default_path_length
Definition kinds.F:58
Interface to the message passing library MPI.
Definition of physical constants:
Definition physcon.F:68
real(kind=dp), parameter, public kcalmol
Definition physcon.F:171
real(kind=dp), parameter, public kjmol
Definition physcon.F:168
real(kind=dp), parameter, public bohr
Definition physcon.F:147
Coordination number routines for dispersion pairpotentials.
real(kind=dp) function, public get_cn_radius(dispersion_env)
...
subroutine, public setr0ab(rout, rcov, r2r4)
...
subroutine, public setrcov(rcov)
...
subroutine, public seten(enout)
...
subroutine, public setcn(cnout)
...
Calculation of D2 dispersion with Grimme or Chai-Head-Gordon damping.
subroutine, public calculate_dispersion_d2_pairpot(qs_env, dispersion_env, evdw, calculate_forces, atevdw)
...
subroutine, public dftd2_param(z, c6, r, found)
...
Calculation of D3 dispersion.
subroutine, public dftd3_c6_param(c6ab, maxci, filename, para_env)
...
subroutine, public calculate_dispersion_d3_pairpot(qs_env, dispersion_env, evdw, calculate_forces, unit_nr, atevdw)
...
Calculation of dispersion using pair potentials.
subroutine, public calculate_dispersion_d4_pairpot(qs_env, dispersion_env, evdw, calculate_forces, iw, atomic_energy)
...
Calculation of dispersion using pair potentials.
subroutine, public qs_dispersion_pairpot_init(atomic_kind_set, qs_kind_set, dispersion_env, pp_section, para_env)
...
subroutine, public calculate_dispersion_pairpot(qs_env, dispersion_env, energy, calculate_forces, atevdw)
...
subroutine, public dftd3_param_from_library(c6ab, maxci, r0ab, rcov, r2r4, pp_type, ref_functional, s6, s8, a1, a2, sr6, sr8, para_env, error, calc_scaling)
...
Definition of disperson types for DFT calculations.
integer, parameter, public dftd2_pp
integer, parameter, public dftd4_pp
integer, parameter, public dftd3_pp
subroutine, public get_qs_env(qs_env, atomic_kind_set, qs_kind_set, cell, super_cell, cell_ref, use_ref_cell, kpoints, dft_control, mos, sab_orb, sab_all, qmmm, qmmm_periodic, mimic, sac_ae, sac_ppl, sac_lri, sap_ppnl, sab_vdw, sab_scp, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, sab_xb, sab_xtb_pp, sab_xtb_nonbond, sab_almo, sab_kp, sab_kp_nosym, sab_cneo, particle_set, energy, force, matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, run_rtp, rtp, matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_ks_im_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, matrix_s_ri_aux_kp, matrix_s, matrix_s_ri_aux, matrix_w, matrix_p_mp2, matrix_p_mp2_admm, matrix_vhxc, rho, rho_xc, pw_env, ewald_env, ewald_pw, active_space, mpools, input, para_env, blacs_env, scf_control, rel_control, kinetic, qs_charges, vppl, xcint_weights, rho_core, rho_nlcc, rho_nlcc_g, ks_env, ks_qmmm_env, wf_history, scf_env, local_particles, local_molecules, distribution_2d, dbcsr_dist, molecule_kind_set, molecule_set, subsys, cp_subsys, oce, local_rho_set, rho_atom_set, task_list, task_list_soft, rho0_atom_set, rho0_mpole, rhoz_set, rhoz_cneo_set, ecoul_1c, rho0_s_rs, rho0_s_gs, rhoz_cneo_s_rs, rhoz_cneo_s_gs, do_kpoints, has_unit_metric, requires_mo_derivs, mo_derivs, mo_loc_history, nkind, natom, nelectron_total, nelectron_spin, efield, neighbor_list_id, linres_control, xas_env, virial, cp_ddapc_env, cp_ddapc_ewald, outer_scf_history, outer_scf_ihistory, x_data, et_coupling, dftb_potential, results, se_taper, se_store_int_env, se_nddo_mpole, se_nonbond_env, admm_env, lri_env, lri_density, exstate_env, ec_env, harris_env, dispersion_env, gcp_env, vee, rho_external, external_vxc, mask, mp2_env, bs_env, kg_env, wanniercentres, atprop, ls_scf_env, do_transport, transport_env, v_hartree_rspace, s_mstruct_changed, rho_changed, potential_changed, forces_up_to_date, mscfg_env, almo_scf_env, gradient_history, variable_history, embed_pot, spin_embed_pot, polar_env, mos_last_converged, eeq, rhs, do_rixs, tb_tblite)
Get the QUICKSTEP environment.
Define the quickstep kind type and their sub types.
subroutine, public get_qs_kind(qs_kind, basis_set, basis_type, ncgf, nsgf, all_potential, tnadd_potential, gth_potential, sgp_potential, upf_potential, cneo_potential, se_parameter, dftb_parameter, xtb_parameter, dftb3_param, zatom, zeff, elec_conf, mao, lmax_dftb, alpha_core_charge, ccore_charge, core_charge, core_charge_radius, paw_proj_set, paw_atom, hard_radius, hard0_radius, max_rad_local, covalent_radius, vdw_radius, gpw_type_forced, harmonics, max_iso_not0, max_s_harm, grid_atom, ngrid_ang, ngrid_rad, lmax_rho0, dft_plus_u_atom, l_of_dft_plus_u, n_of_dft_plus_u, u_minus_j, hund_j, u_of_dft_plus_u, j_of_dft_plus_u, alpha_of_dft_plus_u, beta_of_dft_plus_u, j0_of_dft_plus_u, occupation_of_dft_plus_u, dispersion, bs_occupation, magnetization, no_optimize, addel, laddel, naddel, orbitals, max_scf, eps_scf, smear, u_ramping, u_minus_j_target, eps_u_ramping, proj_shell_charge, lr_atom, do_mtlr, u_j_loop, ao_coef, init_u_ramping_each_scf, reltmat, ghost, monovalent, floating, name, element_symbol, pao_basis_size, pao_model_file, pao_potentials, pao_descriptors, nelec)
Get attributes of an atomic kind.
subroutine, public set_qs_kind(qs_kind, paw_atom, ghost, floating, hard_radius, hard0_radius, covalent_radius, vdw_radius, lmax_rho0, zeff, no_optimize, dispersion, u_minus_j, hund_j, reltmat, dftb_parameter, xtb_parameter, elec_conf, pao_basis_size)
Set the components of an atomic kind data set.
Provides all information about an atomic kind.
type for the atomic properties
Type defining parameters related to the simulation cell.
Definition cell_types.F:60
type of a logger, at the moment it contains just a print level starting at which level it should be l...
stores all the informations relevant to an mpi environment
Provides all information about a quickstep kind.