1
0
mirror of https://github.com/TREX-CoE/qmc-lttc.git synced 2024-11-03 20:54:12 +01:00
qmc-lttc/energy_hydrogen.f90

69 lines
1.3 KiB
Fortran
Raw Permalink Normal View History

2021-01-25 23:52:53 +01:00
program energy_hydrogen
implicit none
double precision, external :: e_loc, psi
double precision :: x(50), w, delta, energy, dx, r(3), a(6), norm
integer :: i, k, l, j
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
do j=1,size(a)
2021-01-29 13:23:00 +01:00
2021-01-25 23:52:53 +01:00
! TODO
2021-01-29 13:23:00 +01:00
2021-01-25 23:52:53 +01:00
print *, 'a = ', a(j), ' E = ', energy
end do
end program energy_hydrogen
2021-01-03 18:45:58 +01:00
program energy_hydrogen
implicit none
double precision, external :: e_loc, psi
double precision :: x(50), w, delta, energy, dx, r(3), a(6), norm
2021-01-29 13:23:00 +01:00
integer :: i, k, l, j
2021-01-03 18:45:58 +01:00
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)
energy = 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
2021-01-03 18:45:58 +01:00
energy = energy + w * e_loc(a(j), r)
norm = norm + w
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-03 18:45:58 +01:00
energy = energy / norm
print *, 'a = ', a(j), ' E = ', energy
end do
end program energy_hydrogen