44 #include "../base/base_uses.f90"
50 REAL(KIND=
dp),
PARAMETER :: f13 = 1.0_dp/3.0_dp, &
57 REAL(KIND=
dp) :: cf, b, b_lda, b_lsd, flda, flsd, sfac, t13
58 REAL(KIND=
dp) :: fact, tact
59 REAL(KIND=
dp) :: eps_rho
61 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'xc_ke_gga'
69 SUBROUTINE ke_gga_init(cutoff)
71 REAL(KIND=
dp),
INTENT(IN) :: cutoff
76 cf = 0.3_dp*(3.0_dp*
pi*
pi)**f23
78 flsd = flda*2.0_dp**f23
80 b_lda = 2.0_dp**f43*(3.0_dp*
pi*
pi)**(f13)
81 b_lsd = 2.0_dp*(3.0_dp*
pi*
pi)**(f13)
82 sfac = 1.0_dp/(2.0_dp*(3.0_dp*
pi*
pi)**f13)
85 END SUBROUTINE ke_gga_init
96 SUBROUTINE ke_gga_info(functional, lsd, reference, shortform, needs, max_deriv)
97 INTEGER,
INTENT(in) :: functional
98 LOGICAL,
INTENT(in) :: lsd
99 CHARACTER(LEN=*),
INTENT(OUT),
OPTIONAL :: reference, shortform
100 TYPE(xc_rho_cflags_type),
INTENT(inout),
OPTIONAL :: needs
101 INTEGER,
INTENT(out),
OPTIONAL :: max_deriv
103 IF (
PRESENT(reference))
THEN
104 SELECT CASE (functional)
106 reference =
"H. Ou-Yang and M. Levy, "// &
107 "Intl. J. Quant. Chem. 40, 379 (1991); Functional 1"
109 reference =
"H. Ou-Yang and M. Levy, "// &
110 "Intl. J. Quant. Chem. 40, 379 (1991); Functional 2"
112 reference =
"H. Lee, C. Lee, R.G. Parr, Phys. Rev. A, 44, 768 (1991)"
114 reference =
"J.P. Perdew and Y. Wang, Phys. Rev. B, 33, 8800 (1986)"
116 reference =
"J.P. Perdew and Y. Wang, Electronic Structure of Solids 91"
118 reference =
"A. Lembarki and H. Chermette, Phys. Rev. A, 50, 5328 (1994)"
120 reference =
"A.J. Thakkar, Phys. Rev. A, 46, 6920 (1992)"
122 reference =
"J.P.Perdew, K.Burke, M.Ernzerhof, Phys. Rev. Letter, 77, 3865 (1996)"
125 IF (len_trim(reference) + 6 < len(reference))
THEN
126 reference(len_trim(reference):len_trim(reference) + 6) =
' {spin unpolarized}'
130 IF (
PRESENT(shortform))
THEN
131 SELECT CASE (functional)
133 shortform =
"Ou-Yang-Levy Functional 1"
135 shortform =
"Ou-Yang-Levy Functional 2"
137 shortform =
"Lee-Lee-Parr Functional"
139 shortform =
"Perdew-Wang 1986 Functional (kinetic energy)"
141 shortform =
"Perdew-Wang 1991 Functional (kinetic energy)"
143 shortform =
"Lembarki-Chermette kinetic energy functional"
145 shortform =
"Thakkar 1992 Functional"
147 shortform =
"Perdew-Burke-Ernzerhof Functional (kinetic energy)"
150 IF (len_trim(shortform) + 6 < len(shortform))
THEN
151 shortform(len_trim(shortform):len_trim(shortform) + 6) =
' {spin unpolarized}'
155 IF (
PRESENT(needs))
THEN
157 needs%rho_spin = .true.
158 needs%rho_spin_1_3 = .true.
159 needs%norm_drho_spin = .true.
162 needs%rho_1_3 = .true.
163 needs%norm_drho = .true.
166 IF (
PRESENT(max_deriv)) max_deriv = 3
179 INTEGER,
INTENT(IN) :: functional
180 TYPE(xc_rho_set_type),
INTENT(IN) :: rho_set
181 TYPE(xc_derivative_set_type),
INTENT(IN) :: deriv_set
182 INTEGER,
INTENT(IN) :: order
184 CHARACTER(LEN=*),
PARAMETER :: routinen =
'ke_gga_lda_eval'
186 INTEGER :: handle, m, npoints
187 INTEGER,
DIMENSION(2, 3) :: bo
188 REAL(kind=
dp) :: drho_cutoff, rho_cutoff
189 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: s
190 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: fs
191 REAL(kind=
dp),
CONTIGUOUS,
DIMENSION(:, :, :),
POINTER :: e_0, e_ndrho, e_ndrho_ndrho, &
192 e_ndrho_ndrho_ndrho, e_rho, e_rho_ndrho, e_rho_ndrho_ndrho, e_rho_rho, e_rho_rho_ndrho, &
193 e_rho_rho_rho, grho, rho, rho13
194 TYPE(xc_derivative_type),
POINTER :: deriv
196 CALL timeset(routinen, handle)
197 NULLIFY (rho, rho13, e_0, e_rho, e_ndrho, &
198 e_rho_rho, e_rho_ndrho, e_ndrho_ndrho, &
199 e_rho_rho_rho, e_rho_rho_ndrho, e_rho_ndrho_ndrho, e_ndrho_ndrho_ndrho)
203 norm_drho=grho, local_bounds=bo, rho_cutoff=rho_cutoff, &
204 drho_cutoff=drho_cutoff)
205 npoints = (bo(2, 1) - bo(1, 1) + 1)*(bo(2, 2) - bo(1, 2) + 1)*(bo(2, 3) - bo(1, 3) + 1)
206 CALL ke_gga_init(rho_cutoff)
208 ALLOCATE (s(npoints))
209 ALLOCATE (fs(npoints, m + 1))
220 SELECT CASE (functional)
222 CALL efactor_ol1(s, fs, m)
223 cpabort(
"OL1 functional currently not working properly")
225 CALL efactor_ol2(s, fs, m)
226 cpabort(
"OL2 functional currently not working properly")
228 CALL efactor_llp(s, fs, m)
230 CALL efactor_pw86(s, fs, m)
232 CALL efactor_pw91(s, fs, m, 1)
234 CALL efactor_pw91(s, fs, m, 2)
236 CALL efactor_t92(s, fs, m)
238 CALL efactor_pbex(s, fs, m, 1)
240 cpabort(
"Unsupported functional")
245 allocate_deriv=.true.)
248 CALL kex_p_0(rho, rho13, fs, e_0, npoints)
251 IF (order >= 1 .OR. order == -1)
THEN
253 allocate_deriv=.true.)
256 allocate_deriv=.true.)
259 CALL kex_p_1(rho, rho13, s, fs, e_rho=e_rho, e_ndrho=e_ndrho, &
262 IF (order >= 2 .OR. order == -2)
THEN
264 allocate_deriv=.true.)
267 allocate_deriv=.true.)
273 CALL kex_p_2(rho, rho13, s, fs, e_rho_rho=e_rho_rho, &
274 e_rho_ndrho=e_rho_ndrho, e_ndrho_ndrho=e_ndrho_ndrho, npoints=npoints)
276 IF (order >= 3 .OR. order == -3)
THEN
278 allocate_deriv=.true.)
290 CALL kex_p_3(rho, rho13, s, fs, e_rho_rho_rho=e_rho_rho_rho, &
291 e_rho_rho_ndrho=e_rho_rho_ndrho, e_rho_ndrho_ndrho=e_rho_ndrho_ndrho, &
292 e_ndrho_ndrho_ndrho=e_ndrho_ndrho_ndrho, npoints=npoints)
294 IF (order > 3 .OR. order < -3)
THEN
295 cpabort(
"derivatives bigger than 3 not implemented")
301 CALL timestop(handle)
314 INTEGER,
INTENT(IN) :: functional
315 TYPE(xc_rho_set_type),
INTENT(IN) :: rho_set
316 TYPE(xc_derivative_set_type),
INTENT(IN) :: deriv_set
317 INTEGER,
INTENT(IN),
OPTIONAL :: order
319 CHARACTER(len=*),
PARAMETER :: routinen =
'ke_gga_lsd_eval'
320 INTEGER,
DIMENSION(2),
PARAMETER :: &
324 INTEGER :: handle, ispin, m, npoints
325 INTEGER,
DIMENSION(2, 3) :: bo
326 REAL(kind=
dp) :: rho_cutoff
327 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: s
328 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: fs
329 REAL(kind=
dp),
CONTIGUOUS,
DIMENSION(:, :, :),
POINTER :: e_0, e_ndrho, e_ndrho_ndrho, &
330 e_ndrho_ndrho_ndrho, e_rho, e_rho_ndrho, e_rho_ndrho_ndrho, e_rho_rho, e_rho_rho_ndrho, &
332 TYPE(cp_3d_r_cp_type),
DIMENSION(2) :: norm_drho, rho, rho_1_3
333 TYPE(xc_derivative_type),
POINTER :: deriv
335 CALL timeset(routinen, handle)
336 NULLIFY (e_0, e_ndrho, e_ndrho_ndrho, e_ndrho_ndrho_ndrho, e_rho_ndrho_ndrho, &
337 e_rho_ndrho, e_rho_rho_ndrho, e_rho, e_rho_rho, e_rho_rho_rho)
339 NULLIFY (norm_drho(ispin)%array, rho(ispin)%array, rho_1_3(ispin)%array)
343 rhob_1_3=rho_1_3(2)%array, rhoa=rho(1)%array, &
344 rhob=rho(2)%array, norm_drhoa=norm_drho(1)%array, &
345 norm_drhob=norm_drho(2)%array, rho_cutoff=rho_cutoff, &
347 npoints = (bo(2, 1) - bo(1, 1) + 1)*(bo(2, 2) - bo(1, 2) + 1)*(bo(2, 3) - bo(1, 3) + 1)
349 CALL ke_gga_init(rho_cutoff)
351 ALLOCATE (s(npoints))
352 ALLOCATE (fs(npoints, m + 1))
362 SELECT CASE (functional)
364 CALL efactor_ol1(s, fs, m)
366 CALL efactor_ol2(s, fs, m)
368 CALL efactor_llp(s, fs, m)
370 tact = (1.0_dp/2.0_dp)**(1.0_dp/3.0_dp)
371 CALL efactor_pw86(s, fs, m, f2_lsd=tact)
374 tact = (1.0_dp/2.0_dp)**(1.0_dp/3.0_dp)
375 CALL efactor_pbex(s, fs, m, 1, f2_lsd=tact)
378 tact = (1.0_dp/2.0_dp)**(1.0_dp/3.0_dp)
379 CALL efactor_pw91(s, fs, m, 1, f2_lsd=tact)
382 tact = (1.0_dp/2.0_dp)**(1.0_dp/3.0_dp)
383 CALL efactor_pw91(s, fs, m, 2, f2_lsd=tact)
386 CALL efactor_t92(s, fs, m)
388 cpabort(
"Unsupported functional")
393 allocate_deriv=.true.)
396 CALL kex_p_0(rho(ispin)%array, rho_1_3(ispin)%array, fs, &
397 e_0=e_0, npoints=npoints)
399 IF (order >= 1 .OR. order == -1)
THEN
401 allocate_deriv=.true.)
404 allocate_deriv=.true.)
407 CALL kex_p_1(rho=rho(ispin)%array, &
408 r13=rho_1_3(ispin)%array, s=s, fs=fs, e_rho=e_rho, &
409 e_ndrho=e_ndrho, npoints=npoints)
411 IF (order >= 2 .OR. order == -2)
THEN
413 rho_spin_name(ispin)], allocate_deriv=.true.)
416 norm_drho_spin_name(ispin)], allocate_deriv=.true.)
419 norm_drho_spin_name(ispin)], allocate_deriv=.true.)
422 CALL kex_p_2(rho(ispin)%array, rho_1_3(ispin)%array, &
423 s, fs, e_rho_rho, e_rho_ndrho, e_ndrho_ndrho, npoints)
425 IF (order >= 3 .OR. order == -3)
THEN
427 rho_spin_name(ispin), rho_spin_name(ispin)], &
428 allocate_deriv=.true.)
431 rho_spin_name(ispin), norm_drho_spin_name(ispin)], &
432 allocate_deriv=.true.)
435 norm_drho_spin_name(ispin), norm_drho_spin_name(ispin)], &
436 allocate_deriv=.true.)
439 norm_drho_spin_name(ispin), norm_drho_spin_name(ispin)], &
440 allocate_deriv=.true.)
443 CALL kex_p_3(rho(ispin)%array, &
444 rho_1_3(ispin)%array, s, fs, e_rho_rho_rho, e_rho_rho_ndrho, &
445 e_rho_ndrho_ndrho, e_ndrho_ndrho_ndrho, npoints)
447 IF (order > 3 .OR. order < -3)
THEN
448 cpabort(
"derivatives bigger than 3 not implemented")
455 CALL timestop(handle)
466 SUBROUTINE kex_p_0(rho, r13, fs, e_0, npoints)
468 REAL(kind=
dp),
DIMENSION(*),
INTENT(IN) :: rho, r13
469 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(IN) :: fs
470 REAL(kind=
dp),
DIMENSION(*),
INTENT(INOUT) :: e_0
471 INTEGER,
INTENT(in) :: npoints
481 IF (rho(ip) > eps_rho)
THEN
482 e_0(ip) = e_0(ip) + fact*r13(ip)*r13(ip)*rho(ip)*fs(ip, 1)
489 END SUBROUTINE kex_p_0
501 SUBROUTINE kex_p_1(rho, r13, s, fs, e_rho, e_ndrho, npoints)
503 REAL(kind=
dp),
DIMENSION(*),
INTENT(IN) :: rho, r13, s
504 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(IN) :: fs
505 REAL(kind=
dp),
DIMENSION(*),
INTENT(INOUT) :: e_rho, e_ndrho
506 INTEGER,
INTENT(in) :: npoints
509 REAL(kind=
dp) :: a0, a1, sx, sy
518 IF (rho(ip) > eps_rho)
THEN
520 a0 = fact*r13(ip)*r13(ip)*rho(ip)
521 a1 = f53*fact*r13(ip)*r13(ip)
522 sx = -f43*s(ip)/rho(ip)
523 sy = sfac*tact/(r13(ip)*rho(ip))
524 e_rho(ip) = e_rho(ip) + a1*fs(ip, 1) + a0*fs(ip, 2)*sx
525 e_ndrho(ip) = e_ndrho(ip) + a0*fs(ip, 2)*sy
533 END SUBROUTINE kex_p_1
546 SUBROUTINE kex_p_2(rho, r13, s, fs, e_rho_rho, e_rho_ndrho, e_ndrho_ndrho, &
549 REAL(kind=
dp),
DIMENSION(*),
INTENT(IN) :: rho, r13, s
550 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(IN) :: fs
551 REAL(kind=
dp),
DIMENSION(*),
INTENT(INOUT) :: e_rho_rho, e_rho_ndrho, e_ndrho_ndrho
552 INTEGER,
INTENT(in) :: npoints
555 REAL(kind=
dp) :: a0, a1, a2, sx, sxx, sxy, sy
565 IF (rho(ip) > eps_rho)
THEN
567 a0 = fact*r13(ip)*r13(ip)*rho(ip)
568 a1 = f53*fact*r13(ip)*r13(ip)
569 a2 = f23*f53*fact/r13(ip)
570 sx = -f43*s(ip)/rho(ip)
571 sy = sfac*tact/(r13(ip)*rho(ip))
572 sxx = 28.0_dp/9.0_dp*s(ip)/(rho(ip)*rho(ip))
573 sxy = -f43*sfac*tact/(r13(ip)*rho(ip)*rho(ip))
574 e_rho_rho(ip) = e_rho_rho(ip) + a2*fs(ip, 1) + 2.0_dp*a1*fs(ip, 2)*sx + &
575 a0*fs(ip, 3)*sx*sx + a0*fs(ip, 2)*sxx
576 e_rho_ndrho(ip) = e_rho_ndrho(ip) + a1*fs(ip, 2)*sy + a0*fs(ip, 3)*sx*sy + &
578 e_ndrho_ndrho(ip) = e_ndrho_ndrho(ip) + a0*fs(ip, 3)*sy*sy
586 END SUBROUTINE kex_p_2
600 SUBROUTINE kex_p_3(rho, r13, s, fs, e_rho_rho_rho, e_rho_rho_ndrho, &
601 e_rho_ndrho_ndrho, e_ndrho_ndrho_ndrho, npoints)
603 REAL(kind=
dp),
DIMENSION(*),
INTENT(IN) :: rho, r13, s
604 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(IN) :: fs
605 REAL(kind=
dp),
DIMENSION(*),
INTENT(inout) :: e_rho_rho_rho, e_rho_rho_ndrho, &
606 e_rho_ndrho_ndrho, e_ndrho_ndrho_ndrho
607 INTEGER,
INTENT(in) :: npoints
610 REAL(kind=
dp) :: a0, a1, a2, a3, sx, sxx, sxxx, sxxy, &
622 IF (rho(ip) > eps_rho)
THEN
624 a0 = fact*r13(ip)*r13(ip)*rho(ip)
625 a1 = f53*fact*r13(ip)*r13(ip)
626 a2 = f23*f53*fact/r13(ip)
627 a3 = -f13*f23*f53*fact/(r13(ip)*rho(ip))
628 sx = -f43*s(ip)/rho(ip)
629 sy = sfac*tact/(r13(ip)*rho(ip))
630 sxx = 28.0_dp/9.0_dp*s(ip)/(rho(ip)*rho(ip))
631 sxy = -f43*sfac*tact/(r13(ip)*rho(ip)*rho(ip))
632 sxxx = -280.0_dp/27.0_dp*s(ip)/(rho(ip)*rho(ip)*rho(ip))
633 sxxy = 28.0_dp/9.0_dp*sfac*tact/(r13(ip)*rho(ip)*rho(ip)*rho(ip))
634 e_rho_rho_rho(ip) = e_rho_rho_rho(ip) + a3*fs(ip, 1) + 3.0_dp*a2*fs(ip, 2)*sx + &
635 3.0_dp*a1*fs(ip, 3)*sx*sx + 3.0_dp*a1*fs(ip, 2)*sxx + &
636 a0*fs(ip, 4)*sx*sx*sx + 3.0_dp*a0*fs(ip, 3)*sx*sxx + &
638 e_rho_rho_ndrho(ip) = e_rho_rho_ndrho(ip) + a2*fs(ip, 2)*sy + 2.0_dp*a1*fs(ip, 3)*sx*sy + &
639 2.0_dp*a1*fs(ip, 2)*sxy + a0*fs(ip, 4)*sx*sx*sy + &
640 2.0_dp*a0*fs(ip, 3)*sx*sxy + a0*fs(ip, 3)*sxx*sy + &
642 e_rho_ndrho_ndrho(ip) = e_rho_ndrho_ndrho(ip) + a1*fs(ip, 3)*sy*sy + a0*fs(ip, 4)*sx*sy*sy + &
643 2.0_dp*a0*fs(ip, 3)*sxy*sy
644 e_ndrho_ndrho_ndrho(ip) = e_ndrho_ndrho_ndrho(ip) + a0*fs(ip, 4)*sy*sy*sy
652 END SUBROUTINE kex_p_3
661 SUBROUTINE efactor_ol1(s, fs, m)
662 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: s
663 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(OUT) :: fs
664 INTEGER,
INTENT(IN) :: m
667 REAL(kind=
dp) :: t1, t2
669 t1 = b*b/(72.0_dp*cf)
679 fs(ip, 1) = 1.0_dp + t1*s(ip)*s(ip) + t2*s(ip)
681 fs(ip, 1) = 1.0_dp + t1*s(ip)*s(ip) + t2*s(ip)
682 fs(ip, 2) = 2.0_dp*t1*s(ip) + t2
684 fs(ip, 1) = 1.0_dp + t1*s(ip)*s(ip) + t2*s(ip)
685 fs(ip, 2) = 2.0_dp*t1*s(ip) + t2
686 fs(ip, 3) = 2.0_dp*t1
688 cpabort(
"Illegal order.")
694 IF (m == 3) fs(:, 4) = 0.0_dp
696 END SUBROUTINE efactor_ol1
703 SUBROUTINE efactor_ol2(s, fs, m)
704 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: s
705 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(OUT) :: fs
706 INTEGER,
INTENT(IN) :: m
709 REAL(kind=
dp) :: t1, t2, t3, y
711 t1 = b*b/(72.0_dp*cf)
720 y = 1.0_dp/(1.0_dp + t3*s(ip))
723 fs(ip, 1) = 1.0_dp + t1*s(ip)*s(ip) + t2*s(ip)*y
725 fs(ip, 1) = 1.0_dp + t1*s(ip)*s(ip) + t2*s(ip)*y
726 fs(ip, 2) = 2.0_dp*t1*s(ip) + t2*y*y
728 fs(ip, 1) = 1.0_dp + t1*s(ip)*s(ip) + t2*s(ip)*y
729 fs(ip, 2) = 2.0_dp*t1*s(ip) + t2*y*y
730 fs(ip, 3) = 2.0_dp*(t1 - t2*t3*y*y*y)
732 fs(ip, 1) = 1.0_dp + t1*s(ip)*s(ip) + t2*s(ip)*y
733 fs(ip, 2) = 2.0_dp*t1*s(ip) + t2*y*y
734 fs(ip, 3) = 2.0_dp*(t1 - t2*t3*y*y*y)
735 fs(ip, 4) = 6.0_dp*t2*t3*t3*y*y*y*y
737 cpabort(
"Illegal order.")
743 END SUBROUTINE efactor_ol2
750 SUBROUTINE efactor_llp(s, fs, m)
751 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: s
752 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(OUT) :: fs
753 INTEGER,
INTENT(IN) :: m
756 REAL(kind=
dp) :: as, bs, p, q, sas, sbs, t1, t10, t11, t12, t133, t16, t17, t19, t2, t20, &
757 t22, t23, t26, t28, t29, t3, t30, t33, t36, t39, t4, t40, t42, t43, t45, t46, t47, t49, &
758 t5, t50, t54, t55, t7, t71, t8, t9, x, ys
773 sbs = sqrt(bs*bs + 1.0_dp)
776 ys = 1.0_dp/(1.0_dp + q*sas)
779 fs(ip, 1) = 1.0_dp + p*x*x*ys
781 fs(ip, 1) = 1.0_dp + p*x*x*ys
785 t8 = sqrt(1.0_dp + t4*t5)
788 t12 = 1.0_dp + t2*t10
790 fs(ip, 2) = 2.0_dp*p*x/t12 - p*t5/t17*(q*t10 + t2*(b + 1.0_dp/t8*t4*x)/t9)
793 fs(ip, 1) = 1.0_dp + p*x*x*ys
798 t8 = sqrt(1.0_dp + t4*t5)
801 t12 = 1.0_dp + t2*t10
803 fs(ip, 2) = 2.0_dp*p*x/t12 - p*t5/t17*(q*t10 + t2*(b + 1.0_dp/t8*t4*x)/t9)
809 t7 = sqrt(1.0_dp + t3*t4)
818 t26 = q*t9 + t1*t22*t23
825 fs(ip, 3) = 2.0_dp*p/t11 - 4.0_dp*p*x*t17*t26 + 2.0_dp*t30/t16/ &
826 t11*t33 - t30*t17*(2.0_dp*q*t22*t23 + t1* &
827 (-1.0_dp/t40/t7*t43*t4 + t20)*t23 - t1*t49/t50)
831 fs(ip, 1) = 1.0_dp + p*x*x*ys
836 t8 = sqrt(1.0_dp + t4*t5)
839 t12 = 1.0_dp + t2*t10
841 fs(ip, 2) = 2.0_dp*p*x/t12 - p*t5/t17*(q*t10 + t2*(b + 1.0_dp/t8*t4*x)/t9)
847 t7 = sqrt(1.0_dp + t3*t4)
856 t26 = q*t9 + t1*t22*t23
863 fs(ip, 3) = 2.0_dp*p/t11 - 4.0_dp*p*x*t17*t26 + 2.0_dp*t30/t16/ &
864 t11*t33 - t30*t17*(2.0_dp*q*t22*t23 + t1* &
865 (-1.0_dp/t40/t7*t43*t4 + t20)*t23 - t1*t49/t50)
879 t23 = q*t9 + t1*t19*t20
885 t40 = 1.0_dp/t36/t7*t39
890 t50 = 2.0_dp*q*t19*t20 + t1*t42*t20 - t1*t45*t47
895 -6.0_dp*p*t133*t23 + 12.0_dp*t26*t28*t29 - &
896 6.0_dp*t26*t133*t50 - 6.0_dp*t54/t55*t29*t23 + &
897 6.0_dp*t54*t28*t23*t50 - t54*t133* &
898 (3.0_dp*q*t42*t20 - 3.0_dp*q*t45*t47 + 3.0_dp*t1* &
899 (1.0_dp/t71/t7*t39*t3*t4*x - t40*x)*t20 - &
900 3.0_dp*t1*t42*t47*t19 + 2.0_dp*t1*t45*t19/t46/t8)
903 cpabort(
"Illegal order.")
909 END SUBROUTINE efactor_llp
917 SUBROUTINE efactor_pw86(s, fs, m, f2_lsd)
918 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: s
919 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(OUT) :: fs
920 INTEGER,
INTENT(IN) :: m
921 REAL(
dp),
OPTIONAL :: f2_lsd
924 REAL(kind=
dp) :: f15, ff, p0, p1, p15, p2, p3, s1, s2, &
932 IF (
PRESENT(f2_lsd)) ff = f2_lsd
945 p0 = 1.0_dp + t1*s2 + t2*s4 + t3*s6
948 p0 = 1.0_dp + t1*s2 + t2*s4 + t3*s6
949 p1 = s1*ff*(2.0_dp*t1 + 4.0_dp*t2*s2 + 6.0_dp*t3*s4)
952 fs(ip, 2) = f15*p1*p15/p0
954 p0 = 1.0_dp + t1*s2 + t2*s4 + t3*s6
955 p1 = s1*ff*(2.0_dp*t1 + 4.0_dp*t2*s2 + 6.0_dp*t3*s4)
956 p2 = ff*ff*(2.0_dp*t1 + 12.0_dp*t2*s2 + 30.0_dp*t3*s4)
959 fs(ip, 2) = f15*p1*p15/p0
960 fs(ip, 3) = f15*p15/p0*(p2 - 14.0_dp/15.0_dp*p1*p1/p0)
962 p0 = 1.0_dp + t1*s2 + t2*s4 + t3*s6
963 p1 = s1*ff*(2.0_dp*t1 + 4.0_dp*t2*s2 + 6.0_dp*t3*s4)
964 p2 = ff*ff*(2.0_dp*t1 + 12.0_dp*t2*s2 + 30.0_dp*t3*s4)
965 p3 = s1*ff*ff*ff*(24.0_dp*t2 + 120.0_dp*t3*s2)
968 fs(ip, 2) = f15*p1*p15/p0
969 fs(ip, 3) = f15*p15/p0*(p2 - 14.0_dp/15.0_dp*p1*p1/p0)
970 fs(ip, 4) = f15*p15/p0*(-14.0_dp*f15*p1*p1/p0 + 14.0_dp*14.0_dp*f15*p1*p1*p1/p0/p0 + &
971 p3 - 14.0_dp*p2*p1/p0 + 14.0_dp*p1*p1/p0/p0)
973 cpabort(
"Illegal order.")
979 END SUBROUTINE efactor_pw86
986 SUBROUTINE efactor_t92(s, fs, m)
987 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: s
988 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(OUT) :: fs
989 INTEGER,
INTENT(IN) :: m
992 REAL(kind=
dp) :: a1, a2, as, asp, asp2, asp3, bs, p, q, &
993 s1, s2, sas, sbs, sbs3, sbs5, t0, w1, &
1009 sbs = sqrt(bs*bs + 1.0_dp)
1012 ys = 1.0_dp/(1.0_dp + q*sas)
1015 fs(ip, 1) = 1.0_dp + p*x*x*ys - a1*x/(1 + a2*x)
1018 fs(ip, 1) = 1.0_dp + p*x*x*ys - a1*x/(1 + a2*x)
1019 fs(ip, 2) = 2.0_dp*p*x*ys - p*q*x*x*asp*ys*ys - a1/(1 + a2*x)**2
1023 asp2 = 2.0_dp*b/sbs - b*bs*bs/sbs3
1024 fs(ip, 1) = 1.0_dp + p*x*x*ys - a1*x/(1 + a2*x)
1025 fs(ip, 2) = 2.0_dp*p*x*ys - p*q*x*x*asp*ys*ys - a1/(1 + a2*x)**2
1026 fs(ip, 3) = 2.0_dp*p*ys - p*q*x*(4.0_dp*asp + x*asp2)*ys*ys + &
1027 2.0_dp*p*q*q*x*x*asp*asp*ys*ys*ys + 2.0_dp*a1*a2/(1 + a2*x)**3
1032 asp2 = 2.0_dp*b/sbs - b*bs*bs/sbs3
1033 asp3 = -4.0_dp*b*b*bs/sbs3 + 3.0_dp*b*b*bs*bs*bs/sbs5
1034 w1 = (4.0_dp*asp + x*asp2)
1035 fs(ip, 1) = 1.0_dp + p*x*x*ys - a1*x/(1 + a2*x)
1036 fs(ip, 2) = 2.0_dp*p*x*ys - p*q*x*x*asp*ys*ys - a1/(1 + a2*x)**2
1037 fs(ip, 3) = 2.0_dp*p*ys - p*q*x*w1*ys*ys + &
1038 2.0_dp*p*q*q*x*x*asp*asp*ys*ys*ys + 2.0_dp*a1*a2/(1 + a2*x)**3
1040 s2 = -6*p/(1 + q*x*log(b*x + sqrt(1 + b**2*x**2)))**2*(q*log(b*x + sqrt(1 + b**2*x**2)) + &
1041 q*x*(b + 1/sqrt(1 + b**2*x**2)*b**2*x)/(b*x + sqrt(1 + b**2*x**2))) + 12*p*x/ &
1042 (1 + q*x*log(b*x + sqrt(1 + b**2*x**2)))**3*(q*log(b*x + sqrt(1 + b**2*x**2)) + &
1043 q*x*(b + 1/sqrt(1 + b**2*x**2)*b**2*x)/(b*x + sqrt(1 + b**2*x**2)))**2
1044 s1 = s2 - 6*p*x/(1 + q*x*log(b*x + sqrt(1 + b**2*x**2)))**2*(2*q*(b + 1/sqrt(1 + b**2*x**2)*b**2*x)/ &
1045 (b*x + sqrt(1 + b**2*x**2)) + q*x*(-1/sqrt(1 + b**2*x**2)**3*b**4*x**2 + 1/sqrt(1 + b**2*x**2)*b**2)/ &
1046 (b*x + sqrt(1 + b**2*x**2)) - q*x*(b + 1/sqrt(1 + b**2*x**2)*b**2*x)**2/ &
1047 (b*x + sqrt(1 + b**2*x**2))**2) - 6*p*x**2/(1 + q*x*log(b*x + sqrt(1 + b**2*x**2)))**4 &
1048 *(q*log(b*x + sqrt(1 + b**2*x**2)) + q*x*(b + 1/sqrt(1 + b**2*x**2)*b**2*x)/(b*x + sqrt(1 + b**2*x**2)))**3
1049 s2 = s1 + 6*p*x**2/(1 + q*x*log(b*x + sqrt(1 + b**2*x**2)))**3*(q*log(b*x + sqrt(1 + b**2*x**2)) + &
1050 q*x*(b + 1/sqrt(1 + b**2*x**2)*b**2*x)/(b*x + sqrt(1 + b**2*x**2)))*(2*q*(b + 1/sqrt(1 + b**2*x**2)*b**2*x) &
1051 /(b*x + sqrt(1 + b**2*x**2)) + q*x*(-1/sqrt(1 + b**2*x**2)**3*b**4*x**2 + 1/sqrt(1 + b**2*x**2)* &
1052 b**2)/(b*x + sqrt(1 + b**2*x**2)) - q*x*(b + 1/sqrt(1 + b**2*x**2)*b**2*x)**2/(b*x + sqrt(1 + b**2*x**2))**2)
1053 t0 = s2 - p*x**2/(1 + q*x*log(b*x + sqrt(1 + b**2*x**2)))**2*(3*q*(-1/sqrt(1 + b**2*x**2)**3*b**4*x**2 + &
1054 1/sqrt(1 + b**2*x**2)*b**2)/(b*x + sqrt(1 + b**2*x**2)) - 3*q*(b + 1/sqrt(1 + b**2*x**2)*b**2*x)**2/ &
1055 (b*x + sqrt(1 + b**2*x**2))**2 + q*x*(3/sqrt(1 + b**2*x**2)**5*b**6*x**3 - 3/sqrt(1 + b**2*x**2)**3*b**4*x)/ &
1056 (b*x + sqrt(1 + b**2*x**2)) - 3*q*x*(-1/sqrt(1 + b**2*x**2)**3*b**4*x**2 + 1/sqrt(1 + b**2*x**2)*b**2)/ &
1057 (b*x + sqrt(1 + b**2*x**2))**2*(b + 1/sqrt(1 + b**2*x**2)*b**2*x) + 2*q*x*(b + 1/sqrt(1 + b**2*x**2)* &
1058 b**2*x)**3/(b*x + sqrt(1 + b**2*x**2))**3) - 6*a1/(1 + a2*x)**3*a2**2 + 6*a1*x/(1 + a2*x)**4*a2**3
1063 cpabort(
"Illegal order")
1069 END SUBROUTINE efactor_t92
1078 SUBROUTINE efactor_pbex(s, fs, m, pset, f2_lsd)
1080 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: s
1081 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(OUT) :: fs
1082 INTEGER,
INTENT(IN) :: m, pset
1083 REAL(
dp),
OPTIONAL :: f2_lsd
1085 REAL(kind=
dp),
PARAMETER :: kappa1 = 0.804_dp, kappa2 = 1.245_dp, &
1086 mu = 0.2195149727645171_dp
1089 REAL(kind=
dp) :: f0, mk, x, x2, y
1091 IF (pset == 1) mk = mu/kappa1
1092 IF (pset == 2) mk = mu/kappa2
1095 IF (
PRESENT(f2_lsd)) f0 = f2_lsd
1104 y = 1.0_dp/(1.0_dp + mk*x2)
1107 fs(ip, 1) = 1.0_dp + mu*x2*y
1109 fs(ip, 1) = 1.0_dp + mu*x2*y
1110 fs(ip, 2) = 2.0_dp*mu*x*y*y*f0
1112 fs(ip, 1) = 1.0_dp + mu*x2*y
1113 fs(ip, 2) = 2.0_dp*mu*x*y*y*f0
1114 fs(ip, 3) = -2.0_dp*mu*(3.0_dp*mk*x2 - 1.0_dp)*y*y*y*f0*f0
1116 fs(ip, 1) = 1.0_dp + mu*x2*y
1117 fs(ip, 2) = 2.0_dp*mu*x*y*y*f0
1118 fs(ip, 3) = -2.0_dp*mu*(3.0_dp*mk*x2 - 1.0_dp)*y*y*y*f0*f0
1119 fs(ip, 4) = 24.0_dp*mu*mk*x*(mk*x2 - 1.0_dp)*y*y*y*y*f0*f0*f0
1121 cpabort(
"Illegal order.")
1127 END SUBROUTINE efactor_pbex
1137 SUBROUTINE efactor_pw91(s, fs, m, pset, f2_lsd)
1138 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: s
1139 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(OUT) :: fs
1140 INTEGER,
INTENT(IN) :: m, pset
1141 REAL(
dp),
OPTIONAL :: f2_lsd
1144 REAL(
dp) :: ff, t1, t10, t101, t106, t109, t111, t113, t119, t12, t123, t124, t13, t14, t15, &
1145 t16, t17, t18, t19, t2, t20, t21, t22, t23, t25, t26, t27, t28, t29, t3, t30, t31, t33, &
1146 t35, t37, t38, t39, t4, t40, t44, t47, t48, t5, t50, t51, t53, t55, t56, t57, t58, t59, &
1147 t6, t60, t64, t65, t69, t7, t70, t71, t73, t77, t78, t8, t80, t82, t9, t90, t93, t94, &
1149 REAL(kind=
dp) :: a1, a2, a3, a4, a5, bb, o, pa(6, 2), x
1154 pa(1:6, 1) = (/0.19645_dp, 0.2743_dp, &
1155 0.1508_dp, 100.0_dp, &
1156 7.7956_dp, 0.004_dp/)
1157 pa(1:6, 2) = (/0.093907_dp, 0.26608_dp, &
1158 0.0809615_dp, 100.0_dp, &
1159 76.320_dp, 0.57767e-4_dp/)
1162 IF (
PRESENT(f2_lsd)) ff = f2_lsd
1164 a2 = pa(2, pset)*ff*ff
1165 a3 = pa(3, pset)*ff*ff
1166 a4 = pa(4, pset)*ff*ff
1169 a5 = pa(6, pset)*ff*ff*ff*ff
1186 t7 = sqrt(o + t3*t4)
1191 fs(ip, 1) = (o + t10 + (a2 - a3*t12)*t4)/(o + t10 + a5*t17)
1201 t6 = sqrt(o + t2*t3)
1206 t17 = t10*(bb + 1/t6*t2*x)/t7
1212 t33 = o + t30 + a5*t31
1215 (t9 + t17 + 2._dp*a3*a4*t19*t21 + 2._dp*t26*x)/ &
1216 t33 - (o + t30 + t26*t3)/t38*(t9 + t17 + 4._dp*a5*t19)
1226 t5 = sqrt(o + t1*t2)
1231 t15 = 2._dp*a1*t9*t13
1235 t25 = t16*(-o/t17/t5*t20*t2 + t7)*t13
1246 t50 = o + t48 + a5*t39
1253 t69 = t53 + t55 + 4._dp*a5*t56
1254 t73 = o + t48 + t60*t2
1257 (t15 + t25 - t30 + 10._dp*t31*t2*t33 - 4._dp*a3*t37*t39*t33 + &
1258 2._dp*a2 - 2._dp*t44)/t50 - 2._dp* &
1259 (t53 + t55 + 2._dp*t31*t56*t33 + 2._dp*t60*x)* &
1260 t65*t69 + 2._dp*t73/t64/t50*t77 - t73*t65*(t15 + t25 - t30 + 12._dp*a5*t2)
1270 t5 = sqrt(0.1e1_dp + t1*t2)
1287 t40 = 3*t29*(1/t30/t5*t1*t9*t35 - t10*x)*t18
1288 t44 = 3*t29*t14*t26*t22
1289 t50 = 2*t29*t23*t22/t25/t17
1298 t73 = 0.1e1_dp + t71 + a5*t64
1307 t101 = t96 + t98 + 4*a5*t35
1309 t109 = t96 + t98 + 2*t51*t59 + 2*t106*x
1312 t119 = t78 + t80 - t82 + 12*a5*t2
1313 t123 = 0.1e1_dp + t71 + t106*t2
1316 (t20 - t28 + t40 - t44 + t50 + 24*t51*x*t53 - 36._dp*t58*t59 + 8._dp*a3*t57*a4*t64* &
1317 x*t53)/t73 - 3._dp*(t78 + t80 - t82 + 10._dp*t51*t2*t53 - &
1318 4._dp*t58*t64*t53 + 2._dp*a2 - 2._dp*t90)*t94*t101 + &
1319 6._dp*t109*t111*t113 - 3._dp*t109*t94*t119 - 6*t123/t124*t113*t101 + &
1320 6._dp*t123*t111*t101*t119 - t123*t94*(t20 - t28 + t40 - t44 + t50 + 24._dp*a5*x)
1327 END SUBROUTINE efactor_pw91
various utilities that regard array of different kinds: output, allocation,... maybe it is not a good...
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
Utility routines for the functional calculations.
subroutine, public calc_wave_vector(tag, rho, grho, s)
...
subroutine, public set_util(cutoff)
...
Calculate the several different kinetic energy functionals with a GGA form.
subroutine, public ke_gga_lsd_eval(functional, rho_set, deriv_set, order)
...
subroutine, public ke_gga_info(functional, lsd, reference, shortform, needs, max_deriv)
...
subroutine, public ke_gga_lda_eval(functional, rho_set, deriv_set, order)
...
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