2020-02-26 23:30:38 +01:00
|
|
|
program print_energy
|
2020-02-26 15:58:14 +01:00
|
|
|
implicit none
|
|
|
|
BEGIN_DOC
|
|
|
|
! Prints the energy of the wave function stored in the |EZFIO| directory.
|
|
|
|
END_DOC
|
|
|
|
|
|
|
|
! this has to be done in order to be sure that N_det, psi_det and
|
|
|
|
! psi_coef_sorted are the wave function stored in the |EZFIO| directory.
|
|
|
|
read_wf = .True.
|
|
|
|
touch read_wf
|
2020-07-14 15:23:53 +02:00
|
|
|
PROVIDE N_states
|
2020-02-26 15:58:14 +01:00
|
|
|
call run
|
|
|
|
end
|
|
|
|
|
|
|
|
subroutine run
|
|
|
|
implicit none
|
2020-07-14 15:23:53 +02:00
|
|
|
integer :: i,j
|
2020-02-26 15:58:14 +01:00
|
|
|
double precision :: i_H_psi_array(N_states)
|
|
|
|
double precision :: E(N_states)
|
|
|
|
double precision :: norm(N_states)
|
|
|
|
|
2020-07-14 15:23:53 +02:00
|
|
|
E(1:N_states) = nuclear_repulsion
|
|
|
|
norm(1:N_states) = 0.d0
|
2020-02-26 15:58:14 +01:00
|
|
|
do i=1,N_det
|
|
|
|
call i_H_psi(psi_det(1,1,i), psi_det, psi_coef, N_int, N_det, &
|
|
|
|
size(psi_coef,1), N_states, i_H_psi_array)
|
2020-07-14 15:23:53 +02:00
|
|
|
do j=1,N_states
|
|
|
|
norm(j) += psi_coef(i,j)*psi_coef(i,j)
|
|
|
|
E(j) += i_H_psi_array(j) * psi_coef(i,j)
|
|
|
|
enddo
|
2020-02-26 15:58:14 +01:00
|
|
|
enddo
|
|
|
|
|
|
|
|
print *, 'Energy:'
|
|
|
|
do i=1,N_states
|
|
|
|
print *, E(i)/norm(i)
|
|
|
|
enddo
|
|
|
|
end
|