10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-12-24 21:33:52 +01:00
quantum_package/plugins/Properties/average.irp.f

26 lines
716 B
Fortran
Raw Normal View History

2015-03-19 21:14:52 +01:00
subroutine get_average(array,density,average)
implicit none
double precision, intent(in) :: array(mo_tot_num_align,mo_tot_num)
double precision, intent(in) :: density(mo_tot_num_align,mo_tot_num)
double precision, intent(out):: average
integer :: i,j
BEGIN_DOC
! computes the average value of a pure MONO ELECTRONIC OPERATOR
! whom integrals on the MO basis are stored in "array"
! and with the density is stored in "density"
END_DOC
average = 0.d0
!$OMP PARALLEL DO DEFAULT(none) &
!$OMP PRIVATE(i,j) &
!$OMP SHARED(mo_tot_num,array,density) &
!$OMP REDUCTION(+:average)
do i = 1, mo_tot_num
do j = 1, mo_tot_num
average += density(j,i) * array(j,i)
enddo
enddo
!$OMP END PARALLEL DO
end