1
0
mirror of https://github.com/TREX-CoE/qmc-lttc.git synced 2024-07-17 16:34:01 +02:00
qmc-lttc/hydrogen.f90

64 lines
1.3 KiB
Fortran
Raw Normal View History

2021-01-03 18:45:58 +01:00
double precision function potential(r)
implicit none
double precision, intent(in) :: r(3)
2021-01-29 13:23:00 +01:00
double precision :: distance
2021-01-26 00:22:37 +01:00
distance = dsqrt( r(1)*r(1) + r(2)*r(2) + r(3)*r(3) )
2021-01-29 13:23:00 +01:00
2021-01-26 00:22:37 +01:00
if (distance > 0.d0) then
2021-01-29 13:23:00 +01:00
potential = -1.d0 / distance
2021-01-26 00:22:37 +01:00
else
stop 'potential at r=0.d0 diverges'
end if
2021-01-29 13:23:00 +01:00
2021-01-03 18:45:58 +01:00
end function potential
double precision function psi(a, r)
implicit none
double precision, intent(in) :: a, r(3)
2021-01-29 13:23:00 +01:00
2021-01-03 18:45:58 +01:00
psi = dexp(-a * dsqrt( r(1)*r(1) + r(2)*r(2) + r(3)*r(3) ))
end function psi
double precision function kinetic(a,r)
implicit none
double precision, intent(in) :: a, r(3)
2021-01-29 13:23:00 +01:00
double precision :: distance
2021-01-26 00:22:37 +01:00
distance = dsqrt( r(1)*r(1) + r(2)*r(2) + r(3)*r(3) )
2021-01-29 13:23:00 +01:00
2021-01-26 00:22:37 +01:00
if (distance > 0.d0) then
2021-01-29 13:23:00 +01:00
kinetic = a * (1.d0 / distance - 0.5d0 * a)
2021-01-26 00:22:37 +01:00
else
stop 'kinetic energy diverges at r=0'
end if
2021-01-29 13:23:00 +01:00
2021-01-03 18:45:58 +01:00
end function kinetic
double precision function e_loc(a,r)
implicit none
double precision, intent(in) :: a, r(3)
2021-01-29 13:23:00 +01:00
double precision, external :: kinetic
double precision, external :: potential
2021-01-29 13:23:00 +01:00
2021-01-03 18:45:58 +01:00
e_loc = kinetic(a,r) + potential(r)
2021-01-29 13:23:00 +01:00
2021-01-03 18:45:58 +01:00
end function e_loc
2021-01-12 01:01:52 +01:00
subroutine drift(a,r,b)
implicit none
double precision, intent(in) :: a, r(3)
double precision, intent(out) :: b(3)
2021-01-29 13:23:00 +01:00
2021-01-12 01:01:52 +01:00
double precision :: ar_inv
2021-01-29 13:23:00 +01:00
2021-01-12 01:01:52 +01:00
ar_inv = -a / dsqrt(r(1)*r(1) + r(2)*r(2) + r(3)*r(3))
2021-01-29 13:23:00 +01:00
b(:) = r(:) * ar_inv
2021-01-12 01:01:52 +01:00
end subroutine drift