1
0
mirror of https://github.com/TREX-CoE/qmc-lttc.git synced 2024-10-13 11:31:50 +02:00
qmc-lttc/variance_hydrogen.f90

58 lines
1.1 KiB
Fortran
Raw Normal View History

2021-01-03 18:45:58 +01:00
program variance_hydrogen
implicit none
2021-01-29 13:23:00 +01:00
double precision :: x(50), w, delta, energy, energy2
double precision :: dx, r(3), a(6), norm, e_tmp, s2
integer :: i, k, l, j
2021-01-03 18:45:58 +01:00
double precision, external :: e_loc, psi
a = (/ 0.1d0, 0.2d0, 0.5d0, 1.d0, 1.5d0, 2.d0 /)
dx = 10.d0/(size(x)-1)
do i=1,size(x)
x(i) = -5.d0 + (i-1)*dx
end do
delta = dx**3
r(:) = 0.d0
do j=1,size(a)
2021-01-29 13:23:00 +01:00
energy = 0.d0
2021-01-20 21:18:22 +01:00
energy2 = 0.d0
2021-01-29 13:23:00 +01:00
norm = 0.d0
2021-01-03 18:45:58 +01:00
do i=1,size(x)
r(1) = x(i)
2021-01-29 13:23:00 +01:00
2021-01-03 18:45:58 +01:00
do k=1,size(x)
r(2) = x(k)
2021-01-29 13:23:00 +01:00
2021-01-03 18:45:58 +01:00
do l=1,size(x)
r(3) = x(l)
2021-01-29 13:23:00 +01:00
2021-01-03 18:45:58 +01:00
w = psi(a(j),r)
w = w * w * delta
2021-01-29 13:23:00 +01:00
e_tmp = e_loc(a(j), r)
energy = energy + w * e_tmp
energy2 = energy2 + w * e_tmp * e_tmp
norm = norm + w
2021-01-03 18:45:58 +01:00
end do
2021-01-29 13:23:00 +01:00
2021-01-03 18:45:58 +01:00
end do
2021-01-29 13:23:00 +01:00
2021-01-03 18:45:58 +01:00
end do
2021-01-29 13:23:00 +01:00
2021-01-20 21:18:22 +01:00
energy = energy / norm
energy2 = energy2 / norm
2021-01-29 13:23:00 +01:00
2021-01-20 21:18:22 +01:00
s2 = energy2 - energy*energy
2021-01-29 13:23:00 +01:00
2021-01-03 18:45:58 +01:00
print *, 'a = ', a(j), ' E = ', energy, ' s2 = ', s2
end do
2021-01-07 10:01:55 +01:00
2021-01-03 18:45:58 +01:00
end program variance_hydrogen