13 INTEGER,
PARAMETER :: ndft = 4000
14 INTEGER,
PARAMETER :: r_grid = 200
15 INTEGER :: kmax, den_step
16 LOGICAL :: shift, wca, mft
17 REAL :: rc, rg, dzr, dzp, tau_cut
18 REAL :: d_hs, dhs_st, z3t_st
20 REAL,
DIMENSION(r_grid) :: x1a
21 REAL,
DIMENSION(NDFT) :: x2a
22 REAL,
DIMENSION(r_grid,NDFT) :: ya, y1a, y2a, y12a
23 REAL,
DIMENSION(r_grid,NDFT,4,4) :: c_bicub
26 REAL,
DIMENSION(r_grid) :: x1a_11
27 REAL,
DIMENSION(NDFT) :: x2a_11
28 REAL,
DIMENSION(r_grid,NDFT) :: ya_11, y1a_11, y2a_11, y12a_11
29 REAL,
DIMENSION(r_grid,NDFT,4,4) :: c_bicub_11
30 REAL,
DIMENSION(r_grid) :: x1a_12
31 REAL,
DIMENSION(NDFT) :: x2a_12
32 REAL,
DIMENSION(r_grid,NDFT) :: ya_12, y1a_12, y2a_12, y12a_12
33 REAL,
DIMENSION(r_grid,NDFT,4,4) :: c_bicub_12
34 REAL,
DIMENSION(r_grid) :: x1a_22
35 REAL,
DIMENSION(NDFT) :: x2a_22
36 REAL,
DIMENSION(r_grid,NDFT) :: ya_22, y1a_22, y2a_22, y12a_22
37 REAL,
DIMENSION(r_grid,NDFT,4,4) :: c_bicub_22
57 SUBROUTINE dft_rad_int (i,j,ih,zz1,rhop,f_int_r,my_int_r, &
58 f_int2_r,my_int2_r,my_int3_r)
64 INTEGER,
INTENT(IN) :: i
65 INTEGER,
INTENT(IN) :: j
66 INTEGER,
INTENT(IN OUT) :: ih
67 REAL,
INTENT(IN) :: zz1
68 REAL,
INTENT(IN) :: rhop(-ndft:ndft)
69 REAL,
INTENT(OUT) :: f_int_r
70 REAL,
INTENT(OUT) :: my_int_r
71 REAL,
INTENT(OUT) :: f_int2_r
72 REAL,
INTENT(OUT) :: my_int2_r
73 REAL,
INTENT(OUT) :: my_int3_r
78 REAL :: fint0, fint0_2, fint1, fint1_2
79 REAL :: myint0, myint0_2, myint0_3, myint1
80 REAL :: myint1_2, myint1_3
81 REAL :: dg_drho, dg_dr
82 REAL :: rad, xg, rdf, rho_bar, ua, rs
83 REAL :: analytic1, analytic2, tau_rs
89 fint0_2 = rc * tau_cut*tau_cut
91 myint0_2 = rc * tau_cut*tau_cut
102 IF ( rs > rc )
WRITE (*,*)
'error !!!!' 103 analytic1 = 0.4*rs**-10 - 0.4*rc**-10 - rs**-4 + rc**-4
104 analytic2 = 16.0/22.0 * (rs**-22 - rc**-22 ) &
105 -2.0*rs**-16 +2.0*rc**-16 +1.6*rs**-10 - 1.6*rc**-10
106 f_int_r = f_int_r + analytic1
107 f_int2_r = f_int2_r + analytic2
108 my_int_r = my_int_r + analytic1
109 my_int2_r= my_int2_r+ analytic2
110 IF ( rs == zz1 )
GO TO 10
111 tau_rs = 4.0 * ( rs**-12 - rs**-6 )
113 fint0_2 = rs * tau_rs*tau_rs
115 myint0_2= rs * tau_rs*tau_rs
117 k = 0 + nint( (rc-rs)/dzr )
129 ua = 4.0 * ( rad**-12 -rad**-6 )
131 rho_bar = ( rhop(i) + rhop(j) )/2.0
134 IF ( rad <= rg )
THEN 135 CALL bi_cub_spline (rho_bar,xg,ya,x1a,x2a,y1a,y2a,y12a, &
136 c_bicub,rdf,dg_drho,dg_dr,den_step,ih,k)
144 fint1 = rdf * rad * ua
145 fint1_2 = rdf * rad * ua * ua
146 myint1 = rad * (rdf + 0.5*rhop(i)*dg_drho) * ua
147 myint1_2 = rdf * rad * ua * ua
148 myint1_3 = dg_drho * rad * ua * ua
150 f_int_r = f_int_r + dzr * (fint1 + fint0)/2.0
151 f_int2_r = f_int2_r + dzr * (fint1_2 + fint0_2)/2.0
152 my_int_r = my_int_r + dzr * (myint1 + myint0)/2.0
153 my_int2_r= my_int2_r+ dzr * (myint1_2 + myint0_2)/2.0
154 my_int3_r= my_int3_r+ dzr * (myint1_3 + myint0_3)/2.0
161 IF ( zz1 >= 1.0 .AND. rad-dzr+1.e-8 >= zz1 )
GO TO 4
162 IF ( zz1 < 1.0 .AND. rad-dzr+1.e-8 >= 1.0 )
GO TO 4
172 analytic1 = 4.0/10.0*rc**-10 - rc**-4
173 analytic2 = 16.0/22.0*rc**-22 - 2.0*rc**-16 + 1.6*rc**-10
174 f_int_r = f_int_r + analytic1
175 f_int2_r = f_int2_r + analytic2
176 my_int_r = my_int_r + analytic1
177 my_int2_r= my_int2_r+ analytic2
179 END SUBROUTINE dft_rad_int
186 SUBROUTINE f_dft ( I1_dft, I2_dft )
193 REAL,
INTENT(OUT) :: i1_dft
194 REAL,
INTENT(OUT) :: i2_dft
199 REAL :: ua, ua_c, ua_2, ua_c_2, rm
200 REAL :: int10, int11, int20, int21
202 REAL :: rad, xg, rdf, rho_st, msegm
204 REAL :: dg_dr, dzr_org
212 rho_st = rho * parame(1,2)**3
214 ua_c = 4.0 * ( rc**-12 - rc**-6 )
219 int20 = rc*rc* ua_c_2
235 DO WHILE ( rad-dzr+1.e-9 >= 1.0 )
242 ua = 4.0 * ( rad**-12 - rad**-6 )
246 IF ( rad <= rg )
THEN 247 CALL bi_cub_spline (rho_st,xg,ya,x1a,x2a,y1a,y2a,y12a, &
248 c_bicub,rdf,dg_drho,dg_dr,den_step,ih,k)
251 int11 = rdf*rad*rad* ua
252 int21 = rdf*rad*rad* ua_2
253 i1_dft= i1_dft + dzr*(int11+int10)/2.0
254 i2_dft= i2_dft + dzr*(int21+int20)/2.0
267 i1_dft= - i1_dft - ( 4.0/9.0 * rc**-9 - 4.0/3.0 * rc**-3 )
272 i2_dft = i2_dft + 16.0/21.0 * rc**-21 - 32.0/15.0 * rc**-15 + 16.0/9.0 * rc**-9
282 SUBROUTINE rdf_matrix (msegm)
289 REAL,
INTENT(IN) :: msegm
293 REAL :: rdf, rad, xg, rho_rdf, z3
300 rho_rdf = 1.e-5 + (1.0) *
REAL(i-1) /
REAL(den_step-1) 301 rho_rdf = rho_rdf / msegm
305 do while ( rad-dzr+1.e-9 >= 0.95 )
310 z3 = rho_rdf * msegm * pi/6.0 * d_hs**3
312 IF ( xg <= rg .AND. z3 > 0.0 )
CALL rdf_int ( z3, msegm, xg, rdf )
313 IF ( xg <= rg ) ya(i,k) = rdf
322 if ( xg > 1.0 ) stop
'rdf_matrix: 0.95*sigma is too high for lower bound' 324 WRITE (*,*)
' done with calculating g(r)',d_hs
327 CALL bicub_derivative ( ya, x1a, x2a, y1a, y2a, y12a, den_step, kmax )
328 CALL bicub_c ( ya, x1a, x2a, y1a, y2a, y12a, c_bicub, den_step, kmax )
330 END SUBROUTINE rdf_matrix
337 SUBROUTINE bi_cub_spline2 ( rho_rdf, xg, ya, x1a, x2a, y1a, &
338 rdf, dg_drho, i_max, ih, k )
344 REAL,
INTENT(IN) :: rho_rdf
345 REAL,
INTENT(IN OUT) :: xg
346 REAL,
INTENT(IN) :: ya(r_grid,ndft)
347 REAL,
INTENT(IN) :: x1a(r_grid)
348 REAL,
INTENT(IN OUT) :: x2a(ndft)
349 REAL,
INTENT(IN) :: y1a(r_grid,ndft)
350 REAL,
INTENT(OUT) :: rdf
351 REAL,
INTENT(OUT) :: dg_drho
352 INTEGER,
INTENT(IN OUT) :: i_max
354 INTEGER,
INTENT(OUT) :: ih
355 INTEGER,
INTENT(IN OUT) :: k
358 REAL :: as,bs,cs,ds,rho_t,del_rho
362 IF ( rho_rdf < x1a(1) )
THEN 367 IF ( x1a(ih) <= rho_rdf.AND.rho_rdf < x1a(ih+1) )
GO TO 10
369 IF ( x1a(ih-1) <= rho_rdf.AND.rho_rdf < x1a(ih) )
THEN 375 CALL hunt(x1a,i_max,rho_rdf,ih)
378 IF ( (x2a(k) > (xg + 1.e-10)) .OR. (x2a(k) < (xg - 1.e-10)) ) &
379 WRITE (*,*)
'error in bi-cubic-spline',x2a(k),xg
382 del_rho = x1a(ih+1) - x1a(ih)
386 cs = 3.0*(ya(ih+1,k)-as)/del_rho**2 - (2.0*bs+y1a(ih+1,k))/del_rho
387 ds = -2.0*(ya(ih+1,k)-as)/del_rho**3 + (bs+y1a(ih+1,k))/del_rho**2
389 rho_t = rho_rdf - x1a(ih)
390 rdf = as + bs*rho_t + cs*rho_t*rho_t + ds*rho_t**3
391 dg_drho = bs + 2.0*cs*rho_t + 3.0*ds*rho_t*rho_t
393 END SUBROUTINE bi_cub_spline2
401 SUBROUTINE bi_cub_spline ( rho_rdf, xg, ya, x1a, x2a, y1a, y2a, y12a, &
402 c_bicub, rdf, dg_drho, dg_dr, i_max, ih, k )
408 REAL,
INTENT(IN OUT) :: rho_rdf
409 REAL,
INTENT(IN OUT) :: xg
410 REAL,
INTENT(IN) :: ya(r_grid,ndft)
411 REAL,
INTENT(IN) :: x1a(r_grid)
412 REAL,
INTENT(IN) :: x2a(ndft)
413 REAL,
INTENT(IN) :: y1a(r_grid,ndft)
414 REAL,
INTENT(IN) :: y2a(r_grid,ndft)
415 REAL,
INTENT(IN) :: y12a(r_grid,ndft)
416 REAL,
INTENT(IN) :: c_bicub(r_grid,ndft,4,4)
417 REAL,
INTENT(OUT) :: rdf
418 REAL,
INTENT(OUT) :: dg_drho
419 REAL,
INTENT(OUT) :: dg_dr
420 INTEGER,
INTENT(IN OUT) :: i_max
422 INTEGER,
INTENT(OUT) :: ih
423 INTEGER,
INTENT(IN) :: k
428 REAL :: y(4),y1(4),y2(4),y12(4),x1l,x1u,x2l,x2u
432 IF ( rho_rdf < x1a(1) )
THEN 438 IF ( x1a(ih) <= rho_rdf .AND. rho_rdf < x1a(ih+1) )
GO TO 10
440 IF ( x1a(ih-1) <= rho_rdf .AND. rho_rdf < x1a(ih) )
THEN 446 CALL hunt ( x1a, i_max, rho_rdf, ih )
449 IF ( x2a(k) /= xg )
THEN 466 y1(3) = y1a(ih+1,k+1)
471 y2(3) = y2a(ih+1,k+1)
475 y12(2) = y12a(ih+1,k)
476 y12(3) = y12a(ih+1,k+1)
477 y12(4) = y12a(ih,k+1)
486 c(m,n) = c_bicub( ih, k, m, n )
489 CALL bcuint ( x1l, x1u, x2l, x2u, rho_rdf, xg, c, rdf, dg_drho, dg_dr )
491 END SUBROUTINE bi_cub_spline
499 SUBROUTINE bicub_derivative ( ya, x1a, x2a, y1a, y2a, y12a, i_max, k_max )
505 REAL,
INTENT(IN) :: ya(r_grid,ndft)
506 REAL,
INTENT(IN) :: x1a(r_grid)
507 REAL,
INTENT(IN) :: x2a(ndft)
508 REAL,
INTENT(OUT) :: y1a(r_grid,ndft)
509 REAL,
INTENT(OUT) :: y2a(r_grid,ndft)
510 REAL,
INTENT(OUT) :: y12a(r_grid,ndft)
511 INTEGER,
INTENT(IN) :: i_max
512 INTEGER,
INTENT(IN) :: k_max
521 y1a(i,k) = (ya(i+1,k)-ya(i-1,k)) / (x1a(i+1)-x1a(i-1))
522 y2a(i,k) = (ya(i,k+1)-ya(i,k-1)) / (x2a(k+1)-x2a(k-1))
523 y12a(i,k)= (ya(i+1,k+1)-ya(i+1,k-1)-ya(i-1,k+1)+ya(i-1,k-1)) &
524 /((x1a(i+1)-x1a(i-1))*(x2a(k+1)-x2a(k-1)))
545 y1a(i,k) = (ya(i,k)-ya(i-1,k)) / (x1a(i)-x1a(i-1))
546 y2a(i,k) = (ya(i,k+1)-ya(i,k-1)) / (x2a(k+1)-x2a(k-1))
547 y12a(i,k)= (ya(i,k+1)-ya(i,k-1)-ya(i-1,k+1)+ya(i-1,k-1)) &
548 /((x1a(i)-x1a(i-1))*(x2a(k+1)-x2a(k-1)))
554 y1a(i,k) = (ya(i+1,k)-ya(i-1,k)) / (x1a(i+1)-x1a(i-1))
555 y2a(i,k) = (ya(i,k)-ya(i,k-1)) / (x2a(k)-x2a(k-1))
556 y12a(i,k)= (ya(i+1,k)-ya(i+1,k-1)-ya(i-1,k)+ya(i-1,k-1)) &
557 /((x1a(i+1)-x1a(i-1))*(x2a(k)-x2a(k-1)))
562 y1a(i,k) = (ya(i,k)-ya(i-1,k)) / (x1a(i)-x1a(i-1))
563 y2a(i,k) = (ya(i,k)-ya(i,k-1)) / (x2a(k)-x2a(k-1))
564 y12a(i,k)= (ya(i,k)-ya(i,k-1)-ya(i-1,k)+ya(i-1,k-1)) &
565 /((x1a(i)-x1a(i-1))*(x2a(k)-x2a(k-1)))
567 END SUBROUTINE bicub_derivative
575 SUBROUTINE bicub_c ( ya, x1a, x2a, y1a, y2a, y12a, c_bicub, i_max, k_max )
581 REAL,
INTENT(IN) :: ya(r_grid,ndft)
582 REAL,
INTENT(IN) :: x1a(r_grid)
583 REAL,
INTENT(IN) :: x2a(ndft)
584 REAL,
INTENT(IN) :: y1a(r_grid,ndft)
585 REAL,
INTENT(IN) :: y2a(r_grid,ndft)
586 REAL,
INTENT(IN) :: y12a(r_grid,ndft)
587 REAL,
INTENT(OUT) :: c_bicub(r_grid,ndft,4,4)
588 INTEGER,
INTENT(IN) :: i_max
589 INTEGER,
INTENT(IN) :: k_max
592 INTEGER :: i, k, m, n
593 REAL :: y(4),y1(4),y2(4),y12(4),x1l,x1u,x2l,x2u
624 CALL bcucof(y,y1,y2,y12,x1u-x1l,x2u-x2l,c)
627 c_bicub(i,k,m,n)=c(m,n)
634 END SUBROUTINE bicub_c
643 SUBROUTINE bcuint ( x1l, x1u, x2l, x2u, x1, x2, c, ansy, ansy1, ansy2 )
653 REAL,
INTENT(IN OUT) :: x1l
654 REAL,
INTENT(IN OUT) :: x1u
655 REAL,
INTENT(IN OUT) :: x2l
656 REAL,
INTENT(IN OUT) :: x2u
657 REAL,
INTENT(IN OUT) :: x1
658 REAL,
INTENT(IN OUT) :: x2
659 REAL,
INTENT(IN) :: c(4,4)
660 REAL,
INTENT(OUT) :: ansy
661 REAL,
INTENT(OUT) :: ansy1
662 REAL,
INTENT(OUT) :: ansy2
672 IF ( x1u == x1l .OR. x2u == x2l )
call paus (
'bad input in bcuint')
673 t = (x1-x1l) / (x1u-x1l)
674 u = (x2-x2l) / (x2u-x2l)
679 ansy = t *ansy + ( (c(i,4)*u + c(i,3))*u+c(i,2) )*u + c(i,1)
680 ansy2 = t *ansy2 + ( 3.*c(i,4)*u+2.*c(i,3) )*u + c(i,2)
681 ansy1 = u *ansy1 + ( 3.*c(4,i)*t+2.*c(3,i) )*t + c(2,i)
683 ansy1 = ansy1 / (x1u-x1l)
684 ansy2 = ansy2 / (x2u-x2l)
686 END SUBROUTINE bcuint
694 SUBROUTINE bcucof(y,y1,y2,y12,d1,d2,c)
699 REAL,
INTENT(IN) :: y(4)
700 REAL,
INTENT(IN) :: y1(4)
701 REAL,
INTENT(IN) :: y2(4)
702 REAL,
INTENT(IN) :: y12(4)
703 REAL,
INTENT(IN) :: d1
704 REAL,
INTENT(IN) :: d2
705 REAL,
INTENT(OUT) :: c(4,4)
709 REAL :: d1d2,xx,cl(16),wt(16,16),x(16)
711 DATA wt/1,0,-3,2,4*0,-3,0,9,-6,2,0,-6,4,8*0,3,0,-9,6,-2,0,6,-4,10* &
712 0,9,-6,2*0,-6,4,2*0,3,-2,6*0,-9,6,2*0,6,-4,4*0,1,0,-3,2,-2,0,6,-4, &
713 1,0,-3,2,8*0,-1,0,3,-2,1,0,-3,2,10*0,-3,2,2*0,3,-2,6*0,3,-2,2*0, &
714 -6,4,2*0,3,-2,0,1,-2,1,5*0,-3,6,-3,0,2,-4,2,9*0,3,-6,3,0,-2,4,-2, &
715 10*0,-3,3,2*0,2,-2,2*0,-1,1,6*0,3,-3,2*0,-2,2,5*0,1,-2,1,0,-2,4, &
716 -2,0,1,-2,1,9*0,-1,2,-1,0,1,-2,1,10*0,1,-1,2*0,-1,1,6*0,-1,1,2*0, &
725 x(i+12) = y12(i)*d1d2
730 xx = xx + wt(i,k) * x(k)
742 END SUBROUTINE bcucof
755 SUBROUTINE hunt ( xx, n, x, jlo )
760 INTEGER,
INTENT(IN) :: n
761 INTEGER,
INTENT(OUT) :: jlo
762 REAL,
INTENT(IN) :: xx(n)
766 INTEGER :: inc,jhi,jm
770 ascnd = xx(n) >= xx(1)
771 IF( jlo <= 0 .OR. jlo > n )
THEN 777 IF( x >= xx(jlo) .EQV. ascnd )
THEN 781 ELSE IF ( x >= xx(jhi) .EQV. ascnd )
THEN 791 ELSE IF ( x < xx(jlo) .EQV. ascnd )
THEN 797 3
IF (jhi-jlo == 1 )
THEN 798 IF ( x == xx(n)) jlo = n - 1
799 IF ( x == xx(1) ) jlo = 1
802 jm = ( jhi + jlo ) / 2
803 IF ( x >= xx(jm) .EQV. ascnd )
THEN 818 SUBROUTINE dens_inv_coeff (rhob)
826 REAL,
INTENT(IN) :: rhob(2)
829 INTEGER :: i, no_step_l, no_step_h
830 REAL :: my_eta_div,den_st,den_min,den_max, den_div
833 REAL :: rho_array1(200),rho_array2(200), &
834 my_rho_array1(200),my_rho_array2(200)
835 COMMON /deninv/ rho_array1,rho_array2,my_rho_array1, &
836 my_rho_array2,my_eta_div,den_min,den_max, no_step_l,no_step_h
839 den_min = rhob(2) * z3t_st * 0.8
840 den_max = rhob(1) * z3t_st * 1.1
847 IF (den_min < den_div)
THEN 849 dense(1) = den_min + (den_div-den_min) *
REAL(i-1)/
REAL(no_step_l-1)
851 rho_array1(i) = dense(1)
852 CALL fugacity (lnphi)
853 my_rho_array1(i) = exp( lnphi(1,1) ) *dense(1)/z3t_st / parame(1,2)**3
855 my_eta_div = my_rho_array1(no_step_l)
858 den_st = max( den_min, den_div )
860 dense(1) = den_st + (den_max-den_st) *
REAL(i-1)/
REAL(no_step_h-1)
862 rho_array2(i) = dense(1)
863 CALL fugacity (lnphi)
864 my_rho_array2(i) = lnphi(1,1) + log( dense(1)/z3t_st /parame(1,2)**3 )
866 IF ( (my_rho_array2(i)- my_rho_array2(i-1)) < 0.0 )
THEN 867 call paus (
'DENS_INV_COEFF: derivative negative')
872 END SUBROUTINE dens_inv_coeff
879 REAL FUNCTION dens_invers ( rhob, my_rho )
886 REAL,
INTENT(IN) :: rhob(2)
887 REAL,
INTENT(IN OUT) :: my_rho
890 INTEGER :: i, no_step_l, no_step_h
891 REAL :: my_eta_div, den_min, den_max, eta
893 REAL :: rho_array1(200),rho_array2(200), &
894 my_rho_array1(200),my_rho_array2(200)
895 COMMON /deninv/ rho_array1,rho_array2,my_rho_array1, &
896 my_rho_array2,my_eta_div,den_min,den_max, no_step_l,no_step_h
906 IF ( exp(my_rho) < my_eta_div )
THEN 908 IF ( my_rho_array1(i) > exp(my_rho) )
THEN 909 eta = rho_array1(i-1) + (rho_array1(i)-rho_array1(i-1)) &
910 / (my_rho_array1(i)-my_rho_array1(i-1)) &
911 * (exp(my_rho)-my_rho_array1(i-1))
912 dens_invers = eta/z3t_st
916 WRITE (*,*)
'error 1',exp(my_rho),my_eta_div
921 IF ( exp(my_rho) >= my_eta_div )
THEN 923 IF ( my_rho_array2(i) > my_rho )
THEN 924 eta = rho_array2(i-1)+(rho_array2(i)-rho_array2(i-1)) &
925 / (my_rho_array2(i)-my_rho_array2(i-1)) *(my_rho-my_rho_array2(i-1))
926 dens_invers = eta/z3t_st
930 WRITE (*,*)
'error 2',my_rho,my_eta_div
935 IF ( dens_invers < (rhob(2)*0.8) )
THEN 936 WRITE (*,*)
'lower bound',dens_invers,my_rho
937 dens_invers = rhob(2)
939 IF ( dens_invers > (rhob(1)*1.1) )
THEN 940 WRITE (*,*)
'upper bound',dens_invers,my_rho
941 dens_invers = rhob(1)
944 END FUNCTION dens_invers
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW This module contains constant...
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW Module DFT_MODULE This module...
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW This module contains paramete...
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW This module contains paramete...