37#include "../base/base_uses.f90"
42 LOGICAL,
PRIVATE,
PARAMETER :: debug_this_module = .true.
43 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'xc_xbeef'
48 REAL(kind=
dp),
PARAMETER :: a(0:29) = [1.516501714304992365356_dp, 0.441353209874497942611_dp, -0.091821352411060291887_dp, &
49 -0.023527543314744041314_dp, 0.034188284548603550816_dp, 0.002411870075717384172_dp, &
50 -0.014163813515916020766_dp, 0.000697589558149178113_dp, 0.009859205136982565273_dp, &
51 -0.006737855050935187551_dp, -0.001573330824338589097_dp, 0.005036146253345903309_dp, &
52 -0.002569472452841069059_dp, -0.000987495397608761146_dp, 0.002033722894696920677_dp, &
53 -0.000801871884834044583_dp, -0.000668807872347525591_dp, 0.001030936331268264214_dp, &
54 -0.000367383865990214423_dp, -0.000421363539352619543_dp, 0.000576160799160517858_dp, &
55 -0.000083465037349510408_dp, -0.000445844758523195788_dp, 0.000460129009232047457_dp, &
56 -0.000005231775398304339_dp, -0.000423957047149510404_dp, 0.000375019067938866537_dp, &
57 0.000021149381251344578_dp, -0.000190491156503997170_dp, 0.000073843624209823442_dp]
73 CHARACTER(LEN=*),
INTENT(OUT),
OPTIONAL :: reference, shortform
75 INTEGER,
INTENT(out),
OPTIONAL :: max_deriv
77 IF (
PRESENT(reference))
THEN
78 reference =
"Wellendorff, J. et al., Phys. Rev. B 85, 235149 (2012) {LDA}"
80 IF (
PRESENT(shortform))
THEN
81 shortform =
"Exchange Contribution to BEEF-vdW Functional (Wellendorff, 2012) {LDA}"
83 IF (
PRESENT(needs))
THEN
85 needs%rho_1_3 = .true.
86 needs%norm_drho = .true.
88 IF (
PRESENT(max_deriv)) max_deriv = 1
104 CHARACTER(LEN=*),
INTENT(OUT),
OPTIONAL :: reference, shortform
106 INTEGER,
INTENT(out),
OPTIONAL :: max_deriv
108 IF (
PRESENT(reference))
THEN
109 reference =
"Wellendorff, J. et al., Phys. Rev. B 85, 235149 (2012) {LSD}"
111 IF (
PRESENT(shortform))
THEN
112 shortform =
"Exchange Contribution to BEEF-vdW Functional (Wellendorff, 2012) {LSD}"
114 IF (
PRESENT(needs))
THEN
115 needs%rho_spin = .true.
116 needs%rho_spin_1_3 = .true.
117 needs%norm_drho_spin = .true.
119 IF (
PRESENT(max_deriv)) max_deriv = 1
137 INTEGER,
INTENT(in) :: grad_deriv
140 CHARACTER(len=*),
PARAMETER :: routinen =
'xbeef_lda_eval'
142 INTEGER :: handle, npoints
143 INTEGER,
DIMENSION(2, 3) :: bo
144 REAL(kind=
dp) :: epsilon_rho, sx
145 REAL(kind=
dp),
CONTIGUOUS,
DIMENSION(:, :, :), &
146 POINTER :: dummy, e_0, e_ndrho, e_rho, norm_drho, &
150 CALL timeset(routinen, handle)
157 norm_drho=norm_drho, local_bounds=bo, rho_cutoff=epsilon_rho)
158 npoints = (bo(2, 1) - bo(1, 1) + 1)*(bo(2, 2) - bo(1, 2) + 1)*(bo(2, 3) - bo(1, 3) + 1)
167 allocate_deriv=.true.)
169 IF (grad_deriv >= 1)
THEN
171 allocate_deriv=.true.)
174 allocate_deriv=.true.)
177 IF (grad_deriv > 1)
THEN
178 cpabort(
"derivatives greater than 1 not implemented")
186 CALL xbeef_lda_calc(rho=rho, rho_1_3=rho_1_3, norm_drho=norm_drho, &
187 e_0=e_0, e_rho=e_rho, e_ndrho=e_ndrho, &
188 grad_deriv=grad_deriv, &
189 npoints=npoints, epsilon_rho=epsilon_rho, sx=sx)
192 CALL timestop(handle)
211 SUBROUTINE xbeef_lda_calc(rho, rho_1_3, norm_drho, &
212 e_0, e_rho, e_ndrho, &
213 grad_deriv, npoints, epsilon_rho, sx)
214 INTEGER,
INTENT(in) :: npoints, grad_deriv
215 REAL(kind=
dp),
DIMENSION(1:npoints),
INTENT(inout) :: e_ndrho, e_rho, e_0
216 REAL(kind=
dp),
DIMENSION(1:npoints),
INTENT(in) :: norm_drho, rho_1_3, rho
217 REAL(kind=
dp),
INTENT(in) :: epsilon_rho, sx
219 INTEGER,
PARAMETER :: m = 30
222 REAL(kind=
dp) :: ds_ndrho, ds_rho, dt, e_ueg, e_ueg_drho, &
223 epsilon_rho43, k_lda, kf, my_rho, &
224 my_rho_1_3, s, s2, t, t3
225 REAL(kind=
dp),
DIMENSION(0:29) :: de_leg, e_leg
229 kf = (3.0_dp*
pi**2)**(1.0_dp/3.0_dp)
230 k_lda = -(2.0_dp/(2.0_dp**(4._dp/3._dp)))*(3.0_dp/2.0_dp)*(3.0_dp/(4.0_dp*
pi))**(1.0_dp/3.0_dp)
233 epsilon_rho43 = epsilon_rho**(4._dp/3._dp)
240 IF (my_rho > epsilon_rho)
THEN
241 my_rho_1_3 = rho_1_3(ii)
243 e_ueg = k_lda*my_rho*my_rho_1_3
244 e_ueg_drho = (4.0_dp/3.0_dp)*k_lda*my_rho_1_3
246 t3 = my_rho_1_3*my_rho*2*kf
248 s = norm_drho(ii)/max(t3, epsilon_rho43)
250 t = 2.0_dp*s2/(4.0_dp + s2) - 1.0_dp
255 IF ((grad_deriv >= 1))
THEN
258 dt = 4.0_dp*s/(4.0_dp + s2) - 4.0_dp*s*s2/(4.0_dp + s2)**2
259 ds_rho = -(4.0_dp*s)/(3.0_dp*max(my_rho, epsilon_rho))
260 ds_ndrho = 1.0_dp/(max(t3, epsilon_rho43))
264 e_leg(i) = 2._dp*(t)*e_leg(i - 1) - e_leg(i - 2) - ((t)*e_leg(i - 1) - e_leg(i - 2))/(real(i, kind=
dp))
267 IF (grad_deriv >= 1)
THEN
269 de_leg(i) = e_leg(i - 1)*i + de_leg(i - 1)*(t)
274 e_0(ii) = e_0(ii) + sum(e_leg*a)*e_ueg*sx
277 IF ((grad_deriv >= 1))
THEN
278 e_rho(ii) = e_rho(ii) + (sum(e_leg*a)*e_ueg_drho + sum(de_leg*a)*dt*ds_rho*e_ueg)*sx
279 e_ndrho(ii) = e_ndrho(ii) + (sum(de_leg*a)*dt*ds_ndrho*e_ueg)*sx
287 END SUBROUTINE xbeef_lda_calc
302 INTEGER,
INTENT(in) :: grad_deriv
305 CHARACTER(len=*),
PARAMETER :: routinen =
'xbeef_lsd_eval'
307 INTEGER :: handle, i, ispin, npoints
308 INTEGER,
DIMENSION(2, 3) :: bo
309 REAL(kind=
dp) :: epsilon_rho, sx
310 REAL(kind=
dp),
CONTIGUOUS,
DIMENSION(:, :, :), &
311 POINTER :: dummy, e_0
312 TYPE(
cp_3d_r_cp_type),
DIMENSION(2) :: e_ndrho, e_rho, norm_drho, rho, rho_1_3
315 CALL timeset(routinen, handle)
321 NULLIFY (norm_drho(i)%array, rho(i)%array, rho_1_3(i)%array)
326 rhob_1_3=rho_1_3(2)%array, rhoa=rho(1)%array, &
327 rhob=rho(2)%array, norm_drhoa=norm_drho(1)%array, &
328 norm_drhob=norm_drho(2)%array, rho_cutoff=epsilon_rho, &
330 npoints = (bo(2, 1) - bo(1, 1) + 1)*(bo(2, 2) - bo(1, 2) + 1)*(bo(2, 3) - bo(1, 3) + 1)
332 dummy => rho(1)%array
336 e_rho(i)%array => dummy
337 e_ndrho(i)%array => dummy
341 allocate_deriv=.true.)
343 IF (grad_deriv >= 1)
THEN
345 allocate_deriv=.true.)
348 allocate_deriv=.true.)
351 allocate_deriv=.true.)
354 allocate_deriv=.true.)
357 IF (grad_deriv > 1)
THEN
358 cpabort(
"derivatives greater than 1 not implemented")
369 CALL xbeef_lsd_calc( &
370 rho_spin=rho(ispin)%array, &
371 rho_1_3_spin=rho_1_3(ispin)%array, &
372 norm_drho_spin=norm_drho(ispin)%array, &
373 e_0=e_0, e_rho_spin=e_rho(ispin)%array, &
374 e_ndrho_spin=e_ndrho(ispin)%array, &
375 grad_deriv=grad_deriv, npoints=npoints, &
376 epsilon_rho=epsilon_rho, sx=sx)
382 CALL timestop(handle)
402 SUBROUTINE xbeef_lsd_calc(rho_spin, rho_1_3_spin, norm_drho_spin, e_0, &
403 e_rho_spin, e_ndrho_spin, grad_deriv, npoints, epsilon_rho, sx)
404 REAL(kind=
dp),
DIMENSION(*),
INTENT(in) :: rho_spin, rho_1_3_spin, norm_drho_spin
405 REAL(kind=
dp),
DIMENSION(*),
INTENT(inout) :: e_0, e_rho_spin, e_ndrho_spin
406 INTEGER,
INTENT(in) :: grad_deriv, npoints
407 REAL(kind=
dp),
INTENT(in) :: epsilon_rho, sx
409 INTEGER,
PARAMETER :: m = 30
412 REAL(kind=
dp) :: ds_ndrho, ds_rho, dt, e_ueg, e_ueg_drho, &
413 epsilon_rho43, k_lsd, kf, &
414 my_epsilon_rho, my_rho, my_rho_1_3, s, &
416 REAL(kind=
dp),
DIMENSION(0:29) :: de_leg, e_leg
420 kf = (3.0_dp*
pi**2)**(1.0_dp/3.0_dp)
421 k_lsd = (3.0_dp/2.0_dp)*(3.0_dp/(4.0_dp*
pi))**(1.0_dp/3.0_dp)
424 my_epsilon_rho = 0.5_dp*epsilon_rho
425 epsilon_rho43 = my_epsilon_rho**(4._dp/3._dp)
429 my_rho = rho_spin(ii)
431 IF (my_rho > epsilon_rho)
THEN
432 my_rho_1_3 = rho_1_3_spin(ii)
434 e_ueg = k_lsd*my_rho*my_rho_1_3
435 e_ueg_drho = (4.0_dp/3.0_dp)*k_lsd*my_rho_1_3
437 t3 = my_rho_1_3*my_rho*2*kf
439 s = norm_drho_spin(ii)/max(t3, epsilon_rho43)
441 t = 2.0_dp*s**2/(4.0_dp + s**2) - 1.0_dp
446 IF ((grad_deriv >= 1))
THEN
449 dt = 4.0_dp*s/(4.0_dp + s2) - 4.0_dp*s*s2/(4.0_dp + s2)**2
450 ds_rho = -(4.0_dp*s)/(3.0_dp*max(my_rho, epsilon_rho))
451 ds_ndrho = 1.0_dp/(max(t3, epsilon_rho43))
455 e_leg(i) = 2._dp*(t)*e_leg(i - 1) - e_leg(i - 2) - ((t)*e_leg(i - 1) - e_leg(i - 2))/(real(i, kind=
dp))
458 IF (grad_deriv >= 1)
THEN
460 de_leg(i) = e_leg(i - 1)*i + de_leg(i - 1)*(t)
467 e_0(ii) = e_0(ii) + sum(e_leg*a)*e_ueg*sx
470 IF ((grad_deriv >= 1))
THEN
471 e_rho_spin(ii) = e_rho_spin(ii) + (sum(e_leg*a)*e_ueg_drho + sum(de_leg*a)*dt*ds_rho*e_ueg)*sx
472 e_ndrho_spin(ii) = e_ndrho_spin(ii) + (sum(de_leg*a)*dt*ds_ndrho*e_ueg)*sx
478 END SUBROUTINE xbeef_lsd_calc
collects all references to literature in CP2K as new algorithms / method are included from literature...
integer, save, public wellendorff2012
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
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
calculates the Exchange contribution in the BEEF-vdW functional
subroutine, public xbeef_lda_eval(rho_set, deriv_set, grad_deriv, xbeef_params)
evaluates the beef exchange functional for lda
subroutine, public xbeef_lsd_info(reference, shortform, needs, max_deriv)
return various information on the functional
subroutine, public xbeef_lda_info(reference, shortform, needs, max_deriv)
return various information on the functional
subroutine, public xbeef_lsd_eval(rho_set, deriv_set, grad_deriv, xbeef_params)
evaluates the beef 88 exchange functional for lsd
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