39 #include "../base/base_uses.f90"
44 LOGICAL,
PRIVATE,
PARAMETER :: debug_this_module = .true.
45 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'xc_lyp_adiabatic'
46 REAL(kind=
dp),
PARAMETER,
PRIVATE :: a = 0.04918_dp, b = 0.132_dp, &
47 c = 0.2533_dp, d = 0.349_dp
65 CHARACTER(LEN=*),
INTENT(OUT),
OPTIONAL :: reference, shortform
66 TYPE(xc_rho_cflags_type),
INTENT(inout),
OPTIONAL :: needs
67 INTEGER,
INTENT(out),
OPTIONAL :: max_deriv
69 IF (
PRESENT(reference))
THEN
70 reference =
"C. Lee, W. Yang, R.G. Parr, Phys. Rev. B, 37, 785 (1988) {LDA version}"
72 IF (
PRESENT(shortform))
THEN
73 shortform =
"Lee-Yang-Parr correlation energy functional (LDA)"
75 IF (
PRESENT(needs))
THEN
77 needs%rho_1_3 = .true.
78 needs%norm_drho = .true.
80 IF (
PRESENT(max_deriv)) max_deriv = 1
96 CHARACTER(LEN=*),
INTENT(OUT),
OPTIONAL :: reference, shortform
97 TYPE(xc_rho_cflags_type),
INTENT(inout),
OPTIONAL :: needs
98 INTEGER,
INTENT(out),
OPTIONAL :: max_deriv
100 IF (
PRESENT(reference))
THEN
101 reference =
"C. Lee, W. Yang, R.G. Parr, Phys. Rev. B, 37, 785 (1988) {LSD version}"
103 IF (
PRESENT(shortform))
THEN
104 shortform =
"Lee-Yang-Parr correlation energy functional (LSD)"
106 IF (
PRESENT(needs))
THEN
107 needs%rho_spin = .true.
108 needs%norm_drho_spin = .true.
109 needs%norm_drho = .true.
111 IF (
PRESENT(max_deriv)) max_deriv = 1
125 TYPE(xc_rho_set_type),
INTENT(IN) :: rho_set
126 TYPE(xc_derivative_set_type),
INTENT(IN) :: deriv_set
127 INTEGER,
INTENT(in) :: grad_deriv
128 TYPE(section_vals_type),
POINTER :: lyp_adiabatic_params
130 CHARACTER(len=*),
PARAMETER :: routinen =
'lyp_adiabatic_lda_eval'
132 INTEGER :: handle, npoints
133 INTEGER,
DIMENSION(2, 3) :: bo
134 REAL(kind=
dp) :: epsilon_norm_drho, epsilon_rho, lambda
135 REAL(kind=
dp),
CONTIGUOUS,
DIMENSION(:, :, :), &
136 POINTER :: dummy, e_0, e_ndrho, e_rho, norm_drho, &
138 TYPE(xc_derivative_type),
POINTER :: deriv
140 CALL timeset(routinen, handle)
146 norm_drho=norm_drho, local_bounds=bo, rho_cutoff=epsilon_rho, &
147 drho_cutoff=epsilon_norm_drho)
148 npoints = (bo(2, 1) - bo(1, 1) + 1)*(bo(2, 2) - bo(1, 2) + 1)*(bo(2, 3) - bo(1, 3) + 1)
156 IF (grad_deriv >= 0)
THEN
158 allocate_deriv=.true.)
161 IF (grad_deriv >= 1 .OR. grad_deriv == -1)
THEN
163 allocate_deriv=.true.)
166 allocate_deriv=.true.)
169 IF (grad_deriv > 1 .OR. grad_deriv < -1)
THEN
170 cpabort(
"derivatives bigger than 1 not implemented")
178 CALL lyp_adiabatic_lda_calc(rho=rho, norm_drho=norm_drho, &
179 e_0=e_0, e_rho=e_rho, e_ndrho=e_ndrho, &
180 grad_deriv=grad_deriv, &
181 npoints=npoints, epsilon_rho=epsilon_rho, lambda=lambda)
187 CALL timestop(handle)
205 SUBROUTINE lyp_adiabatic_lda_calc(rho, norm_drho, &
206 e_0, e_rho, e_ndrho, &
207 grad_deriv, npoints, epsilon_rho, lambda)
208 INTEGER,
INTENT(in) :: npoints, grad_deriv
209 REAL(kind=
dp),
DIMENSION(1:npoints),
INTENT(inout) :: e_ndrho, e_rho, e_0
210 REAL(kind=
dp),
DIMENSION(1:npoints),
INTENT(in) :: norm_drho, rho
211 REAL(kind=
dp),
INTENT(in) :: epsilon_rho, lambda
214 REAL(kind=
dp) :: cf, my_ndrho, my_rho, t10, t107, t11, t117, t12, t122, t125, t13, t14, t15, &
215 t153, t16, t17, t180, t189, t19, t195, t2, t20, t25, t28, t29, t3, t34, t36, t37, t38, &
216 t4, t40, t41, t42, t43, t45, t46, t47, t50, t51, t52, t57, t58, t59, t6, t63, t65, t7, &
217 t71, t77, t78, t87, t9, t94
219 cf = 0.3_dp*(3._dp*
pi*
pi)**(2._dp/3._dp)
225 IF (my_rho > epsilon_rho)
THEN
226 IF (grad_deriv >= 0)
THEN
227 my_ndrho = norm_drho(ii)
229 t3 = my_rho**(0.1e1_dp/0.3e1_dp)
231 t6 = 0.10e1_dp + t2*t4
242 t19 = 0.1e1_dp/t17/t16
244 t25 = 0.30e1_dp + 0.70e1_dp*t12 + 0.70e1_dp*t2*t4*t7
245 t28 = cf - 0.1388888889e-1_dp*t20*t25
258 t50 = 0.1e1_dp/t17/my_rho
264 t63 = 0.70e1_dp*t52 + 0.70e1_dp*d*t4*t7 - 0.70e1_dp*t58*t59*t37
267 e_0(ii) = e_0(ii) + 0.20e1_dp*lambda*(-a*my_rho*t7 - t10*t29) + t34*(a*t17 &
268 *t38 + t40*t43 + t40*t47 + 0.13888888888888888889e-1_dp*t51* &
272 IF (grad_deriv >= 1)
THEN
277 t94 = 0.1e1_dp/t3/my_rho
278 t107 = 0.37037037037037037037e-1_dp*t15/t17/t87*t25 - 0.1388888889e-1_dp &
279 *t20*(-0.2333333333e1_dp*t11*t94 - 0.2333333333e1_dp*t2 &
280 *t94*t7 + 0.23333333333333333333e1_dp*t57*t34*t50*t37)
281 t117 = 0.1e1_dp/t36/t6
286 t189 = 0.2e1_dp/0.3e1_dp*t71*t38 + 0.2e1_dp/0.3e1_dp*a*t59*t117* &
287 t57*lambda + 0.2e1_dp/0.3e1_dp*t122*t43 + t9*t59*t125*t78 &
288 /0.3e1_dp + 0.2e1_dp/0.3e1_dp*t9*t59*c*t45*t46*lambda + t40 &
289 *t41*t7*t107 + 0.2e1_dp/0.3e1_dp*t122*t47 + 0.2e1_dp/0.3e1_dp* &
290 t9*t59*t13*t117*t28*t58 + t40*t45*t107*d - 0.2314814815e-1_dp &
291 *t9*t19*t65 + 0.46296296296296296297e-2_dp*t9*t153 &
292 *c*t77*t7*t15*t63 + 0.46296296296296296297e-2_dp*t9*t153 &
293 *t13*t37*t15*t63*d*lambda + 0.13888888888888888889e-1_dp &
294 *t51*t14*t15*(-0.2333333333e1_dp*c*t94 - 0.2333333333e1_dp* &
295 d*t94*t7 + 0.70000000000000000000e1_dp*t57*t50*t37*lambda &
296 - 0.4666666667e1_dp*t57*d*t34*t180*t117)
298 e_rho(ii) = e_rho(ii) + 0.20e1_dp*lambda*(-a*t7 - t71*t38*lambda/0.3e1_dp - t9* &
299 t29 - t9*t52*t78/0.3e1_dp - t9*t4*t13*t37*t28*t2/0.3e1_dp &
300 - t10*t14*t107) + t34*t189
301 t195 = t14*my_ndrho*t25
303 e_ndrho(ii) = e_ndrho(ii) + 0.55555555555555555556e-1_dp*lambda*a*b*t50*t195 + t34 &
304 *(-0.2777777778e-1_dp*t9*t180*c*t195 - 0.2777777778e-1_dp*t9 &
305 *t180*t13*t37*my_ndrho*t25*d + 0.27777777777777777778e-1_dp* &
306 t51*t14*my_ndrho*t63)
314 END SUBROUTINE lyp_adiabatic_lda_calc
327 TYPE(xc_rho_set_type) :: rho_set
328 TYPE(xc_derivative_set_type),
INTENT(IN) :: deriv_set
329 INTEGER,
INTENT(in) :: grad_deriv
330 TYPE(section_vals_type),
POINTER :: lyp_adiabatic_params
332 CHARACTER(len=*),
PARAMETER :: routinen =
'lyp_adiabatic_lsd_eval'
334 INTEGER :: handle, npoints
335 INTEGER,
DIMENSION(2, 3) :: bo
336 REAL(kind=
dp) :: epsilon_rho, lambda
337 REAL(kind=
dp),
CONTIGUOUS,
DIMENSION(:, :, :),
POINTER :: dummy, e_0, e_ndr, e_ndr_ndr, &
338 e_ndr_ra, e_ndr_rb, e_ndra, e_ndra_ndra, e_ndra_ra, e_ndra_rb, e_ndrb, e_ndrb_ndrb, &
339 e_ndrb_ra, e_ndrb_rb, e_ra, e_ra_ra, e_ra_rb, e_rb, e_rb_rb, norm_drho, norm_drhoa, &
340 norm_drhob, rhoa, rhob
341 TYPE(xc_derivative_type),
POINTER :: deriv
343 CALL timeset(routinen, handle)
350 rhoa=rhoa, rhob=rhob, norm_drhoa=norm_drhoa, &
351 norm_drhob=norm_drhob, norm_drho=norm_drho, &
352 rho_cutoff=epsilon_rho, &
354 npoints = (bo(2, 1) - bo(1, 1) + 1)*(bo(2, 2) - bo(1, 2) + 1)*(bo(2, 3) - bo(1, 3) + 1)
376 IF (grad_deriv >= 0)
THEN
378 allocate_deriv=.true.)
381 IF (grad_deriv == 1 .OR. grad_deriv == -1)
THEN
383 allocate_deriv=.true.)
386 allocate_deriv=.true.)
389 allocate_deriv=.true.)
392 allocate_deriv=.true.)
395 allocate_deriv=.true.)
398 IF (grad_deriv > 1 .OR. grad_deriv < -1)
THEN
399 cpabort(
"derivatives bigger than 1 not implemented")
408 CALL lyp_adiabatic_lsd_calc( &
409 rhoa=rhoa, rhob=rhob, norm_drho=norm_drho, norm_drhoa=norm_drhoa, &
410 norm_drhob=norm_drhob, e_0=e_0, e_ra=e_ra, e_rb=e_rb, &
412 e_ndra=e_ndra, e_ndrb=e_ndrb, &
413 grad_deriv=grad_deriv, npoints=npoints, &
414 epsilon_rho=epsilon_rho, lambda=lambda)
418 CALL timestop(handle)
442 SUBROUTINE lyp_adiabatic_lsd_calc(rhoa, rhob, norm_drho, norm_drhoa, norm_drhob, &
446 grad_deriv, npoints, epsilon_rho, lambda)
447 REAL(kind=
dp),
DIMENSION(*),
INTENT(in) :: rhoa, rhob, norm_drho, norm_drhoa, &
449 REAL(kind=
dp),
DIMENSION(*),
INTENT(inout) :: e_0, e_ra, e_rb, e_ndr, e_ndra, e_ndrb
450 INTEGER,
INTENT(in) :: grad_deriv, npoints
451 REAL(kind=
dp),
INTENT(in) :: epsilon_rho, lambda
454 REAL(kind=
dp) :: cf, my_ndrho, my_ndrhoa, my_ndrhob, my_rhoa, my_rhob, t1, t10, t100, t102, &
455 t103, t106, t108, t113, t115, t118, t119, t124, t125, t128, t129, t132, t135, t138, t14, &
456 t140, t141, t143, t145, t146, t15, t151, t153, t157, t16, t162, t165, t169, t17, t171, &
457 t174, t179, t18, t183, t186, t187, t188, t19, t194, t196, t199, t2, t200, t202, t21, &
458 t212, t216, t220, t222, t223, t225, t23, t231, t237, t24, t246, t25, t250, t259, t26, &
459 t266, t27, t270, t273, t276, t28, t280, t285, t288, t294, t3, t30, t300, t307, t31, t316, &
460 t32, t325, t348, t351, t355, t362, t387, t39, t394, t4, t41, t42
461 REAL(kind=
dp) :: t421, t46, t47, t48, t49, t5, t51, t55, t58, t6, t62, t63, t65, t67, t7, &
462 t73, t74, t76, t77, t78, t80, t83, t84, t85, t86, t87, t9, t90, t91, t94, t95, t96, t97
464 cf = 0.3_dp*(3._dp*
pi*
pi)**(2._dp/3._dp)
469 my_rhoa = max(rhoa(ii), 0.0_dp)
470 my_rhob = max(rhob(ii), 0.0_dp)
471 IF (my_rhoa + my_rhob > epsilon_rho)
THEN
472 my_ndrhoa = norm_drhoa(ii)
473 my_ndrhob = norm_drhob(ii)
474 my_ndrho = norm_drho(ii)
475 IF (grad_deriv >= 0)
THEN
477 t2 = my_rhoa + my_rhob
481 t6 = t2**(0.1e1_dp/0.3e1_dp)
483 t9 = 0.10e1_dp + t5*t7
492 t23 = 0.1e1_dp/t21/t19/t2
494 t25 = my_rhoa*my_rhob
496 t27 = my_rhoa**(0.1e1_dp/0.3e1_dp)
499 t31 = my_rhob**(0.1e1_dp/0.3e1_dp)
502 t41 = 0.26111111111111111111e1_dp - 0.3888888889e0_dp*t16 - 0.3888888889e0_dp &
505 t46 = 0.25000000000000000000e1_dp - 0.5555555556e-1_dp*t16 - 0.5555555556e-1_dp &
510 t51 = t16 + t39 - 0.110e2_dp
511 t55 = my_rhoa*t3*t47 + t4*t48
512 t58 = 0.12699208415745595798e2_dp*cf*(t28*t26 + t32*t30) + t41 &
513 *t42 - t46*t49 - 0.1111111111e0_dp*t51*t55
514 t62 = 0.66666666666666666667e0_dp*t19
517 t67 = t25*t58 - 0.6666666667e0_dp*t19*t42 + t63*t48 + t65*t47
539 t108 = -0.3888888889e0_dp*t97 - 0.3888888889e0_dp*t100 + 0.38888888888888888889e0_dp &
541 t113 = -0.5555555556e-1_dp*t97 - 0.5555555556e-1_dp*t100 + 0.55555555555555555556e-1_dp &
543 t115 = t97 + t100 - t106
544 t118 = t108*t42 - t113*t49 - 0.1111111111e0_dp*t115*t55
547 e_0(ii) = e_0(ii) + 0.20e1_dp*lambda*(-0.40e1_dp*t1*t4*t10 - t18*t24*t67) &
548 + t73*(0.40e1_dp*t74*t80 + t83*t86*t87 + t18*t90*t91 - &
552 IF (grad_deriv == 1 .OR. grad_deriv == -1)
THEN
557 t132 = 0.40e1_dp*t1*t129*t10
558 t135 = 0.1e1_dp/t6/t19*t78
559 t138 = 0.1333333333e1_dp*t74*t135*t5
563 t145 = t14*t15*t143/0.3e1_dp
565 t151 = t14*t146*t141*t67*t5/0.3e1_dp
566 t153 = 0.1e1_dp/t21/t84
567 t157 = 0.11e2_dp/0.3e1_dp*t18*t10*t153*t67
570 t169 = 0.1e1_dp/t21/t2
571 t171 = t102*t73*t169*t78
572 t174 = (0.12962962962962962963e0_dp*t162 + 0.12962962962962962963e0_dp &
573 *t165 - 0.1296296296e0_dp*t171)*t42
574 t179 = (0.18518518518518518519e-1_dp*t162 + 0.18518518518518518519e-1_dp &
575 *t165 - 0.1851851852e-1_dp*t171)*t49
576 t183 = 0.1111111111e0_dp*(-t162/0.3e1_dp - t165/0.3e1_dp + t171/0.3e1_dp) &
578 t186 = my_rhoa*t128*t47
580 t188 = t3*t47 - t186 - t187
581 t194 = 0.1333333333e1_dp*t2*t42
582 t196 = 0.13333333333333333333e1_dp*my_rhob
583 t199 = 0.13333333333333333333e1_dp*my_rhoa
585 t202 = my_rhob*t58 + t25*(0.33864555775321588795e2_dp*cf*t28*my_rhoa &
586 + t174 - t179 - t183 - 0.1111111111e0_dp*t51*t188) - t194 + (-0.6666666667e0_dp &
587 *my_rhoa + t196)*t48 + t200*t47
588 t212 = 0.5333333333e1_dp*t74*t135*d
589 t216 = 0.1e1_dp/t77/t9
590 t220 = 0.26666666666666666667e1_dp*t74/t21/t19*t216*t103
593 t225 = 0.1e1_dp/t6/t140
594 t231 = t14*t223*t225*lambda*t17*t87/0.3e1_dp
595 t237 = 0.2e1_dp/0.3e1_dp*t14*c*t225*t146*t91*lambda
596 t246 = 0.2e1_dp/0.3e1_dp*t14*t17*t216*t225*t67*t103
597 t250 = 4*t18*t78*t141*t91
598 t259 = t14*t15*t141*t94*t25*t118/0.3e1_dp
599 t266 = t14*t146*t141*t25*t118*d*lambda/0.3e1_dp
600 t270 = 0.11e2_dp/0.3e1_dp*t95*t153*my_rhoa*t119
603 t280 = t102*t169*t78*lambda
604 t285 = t102*d*t73*t128*t216
605 t288 = (0.12962962962962962963e0_dp*t273 + 0.12962962962962962963e0_dp &
606 *t276 - 0.3888888889e0_dp*t280 + 0.25925925925925925926e0_dp*t285) &
608 t294 = (0.18518518518518518519e-1_dp*t273 + 0.18518518518518518519e-1_dp &
609 *t276 - 0.5555555556e-1_dp*t280 + 0.37037037037037037037e-1_dp*t285) &
611 t300 = 0.1111111111e0_dp*(-t273/0.3e1_dp - t276/0.3e1_dp + t280 - 0.2e1_dp &
613 t307 = 0.40e1_dp*t124*t80 - t212 + t220 - t222 + t231 + t237 + t83 &
614 *t86*t10*t202 + t246 - t250 + t18*t90*t202*d - t259 - &
615 t266 + t270 - t18*t24*t119 - t95*t96*my_rhob*(t288 - t294 - &
616 t300 - 0.1111111111e0_dp*t115*t188)
618 e_ra(ii) = e_ra(ii) + 0.20e1_dp*lambda*(-0.40e1_dp*t124*t125 + t132 - t138 - t145 &
619 - t151 + t157 - t18*t24*t202) + t73*t307
621 t316 = -t186 + t3*t48 - t187
622 t325 = my_rhoa*t58 + t25*(0.33864555775321588795e2_dp*cf*t32*my_rhob &
623 + t174 - t179 - t183 - 0.1111111111e0_dp*t51*t316) - t194 + t200 &
624 *t48 + (t199 - 0.6666666667e0_dp*my_rhob)*t47
625 t348 = 0.40e1_dp*t1*t80 - t212 + t220 - t222 + t231 + t237 + t83* &
626 t86*t10*t325 + t246 - t250 + t18*t90*t325*d - t259 - t266 &
627 + t270 - t18*t24*my_rhoa*t118 - t95*t96*my_rhob*(t288 - t294 &
628 - t300 - 0.1111111111e0_dp*t115*t316)
630 e_rb(ii) = e_rb(ii) + 0.20e1_dp*lambda*(-0.40e1_dp*t1*t125 + t132 - t138 - t145 - &
631 t151 + t157 - t18*t24*t325) + t73*t348
635 t362 = t25*(-real(2*t46*my_ndrhoa,
dp) - 0.2222222222e0_dp*t51*my_rhoa &
636 *t355) + real(2*t65*my_ndrhoa,
dp)
638 e_ndra(ii) = e_ndra(ii) - 0.20e1_dp*t351*t94*t23*t362 + t73*(t83*t86*t10* &
639 t362 + t18*t90*t362*d - t95*t96*my_rhob*(-real(2*t113* &
640 my_ndrhoa,
dp) - 0.2222222222e0_dp*t115*my_rhoa*t355))
643 t394 = t25*(-real(2*t46*my_ndrhob,
dp) - 0.2222222222e0_dp*t51*my_rhob &
644 *t387) + real(2*t63*my_ndrhob,
dp)
646 e_ndrb(ii) = e_ndrb(ii) - 0.20e1_dp*t351*t94*t23*t394 + t73*(t83*t86*t10* &
647 t394 + t18*t90*t394*d - t95*t96*my_rhob*(-real(2*t113* &
648 my_ndrhob,
dp) - 0.2222222222e0_dp*t115*my_rhob*t387))
650 t421 = real(2*t25*t41*my_ndrho,
dp) - 0.1333333333e1_dp*real(t19,
dp)*real(my_ndrho,
dp)
652 e_ndr(ii) = e_ndr(ii) - 0.20e1_dp*t351*t94*t23*t421 + t73*(t83*t86*t10*t421 &
653 + t18*t90*t421*d - real(2*t95*t96*my_rhob*t108*my_ndrho,
dp))
661 END SUBROUTINE lyp_adiabatic_lsd_calc
collects all references to literature in CP2K as new algorithms / method are included from literature...
integer, save, public lee1988
Defines the basic variable types.
integer, parameter, public dp
Definition of mathematical constants and functions.
real(kind=dp), parameter, public pi
Module with functions to handle derivative descriptors. derivative description are strings have the f...
integer, parameter, public deriv_norm_drho
integer, parameter, public deriv_norm_drhoa
integer, parameter, public deriv_rhob
integer, parameter, public deriv_rhoa
integer, parameter, public deriv_rho
integer, parameter, public deriv_norm_drhob
represent a group ofunctional derivatives
type(xc_derivative_type) function, pointer, public xc_dset_get_derivative(derivative_set, description, allocate_deriv)
returns the requested xc_derivative
Provides types for the management of the xc-functionals and their derivatives.
subroutine, public xc_derivative_get(deriv, split_desc, order, deriv_data, accept_null_data)
returns various information on the given derivative
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)
...
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