9
1
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-10-13 19:31:29 +02:00
qp2/src/determinants/energy.irp.f

32 lines
762 B
Fortran
Raw Normal View History

2019-01-25 11:39:31 +01:00
BEGIN_PROVIDER [ double precision, diagonal_H_matrix_on_psi_det, (N_det) ]
implicit none
BEGIN_DOC
! Diagonal of the Hamiltonian ordered as psi_det
END_DOC
double precision, external :: diag_h_mat_elem
integer :: i
do i=1,N_det
diagonal_H_matrix_on_psi_det(i) = diag_h_mat_elem(psi_det(1,1,i),N_int)
enddo
END_PROVIDER
BEGIN_PROVIDER [ double precision, barycentric_electronic_energy, (N_states) ]
implicit none
BEGIN_DOC
! $E_n = \sum_i {c_i^{(n)}}^2 H_{ii}$
END_DOC
integer :: istate,i
barycentric_electronic_energy(:) = 0.d0
do istate=1,N_states
do i=1,N_det
barycentric_electronic_energy(istate) += psi_coef(i,istate)*psi_coef(i,istate)*diagonal_H_matrix_on_psi_det(i)
enddo
enddo
END_PROVIDER