1
0
mirror of https://github.com/TREX-CoE/irpjast.git synced 2024-07-22 18:57:41 +02:00

Naive feen ok. Progressive opt

This commit is contained in:
Panadestein 2020-12-09 22:23:19 +01:00
parent 266e9dc655
commit e184163d6f
6 changed files with 4282 additions and 13 deletions

View File

@ -64,3 +64,103 @@ BEGIN_PROVIDER [double precision, factor_een]
factor_een = 0.5d0 * factor_een
END_PROVIDER
BEGIN_PROVIDER [double precision, factor_een_naive]
implicit none
BEGIN_DOC
! Electron-electron nucleus contribution to Jastrow factor in a naive way
END_DOC
integer :: i, j, alpha, p, k, l, lmax, cindex
double precision :: ria, rja, rij
PROVIDE cord_vect
factor_een_naive = 0.0d0
do alpha = 1, nnuc
do j = 2, nelec
rja = rescale_een_n(j, alpha)
do i = 1, j - 1
ria = rescale_een_n(i, alpha)
rij = rescale_een_e(i, j)
cindex = 0
do p = 2, ncord
do k = p - 1, 0, -1
if ( k /= 0 ) then
lmax = p - k
else
lmax = p - k - 2
end if
do l = lmax, 0, -1
if ( iand(p - k - l, 1) == 0 ) then
cindex = cindex + 1
factor_een_naive = factor_een_naive + &
cord_vect(cindex, typenuc_arr(alpha)) * &
rij ** k * (ria ** l + rja ** l) * (ria * rja) ** rshift(p - k - l, 1)
print *, "a", (ria * rja) ** rshift(p - k - l, 1)
end if
end do
end do
end do
end do
end do
end do
END_PROVIDER
BEGIN_PROVIDER [double precision, factor_een_prog]
implicit none
BEGIN_DOC
! Electron-electron nucleus contribution to Jastrow factor in a naive way
END_DOC
integer :: alpha, i, j, p, k, l, lmax, m, cindex
double precision :: ria, rja, rij, rij_inv
double precision :: c, c_inv, t, x, y, z ! Placeholders for optimization
PROVIDE cord_vect
factor_een_prog = 0.0d0
do alpha = 1, nnuc
do j = 2, nelec
rja = rescale_een_n(j, alpha)
do i = 1, j - 1
ria = rescale_een_n(i, alpha)
rij = rescale_een_e(i, j)
rij_inv = 1.0d0 / (rij * rij)
c = ria * rja
c_inv = 1.0d0 / c
cindex = 0
do p = 2, ncord
x = 1.0d0
do l = 1, p - 1
x = x * rij
end do
do k = p - 1, 0, -1
if ( k /= 0 ) then
lmax = p - k
else
lmax = p - k - 2
end if
t = 1.0d0
do l = 1, rshift(p - k, 1)
t = t * c
end do
do l = lmax, iand(p - k, 1), -2
cindex = cindex + 1
factor_een_prog = factor_een_prog + &
cord_vect(cindex, typenuc_arr(alpha)) * &
x * (ria ** l + rja ** l) * t
t = t * c_inv
x = x * rij_inv
end do
end do
end do
end do
end do
end do
END_PROVIDER

View File

@ -51,6 +51,28 @@ BEGIN_PROVIDER [ double precision, elec_dist, (nelec, nelec) ]
enddo
END_PROVIDER
BEGIN_PROVIDER [double precision, asymp_jasb, (2)]
BEGIN_DOC
! Asymptotic component subtracted from J_ee
END_DOC
implicit none
integer :: i, p
double precision :: asym_one, x
asym_one = bord_vect(1) * kappa_inv / (1.0d0 + bord_vect(2) * kappa_inv)
asymp_jasb(:) = (/asym_one, 0.5d0 * asym_one/)
do i = 1, 2
x = kappa_inv
do p = 2, nbord
x = x * kappa_inv
asymp_jasb(i) = asymp_jasb(i) + bord_vect(p + 1) * x
end do
end do
END_PROVIDER
BEGIN_PROVIDER [double precision, factor_ee]
implicit none
BEGIN_DOC
@ -62,29 +84,26 @@ BEGIN_PROVIDER [double precision, factor_ee]
factor_ee = 0.0d0
do j = 1, nelec
do i = 1, nelec
do i = 1, j - 1
x = rescale_ee(i, j)
pow_ser = 0.0d0
spin_fact = 1.0d0
ipar = 0
ipar = 1
do p = 2, nbord
x = x * rescale_ee(i, j)
pow_ser = pow_ser + bord_vect(p + 1) * x
end do
if ((i.le.nelec_up .and. j.le.nelec_up) .or. &
(i.gt.nelec_up .and. j.gt.nelec_up)) then
if (j.le.nelec_up .or. i.gt.nelec_up) then
spin_fact = 0.5d0
ipar = 1
ipar = 2
end if
factor_ee = factor_ee + spin_fact * bord_vect(1) * rescale_ee(i, j) &
/ (1.0d0 + bord_vect(2) * rescale_ee(i, j)) + pow_ser
/ (1.0d0 + bord_vect(2) * rescale_ee(i, j)) - asymp_jasb(ipar) + pow_ser
end do
end do
factor_ee = 0.5d0 * factor_ee
END_PROVIDER

BIN
jastrow

Binary file not shown.

View File

@ -5,11 +5,13 @@ BEGIN_PROVIDER [ double precision, jastrow_full ]
END_DOC
integer :: i, j
print *, factor_ee
print *, factor_en
print *, factor_een
print *, "J_ee = ", factor_ee
print *, "J_en = ", factor_en
print *, "J_een = ", factor_een
print *, "J_enn_naive = ", factor_een_naive
print *, "J_enn_prog = ", factor_een_prog
print *, "J = J_ee + J_en + J_een = ", factor_ee + factor_en + factor_een
jastrow_full = dexp(factor_ee + factor_en + factor_een)
END_PROVIDER

4148
tt Normal file

File diff suppressed because it is too large Load Diff