10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-06-02 11:25:26 +02:00
quantum_package/plugins/Properties/average.irp.f

26 lines
704 B
Fortran
Raw Normal View History

2015-03-19 21:14:52 +01:00
subroutine get_average(array,density,average)
implicit none
2017-11-27 10:58:32 +01:00
double precision, intent(in) :: array(mo_tot_num,mo_tot_num)
double precision, intent(in) :: density(mo_tot_num,mo_tot_num)
2015-03-19 21:14:52 +01:00
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