(git:1f9fd2c)
Loading...
Searching...
No Matches
xc_derivatives.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! **************************************************************************************************
10
14 USE kinds, ONLY: dp
15 USE xc_b97, ONLY: b97_lda_eval,&
19 USE xc_cs1, ONLY: cs1_lda_eval,&
24 USE xc_exchange_gga, ONLY: xgga_eval,&
27 USE xc_hcth, ONLY: hcth_lda_eval,&
29 USE xc_ke_gga, ONLY: ke_gga_info,&
32 USE xc_libxc, ONLY: libxc_lda_eval,&
36 USE xc_lyp, ONLY: lyp_lda_eval,&
44 USE xc_optx, ONLY: optx_lda_eval,&
48 USE xc_pade, ONLY: pade_info,&
49 pade_init,&
52 USE xc_pbe, ONLY: pbe_lda_eval,&
56 USE xc_perdew86, ONLY: p86_lda_eval,&
61 USE xc_perdew_zunger, ONLY: pz_info,&
68 USE xc_tfw, ONLY: tfw_lda_eval,&
75 USE xc_tpss, ONLY: tpss_lda_eval,&
77 USE xc_vwn, ONLY: vwn_lda_eval,&
81 USE xc_xalpha, ONLY: xalpha_info,&
84 USE xc_xbecke88, ONLY: xb88_lda_eval,&
100 USE xc_xbeef, ONLY: xbeef_lda_eval,&
116 USE xc_xwpbe, ONLY: xwpbe_lda_eval,&
120#include "../base/base_uses.f90"
121
122 IMPLICIT NONE
123
124 PRIVATE
125
126 LOGICAL, PARAMETER :: debug_this_module = .false.
127 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'xc_derivatives'
128
130
131CONTAINS
132
133! **************************************************************************************************
134!> \brief get the information about the given functional
135!> \param functional the functional you want info about
136!> \param lsd if you are using lsd or lda
137!> \param reference the reference to the acticle where the functional is
138!> explained
139!> \param shortform the short definition of the functional
140!> \param needs the flags corresponding to the inputs needed by this
141!> functional are set to true (the flags not needed aren't touched)
142!> \param max_deriv the maximal derivative available
143!> \param print_warn whether to print warnings (mainly relevant for libxc)
144!> \author fawzi
145! **************************************************************************************************
146 SUBROUTINE xc_functional_get_info(functional, lsd, reference, shortform, &
147 needs, max_deriv, print_warn)
148 TYPE(section_vals_type), POINTER :: functional
149 LOGICAL, INTENT(in) :: lsd
150 CHARACTER(LEN=*), INTENT(OUT), OPTIONAL :: reference, shortform
151 TYPE(xc_rho_cflags_type), INTENT(inout), OPTIONAL :: needs
152 INTEGER, INTENT(out), OPTIONAL :: max_deriv
153 LOGICAL, INTENT(IN), OPTIONAL :: print_warn
154
155 INTEGER :: i_param
156 REAL(kind=dp) :: r_param
157
158 cpassert(ASSOCIATED(functional))
159 SELECT CASE (functional%section%name)
160 CASE ("BECKE97")
161 IF (lsd) THEN
162 CALL b97_lsd_info(reference=reference, shortform=shortform, &
163 needs=needs, max_deriv=max_deriv, b97_params=functional)
164 ELSE
165 CALL b97_lda_info(reference=reference, shortform=shortform, &
166 needs=needs, max_deriv=max_deriv, b97_params=functional)
167 END IF
168 CASE ("BECKE88_LR_ADIABATIC")
169 IF (lsd) THEN
170 CALL xb88_lr_adiabatic_lsd_info(reference=reference, shortform=shortform, &
171 needs=needs, max_deriv=max_deriv)
172 ELSE
173 CALL xb88_lr_adiabatic_lda_info(reference=reference, shortform=shortform, &
174 needs=needs, max_deriv=max_deriv)
175 END IF
176 CASE ("LYP_ADIABATIC")
177 IF (lsd) THEN
178 CALL lyp_adiabatic_lsd_info(reference=reference, shortform=shortform, &
179 needs=needs, max_deriv=max_deriv)
180 ELSE
181 CALL lyp_adiabatic_lda_info(reference=reference, shortform=shortform, &
182 needs=needs, max_deriv=max_deriv)
183 END IF
184 CASE ("BEEF")
185 IF (lsd) THEN
186 CALL xbeef_lsd_info(reference=reference, shortform=shortform, &
187 needs=needs, max_deriv=max_deriv)
188 ELSE
189 CALL xbeef_lda_info(reference=reference, shortform=shortform, &
190 needs=needs, max_deriv=max_deriv)
191 END IF
192 CASE ("BECKE88")
193 IF (lsd) THEN
194 CALL xb88_lsd_info(reference=reference, shortform=shortform, &
195 needs=needs, max_deriv=max_deriv)
196 ELSE
197 CALL xb88_lda_info(reference=reference, shortform=shortform, &
198 needs=needs, max_deriv=max_deriv)
199 END IF
200 CASE ("BECKE88_LR")
201 IF (lsd) THEN
202 CALL xb88_lr_lsd_info(reference=reference, shortform=shortform, &
203 needs=needs, max_deriv=max_deriv)
204 ELSE
205 CALL xb88_lr_lda_info(reference=reference, shortform=shortform, &
206 needs=needs, max_deriv=max_deriv)
207 END IF
208 CASE ("LYP")
209 IF (lsd) THEN
210 CALL lyp_lsd_info(reference=reference, shortform=shortform, &
211 needs=needs, max_deriv=max_deriv)
212 ELSE
213 CALL lyp_lda_info(reference=reference, shortform=shortform, &
214 needs=needs, max_deriv=max_deriv)
215 END IF
216 CASE ("PADE")
217 CALL pade_info(reference, shortform, lsd=lsd, needs=needs)
218 CASE ("HCTH")
219 CALL section_vals_val_get(functional, "PARAMETER_SET", i_val=i_param)
220 cpassert(.NOT. lsd)
221 CALL hcth_lda_info(i_param, reference, shortform, needs, max_deriv)
222 CASE ("OPTX")
223 IF (lsd) THEN
224 CALL optx_lsd_info(reference, shortform, needs, max_deriv)
225 ELSE
226 CALL optx_lda_info(reference, shortform, needs, max_deriv)
227 END IF
228 CASE ("CS1")
229 IF (lsd) THEN
230 CALL cs1_lsd_info(reference, shortform, needs, max_deriv)
231 ELSE
232 CALL cs1_lda_info(reference, shortform, needs=needs, max_deriv=max_deriv)
233 END IF
234 CASE ("XGGA")
235 CALL section_vals_val_get(functional, "FUNCTIONAL", i_val=i_param)
236 CALL xgga_info(i_param, lsd, reference, shortform, needs, max_deriv)
237 CASE ("KE_GGA")
238 CALL section_vals_val_get(functional, "FUNCTIONAL", i_val=i_param)
239 CALL ke_gga_info(i_param, lsd, reference, shortform, needs, max_deriv)
240 CASE ("P86C")
241 IF (lsd) THEN
242 cpabort("BP functional not implemented with LSD")
243 END IF
244 CALL p86_lda_info(reference, shortform, needs, max_deriv)
245 CASE ("PW92")
246 CALL section_vals_val_get(functional, "PARAMETRIZATION", i_val=i_param)
247 CALL section_vals_val_get(functional, "SCALE", r_val=r_param)
248 CALL perdew_wang_info(i_param, lsd, reference, shortform, needs, max_deriv, &
249 r_param)
250 CASE ("PZ81")
251 CALL section_vals_val_get(functional, "PARAMETRIZATION", i_val=i_param)
252 CALL pz_info(i_param, lsd, reference, shortform, needs, max_deriv)
253 CASE ("TFW")
254 IF (lsd) THEN
255 CALL tfw_lsd_info(reference, shortform, needs, max_deriv)
256 ELSE
257 CALL tfw_lda_info(reference, shortform, needs, max_deriv)
258 END IF
259 CASE ("TF")
260 CALL thomas_fermi_info(lsd, reference, shortform, needs, max_deriv)
261 CASE ("VWN")
262 IF (lsd) THEN
263 CALL vwn_lsd_info(reference, shortform, needs, max_deriv)
264 ELSE
265 CALL vwn_lda_info(reference, shortform, needs, max_deriv)
266 END IF
267 CASE ("XALPHA")
268 CALL section_vals_val_get(functional, "XA", r_val=r_param)
269 CALL xalpha_info(lsd, reference, shortform, needs, max_deriv, &
270 xa_parameter=r_param)
271 CASE ("TPSS")
272 IF (lsd) THEN
273 cpabort("TPSS functional not implemented with LSD. Use the LIBXC version instead.")
274 ELSE
275 CALL tpss_lda_info(functional, reference, shortform, needs, max_deriv)
276 END IF
277 CASE ("PBE")
278 IF (lsd) THEN
279 CALL pbe_lsd_info(functional, reference, shortform, needs, max_deriv)
280 ELSE
281 CALL pbe_lda_info(functional, reference, shortform, needs, max_deriv)
282 END IF
283 CASE ("GAUXC")
284 CALL skala_info(functional, lsd, reference, shortform, needs, max_deriv)
285 ! Note: SKALA functional routes through apply_gauxc in qs_ks_methods.F
286 ! when USE_GAUXC = .TRUE. (requires dft_control%use_gauxc to be set)
287 CASE ("XWPBE")
288 IF (lsd) THEN
289 CALL xwpbe_lsd_info(reference, shortform, needs, max_deriv)
290 ELSE
291 CALL xwpbe_lda_info(reference, shortform, needs, max_deriv)
292 END IF
293 CASE ("BECKE_ROUSSEL")
294 IF (lsd) THEN
295 CALL xbecke_roussel_lsd_info(reference, shortform, needs, max_deriv)
296 ELSE
297 CALL xbecke_roussel_lda_info(reference, shortform, needs, max_deriv)
298 END IF
299 CASE ("LDA_HOLE_T_C_LR")
300 IF (lsd) THEN
301 CALL xlda_hole_t_c_lr_lsd_info(reference, shortform, needs, max_deriv)
302 ELSE
303 CALL xlda_hole_t_c_lr_lda_info(reference, shortform, needs, max_deriv)
304 END IF
305 CASE ("PBE_HOLE_T_C_LR")
306 IF (lsd) THEN
307 CALL xpbe_hole_t_c_lr_lsd_info(reference, shortform, needs, max_deriv)
308 ELSE
309 CALL xpbe_hole_t_c_lr_lda_info(reference, shortform, needs, max_deriv)
310 END IF
311 CASE ("GV09")
312 IF (lsd) THEN
313 CALL xbr_pbe_lda_hole_tc_lr_lsd_info(reference, shortform, needs, max_deriv)
314 ELSE
315 CALL xbr_pbe_lda_hole_tc_lr_lda_info(reference, shortform, needs, max_deriv)
316 END IF
317 CASE default
318 ! If the functional has not been implemented internally, it's from LibXC
319 IF (lsd) THEN
320 CALL libxc_lsd_info(functional, reference, shortform, needs, max_deriv, print_warn)
321 ELSE
322 CALL libxc_lda_info(functional, reference, shortform, needs, max_deriv, print_warn)
323 END IF
324 END SELECT
325 END SUBROUTINE xc_functional_get_info
326
327! **************************************************************************************************
328!> \brief evaluate a functional (and its derivatives)
329!> \param functional a section that describes the functional to be added
330!> \param lsd if a local spin desnity is performed
331!> \param rho_set a rho set where all the arguments needed by this functional
332!> should be valid (which argument are needed can be found with
333!> xc_functional_get_info)
334!> \param deriv_set place where to store the functional derivatives (they are
335!> added to the derivatives)
336!> \param deriv_order degree of the derivative that should be evaluated,
337!> if positive all the derivatives up to the given degree are evaluated,
338!> if negative only the given degree is requested (but to simplify
339!> the code all the derivatives might be calculated, you should ignore
340!> them when adding derivatives of various functionals they might contain
341!> the derivative of just one functional)
342!> \par History
343!> 11.2003 created [fawzi]
344!> \author fawzi
345! **************************************************************************************************
346 SUBROUTINE xc_functional_eval(functional, lsd, rho_set, deriv_set, deriv_order)
347
348 TYPE(section_vals_type), POINTER :: functional
349 LOGICAL, INTENT(in) :: lsd
350 TYPE(xc_rho_set_type), INTENT(IN) :: rho_set
351 TYPE(xc_derivative_set_type), INTENT(IN) :: deriv_set
352 INTEGER, INTENT(IN) :: deriv_order
353
354 CHARACTER(len=*), PARAMETER :: abort_message_skala = &
355 "GauXC functionals are evaluated only through the QS GauXC path. "// &
356 "Higher XC derivatives for response and kernel properties are not implemented.", &
357 routinen = 'xc_functional_eval'
358
359 INTEGER :: handle, i_param
360 LOGICAL :: fun_active
361 REAL(kind=dp) :: density_cut, gradient_cut, r_param
362
363 CALL timeset(routinen, handle)
364
365 CALL xc_rho_set_get(rho_set, rho_cutoff=density_cut, &
366 drho_cutoff=gradient_cut)
367 CALL section_vals_val_get(functional, "_SECTION_PARAMETERS_", &
368 l_val=fun_active)
369 IF (.NOT. fun_active) THEN
370 CALL timestop(handle)
371 RETURN
372 END IF
373
374 SELECT CASE (functional%section%name)
375 CASE ("BECKE97")
376 IF (lsd) THEN
377 CALL b97_lsd_eval(rho_set, deriv_set, deriv_order, functional)
378 ELSE
379 CALL b97_lda_eval(rho_set, deriv_set, deriv_order, functional)
380 END IF
381 CASE ("BECKE88_LR_ADIABATIC")
382 IF (lsd) THEN
383 CALL xb88_lr_adiabatic_lsd_eval(rho_set, deriv_set, deriv_order, functional)
384 ELSE
385 CALL xb88_lr_adiabatic_lda_eval(rho_set, deriv_set, deriv_order, functional)
386 END IF
387 CASE ("LYP_ADIABATIC")
388 IF (lsd) THEN
389 CALL lyp_adiabatic_lsd_eval(rho_set, deriv_set, deriv_order, functional)
390 ELSE
391 CALL lyp_adiabatic_lda_eval(rho_set, deriv_set, deriv_order, functional)
392 END IF
393 CASE ("BECKE88")
394 IF (lsd) THEN
395 CALL xb88_lsd_eval(rho_set, deriv_set, deriv_order, functional)
396 ELSE
397 CALL xb88_lda_eval(rho_set, deriv_set, deriv_order, functional)
398 END IF
399 CASE ("BEEF")
400 IF (lsd) THEN
401 CALL xbeef_lsd_eval(rho_set, deriv_set, deriv_order, functional)
402 ELSE
403 CALL xbeef_lda_eval(rho_set, deriv_set, deriv_order, functional)
404 END IF
405 CASE ("BECKE88_LR")
406 IF (lsd) THEN
407 CALL xb88_lr_lsd_eval(rho_set, deriv_set, deriv_order, functional)
408 ELSE
409 CALL xb88_lr_lda_eval(rho_set, deriv_set, deriv_order, functional)
410 END IF
411 CASE ("LYP")
412 IF (lsd) THEN
413 CALL lyp_lsd_eval(rho_set, deriv_set, deriv_order, functional)
414 ELSE
415 CALL lyp_lda_eval(rho_set, deriv_set, deriv_order, functional)
416 END IF
417 CASE ("PADE")
418 CALL pade_init(density_cut)
419 IF (lsd) THEN
420 CALL pade_lsd_pw_eval(deriv_set, rho_set, deriv_order)
421 ELSE
422 CALL pade_lda_pw_eval(deriv_set, rho_set, deriv_order)
423 END IF
424 CASE ("HCTH")
425 cpassert(.NOT. lsd)
426 CALL section_vals_val_get(functional, "PARAMETER_SET", i_val=i_param)
427 CALL hcth_lda_eval(i_param, rho_set, deriv_set, deriv_order)
428 CASE ("OPTX")
429 IF (lsd) THEN
430 CALL optx_lsd_eval(rho_set, deriv_set, deriv_order, functional)
431 ELSE
432 CALL optx_lda_eval(rho_set, deriv_set, deriv_order, functional)
433 END IF
434 CASE ("CS1")
435 IF (lsd) THEN
436 CALL cs1_lsd_eval(rho_set, deriv_set, deriv_order)
437 ELSE
438 CALL cs1_lda_eval(rho_set, deriv_set, deriv_order)
439 END IF
440 CASE ("XGGA")
441 CALL section_vals_val_get(functional, "FUNCTIONAL", i_val=i_param)
442 CALL xgga_eval(i_param, lsd, rho_set, deriv_set, deriv_order)
443 CASE ("KE_GGA")
444 CALL section_vals_val_get(functional, "FUNCTIONAL", i_val=i_param)
445 IF (lsd) THEN
446 CALL ke_gga_lsd_eval(i_param, rho_set, deriv_set, deriv_order)
447 ELSE
448 CALL ke_gga_lda_eval(i_param, rho_set, deriv_set, deriv_order)
449 END IF
450 CASE ("P86C")
451 cpassert(.NOT. lsd)
452 CALL p86_lda_eval(rho_set, deriv_set, deriv_order, functional)
453 CASE ("PW92")
454 CALL section_vals_val_get(functional, "PARAMETRIZATION", i_val=i_param)
455 CALL section_vals_val_get(functional, "SCALE", r_val=r_param)
456 IF (lsd) THEN
457 CALL perdew_wang_lsd_eval(i_param, rho_set, deriv_set, deriv_order, &
458 r_param)
459 ELSE
460 CALL perdew_wang_lda_eval(i_param, rho_set, deriv_set, deriv_order, &
461 r_param)
462 END IF
463 CASE ("PZ81")
464 CALL section_vals_val_get(functional, "PARAMETRIZATION", i_val=i_param)
465 IF (lsd) THEN
466 CALL pz_lsd_eval(i_param, rho_set, deriv_set, deriv_order, functional)
467 ELSE
468 CALL pz_lda_eval(i_param, rho_set, deriv_set, deriv_order, functional)
469 END IF
470 CASE ("TFW")
471 IF (lsd) THEN
472 CALL tfw_lsd_eval(rho_set, deriv_set, deriv_order)
473 ELSE
474 CALL tfw_lda_eval(rho_set, deriv_set, deriv_order)
475 END IF
476 CASE ("TF")
477 IF (lsd) THEN
478 CALL thomas_fermi_lsd_eval(rho_set, deriv_set, deriv_order)
479 ELSE
480 CALL thomas_fermi_lda_eval(rho_set, deriv_set, deriv_order)
481 END IF
482 CASE ("VWN")
483 IF (lsd) THEN
484 CALL vwn_lsd_eval(rho_set, deriv_set, deriv_order, functional)
485 ELSE
486 CALL vwn_lda_eval(rho_set, deriv_set, deriv_order, functional)
487 END IF
488 CASE ("XALPHA")
489 CALL section_vals_val_get(functional, "XA", r_val=r_param)
490 IF (lsd) THEN
491 CALL xalpha_lsd_eval(rho_set, deriv_set, deriv_order, &
492 xa_parameter=r_param, xa_params=functional)
493 ELSE
494 CALL xalpha_lda_eval(rho_set, deriv_set, deriv_order, &
495 xa_parameter=r_param, xa_params=functional)
496 END IF
497 CASE ("TPSS")
498 IF (lsd) THEN
499 cpabort("TPSS functional not implemented with LSD. Use the LIBXC version instead.")
500 ELSE
501 CALL tpss_lda_eval(rho_set, deriv_set, deriv_order, functional)
502 END IF
503 CASE ("PBE")
504 IF (lsd) THEN
505 CALL pbe_lsd_eval(rho_set, deriv_set, deriv_order, functional)
506 ELSE
507 CALL pbe_lda_eval(rho_set, deriv_set, deriv_order, functional)
508 END IF
509 CASE ("GAUXC")
510 cpabort(abort_message_skala)
511 CASE ("XWPBE")
512 IF (lsd) THEN
513 CALL xwpbe_lsd_eval(rho_set, deriv_set, deriv_order, functional)
514 ELSE
515 CALL xwpbe_lda_eval(rho_set, deriv_set, deriv_order, functional)
516 END IF
517 CASE ("BECKE_ROUSSEL")
518 IF (lsd) THEN
519 CALL xbecke_roussel_lsd_eval(rho_set, deriv_set, deriv_order, functional)
520 ELSE
521 CALL xbecke_roussel_lda_eval(rho_set, deriv_set, deriv_order, functional)
522 END IF
523 CASE ("LDA_HOLE_T_C_LR")
524 IF (lsd) THEN
525 CALL xlda_hole_t_c_lr_lsd_eval(rho_set, deriv_set, deriv_order, functional)
526 ELSE
527 CALL xlda_hole_t_c_lr_lda_eval(rho_set, deriv_set, deriv_order, functional)
528 END IF
529 CASE ("PBE_HOLE_T_C_LR")
530 IF (lsd) THEN
531 CALL xpbe_hole_t_c_lr_lsd_eval(rho_set, deriv_set, deriv_order, functional)
532 ELSE
533 CALL xpbe_hole_t_c_lr_lda_eval(rho_set, deriv_set, deriv_order, functional)
534 END IF
535 CASE ("GV09")
536 IF (lsd) THEN
537 CALL xbr_pbe_lda_hole_tc_lr_lsd_eval(rho_set, deriv_set, deriv_order, &
538 functional)
539 ELSE
540 CALL xbr_pbe_lda_hole_tc_lr_lda_eval(rho_set, deriv_set, deriv_order, &
541 functional)
542 END IF
543 CASE default
544 ! If functional not natively supported, ask LibXC
545 IF (lsd) THEN
546 CALL libxc_lsd_eval(rho_set, deriv_set, deriv_order, functional)
547 ELSE
548 CALL libxc_lda_eval(rho_set, deriv_set, deriv_order, functional)
549 END IF
550 END SELECT
551
552 CALL timestop(handle)
553 END SUBROUTINE xc_functional_eval
554
555! **************************************************************************************************
556!> \brief ...
557!> \param functionals a section containing the functional combination to be
558!> applied
559!> \param lsd if a local spin desnity is performed
560!> \param rho_set a rho set where all the arguments needed by this functional
561!> should be valid (which argument are needed can be found with
562!> xc_functional_get_info)
563!> \param deriv_set place where to store the functional derivatives (they are
564!> added to the derivatives)
565!> \param deriv_order degree of the derivative that should be evaluated,
566!> if positive all the derivatives up to the given degree are evaluated,
567!> if negative only the given degree is requested (but to simplify
568!> the code all the derivatives might be calculated, you should ignore
569!> them when adding derivatives of various functionals they might contain
570!> the derivative of just one functional)
571!> \author fawzi
572! **************************************************************************************************
573 SUBROUTINE xc_functionals_eval(functionals, lsd, rho_set, deriv_set, &
574 deriv_order)
575 TYPE(section_vals_type), POINTER :: functionals
576 LOGICAL, INTENT(in) :: lsd
577 TYPE(xc_rho_set_type), INTENT(IN) :: rho_set
578 TYPE(xc_derivative_set_type), INTENT(IN) :: deriv_set
579 INTEGER, INTENT(in) :: deriv_order
580
581 INTEGER :: ifun
582 TYPE(section_vals_type), POINTER :: xc_fun
583
584 cpassert(ASSOCIATED(functionals))
585 ifun = 0
586 DO
587 ifun = ifun + 1
588 xc_fun => section_vals_get_subs_vals2(functionals, i_section=ifun)
589 IF (.NOT. ASSOCIATED(xc_fun)) EXIT
590 CALL xc_functional_eval(xc_fun, &
591 lsd=lsd, &
592 rho_set=rho_set, &
593 deriv_set=deriv_set, &
594 deriv_order=deriv_order)
595 END DO
596 END SUBROUTINE xc_functionals_eval
597
598! **************************************************************************************************
599!> \brief ...
600!> \param functionals a section containing the functional combination to be
601!> applied
602!> \param lsd if a local spin desnity is performed
603!> \param calc_potential set, if potential calculation will be carried out later.
604!> helps to save memory and flops. defaults to false.
605!> \return ...
606!> \author fawzi
607! **************************************************************************************************
608 FUNCTION xc_functionals_get_needs(functionals, lsd, calc_potential) &
609 result(needs)
610 TYPE(section_vals_type), POINTER :: functionals
611 LOGICAL, INTENT(in) :: lsd
612 LOGICAL, INTENT(in), OPTIONAL :: calc_potential
613 TYPE(xc_rho_cflags_type) :: needs
614
615 INTEGER :: ifun
616 LOGICAL :: my_calc_potential
617 TYPE(section_vals_type), POINTER :: xc_fun
618
619 my_calc_potential = .false.
620 IF (PRESENT(calc_potential)) my_calc_potential = calc_potential
621
622 cpassert(ASSOCIATED(functionals))
623 CALL xc_rho_cflags_setall(needs, .false.)
624
625 ifun = 0
626 DO
627 ifun = ifun + 1
628 xc_fun => section_vals_get_subs_vals2(functionals, i_section=ifun)
629 IF (.NOT. ASSOCIATED(xc_fun)) EXIT
630 CALL xc_functional_get_info(xc_fun, lsd=lsd, needs=needs)
631 END DO
632
633 IF (my_calc_potential) THEN
634 IF (lsd) THEN
635 needs%rho_spin = .true.
636 needs%tau_spin = needs%tau_spin .OR. needs%tau
637 ELSE
638 needs%rho = .true.
639 END IF
640 IF (needs%norm_drho .OR. needs%norm_drho_spin) THEN
641 IF (lsd) THEN
642 needs%drho_spin = .true.
643 ELSE
644 needs%drho = .true.
645 END IF
646 END IF
647 END IF
648 END FUNCTION xc_functionals_get_needs
649
650END MODULE xc_derivatives
objects that represent the structure of input sections and the data contained in an input section
type(section_vals_type) function, pointer, public section_vals_get_subs_vals2(section_vals, i_section, i_rep_section)
returns the values of the n-th non default subsection (null if no such section exists (not so many no...
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
calculates the b97 correlation functional
Definition xc_b97.F:24
subroutine, public b97_lda_info(b97_params, reference, shortform, needs, max_deriv)
return various information on the functional
Definition xc_b97.F:187
subroutine, public b97_lda_eval(rho_set, deriv_set, grad_deriv, b97_params)
evaluates the b97 correlation functional for lda
Definition xc_b97.F:252
subroutine, public b97_lsd_info(b97_params, reference, shortform, needs, max_deriv)
return various information on the functional
Definition xc_b97.F:219
subroutine, public b97_lsd_eval(rho_set, deriv_set, grad_deriv, b97_params)
evaluates the b 97 xc functional for lsd
Definition xc_b97.F:364
Calculate the CS1 Functional (Handy s improved LYP functional)
Definition xc_cs1.F:15
subroutine, public cs1_lda_eval(rho_set, deriv_set, order)
...
Definition xc_cs1.F:149
subroutine, public cs1_lsd_eval(rho_set, deriv_set, order)
...
Definition xc_cs1.F:238
subroutine, public cs1_lsd_info(reference, shortform, needs, max_deriv)
return various information on the functional
Definition xc_cs1.F:100
subroutine, public cs1_lda_info(reference, shortform, needs, max_deriv)
return various information on the functional
Definition xc_cs1.F:72
represent a group ofunctional derivatives
type(xc_rho_cflags_type) function, public xc_functionals_get_needs(functionals, lsd, calc_potential)
...
subroutine, public xc_functional_get_info(functional, lsd, reference, shortform, needs, max_deriv, print_warn)
get the information about the given functional
subroutine, public xc_functionals_eval(functionals, lsd, rho_set, deriv_set, deriv_order)
...
Calculate several different exchange energy functionals with a GGA form.
subroutine, public xgga_eval(functional, lsd, rho_set, deriv_set, order)
evaluates different exchange gga
subroutine, public xgga_info(functional, lsd, reference, shortform, needs, max_deriv)
return various information on the xgga functionals
subroutine, public skala_info(functional, lsd, reference, shortform, needs, max_deriv)
Return information about the Skala functional.
calculate the Hamprecht, Cohen, Tozer, and Handy (HCTH) exchange functional
Definition xc_hcth.F:13
subroutine, public hcth_lda_info(iparset, reference, shortform, needs, max_deriv)
return various information on the functional
Definition xc_hcth.F:49
subroutine, public hcth_lda_eval(iparset, rho_set, deriv_set, grad_deriv)
evaluates the hcth functional for lda
Definition xc_hcth.F:118
Calculate the several different kinetic energy functionals with a GGA form.
Definition xc_ke_gga.F:16
subroutine, public ke_gga_lsd_eval(functional, rho_set, deriv_set, order)
...
Definition xc_ke_gga.F:313
subroutine, public ke_gga_info(functional, lsd, reference, shortform, needs, max_deriv)
...
Definition xc_ke_gga.F:97
subroutine, public ke_gga_lda_eval(functional, rho_set, deriv_set, order)
...
Definition xc_ke_gga.F:178
calculates a functional from libxc and its derivatives
Definition xc_libxc.F:28
subroutine, public libxc_lda_eval(rho_set, deriv_set, grad_deriv, libxc_params)
evaluates the functional from libxc
Definition xc_libxc.F:548
subroutine, public libxc_lsd_eval(rho_set, deriv_set, grad_deriv, libxc_params)
evaluates the functional from libxc
Definition xc_libxc.F:783
subroutine, public libxc_lsd_info(libxc_params, reference, shortform, needs, max_deriv, print_warn)
info about the functional from libxc
Definition xc_libxc.F:421
subroutine, public libxc_lda_info(libxc_params, reference, shortform, needs, max_deriv, print_warn)
info about the functional from libxc
Definition xc_libxc.F:313
Calculates the density_scaled Lyp functional when used in adiabatic hybrids. The energy is given as.
subroutine, public lyp_adiabatic_lda_info(reference, shortform, needs, max_deriv)
return various information on the functional
subroutine, public lyp_adiabatic_lsd_info(reference, shortform, needs, max_deriv)
return various information on the functional
subroutine, public lyp_adiabatic_lda_eval(rho_set, deriv_set, grad_deriv, lyp_adiabatic_params)
...
subroutine, public lyp_adiabatic_lsd_eval(rho_set, deriv_set, grad_deriv, lyp_adiabatic_params)
...
calculates the lyp correlation functional
Definition xc_lyp.F:14
subroutine, public lyp_lda_info(reference, shortform, needs, max_deriv)
return various information on the functional
Definition xc_lyp.F:59
subroutine, public lyp_lsd_eval(rho_set, deriv_set, grad_deriv, lyp_params)
evaluates the becke 88 exchange functional for lsd
Definition xc_lyp.F:727
subroutine, public lyp_lsd_info(reference, shortform, needs, max_deriv)
return various information on the functional
Definition xc_lyp.F:90
subroutine, public lyp_lda_eval(rho_set, deriv_set, grad_deriv, lyp_params)
evaluates the lyp correlation functional for lda
Definition xc_lyp.F:124
calculate optx
Definition xc_optx.F:14
subroutine, public optx_lda_info(reference, shortform, needs, max_deriv)
info about the optx functional
Definition xc_optx.F:52
subroutine, public optx_lsd_eval(rho_set, deriv_set, grad_deriv, optx_params)
evaluates the optx functional for lsd
Definition xc_optx.F:169
subroutine, public optx_lda_eval(rho_set, deriv_set, grad_deriv, optx_params)
evaluates the optx functional for lda
Definition xc_optx.F:110
subroutine, public optx_lsd_info(reference, shortform, needs, max_deriv)
info about the optx functional (LSD)
Definition xc_optx.F:79
Calculate the LDA functional in the Pade approximation Literature: S. Goedecker, M....
Definition xc_pade.F:19
subroutine, public pade_init(cutoff, debug)
...
Definition xc_pade.F:80
subroutine, public pade_lsd_pw_eval(deriv_set, rho_set, order)
...
Definition xc_pade.F:204
subroutine, public pade_info(reference, shortform, lsd, needs, max_deriv)
...
Definition xc_pade.F:106
subroutine, public pade_lda_pw_eval(deriv_set, rho_set, order)
...
Definition xc_pade.F:141
calculates the pbe correlation functional
Definition xc_pbe.F:21
subroutine, public pbe_lda_eval(rho_set, deriv_set, grad_deriv, pbe_params)
evaluates the pbe correlation functional for lda
Definition xc_pbe.F:280
subroutine, public pbe_lsd_info(pbe_params, reference, shortform, needs, max_deriv)
return various information on the functional
Definition xc_pbe.F:174
subroutine, public pbe_lsd_eval(rho_set, deriv_set, grad_deriv, pbe_params)
evaluates the becke 88 exchange functional for lsd
Definition xc_pbe.F:1326
subroutine, public pbe_lda_info(pbe_params, reference, shortform, needs, max_deriv)
return various information on the functional
Definition xc_pbe.F:70
Calculate the Perdew Correlation from 1986.
Definition xc_perdew86.F:15
subroutine, public p86_lda_info(reference, shortform, needs, max_deriv)
...
Definition xc_perdew86.F:94
subroutine, public p86_lda_eval(rho_set, deriv_set, order, p86_params)
...
Calculate the Perdew-Wang correlation potential and energy density and ist derivatives with respect t...
subroutine, public perdew_wang_lda_eval(method, rho_set, deriv_set, order, scale)
Calculate the correlation energy and its derivatives wrt to rho (the electron density) up to 3rd orde...
subroutine, public perdew_wang_info(method, lsd, reference, shortform, needs, max_deriv, scale)
Return some info on the functionals.
subroutine, public perdew_wang_lsd_eval(method, rho_set, deriv_set, order, scale)
Calculate the correlation energy and its derivatives wrt to rho (the electron density) up to 3rd orde...
Calculate the Perdew-Zunger correlation potential and energy density and ist derivatives with respect...
subroutine, public pz_lda_eval(method, rho_set, deriv_set, order, pz_params)
Calculate the correlation energy and its derivatives wrt to rho (the electron density) up to 3rd orde...
subroutine, public pz_lsd_eval(method, rho_set, deriv_set, order, pz_params)
Calculate the correlation energy and its derivatives wrt to rho (the electron density) up to 3rd orde...
subroutine, public pz_info(method, lsd, reference, shortform, needs, max_deriv)
Return some info on the functionals.
contains the structure
elemental subroutine, public xc_rho_cflags_setall(cflags, value)
sets all the flags to the given value
contains the structure
subroutine, public xc_rho_set_get(rho_set, can_return_null, rho, drho, norm_drho, rhoa, rhob, norm_drhoa, norm_drhob, rho_1_3, rhoa_1_3, rhob_1_3, laplace_rho, laplace_rhoa, laplace_rhob, drhoa, drhob, rho_cutoff, drho_cutoff, tau_cutoff, tau, tau_a, tau_b, local_bounds)
returns the various attributes of rho_set
Calculate the Thomas-Fermi kinetic energy functional plus the von Weizsaecker term.
Definition xc_tfw.F:16
subroutine, public tfw_lda_info(reference, shortform, needs, max_deriv)
...
Definition xc_tfw.F:81
subroutine, public tfw_lda_eval(rho_set, deriv_set, order)
...
Definition xc_tfw.F:134
subroutine, public tfw_lsd_info(reference, shortform, needs, max_deriv)
...
Definition xc_tfw.F:108
subroutine, public tfw_lsd_eval(rho_set, deriv_set, order)
...
Definition xc_tfw.F:244
Calculate the Thomas-Fermi kinetic energy functional.
subroutine, public thomas_fermi_lsd_eval(rho_set, deriv_set, order)
...
subroutine, public thomas_fermi_lda_eval(rho_set, deriv_set, order)
...
subroutine, public thomas_fermi_info(lsd, reference, shortform, needs, max_deriv)
...
Calculates the tpss functional.
Definition xc_tpss.F:17
subroutine, public tpss_lda_eval(rho_set, deriv_set, grad_deriv, tpss_params)
evaluates the tpss functional in the spin unpolarized (lda) case
Definition xc_tpss.F:109
subroutine, public tpss_lda_info(tpss_params, reference, shortform, needs, max_deriv)
return various information on the functional
Definition xc_tpss.F:60
Calculate the LDA functional according to Vosk, Wilk and Nusair Literature: S. H. Vosko,...
Definition xc_vwn.F:21
subroutine, public vwn_lda_info(reference, shortform, needs, max_deriv)
...
Definition xc_vwn.F:115
subroutine, public vwn_lda_eval(rho_set, deriv_set, order, vwn_params)
...
Definition xc_vwn.F:167
subroutine, public vwn_lsd_eval(rho_set, deriv_set, order, vwn_params)
...
Definition xc_vwn.F:525
subroutine, public vwn_lsd_info(reference, shortform, needs, max_deriv)
...
Definition xc_vwn.F:141
Calculate the local exchange functional.
Definition xc_xalpha.F:19
subroutine, public xalpha_lda_eval(rho_set, deriv_set, order, xa_params, xa_parameter)
...
Definition xc_xalpha.F:153
subroutine, public xalpha_info(lsd, reference, shortform, needs, max_deriv, xa_parameter, scaling)
...
Definition xc_xalpha.F:92
subroutine, public xalpha_lsd_eval(rho_set, deriv_set, order, xa_params, xa_parameter)
...
Definition xc_xalpha.F:223
calculates the longrange part of Becke 88 exchange functional
subroutine, public xb88_lr_lda_eval(rho_set, deriv_set, grad_deriv, xb88_lr_params)
evaluates the becke 88 longrange exchange functional for lda
subroutine, public xb88_lr_lsd_info(reference, shortform, needs, max_deriv)
return various information on the functional
subroutine, public xb88_lr_lda_info(reference, shortform, needs, max_deriv)
return various information on the functional
subroutine, public xb88_lr_lsd_eval(rho_set, deriv_set, grad_deriv, xb88_lr_params)
evaluates the becke 88 longrange exchange functional for lsd
Calculates the density_scaled BECKE88 long-range functional when used in adiabatic hybrids....
subroutine, public xb88_lr_adiabatic_lda_eval(rho_set, deriv_set, grad_deriv, xb88_lr_ad_params)
evaluates the becke 88 longrange exchange functional for lda
subroutine, public xb88_lr_adiabatic_lda_info(reference, shortform, needs, max_deriv)
return various information on the functional
subroutine, public xb88_lr_adiabatic_lsd_eval(rho_set, deriv_set, grad_deriv, xb88_lr_ad_params)
evaluates the becke 88 longrange exchange functional for lsd
subroutine, public xb88_lr_adiabatic_lsd_info(reference, shortform, needs, max_deriv)
return various information on the functional
calculates the Becke 88 exchange functional
Definition xc_xbecke88.F:14
subroutine, public xb88_lsd_info(reference, shortform, needs, max_deriv)
return various information on the functional
Definition xc_xbecke88.F:90
subroutine, public xb88_lda_eval(rho_set, deriv_set, grad_deriv, xb88_params)
evaluates the becke 88 exchange functional for lda
subroutine, public xb88_lsd_eval(rho_set, deriv_set, grad_deriv, xb88_params)
evaluates the becke 88 exchange functional for lsd
subroutine, public xb88_lda_info(reference, shortform, needs, max_deriv)
return various information on the functional
Definition xc_xbecke88.F:59
Calculates the exchange energy based on the Becke-Roussel exchange hole. Takes advantage of an analyt...
subroutine, public xbecke_roussel_lsd_eval(rho_set, deriv_set, grad_deriv, br_params)
evaluates the Becke Roussel exchange functional for lda
subroutine, public xbecke_roussel_lda_info(reference, shortform, needs, max_deriv)
return various information on the functional
subroutine, public xbecke_roussel_lda_eval(rho_set, deriv_set, grad_deriv, br_params)
evaluates the Becke Roussel exchange functional for lda
subroutine, public xbecke_roussel_lsd_info(reference, shortform, needs, max_deriv)
return various information on the functional
calculates the Exchange contribution in the BEEF-vdW functional
Definition xc_xbeef.F:15
subroutine, public xbeef_lda_eval(rho_set, deriv_set, grad_deriv, xbeef_params)
evaluates the beef exchange functional for lda
Definition xc_xbeef.F:137
subroutine, public xbeef_lsd_info(reference, shortform, needs, max_deriv)
return various information on the functional
Definition xc_xbeef.F:104
subroutine, public xbeef_lda_info(reference, shortform, needs, max_deriv)
return various information on the functional
Definition xc_xbeef.F:73
subroutine, public xbeef_lsd_eval(rho_set, deriv_set, grad_deriv, xbeef_params)
evaluates the beef 88 exchange functional for lsd
Definition xc_xbeef.F:311
This functional is a combination of three different exchange hole models. The ingredients are:
subroutine, public xbr_pbe_lda_hole_tc_lr_lsd_eval(rho_set, deriv_set, grad_deriv, params)
Intermediate routine that gets grids, derivatives and some params.
subroutine, public xbr_pbe_lda_hole_tc_lr_lda_eval(rho_set, deriv_set, grad_deriv, params)
Intermediate routine that gets grids, derivatives and some params.
subroutine, public xbr_pbe_lda_hole_tc_lr_lda_info(reference, shortform, needs, max_deriv)
return various information on the functional
subroutine, public xbr_pbe_lda_hole_tc_lr_lsd_info(reference, shortform, needs, max_deriv)
return various information on the functional
Calculates the lda exchange hole in a truncated coulomb potential. Can be used as longrange correctio...
subroutine, public xlda_hole_t_c_lr_lda_eval(rho_set, deriv_set, order, params)
evaluates the truncated lda exchange hole
subroutine, public xlda_hole_t_c_lr_lda_info(reference, shortform, needs, max_deriv)
returns various information on the functional
subroutine, public xlda_hole_t_c_lr_lsd_eval(rho_set, deriv_set, order, params)
evaluates the truncated lsd exchange hole. Calls the lda routine and applies spin scaling relation
subroutine, public xlda_hole_t_c_lr_lsd_info(reference, shortform, needs, max_deriv)
returns various information on the functional
Calculates the exchange energy for the pbe hole model in a truncated coulomb potential,...
subroutine, public xpbe_hole_t_c_lr_lda_info(reference, shortform, needs, max_deriv)
returns various information on the functional
subroutine, public xpbe_hole_t_c_lr_lda_eval(rho_set, deriv_set, order, params)
evaluates the pbe-hole exchange in a truncated coulomb potential
subroutine, public xpbe_hole_t_c_lr_lsd_eval(rho_set, deriv_set, order, params)
evaluates the pbe-hole exchange in a truncated coulomb potential
subroutine, public xpbe_hole_t_c_lr_lsd_info(reference, shortform, needs, max_deriv)
returns various information on the functional
Calculates short range exchange part for wPBE functional and averaged PBE exchange-hole functional (o...
Definition xc_xwpbe.F:15
subroutine, public xwpbe_lda_eval(rho_set, deriv_set, order, xwpbe_params)
evaluates the screened hole averaged PBE exchange functional for lda
Definition xc_xwpbe.F:150
subroutine, public xwpbe_lsd_eval(rho_set, deriv_set, order, xwpbe_params)
evaluates the screened hole averaged PBE exchange functional for lsd
Definition xc_xwpbe.F:5255
subroutine, public xwpbe_lda_info(reference, shortform, needs, max_deriv)
return various information on the functional
Definition xc_xwpbe.F:113
subroutine, public xwpbe_lsd_info(reference, shortform, needs, max_deriv)
return various information on the functional
Definition xc_xwpbe.F:5220
A derivative set contains the different derivatives of a xc-functional in form of a linked list.
contains a flag for each component of xc_rho_set, so that you can use it to tell which components you...
represent a density, with all the representation and data needed to perform a functional evaluation