From 25663a89cd34999d8f986c968aa2608268f4bc46 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 14 Jul 2020 15:23:53 +0200 Subject: [PATCH] Fixed print_energy --- src/tools/print_energy.irp.f | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/tools/print_energy.irp.f b/src/tools/print_energy.irp.f index 4703e7d4..f78dffc8 100644 --- a/src/tools/print_energy.irp.f +++ b/src/tools/print_energy.irp.f @@ -8,23 +8,26 @@ program print_energy ! psi_coef_sorted are the wave function stored in the |EZFIO| directory. read_wf = .True. touch read_wf + PROVIDE N_states call run end subroutine run implicit none - integer :: i + integer :: i,j double precision :: i_H_psi_array(N_states) double precision :: E(N_states) double precision :: norm(N_states) - E(:) = nuclear_repulsion - norm(:) = 0.d0 + E(1:N_states) = nuclear_repulsion + norm(1:N_states) = 0.d0 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) - norm(:) += psi_coef(i,:)**2 - E(:) += i_H_psi_array(:) * psi_coef(i,:) + 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 enddo print *, 'Energy:'