10
1
mirror of https://github.com/pfloos/quack synced 2024-12-26 14:23:38 +01:00
QuAcK/src/eDFT/restricted_fock_exchange_individual_energy.f90

32 lines
822 B
Fortran
Raw Normal View History

2020-07-06 20:57:27 +02:00
subroutine restricted_fock_exchange_individual_energy(nBas,Pw,P,ERI,Ex)
2020-03-31 22:15:45 +02:00
! Compute the Fock exchange potential
implicit none
! Input variables
integer,intent(in) :: nBas
double precision,intent(in) :: Pw(nBas,nBas)
2020-03-31 22:15:45 +02:00
double precision,intent(in) :: P(nBas,nBas)
double precision,intent(in) :: ERI(nBas,nBas,nBas,nBas)
! Local variables
double precision,allocatable :: Fx(:,:)
double precision,external :: trace_matrix
! Output variables
double precision,intent(out) :: Ex
! Compute HF exchange matrix
allocate(Fx(nBas,nBas))
2020-07-06 20:57:27 +02:00
call restricted_fock_exchange_potential(nBas,Pw(:,:),ERI(:,:,:,:),Fx(:,:))
2020-04-06 19:40:42 +02:00
Ex = trace_matrix(nBas,matmul(P(:,:),Fx(:,:))) &
- 0.5d0*trace_matrix(nBas,matmul(Pw(:,:),Fx(:,:)))
2020-03-31 22:15:45 +02:00
2020-07-06 20:57:27 +02:00
end subroutine restricted_fock_exchange_individual_energy