19 PUBLIC fmt_weighted_densities_d
27 SUBROUTINE fmt_weighted_densities_d(rhop, rhopd, n0, n1, n2, n3, nv1, &
28 & nv2, phi_dn0, phi_dn0d, phi_dn1, phi_dn1d, phi_dn2, phi_dn2d, &
29 & phi_dn3, phi_dn3d, phi_dnv1, phi_dnv1d, phi_dnv2, phi_dnv2d, user)
33 USE mod_dft
, ONLY : zp, dzp, fa
40 #include <finclude/petscsys.h> 44 petscscalar :: rhop(ncomp,user%gxs:user%gxe)
45 petscscalar :: rhopd(ncomp,user%gxs:user%gxe)
46 REAL,
dimension(user%gxs:user%gxe),
Intent(OUT) :: n0,n1,n2,n3,nv1,nv2
47 REAL,
dimension(user%gxs:user%gxe),
Intent(OUT) :: phi_dn0,phi_dn1,phi_dn2,phi_dn3,phi_dnv1,phi_dnv2
48 REAL,
dimension(user%gxs:user%gxe),
Intent(OUT) :: phi_dn0d,phi_dn1d,phi_dn2d,phi_dn3d,phi_dnv1d,phi_dnv2d
54 REAL,
DIMENSION(user%gxs:user%gxe) :: n0d,n1d,n2d,n3d,nv1d,nv2d
59 INTEGER,
parameter :: nmax = 800
60 REAL,
DIMENSION(NMAX) :: x_int, n2_int, n3_int, nv2_int
61 REAL,
DIMENSION(NMAX) :: n2_intd, n3_intd, nv2_intd
62 REAL,
DIMENSION(NMAX) :: y2_n2, y2_n3, y2_nv2
63 REAL,
DIMENSION(NMAX) :: y2_n2d, y2_n3d, y2_nv2d
64 REAL :: int_n2, int_n3, int_nv2, xhi, xlo
65 REAL :: int_n2d, int_n3d, int_nv2d
66 REAL :: zms, zms2, zms3, logzms
67 REAL :: zmsd, zms2d, zms3d, logzmsd
68 REAL :: nn0, nn1, nn2, nn3, nnv1, nnv2
69 REAL :: nn0d, nn1d, nn2d, nn3d, nnv1d, nnv2d
70 REAL :: rhopjk, rhopjp1k
71 REAL :: rhopjkd, rhopjp1kd
84 result1 = maxval(fa(1:ncomp) + 5)
103 Do i=user%xs-fa2,user%xe+fa2
115 rhopjkd = parame(k,1)*rhopd(k, j)
116 rhopjk = rhop(k, j)*parame(k,1)
117 rhopjp1kd = parame(k,1)*rhopd(k, j+1)
118 rhopjp1k = rhop(k, j+1)*parame(k,1)
119 IF (zp(i) - zp(j+1) .LT. d2 .AND. zp(i) - zp(j) .GE. d2)
THEN 129 dz = zp(j+1) - (zp(i)-d2)
135 n2_intd(n) = rhopjkd + (dzp-dz)*(rhopjp1kd-rhopjkd)/dzp
136 n2_int(n) = rhopjk + (rhopjp1k-rhopjk)/dzp*(dzp-dz)
141 nv2_intd(n) = zz*rhopjkd + (dzp-dz)*((zp(j+1)-zp(i))*&
142 & rhopjp1kd-zz*rhopjkd)/dzp
143 nv2_int(n) = rhopjk*zz + (rhopjp1k*(zp(j+1)-zp(i))-rhopjk*&
146 ELSE IF (zp(j) .GT. zp(i) - d2 .AND. zp(j) .LE. zp(i) + d2) &
151 x_int(n) = x_int(n-1) + dz
156 n3_intd(n) = (d2**2-zz**2)*rhopjkd
157 n3_int(n) = rhopjk*(d2**2-zz**2)
158 nv2_intd(n) = zz*rhopjkd
159 nv2_int(n) = rhopjk*zz
160 IF (zp(j) .LT. zp(i) + d2 .AND. zp(j+1) .GE. zp(i) + d2) &
163 dz = zp(i) + d2 - zp(j)
168 x_int(n) = x_int(n-1) + dz
173 n2_intd(n) = rhopjkd + dz*(rhopjp1kd-rhopjkd)/dzp
174 n2_int(n) = rhopjk + (rhopjp1k-rhopjk)/dzp*dz
178 nv2_intd(n) = zz*rhopjkd + dz*((zp(j+1)-zp(i))*rhopjp1kd-&
180 nv2_int(n) = rhopjk*zz + (rhopjp1k*(zp(j+1)-zp(i))-rhopjk*&
188 CALL spline_d(x_int, n2_int, n2_intd, n, 1.e30, 1.e30, y2_n2, &
190 CALL spline_d(x_int, n3_int, n3_intd, n, 1.e30, 1.e30, y2_n3, &
192 CALL spline_d(x_int, nv2_int, nv2_intd, n, 1.e30, 1.e30, y2_nv2&
194 CALL splint_integral_d(x_int, n2_int, n2_intd, y2_n2, y2_n2d, n&
195 & , xlo, xhi, int_n2, int_n2d)
196 CALL splint_integral_d(x_int, n3_int, n3_intd, y2_n3, y2_n3d, n&
197 & , xlo, xhi, int_n3, int_n3d)
198 CALL splint_integral_d(x_int, nv2_int, nv2_intd, y2_nv2, y2_nv2d&
199 & , n, xlo, xhi, int_nv2, int_nv2d)
201 n2d(i) = n2d(i) + pi*dhs(k)*int_n2d
202 n2(i) = n2(i) + pi*dhs(k)*int_n2
203 n1d(i) = n1d(i) + 0.5*int_n2d
204 n1(i) = n1(i) + 0.5*int_n2
205 n0d(i) = n0d(i) + int_n2d/dhs(k)
206 n0(i) = n0(i) + int_n2/dhs(k)
207 n3d(i) = n3d(i) + pi*int_n3d
208 n3(i) = n3(i) + pi*int_n3
209 nv2d(i) = nv2d(i) - 2.0*pi*int_nv2d
210 nv2(i) = nv2(i) - 2.0*pi*int_nv2
211 nv1d(i) = nv1d(i) - int_nv2d/dhs(k)
212 nv1(i) = nv1(i) - int_nv2/dhs(k)
235 Do i=user%xs-maxval((fa(1:ncomp)+1)/2),user%xe+maxval((fa(1:ncomp)+1)/2)
251 zms2d = zmsd*zms + zms*zmsd
253 zms3d = zms2d*zms + zms2*zmsd
258 phi_dn0d(i) = -logzmsd
260 phi_dn1d(i) = (nn2d*zms-nn2*zmsd)/zms**2
262 phi_dn2d(i) = (nn1d*zms-nn1*zmsd)/zms**2 + (3.0*((nn2d*nn2+nn2*&
263 & nn2d-nnv2d*nnv2-nnv2*nnv2d)*(nn3+zms2*logzms)+(nn2*nn2-nnv2*nnv2&
264 & )*(nn3d+zms2d*logzms+zms2*logzmsd))*36.0*pi*nn3**2*zms2-3.0*(nn2&
265 & *nn2-nnv2*nnv2)*(nn3+zms2*logzms)*36.0*pi*((nn3d*nn3+nn3*nn3d)*&
266 & zms2+nn3**2*zms2d))/(36.0*pi*nn3*nn3*zms2)**2
267 phi_dn2(i) = nn1/zms + 3.0*(nn2*nn2-nnv2*nnv2)*(nn3+zms2*logzms)/(&
268 & 36.0*pi*nn3*nn3*zms2)
269 phi_dn3d(i) = (nn0d*zms-nn0*zmsd)/zms**2 + ((nn1d*nn2+nn1*nn2d-&
270 & nnv1d*nnv2-nnv1*nnv2d)*zms2-(nn1*nn2-nnv1*nnv2)*zms2d)/zms2**2 -&
271 & (((3*nn2**2*nn2d-3.0*((nn2d*nnv2+nn2*nnv2d)*nnv2+nn2*nnv2*nnv2d)&
272 & )*(nn3*(nn3**2-5.0*nn3+2.0)+2.0*zms3*logzms)+(nn2**3-3.0*nn2*&
273 & nnv2*nnv2)*(nn3d*(nn3**2-5.0*nn3+2.0)+nn3*(2*nn3*nn3d-5.0*nn3d)+&
274 & 2.0*(zms3d*logzms+zms3*logzmsd)))*36.0*pi*nn3**3*zms3-(nn2**3-&
275 & 3.0*nn2*nnv2*nnv2)*(nn3*(nn3**2-5.0*nn3+2.0)+2.0*zms3*logzms)*&
276 & 36.0*pi*(3*nn3**2*nn3d*zms3+nn3**3*zms3d))/(36.0*pi*nn3**3*zms3)&
278 phi_dn3(i) = nn0/zms + (nn1*nn2-nnv1*nnv2)/zms2 - (nn2**3-3.0*nn2*&
279 & nnv2*nnv2)*(nn3*(nn3**2-5.0*nn3+2.0)+2.0*zms3*logzms)/(36.0*pi*&
281 phi_dnv1d(i) = -((nnv2d*zms-nnv2*zmsd)/zms**2)
282 phi_dnv1(i) = -(nnv2/zms)
283 phi_dnv2d(i) = -((nnv1d*zms-nnv1*zmsd)/zms**2) - (6.0*((nn2d*nnv2+&
284 & nn2*nnv2d)*(nn3+zms2*logzms)+nn2*nnv2*(nn3d+zms2d*logzms+zms2*&
285 & logzmsd))*36.0*pi*nn3**2*zms2-6.0*nn2*nnv2*(nn3+zms2*logzms)*&
286 & 36.0*pi*(2*nn3*nn3d*zms2+nn3**2*zms2d))/(36.0*pi*nn3**2*zms2)**2
287 phi_dnv2(i) = -(nnv1/zms) - 6.0*nn2*nnv2*(nn3+zms2*logzms)/(36.0*&
293 END SUBROUTINE fmt_weighted_densities_d
301 SUBROUTINE fmt_dfdrho_d(i, fa, user, phi_dn0, phi_dn0d, phi_dn1, &
302 & phi_dn1d, phi_dn2, phi_dn2d, phi_dn3, phi_dn3d, phi_dnv1, phi_dnv1d&
303 & , phi_dnv2, phi_dnv2d, df_drho_fmt, df_drho_fmtd)
306 USE mod_dft
, ONLY : zp, dzp
316 INTEGER,
INTENT(IN) :: i
317 INTEGER,
INTENT(IN) :: fa(ncomp)
319 REAL,
dimension(user%gxs:user%gxe),
INTENT(IN) :: phi_dn0,phi_dn1,phi_dn2,phi_dn3,phi_dnv1,phi_dnv2
320 REAL,
dimension(user%gxs:user%gxe),
INTENT(IN) :: phi_dn0d,phi_dn1d,phi_dn2d,phi_dn3d,phi_dnv1d,phi_dnv2d
322 REAL,
dimension(user%xs:user%xe,ncomp),
INTENT(OUT) :: df_drho_fmt
323 REAL,
dimension(user%xs:user%xe,ncomp),
INTENT(OUT) :: df_drho_fmtd
329 REAL :: dz, d2, zz, zz_jp1
330 INTEGER,
parameter :: nmax = 800
331 REAL,
DIMENSION(NMAX) :: x_int, y_int, y0_int, y1_int, y2_int, y3_int&
332 & , yv1_int, yv2_int, y2
333 REAL,
DIMENSION(NMAX) :: y_intd, y2d
334 REAL :: xhi, xlo, integral, int0, int1, int2, int3, intv1, intv2
337 REAL :: at_jd, at_jp1d
352 IF (zp(i) - zp(j+1) .LT. d2 .AND. zp(i) - zp(j) .GE. d2)
THEN 359 dz = zp(j+1) - (zp(i)-d2)
361 zz_jp1 = zp(j+1) - zp(i)
362 at_jd = phi_dn0d(j)/dhs(k) + 0.5*phi_dn1d(j) + pi*dhs(k)*&
363 & phi_dn2d(j) + pi*(d2**2-zz**2)*phi_dn3d(j) + zz*phi_dnv1d(&
364 & j)/dhs(k) + 2.0*pi*zz*phi_dnv2d(j)
365 at_j = phi_dn0(j)/dhs(k) + 0.5*phi_dn1(j) + pi*dhs(k)*&
366 & phi_dn2(j) + pi*phi_dn3(j)*(d2**2-zz**2) + phi_dnv1(j)*zz/&
367 & dhs(k) + 2.0*pi*phi_dnv2(j)*zz
368 at_jp1d = phi_dn0d(j+1)/dhs(k) + 0.5*phi_dn1d(j+1) + pi*dhs(&
369 & k)*phi_dn2d(j+1) + pi*(d2**2-zz_jp1**2)*phi_dn3d(j+1) + &
370 & zz_jp1*phi_dnv1d(j+1)/dhs(k) + 2.0*pi*zz_jp1*phi_dnv2d(j+1&
372 at_jp1 = phi_dn0(j+1)/dhs(k) + 0.5*phi_dn1(j+1) + pi*dhs(k)*&
373 & phi_dn2(j+1) + pi*phi_dn3(j+1)*(d2**2-zz_jp1**2) + &
374 & phi_dnv1(j+1)*zz_jp1/dhs(k) + 2.0*pi*phi_dnv2(j+1)*zz_jp1
376 y_intd(n) = at_jd + (dzp-dz)*(at_jp1d-at_jd)/dzp
377 y_int(n) = at_j + (at_jp1-at_j)/dzp*(dzp-dz)
386 ELSE IF (zp(j) .GT. zp(i) - d2 .AND. zp(j) .LE. zp(i) + d2)
THEN 390 x_int(n) = x_int(n-1) + dz
391 y_intd(n) = phi_dn0d(j)/dhs(k) + 0.5*phi_dn1d(j) + pi*dhs(k)*&
392 & phi_dn2d(j) + pi*(d2**2-zz**2)*phi_dn3d(j) + zz*phi_dnv1d(j)&
393 & /dhs(k) + 2.0*pi*zz*phi_dnv2d(j)
394 y_int(n) = phi_dn0(j)/dhs(k) + 0.5*phi_dn1(j) + pi*dhs(k)*&
395 & phi_dn2(j) + pi*phi_dn3(j)*(d2**2-zz**2) + phi_dnv1(j)*zz/&
396 & dhs(k) + 2.0*pi*phi_dnv2(j)*zz
405 IF (zp(j) .LT. zp(i) + d2 .AND. zp(j+1) .GT. zp(i) + d2)
THEN 409 zz_jp1 = zp(j+1) - zp(i)
410 dz = zp(i) + d2 - zp(j)
411 x_int(n) = x_int(n-1) + dz
412 at_jd = phi_dn0d(j)/dhs(k) + 0.5*phi_dn1d(j) + pi*dhs(k)*&
413 & phi_dn2d(j) + pi*(d2**2-zz**2)*phi_dn3d(j) + zz*phi_dnv1d(&
414 & j)/dhs(k) + 2.0*pi*zz*phi_dnv2d(j)
415 at_j = phi_dn0(j)/dhs(k) + 0.5*phi_dn1(j) + pi*dhs(k)*&
416 & phi_dn2(j) + pi*phi_dn3(j)*(d2**2-zz**2) + phi_dnv1(j)*zz/&
417 & dhs(k) + 2.0*pi*phi_dnv2(j)*zz
418 at_jp1d = phi_dn0d(j+1)/dhs(k) + 0.5*phi_dn1d(j+1) + pi*dhs(&
419 & k)*phi_dn2d(j+1) + pi*(d2**2-zz_jp1**2)*phi_dn3d(j+1) + &
420 & zz_jp1*phi_dnv1d(j+1)/dhs(k) + 2.0*pi*zz_jp1*phi_dnv2d(j+1&
422 at_jp1 = phi_dn0(j+1)/dhs(k) + 0.5*phi_dn1(j+1) + pi*dhs(k)*&
423 & phi_dn2(j+1) + pi*phi_dn3(j+1)*(d2**2-zz_jp1**2) + &
424 & phi_dnv1(j+1)*zz_jp1/dhs(k) + 2.0*pi*phi_dnv2(j+1)*zz_jp1
425 y_intd(n) = at_jd + dz*(at_jp1d-at_jd)/dzp
426 y_int(n) = at_j + (at_jp1-at_j)/dzp*dz
440 CALL spline_d(x_int, y_int, y_intd, n, 1.e30, 1.e30, y2, y2d)
441 CALL splint_integral_d(x_int, y_int, y_intd, y2, y2d, n, xlo, xhi&
442 & , integral, integrald)
457 df_drho_fmtd(i, k) = parame(k,1)*integrald
458 df_drho_fmt(i, k) = integral*parame(k,1)
463 END SUBROUTINE fmt_dfdrho_d
465 END MODULE mod_dft_fmt_d
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW This module contains constant...
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW This module contains paramete...
In this module, the application context is defined.
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW This module contains paramete...