32 #include "../base/base_uses.f90"
40 REAL(KIND=
dp),
PARAMETER :: pi = 3.14159265358979323846264338_dp
41 REAL(KIND=
dp),
PARAMETER :: f13 = 1.0_dp/3.0_dp, &
48 REAL(KIND=
dp) :: cf, flda, flsd
49 REAL(KIND=
dp) :: eps_rho
51 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'xc_thomas_fermi'
59 SUBROUTINE thomas_fermi_init(cutoff)
61 REAL(KIND=
dp),
INTENT(IN) :: cutoff
66 cf = 0.3_dp*(3.0_dp*pi*pi)**f23
68 flsd = flda*2.0_dp**f23
70 END SUBROUTINE thomas_fermi_init
81 LOGICAL,
INTENT(in) :: lsd
82 CHARACTER(LEN=*),
INTENT(OUT),
OPTIONAL :: reference, shortform
83 TYPE(xc_rho_cflags_type),
INTENT(inout),
OPTIONAL :: needs
84 INTEGER,
INTENT(out),
OPTIONAL :: max_deriv
86 IF (
PRESENT(reference))
THEN
87 reference =
"Thomas-Fermi kinetic energy functional: see Parr and Yang"
89 IF (len_trim(reference) + 6 < len(reference))
THEN
90 reference(len_trim(reference):len_trim(reference) + 6) =
' {LDA}'
94 IF (
PRESENT(shortform))
THEN
95 shortform =
"Thomas-Fermi kinetic energy functional"
97 IF (len_trim(shortform) + 6 < len(shortform))
THEN
98 shortform(len_trim(shortform):len_trim(shortform) + 6) =
' {LDA}'
102 IF (
PRESENT(needs))
THEN
104 needs%rho_spin = .true.
105 needs%rho_spin_1_3 = .true.
108 needs%rho_1_3 = .true.
111 IF (
PRESENT(max_deriv)) max_deriv = 3
122 TYPE(xc_rho_set_type),
INTENT(IN) :: rho_set
123 TYPE(xc_derivative_set_type),
INTENT(IN) :: deriv_set
124 INTEGER,
INTENT(in) :: order
126 CHARACTER(len=*),
PARAMETER :: routinen =
'thomas_fermi_lda_eval'
128 INTEGER :: handle, npoints
129 INTEGER,
DIMENSION(2, 3) :: bo
130 REAL(kind=
dp) :: epsilon_rho
131 REAL(kind=
dp),
CONTIGUOUS,
DIMENSION(:, :, :), &
132 POINTER :: e_0, e_rho, e_rho_rho, e_rho_rho_rho, &
134 TYPE(xc_derivative_type),
POINTER :: deriv
136 CALL timeset(routinen, handle)
139 local_bounds=bo, rho_cutoff=epsilon_rho)
140 npoints = (bo(2, 1) - bo(1, 1) + 1)*(bo(2, 2) - bo(1, 2) + 1)*(bo(2, 3) - bo(1, 3) + 1)
141 CALL thomas_fermi_init(epsilon_rho)
145 allocate_deriv=.true.)
148 CALL thomas_fermi_lda_0(rho, r13, e_0, npoints)
150 IF (order >= 1 .OR. order == -1)
THEN
152 allocate_deriv=.true.)
155 CALL thomas_fermi_lda_1(rho, r13, e_rho, npoints)
157 IF (order >= 2 .OR. order == -2)
THEN
159 allocate_deriv=.true.)
162 CALL thomas_fermi_lda_2(rho, r13, e_rho_rho, npoints)
164 IF (order >= 3 .OR. order == -3)
THEN
166 allocate_deriv=.true.)
169 CALL thomas_fermi_lda_3(rho, r13, e_rho_rho_rho, npoints)
171 IF (order > 3 .OR. order < -3)
THEN
172 cpabort(
"derivatives bigger than 3 not implemented")
174 CALL timestop(handle)
184 TYPE(xc_rho_set_type),
INTENT(IN) :: rho_set
185 TYPE(xc_derivative_set_type),
INTENT(IN) :: deriv_set
186 INTEGER,
INTENT(in) :: order
188 CHARACTER(len=*),
PARAMETER :: routinen =
'thomas_fermi_lsd_eval'
191 INTEGER :: handle, i, ispin, npoints
192 INTEGER,
DIMENSION(2, 3) :: bo
193 REAL(kind=
dp) :: epsilon_rho
194 REAL(kind=
dp),
CONTIGUOUS,
DIMENSION(:, :, :), &
195 POINTER :: e_0, e_rho, e_rho_rho, e_rho_rho_rho
196 TYPE(cp_3d_r_cp_type),
DIMENSION(2) :: rho, rho_1_3
197 TYPE(xc_derivative_type),
POINTER :: deriv
199 CALL timeset(routinen, handle)
202 NULLIFY (rho(i)%array, rho_1_3(i)%array)
206 rhob_1_3=rho_1_3(2)%array, rhoa=rho(1)%array, &
208 rho_cutoff=epsilon_rho, &
210 npoints = (bo(2, 1) - bo(1, 1) + 1)*(bo(2, 2) - bo(1, 2) + 1)*(bo(2, 3) - bo(1, 3) + 1)
211 CALL thomas_fermi_init(epsilon_rho)
216 allocate_deriv=.true.)
219 CALL thomas_fermi_lsd_0(rho(ispin)%array, rho_1_3(ispin)%array, &
222 IF (order >= 1 .OR. order == -1)
THEN
224 allocate_deriv=.true.)
227 CALL thomas_fermi_lsd_1(rho(ispin)%array, rho_1_3(ispin)%array, &
230 IF (order >= 2 .OR. order == -2)
THEN
232 rho_spin_name(ispin)], allocate_deriv=.true.)
235 CALL thomas_fermi_lsd_2(rho(ispin)%array, rho_1_3(ispin)%array, &
238 IF (order >= 3 .OR. order == -3)
THEN
240 rho_spin_name(ispin), rho_spin_name(ispin)], &
241 allocate_deriv=.true.)
244 CALL thomas_fermi_lsd_3(rho(ispin)%array, rho_1_3(ispin)%array, &
245 e_rho_rho_rho, npoints)
247 IF (order > 3 .OR. order < -3)
THEN
248 cpabort(
"derivatives bigger than 3 not implemented")
251 CALL timestop(handle)
261 SUBROUTINE thomas_fermi_lda_0(rho, r13, e_0, npoints)
263 REAL(kind=
dp),
DIMENSION(*),
INTENT(IN) :: rho, r13
264 REAL(kind=
dp),
DIMENSION(*),
INTENT(INOUT) :: e_0
265 INTEGER,
INTENT(in) :: npoints
273 IF (rho(ip) > eps_rho)
THEN
275 e_0(ip) = e_0(ip) + flda*r13(ip)*r13(ip)*rho(ip)
281 END SUBROUTINE thomas_fermi_lda_0
290 SUBROUTINE thomas_fermi_lda_1(rho, r13, e_rho, npoints)
292 REAL(kind=
dp),
DIMENSION(*),
INTENT(IN) :: rho, r13
293 REAL(kind=
dp),
DIMENSION(*),
INTENT(INOUT) :: e_rho
294 INTEGER,
INTENT(in) :: npoints
305 IF (rho(ip) > eps_rho)
THEN
307 e_rho(ip) = e_rho(ip) + f*r13(ip)*r13(ip)
313 END SUBROUTINE thomas_fermi_lda_1
322 SUBROUTINE thomas_fermi_lda_2(rho, r13, e_rho_rho, npoints)
324 REAL(kind=
dp),
DIMENSION(*),
INTENT(IN) :: rho, r13
325 REAL(kind=
dp),
DIMENSION(*),
INTENT(INOUT) :: e_rho_rho
326 INTEGER,
INTENT(in) :: npoints
337 IF (rho(ip) > eps_rho)
THEN
339 e_rho_rho(ip) = e_rho_rho(ip) + f/r13(ip)
345 END SUBROUTINE thomas_fermi_lda_2
354 SUBROUTINE thomas_fermi_lda_3(rho, r13, e_rho_rho_rho, npoints)
356 REAL(kind=
dp),
DIMENSION(*),
INTENT(IN) :: rho, r13
357 REAL(kind=
dp),
DIMENSION(*),
INTENT(INOUT) :: e_rho_rho_rho
358 INTEGER,
INTENT(in) :: npoints
363 f = -f13*f23*f53*flda
369 IF (rho(ip) > eps_rho)
THEN
371 e_rho_rho_rho(ip) = e_rho_rho_rho(ip) + f/(r13(ip)*rho(ip))
377 END SUBROUTINE thomas_fermi_lda_3
386 SUBROUTINE thomas_fermi_lsd_0(rhoa, r13a, e_0, npoints)
388 REAL(kind=
dp),
DIMENSION(*),
INTENT(IN) :: rhoa, r13a
389 REAL(kind=
dp),
DIMENSION(*),
INTENT(INOUT) :: e_0
390 INTEGER,
INTENT(in) :: npoints
398 IF (rhoa(ip) > eps_rho)
THEN
399 e_0(ip) = e_0(ip) + flsd*r13a(ip)*r13a(ip)*rhoa(ip)
404 END SUBROUTINE thomas_fermi_lsd_0
413 SUBROUTINE thomas_fermi_lsd_1(rhoa, r13a, e_rho, npoints)
415 REAL(kind=
dp),
DIMENSION(*),
INTENT(IN) :: rhoa, r13a
416 REAL(kind=
dp),
DIMENSION(*),
INTENT(INOUT) :: e_rho
417 INTEGER,
INTENT(in) :: npoints
428 IF (rhoa(ip) > eps_rho)
THEN
429 e_rho(ip) = e_rho(ip) + f*r13a(ip)*r13a(ip)
434 END SUBROUTINE thomas_fermi_lsd_1
443 SUBROUTINE thomas_fermi_lsd_2(rhoa, r13a, e_rho_rho, npoints)
445 REAL(kind=
dp),
DIMENSION(*),
INTENT(IN) :: rhoa, r13a
446 REAL(kind=
dp),
DIMENSION(*),
INTENT(INOUT) :: e_rho_rho
447 INTEGER,
INTENT(in) :: npoints
459 IF (rhoa(ip) > eps_rho)
THEN
460 e_rho_rho(ip) = e_rho_rho(ip) + f/r13a(ip)
465 END SUBROUTINE thomas_fermi_lsd_2
474 SUBROUTINE thomas_fermi_lsd_3(rhoa, r13a, e_rho_rho_rho, npoints)
476 REAL(kind=
dp),
DIMENSION(*),
INTENT(IN) :: rhoa, r13a
477 REAL(kind=
dp),
DIMENSION(*),
INTENT(INOUT) :: e_rho_rho_rho
478 INTEGER,
INTENT(in) :: npoints
483 f = -f13*f23*f53*flsd
489 IF (rhoa(ip) > eps_rho)
THEN
490 e_rho_rho_rho(ip) = e_rho_rho_rho(ip) + f/(r13a(ip)*rhoa(ip))
495 END SUBROUTINE thomas_fermi_lsd_3
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
Module with functions to handle derivative descriptors. derivative description are strings have the f...
integer, parameter, public deriv_rhob
integer, parameter, public deriv_rhoa
integer, parameter, public deriv_rho
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 set_util(cutoff)
...
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.
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)
...