1
0
mirror of https://github.com/TREX-CoE/irpjast.git synced 2024-12-25 13:53:59 +01:00
irpjast/nuclei.irp.f

152 lines
3.5 KiB
FortranFixed
Raw Normal View History

2020-11-17 21:35:52 +01:00
BEGIN_PROVIDER [ integer, nnuc ]
implicit none
BEGIN_DOC
! Number of nuclei
END_DOC
!nnuc = 2
2021-03-09 00:59:49 +01:00
! read(*,*)nnuc
nnuc = nelec/5
2020-12-07 10:55:37 +01:00
END_PROVIDER
2021-03-10 21:26:25 +01:00
BEGIN_PROVIDER [ integer, nnuc_8 ]
implicit none
integer, external :: size_8
nnuc_8 = size_8(nnuc)
END_PROVIDER
2020-12-07 10:55:37 +01:00
BEGIN_PROVIDER [ integer, typenuc ]
&BEGIN_PROVIDER [integer, typenuc_arr, (nnuc)]
implicit none
BEGIN_DOC
2020-12-14 13:40:47 +01:00
! Type of the nuclei
2020-12-07 10:55:37 +01:00
END_DOC
typenuc = 1
!typenuc_arr = (/1, 1/)
typenuc_arr = 1
2020-11-17 21:35:52 +01:00
END_PROVIDER
BEGIN_PROVIDER [ double precision, nuc_coord, (nnuc, 3) ]
implicit none
BEGIN_DOC
! Nuclei coordinates
END_DOC
2020-12-07 10:55:37 +01:00
character(len=*), parameter :: FILE_NAME = "geometry.txt"
2020-12-08 13:08:23 +01:00
integer :: fu, rc, i
2020-12-07 10:55:37 +01:00
open(action='read', file=FILE_NAME, iostat=rc, newunit=fu)
2020-12-08 13:08:23 +01:00
do i = 1, nnuc
read(fu, *) nuc_coord(i, :)
end do
2020-12-07 10:55:37 +01:00
close(fu)
2020-11-17 21:35:52 +01:00
END_PROVIDER
2020-11-26 16:12:33 +01:00
BEGIN_PROVIDER [ double precision, elnuc_dist, (nelec, nnuc) ]
2020-11-17 21:35:52 +01:00
implicit none
BEGIN_DOC
! e-n distance
END_DOC
integer :: i, j
double precision :: x, y, z
do j = 1, nnuc
2020-12-08 13:08:23 +01:00
do i = 1, nelec
x = elec_coord(i, 1) - nuc_coord(j, 1)
y = elec_coord(i, 2) - nuc_coord(j, 2)
z = elec_coord(i, 3) - nuc_coord(j, 3)
elnuc_dist(i, j) = dsqrt( x*x + y*y + z*z )
enddo
2020-11-17 21:35:52 +01:00
enddo
END_PROVIDER
BEGIN_PROVIDER [double precision, factor_en]
implicit none
BEGIN_DOC
! Electron-nuclei contribution to Jastrow factor
END_DOC
integer :: i, a, p
2020-12-04 01:05:07 +01:00
double precision :: pow_ser, x
factor_en = 0.0d0
2020-12-16 19:38:41 +01:00
do a = 1 , nnuc
2020-12-07 10:55:37 +01:00
do i = 1, nelec
2020-12-16 19:38:41 +01:00
x = rescale_en(i, a)
2020-12-08 18:56:36 +01:00
pow_ser = 0.0d0
2020-12-08 23:40:24 +01:00
2020-11-17 21:35:52 +01:00
do p = 2, naord
2020-12-16 19:38:41 +01:00
x = x * rescale_en(i, a)
pow_ser = pow_ser + aord_vect(p + 1, typenuc_arr(a)) * x
2020-11-17 21:35:52 +01:00
end do
2020-12-08 23:40:24 +01:00
2020-12-16 19:38:41 +01:00
factor_en = factor_en + aord_vect(1, typenuc_arr(a)) * rescale_en(i, a) &
/ (1.0d0 + aord_vect(2, typenuc_arr(a)) * rescale_en(i, a)) + pow_ser
end do
end do
END_PROVIDER
BEGIN_PROVIDER [double precision, factor_en_deriv_e, (4, nelec) ]
implicit none
BEGIN_DOC
! Dimensions 1-3 : dx, dy, dz
! Dimension 4 : d2x + d2y + d2z
END_DOC
integer :: i, ii, a, p
2020-12-17 15:33:51 +01:00
double precision :: x, x_inv, y, den, invden, lap1, lap2, lap3, third
double precision, dimension(3) :: pow_ser_g
double precision, dimension(4) :: dx
2020-12-16 19:38:41 +01:00
factor_en_deriv_e = 0.0d0
2020-12-17 15:33:51 +01:00
third = 1.0d0 / 3.0d0
2020-12-16 19:38:41 +01:00
do a = 1 , nnuc
do i = 1, nelec
pow_ser_g = 0.0d0
den = 1.0d0 + aord_vect(2, typenuc_arr(a)) * rescale_en(i, a)
invden = 1.0d0 / den
x_inv = 1.0d0 / rescale_en(i, a)
2020-12-16 19:38:41 +01:00
do ii = 1, 4
dx(ii) = rescale_en_deriv_e(ii, i, a)
enddo
lap1 = 0.0d0
lap2 = 0.0d0
2020-12-17 15:33:51 +01:00
lap3 = 0.0d0
2020-12-16 19:38:41 +01:00
do ii = 1, 3
x = rescale_en(i, a)
do p = 2, naord
2020-12-17 15:33:51 +01:00
! p a_{p+1} r[i,a]^(p-1)
y = p * aord_vect(p + 1, typenuc_arr(a)) * x
pow_ser_g(ii) += y * dx(ii)
! (p-1) p a_{p+1} r[i,a]^(p-2) r'[i,a]^2
lap1 += (p - 1) * y * x_inv * dx(ii) * dx(ii)
! p a_{p+1} r[i,a]^(p-1) r''[i,a]
lap2 += y
x = x * rescale_en(i, a)
2020-12-16 19:38:41 +01:00
end do
! (a1 (-2 a2 r'[i,a]^2+(1+a2 r[i,a]) r''[i,a]))/(1+a2 r[i,a])^3
2020-12-17 15:33:51 +01:00
lap3 += -2.0d0 * aord_vect(2, typenuc_arr(a)) * dx(ii) * dx(ii)
2020-12-16 19:38:41 +01:00
2020-12-17 15:33:51 +01:00
! \frac{a1 * r'(i,a)}{(a2 * r(i,a)+1)^2}
2020-12-16 19:38:41 +01:00
factor_en_deriv_e(ii, i) += aord_vect(1, typenuc_arr(a)) &
* dx(ii) * invden * invden + pow_ser_g(ii)
enddo
ii = 4
2020-12-17 15:33:51 +01:00
lap2 *= dx(ii) * third
lap3 += den * dx(ii)
lap3 *= aord_vect(1, typenuc_arr(a)) * invden * invden * invden
2020-12-17 15:33:51 +01:00
factor_en_deriv_e(ii, i) += lap1 + lap2 + lap3
2020-12-08 23:40:24 +01:00
2020-11-17 21:35:52 +01:00
end do
end do
2020-11-25 18:09:13 +01:00
2020-11-17 21:35:52 +01:00
END_PROVIDER