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
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
182 INTEGER,
INTENT(IN) :: order
184 CHARACTER(LEN=*),
PARAMETER :: routinen =
'ke_gga_lda_eval'
186 INTEGER :: handle, 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
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)
202 norm_drho=grho, local_bounds=bo, rho_cutoff=rho_cutoff, &
203 drho_cutoff=drho_cutoff)
204 npoints = (bo(2, 1) - bo(1, 1) + 1)*(bo(2, 2) - bo(1, 2) + 1)*(bo(2, 3) - bo(1, 3) + 1)
205 CALL ke_gga_init(rho_cutoff)
207 ALLOCATE (s(npoints))
208 ALLOCATE (fs(npoints, order + 1))
219 SELECT CASE (functional)
221 CALL efactor_ol1(s, fs, order)
222 cpabort(
"OL1 functional currently not working properly")
224 CALL efactor_ol2(s, fs, order)
225 cpabort(
"OL2 functional currently not working properly")
227 CALL efactor_llp(s, fs, order)
229 CALL efactor_pw86(s, fs, order)
231 CALL efactor_pw91(s, fs, order, 1)
233 CALL efactor_pw91(s, fs, order, 2)
235 CALL efactor_t92(s, fs, order)
237 CALL efactor_pbex(s, fs, order, 1)
239 cpabort(
"Unsupported functional")
243 allocate_deriv=.true.)
246 CALL kex_p_0(rho, rho13, fs, e_0, npoints)
250 allocate_deriv=.true.)
253 allocate_deriv=.true.)
256 CALL kex_p_1(rho, rho13, s, fs, e_rho=e_rho, e_ndrho=e_ndrho, &
261 allocate_deriv=.true.)
264 allocate_deriv=.true.)
270 CALL kex_p_2(rho, rho13, s, fs, e_rho_rho=e_rho_rho, &
271 e_rho_ndrho=e_rho_ndrho, e_ndrho_ndrho=e_ndrho_ndrho, npoints=npoints)
275 allocate_deriv=.true.)
287 CALL kex_p_3(rho, rho13, s, fs, e_rho_rho_rho=e_rho_rho_rho, &
288 e_rho_rho_ndrho=e_rho_rho_ndrho, e_rho_ndrho_ndrho=e_rho_ndrho_ndrho, &
289 e_ndrho_ndrho_ndrho=e_ndrho_ndrho_ndrho, npoints=npoints)
292 cpabort(
"derivatives bigger than 3 not implemented")
298 CALL timestop(handle)
311 INTEGER,
INTENT(IN) :: functional
314 INTEGER,
INTENT(IN),
OPTIONAL :: order
316 CHARACTER(len=*),
PARAMETER :: routinen =
'ke_gga_lsd_eval'
317 INTEGER,
DIMENSION(2),
PARAMETER :: &
321 INTEGER :: handle, ispin, npoints
322 INTEGER,
DIMENSION(2, 3) :: bo
323 REAL(kind=
dp) :: rho_cutoff
324 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: s
325 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: fs
326 REAL(kind=
dp),
CONTIGUOUS,
DIMENSION(:, :, :),
POINTER :: e_0, e_ndrho, e_ndrho_ndrho, &
327 e_ndrho_ndrho_ndrho, e_rho, e_rho_ndrho, e_rho_ndrho_ndrho, e_rho_rho, e_rho_rho_ndrho, &
332 CALL timeset(routinen, handle)
333 NULLIFY (e_0, e_ndrho, e_ndrho_ndrho, e_ndrho_ndrho_ndrho, e_rho_ndrho_ndrho, &
334 e_rho_ndrho, e_rho_rho_ndrho, e_rho, e_rho_rho, e_rho_rho_rho)
336 NULLIFY (norm_drho(ispin)%array, rho(ispin)%array, rho_1_3(ispin)%array)
340 rhob_1_3=rho_1_3(2)%array, rhoa=rho(1)%array, &
341 rhob=rho(2)%array, norm_drhoa=norm_drho(1)%array, &
342 norm_drhob=norm_drho(2)%array, rho_cutoff=rho_cutoff, &
344 npoints = (bo(2, 1) - bo(1, 1) + 1)*(bo(2, 2) - bo(1, 2) + 1)*(bo(2, 3) - bo(1, 3) + 1)
345 CALL ke_gga_init(rho_cutoff)
347 ALLOCATE (s(npoints))
348 ALLOCATE (fs(npoints, order + 1))
358 SELECT CASE (functional)
360 CALL efactor_ol1(s, fs, order)
362 CALL efactor_ol2(s, fs, order)
364 CALL efactor_llp(s, fs, order)
366 tact = (1.0_dp/2.0_dp)**(1.0_dp/3.0_dp)
367 CALL efactor_pw86(s, fs, order, f2_lsd=tact)
370 tact = (1.0_dp/2.0_dp)**(1.0_dp/3.0_dp)
371 CALL efactor_pbex(s, fs, order, 1, f2_lsd=tact)
374 tact = (1.0_dp/2.0_dp)**(1.0_dp/3.0_dp)
375 CALL efactor_pw91(s, fs, order, 1, f2_lsd=tact)
378 tact = (1.0_dp/2.0_dp)**(1.0_dp/3.0_dp)
379 CALL efactor_pw91(s, fs, order, 2, f2_lsd=tact)
382 CALL efactor_t92(s, fs, order)
384 cpabort(
"Unsupported functional")
388 allocate_deriv=.true.)
391 CALL kex_p_0(rho(ispin)%array, rho_1_3(ispin)%array, fs, &
392 e_0=e_0, npoints=npoints)
395 allocate_deriv=.true.)
398 allocate_deriv=.true.)
401 CALL kex_p_1(rho=rho(ispin)%array, &
402 r13=rho_1_3(ispin)%array, s=s, fs=fs, e_rho=e_rho, &
403 e_ndrho=e_ndrho, npoints=npoints)
407 rho_spin_name(ispin)], allocate_deriv=.true.)
410 norm_drho_spin_name(ispin)], allocate_deriv=.true.)
413 norm_drho_spin_name(ispin)], allocate_deriv=.true.)
416 CALL kex_p_2(rho(ispin)%array, rho_1_3(ispin)%array, &
417 s, fs, e_rho_rho, e_rho_ndrho, e_ndrho_ndrho, npoints)
421 rho_spin_name(ispin), rho_spin_name(ispin)], &
422 allocate_deriv=.true.)
425 rho_spin_name(ispin), norm_drho_spin_name(ispin)], &
426 allocate_deriv=.true.)
429 norm_drho_spin_name(ispin), norm_drho_spin_name(ispin)], &
430 allocate_deriv=.true.)
433 norm_drho_spin_name(ispin), norm_drho_spin_name(ispin)], &
434 allocate_deriv=.true.)
437 CALL kex_p_3(rho(ispin)%array, &
438 rho_1_3(ispin)%array, s, fs, e_rho_rho_rho, e_rho_rho_ndrho, &
439 e_rho_ndrho_ndrho, e_ndrho_ndrho_ndrho, npoints)
442 cpabort(
"derivatives bigger than 3 not implemented")
449 CALL timestop(handle)
460 SUBROUTINE kex_p_0(rho, r13, fs, e_0, npoints)
462 REAL(kind=
dp),
DIMENSION(*),
INTENT(IN) :: rho, r13
463 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(IN) :: fs
464 REAL(kind=
dp),
DIMENSION(*),
INTENT(INOUT) :: e_0
465 INTEGER,
INTENT(in) :: npoints
475 IF (rho(ip) > eps_rho)
THEN
476 e_0(ip) = e_0(ip) + fact*r13(ip)*r13(ip)*rho(ip)*fs(ip, 1)
483 END SUBROUTINE kex_p_0
495 SUBROUTINE kex_p_1(rho, r13, s, fs, e_rho, e_ndrho, npoints)
497 REAL(kind=
dp),
DIMENSION(*),
INTENT(IN) :: rho, r13, s
498 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(IN) :: fs
499 REAL(kind=
dp),
DIMENSION(*),
INTENT(INOUT) :: e_rho, e_ndrho
500 INTEGER,
INTENT(in) :: npoints
503 REAL(kind=
dp) :: a0, a1, sx, sy
512 IF (rho(ip) > eps_rho)
THEN
514 a0 = fact*r13(ip)*r13(ip)*rho(ip)
515 a1 = f53*fact*r13(ip)*r13(ip)
516 sx = -f43*s(ip)/rho(ip)
517 sy = sfac*tact/(r13(ip)*rho(ip))
518 e_rho(ip) = e_rho(ip) + a1*fs(ip, 1) + a0*fs(ip, 2)*sx
519 e_ndrho(ip) = e_ndrho(ip) + a0*fs(ip, 2)*sy
527 END SUBROUTINE kex_p_1
540 SUBROUTINE kex_p_2(rho, r13, s, fs, e_rho_rho, e_rho_ndrho, e_ndrho_ndrho, &
543 REAL(kind=
dp),
DIMENSION(*),
INTENT(IN) :: rho, r13, s
544 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(IN) :: fs
545 REAL(kind=
dp),
DIMENSION(*),
INTENT(INOUT) :: e_rho_rho, e_rho_ndrho, e_ndrho_ndrho
546 INTEGER,
INTENT(in) :: npoints
549 REAL(kind=
dp) :: a0, a1, a2, sx, sxx, sxy, sy
559 IF (rho(ip) > eps_rho)
THEN
561 a0 = fact*r13(ip)*r13(ip)*rho(ip)
562 a1 = f53*fact*r13(ip)*r13(ip)
563 a2 = f23*f53*fact/r13(ip)
564 sx = -f43*s(ip)/rho(ip)
565 sy = sfac*tact/(r13(ip)*rho(ip))
566 sxx = 28.0_dp/9.0_dp*s(ip)/(rho(ip)*rho(ip))
567 sxy = -f43*sfac*tact/(r13(ip)*rho(ip)*rho(ip))
568 e_rho_rho(ip) = e_rho_rho(ip) + a2*fs(ip, 1) + 2.0_dp*a1*fs(ip, 2)*sx + &
569 a0*fs(ip, 3)*sx*sx + a0*fs(ip, 2)*sxx
570 e_rho_ndrho(ip) = e_rho_ndrho(ip) + a1*fs(ip, 2)*sy + a0*fs(ip, 3)*sx*sy + &
572 e_ndrho_ndrho(ip) = e_ndrho_ndrho(ip) + a0*fs(ip, 3)*sy*sy
580 END SUBROUTINE kex_p_2
594 SUBROUTINE kex_p_3(rho, r13, s, fs, e_rho_rho_rho, e_rho_rho_ndrho, &
595 e_rho_ndrho_ndrho, e_ndrho_ndrho_ndrho, npoints)
597 REAL(kind=
dp),
DIMENSION(*),
INTENT(IN) :: rho, r13, s
598 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(IN) :: fs
599 REAL(kind=
dp),
DIMENSION(*),
INTENT(inout) :: e_rho_rho_rho, e_rho_rho_ndrho, &
600 e_rho_ndrho_ndrho, e_ndrho_ndrho_ndrho
601 INTEGER,
INTENT(in) :: npoints
604 REAL(kind=
dp) :: a0, a1, a2, a3, sx, sxx, sxxx, sxxy, &
616 IF (rho(ip) > eps_rho)
THEN
618 a0 = fact*r13(ip)*r13(ip)*rho(ip)
619 a1 = f53*fact*r13(ip)*r13(ip)
620 a2 = f23*f53*fact/r13(ip)
621 a3 = -f13*f23*f53*fact/(r13(ip)*rho(ip))
622 sx = -f43*s(ip)/rho(ip)
623 sy = sfac*tact/(r13(ip)*rho(ip))
624 sxx = 28.0_dp/9.0_dp*s(ip)/(rho(ip)*rho(ip))
625 sxy = -f43*sfac*tact/(r13(ip)*rho(ip)*rho(ip))
626 sxxx = -280.0_dp/27.0_dp*s(ip)/(rho(ip)*rho(ip)*rho(ip))
627 sxxy = 28.0_dp/9.0_dp*sfac*tact/(r13(ip)*rho(ip)*rho(ip)*rho(ip))
628 e_rho_rho_rho(ip) = e_rho_rho_rho(ip) + a3*fs(ip, 1) + 3.0_dp*a2*fs(ip, 2)*sx + &
629 3.0_dp*a1*fs(ip, 3)*sx*sx + 3.0_dp*a1*fs(ip, 2)*sxx + &
630 a0*fs(ip, 4)*sx*sx*sx + 3.0_dp*a0*fs(ip, 3)*sx*sxx + &
632 e_rho_rho_ndrho(ip) = e_rho_rho_ndrho(ip) + a2*fs(ip, 2)*sy + 2.0_dp*a1*fs(ip, 3)*sx*sy + &
633 2.0_dp*a1*fs(ip, 2)*sxy + a0*fs(ip, 4)*sx*sx*sy + &
634 2.0_dp*a0*fs(ip, 3)*sx*sxy + a0*fs(ip, 3)*sxx*sy + &
636 e_rho_ndrho_ndrho(ip) = e_rho_ndrho_ndrho(ip) + a1*fs(ip, 3)*sy*sy + a0*fs(ip, 4)*sx*sy*sy + &
637 2.0_dp*a0*fs(ip, 3)*sxy*sy
638 e_ndrho_ndrho_ndrho(ip) = e_ndrho_ndrho_ndrho(ip) + a0*fs(ip, 4)*sy*sy*sy
646 END SUBROUTINE kex_p_3
655 SUBROUTINE efactor_ol1(s, fs, m)
656 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: s
657 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(OUT) :: fs
658 INTEGER,
INTENT(IN) :: m
661 REAL(kind=
dp) :: t1, t2
663 t1 = b*b/(72.0_dp*cf)
673 fs(ip, 1) = 1.0_dp + t1*s(ip)*s(ip) + t2*s(ip)
675 fs(ip, 1) = 1.0_dp + t1*s(ip)*s(ip) + t2*s(ip)
676 fs(ip, 2) = 2.0_dp*t1*s(ip) + t2
678 fs(ip, 1) = 1.0_dp + t1*s(ip)*s(ip) + t2*s(ip)
679 fs(ip, 2) = 2.0_dp*t1*s(ip) + t2
680 fs(ip, 3) = 2.0_dp*t1
682 cpabort(
"Illegal order.")
688 IF (m == 3) fs(:, 4) = 0.0_dp
690 END SUBROUTINE efactor_ol1
697 SUBROUTINE efactor_ol2(s, fs, m)
698 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: s
699 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(OUT) :: fs
700 INTEGER,
INTENT(IN) :: m
703 REAL(kind=
dp) :: t1, t2, t3, y
705 t1 = b*b/(72.0_dp*cf)
714 y = 1.0_dp/(1.0_dp + t3*s(ip))
717 fs(ip, 1) = 1.0_dp + t1*s(ip)*s(ip) + t2*s(ip)*y
719 fs(ip, 1) = 1.0_dp + t1*s(ip)*s(ip) + t2*s(ip)*y
720 fs(ip, 2) = 2.0_dp*t1*s(ip) + t2*y*y
722 fs(ip, 1) = 1.0_dp + t1*s(ip)*s(ip) + t2*s(ip)*y
723 fs(ip, 2) = 2.0_dp*t1*s(ip) + t2*y*y
724 fs(ip, 3) = 2.0_dp*(t1 - t2*t3*y*y*y)
726 fs(ip, 1) = 1.0_dp + t1*s(ip)*s(ip) + t2*s(ip)*y
727 fs(ip, 2) = 2.0_dp*t1*s(ip) + t2*y*y
728 fs(ip, 3) = 2.0_dp*(t1 - t2*t3*y*y*y)
729 fs(ip, 4) = 6.0_dp*t2*t3*t3*y*y*y*y
731 cpabort(
"Illegal order.")
737 END SUBROUTINE efactor_ol2
744 SUBROUTINE efactor_llp(s, fs, m)
745 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: s
746 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(OUT) :: fs
747 INTEGER,
INTENT(IN) :: m
750 REAL(kind=
dp) :: as, bs, p, q, sas, sbs, t1, t10, t11, t12, t133, t16, t17, t19, t2, t20, &
751 t22, t23, t26, t28, t29, t3, t30, t33, t36, t39, t4, t40, t42, t43, t45, t46, t47, t49, &
752 t5, t50, t54, t55, t7, t71, t8, t9, x, ys
767 sbs = sqrt(bs*bs + 1.0_dp)
770 ys = 1.0_dp/(1.0_dp + q*sas)
773 fs(ip, 1) = 1.0_dp + p*x*x*ys
775 fs(ip, 1) = 1.0_dp + p*x*x*ys
779 t8 = sqrt(1.0_dp + t4*t5)
782 t12 = 1.0_dp + t2*t10
784 fs(ip, 2) = 2.0_dp*p*x/t12 - p*t5/t17*(q*t10 + t2*(b + 1.0_dp/t8*t4*x)/t9)
787 fs(ip, 1) = 1.0_dp + p*x*x*ys
792 t8 = sqrt(1.0_dp + t4*t5)
795 t12 = 1.0_dp + t2*t10
797 fs(ip, 2) = 2.0_dp*p*x/t12 - p*t5/t17*(q*t10 + t2*(b + 1.0_dp/t8*t4*x)/t9)
803 t7 = sqrt(1.0_dp + t3*t4)
812 t26 = q*t9 + t1*t22*t23
819 fs(ip, 3) = 2.0_dp*p/t11 - 4.0_dp*p*x*t17*t26 + 2.0_dp*t30/t16/ &
820 t11*t33 - t30*t17*(2.0_dp*q*t22*t23 + t1* &
821 (-1.0_dp/t40/t7*t43*t4 + t20)*t23 - t1*t49/t50)
825 fs(ip, 1) = 1.0_dp + p*x*x*ys
830 t8 = sqrt(1.0_dp + t4*t5)
833 t12 = 1.0_dp + t2*t10
835 fs(ip, 2) = 2.0_dp*p*x/t12 - p*t5/t17*(q*t10 + t2*(b + 1.0_dp/t8*t4*x)/t9)
841 t7 = sqrt(1.0_dp + t3*t4)
850 t26 = q*t9 + t1*t22*t23
857 fs(ip, 3) = 2.0_dp*p/t11 - 4.0_dp*p*x*t17*t26 + 2.0_dp*t30/t16/ &
858 t11*t33 - t30*t17*(2.0_dp*q*t22*t23 + t1* &
859 (-1.0_dp/t40/t7*t43*t4 + t20)*t23 - t1*t49/t50)
873 t23 = q*t9 + t1*t19*t20
879 t40 = 1.0_dp/t36/t7*t39
884 t50 = 2.0_dp*q*t19*t20 + t1*t42*t20 - t1*t45*t47
889 -6.0_dp*p*t133*t23 + 12.0_dp*t26*t28*t29 - &
890 6.0_dp*t26*t133*t50 - 6.0_dp*t54/t55*t29*t23 + &
891 6.0_dp*t54*t28*t23*t50 - t54*t133* &
892 (3.0_dp*q*t42*t20 - 3.0_dp*q*t45*t47 + 3.0_dp*t1* &
893 (1.0_dp/t71/t7*t39*t3*t4*x - t40*x)*t20 - &
894 3.0_dp*t1*t42*t47*t19 + 2.0_dp*t1*t45*t19/t46/t8)
897 cpabort(
"Illegal order.")
903 END SUBROUTINE efactor_llp
911 SUBROUTINE efactor_pw86(s, fs, m, f2_lsd)
912 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: s
913 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(OUT) :: fs
914 INTEGER,
INTENT(IN) :: m
915 REAL(
dp),
OPTIONAL :: f2_lsd
918 REAL(kind=
dp) :: f15, ff, p0, p1, p15, p2, p3, s1, s2, &
926 IF (
PRESENT(f2_lsd)) ff = f2_lsd
939 p0 = 1.0_dp + t1*s2 + t2*s4 + t3*s6
942 p0 = 1.0_dp + t1*s2 + t2*s4 + t3*s6
943 p1 = s1*ff*(2.0_dp*t1 + 4.0_dp*t2*s2 + 6.0_dp*t3*s4)
946 fs(ip, 2) = f15*p1*p15/p0
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)
950 p2 = ff*ff*(2.0_dp*t1 + 12.0_dp*t2*s2 + 30.0_dp*t3*s4)
953 fs(ip, 2) = f15*p1*p15/p0
954 fs(ip, 3) = f15*p15/p0*(p2 - 14.0_dp/15.0_dp*p1*p1/p0)
956 p0 = 1.0_dp + t1*s2 + t2*s4 + t3*s6
957 p1 = s1*ff*(2.0_dp*t1 + 4.0_dp*t2*s2 + 6.0_dp*t3*s4)
958 p2 = ff*ff*(2.0_dp*t1 + 12.0_dp*t2*s2 + 30.0_dp*t3*s4)
959 p3 = s1*ff*ff*ff*(24.0_dp*t2 + 120.0_dp*t3*s2)
962 fs(ip, 2) = f15*p1*p15/p0
963 fs(ip, 3) = f15*p15/p0*(p2 - 14.0_dp/15.0_dp*p1*p1/p0)
964 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 + &
965 p3 - 14.0_dp*p2*p1/p0 + 14.0_dp*p1*p1/p0/p0)
967 cpabort(
"Illegal order.")
973 END SUBROUTINE efactor_pw86
980 SUBROUTINE efactor_t92(s, fs, m)
981 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: s
982 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(OUT) :: fs
983 INTEGER,
INTENT(IN) :: m
986 REAL(kind=
dp) :: a1, a2, as, asp, asp2, asp3, bs, p, q, &
987 s1, s2, sas, sbs, sbs3, sbs5, t0, w1, &
1003 sbs = sqrt(bs*bs + 1.0_dp)
1006 ys = 1.0_dp/(1.0_dp + q*sas)
1009 fs(ip, 1) = 1.0_dp + p*x*x*ys - a1*x/(1 + a2*x)
1012 fs(ip, 1) = 1.0_dp + p*x*x*ys - a1*x/(1 + a2*x)
1013 fs(ip, 2) = 2.0_dp*p*x*ys - p*q*x*x*asp*ys*ys - a1/(1 + a2*x)**2
1017 asp2 = 2.0_dp*b/sbs - b*bs*bs/sbs3
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
1020 fs(ip, 3) = 2.0_dp*p*ys - p*q*x*(4.0_dp*asp + x*asp2)*ys*ys + &
1021 2.0_dp*p*q*q*x*x*asp*asp*ys*ys*ys + 2.0_dp*a1*a2/(1 + a2*x)**3
1026 asp2 = 2.0_dp*b/sbs - b*bs*bs/sbs3
1027 asp3 = -4.0_dp*b*b*bs/sbs3 + 3.0_dp*b*b*bs*bs*bs/sbs5
1028 w1 = (4.0_dp*asp + x*asp2)
1029 fs(ip, 1) = 1.0_dp + p*x*x*ys - a1*x/(1 + a2*x)
1030 fs(ip, 2) = 2.0_dp*p*x*ys - p*q*x*x*asp*ys*ys - a1/(1 + a2*x)**2
1031 fs(ip, 3) = 2.0_dp*p*ys - p*q*x*w1*ys*ys + &
1032 2.0_dp*p*q*q*x*x*asp*asp*ys*ys*ys + 2.0_dp*a1*a2/(1 + a2*x)**3
1034 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)) + &
1035 q*x*(b + 1/sqrt(1 + b**2*x**2)*b**2*x)/(b*x + sqrt(1 + b**2*x**2))) + 12*p*x/ &
1036 (1 + q*x*log(b*x + sqrt(1 + b**2*x**2)))**3*(q*log(b*x + sqrt(1 + b**2*x**2)) + &
1037 q*x*(b + 1/sqrt(1 + b**2*x**2)*b**2*x)/(b*x + sqrt(1 + b**2*x**2)))**2
1038 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)/ &
1039 (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)/ &
1040 (b*x + sqrt(1 + b**2*x**2)) - q*x*(b + 1/sqrt(1 + b**2*x**2)*b**2*x)**2/ &
1041 (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 &
1042 *(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
1043 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)) + &
1044 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) &
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)* &
1046 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)
1047 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 + &
1048 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/ &
1049 (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)/ &
1050 (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)/ &
1051 (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)* &
1052 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
1057 cpabort(
"Illegal order")
1063 END SUBROUTINE efactor_t92
1072 SUBROUTINE efactor_pbex(s, fs, m, pset, f2_lsd)
1074 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: s
1075 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(OUT) :: fs
1076 INTEGER,
INTENT(IN) :: m, pset
1077 REAL(
dp),
OPTIONAL :: f2_lsd
1079 REAL(kind=
dp),
PARAMETER :: kappa1 = 0.804_dp, kappa2 = 1.245_dp, &
1080 mu = 0.2195149727645171_dp
1083 REAL(kind=
dp) :: f0, mk, x, x2, y
1085 IF (pset == 1) mk = mu/kappa1
1086 IF (pset == 2) mk = mu/kappa2
1089 IF (
PRESENT(f2_lsd)) f0 = f2_lsd
1098 y = 1.0_dp/(1.0_dp + mk*x2)
1101 fs(ip, 1) = 1.0_dp + mu*x2*y
1103 fs(ip, 1) = 1.0_dp + mu*x2*y
1104 fs(ip, 2) = 2.0_dp*mu*x*y*y*f0
1106 fs(ip, 1) = 1.0_dp + mu*x2*y
1107 fs(ip, 2) = 2.0_dp*mu*x*y*y*f0
1108 fs(ip, 3) = -2.0_dp*mu*(3.0_dp*mk*x2 - 1.0_dp)*y*y*y*f0*f0
1110 fs(ip, 1) = 1.0_dp + mu*x2*y
1111 fs(ip, 2) = 2.0_dp*mu*x*y*y*f0
1112 fs(ip, 3) = -2.0_dp*mu*(3.0_dp*mk*x2 - 1.0_dp)*y*y*y*f0*f0
1113 fs(ip, 4) = 24.0_dp*mu*mk*x*(mk*x2 - 1.0_dp)*y*y*y*y*f0*f0*f0
1115 cpabort(
"Illegal order.")
1121 END SUBROUTINE efactor_pbex
1131 SUBROUTINE efactor_pw91(s, fs, m, pset, f2_lsd)
1132 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: s
1133 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(OUT) :: fs
1134 INTEGER,
INTENT(IN) :: m, pset
1135 REAL(
dp),
OPTIONAL :: f2_lsd
1138 REAL(
dp) :: ff, t1, t10, t101, t106, t109, t111, t113, t119, t12, t123, t124, t13, t14, t15, &
1139 t16, t17, t18, t19, t2, t20, t21, t22, t23, t25, t26, t27, t28, t29, t3, t30, t31, t33, &
1140 t35, t37, t38, t39, t4, t40, t44, t47, t48, t5, t50, t51, t53, t55, t56, t57, t58, t59, &
1141 t6, t60, t64, t65, t69, t7, t70, t71, t73, t77, t78, t8, t80, t82, t9, t90, t93, t94, &
1143 REAL(kind=
dp) :: a1, a2, a3, a4, a5, bb, o, pa(6, 2), x
1148 pa(1:6, 1) = [0.19645_dp, 0.2743_dp, &
1149 0.1508_dp, 100.0_dp, &
1150 7.7956_dp, 0.004_dp]
1151 pa(1:6, 2) = [0.093907_dp, 0.26608_dp, &
1152 0.0809615_dp, 100.0_dp, &
1153 76.320_dp, 0.57767e-4_dp]
1156 IF (
PRESENT(f2_lsd)) ff = f2_lsd
1158 a2 = pa(2, pset)*ff*ff
1159 a3 = pa(3, pset)*ff*ff
1160 a4 = pa(4, pset)*ff*ff
1163 a5 = pa(6, pset)*ff*ff*ff*ff
1180 t7 = sqrt(o + t3*t4)
1185 fs(ip, 1) = (o + t10 + (a2 - a3*t12)*t4)/(o + t10 + a5*t17)
1195 t6 = sqrt(o + t2*t3)
1200 t17 = t10*(bb + 1/t6*t2*x)/t7
1206 t33 = o + t30 + a5*t31
1209 (t9 + t17 + 2._dp*a3*a4*t19*t21 + 2._dp*t26*x)/ &
1210 t33 - (o + t30 + t26*t3)/t38*(t9 + t17 + 4._dp*a5*t19)
1220 t5 = sqrt(o + t1*t2)
1225 t15 = 2._dp*a1*t9*t13
1229 t25 = t16*(-o/t17/t5*t20*t2 + t7)*t13
1240 t50 = o + t48 + a5*t39
1247 t69 = t53 + t55 + 4._dp*a5*t56
1248 t73 = o + t48 + t60*t2
1251 (t15 + t25 - t30 + 10._dp*t31*t2*t33 - 4._dp*a3*t37*t39*t33 + &
1252 2._dp*a2 - 2._dp*t44)/t50 - 2._dp* &
1253 (t53 + t55 + 2._dp*t31*t56*t33 + 2._dp*t60*x)* &
1254 t65*t69 + 2._dp*t73/t64/t50*t77 - t73*t65*(t15 + t25 - t30 + 12._dp*a5*t2)
1264 t5 = sqrt(0.1e1_dp + t1*t2)
1281 t40 = 3*t29*(1/t30/t5*t1*t9*t35 - t10*x)*t18
1282 t44 = 3*t29*t14*t26*t22
1283 t50 = 2*t29*t23*t22/t25/t17
1292 t73 = 0.1e1_dp + t71 + a5*t64
1301 t101 = t96 + t98 + 4*a5*t35
1303 t109 = t96 + t98 + 2*t51*t59 + 2*t106*x
1306 t119 = t78 + t80 - t82 + 12*a5*t2
1307 t123 = 0.1e1_dp + t71 + t106*t2
1310 (t20 - t28 + t40 - t44 + t50 + 24*t51*x*t53 - 36._dp*t58*t59 + 8._dp*a3*t57*a4*t64* &
1311 x*t53)/t73 - 3._dp*(t78 + t80 - t82 + 10._dp*t51*t2*t53 - &
1312 4._dp*t58*t64*t53 + 2._dp*a2 - 2._dp*t90)*t94*t101 + &
1313 6._dp*t109*t111*t113 - 3._dp*t109*t94*t119 - 6*t123/t124*t113*t101 + &
1314 6._dp*t123*t111*t101*t119 - t123*t94*(t20 - t28 + t40 - t44 + t50 + 24._dp*a5*x)
1321 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
represent a pointer to a contiguous 3d array
A derivative set contains the different derivatives of a xc-functional in form of a linked list.
represent a derivative of a functional
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