2023-07-18 11:53:38 +02:00
|
|
|
subroutine phRPAx(TDA,doACFDT,exchange_kernel,singlet,triplet,nBas,nC,nO,nV,nR,nS,ENuc,EHF,ERI,dipole_int,e)
|
2020-01-28 09:00:11 +01:00
|
|
|
|
|
|
|
! Perform random phase approximation calculation with exchange (aka TDHF)
|
|
|
|
|
|
|
|
implicit none
|
|
|
|
include 'parameters.h'
|
|
|
|
include 'quadrature.h'
|
|
|
|
|
|
|
|
! Input variables
|
|
|
|
|
2020-09-24 16:39:15 +02:00
|
|
|
logical,intent(in) :: TDA
|
2020-01-28 09:00:11 +01:00
|
|
|
logical,intent(in) :: doACFDT
|
|
|
|
logical,intent(in) :: exchange_kernel
|
2020-09-23 09:46:44 +02:00
|
|
|
logical,intent(in) :: singlet
|
|
|
|
logical,intent(in) :: triplet
|
2020-01-28 09:00:11 +01:00
|
|
|
integer,intent(in) :: nBas
|
|
|
|
integer,intent(in) :: nC
|
|
|
|
integer,intent(in) :: nO
|
|
|
|
integer,intent(in) :: nV
|
|
|
|
integer,intent(in) :: nR
|
|
|
|
integer,intent(in) :: nS
|
|
|
|
double precision,intent(in) :: ENuc
|
2023-07-18 11:53:38 +02:00
|
|
|
double precision,intent(in) :: EHF
|
|
|
|
double precision,intent(in) :: e(nBas)
|
2020-01-28 09:00:11 +01:00
|
|
|
double precision,intent(in) :: ERI(nBas,nBas,nBas,nBas)
|
2020-09-28 21:25:25 +02:00
|
|
|
double precision,intent(in) :: dipole_int(nBas,nBas,ncart)
|
2020-01-28 09:00:11 +01:00
|
|
|
|
|
|
|
! Local variables
|
|
|
|
|
|
|
|
integer :: ispin
|
2023-07-18 11:53:38 +02:00
|
|
|
logical :: dRPA
|
|
|
|
double precision,allocatable :: Aph(:,:)
|
|
|
|
double precision,allocatable :: Bph(:,:)
|
2023-07-12 13:34:10 +02:00
|
|
|
double precision,allocatable :: Om(:)
|
|
|
|
double precision,allocatable :: XpY(:,:)
|
|
|
|
double precision,allocatable :: XmY(:,:)
|
2020-01-28 09:00:11 +01:00
|
|
|
|
2023-07-18 11:53:38 +02:00
|
|
|
double precision :: EcTr(nspin)
|
2020-01-28 09:00:11 +01:00
|
|
|
double precision :: EcAC(nspin)
|
|
|
|
|
|
|
|
! Hello world
|
|
|
|
|
|
|
|
write(*,*)
|
|
|
|
write(*,*)'***********************************************************'
|
|
|
|
write(*,*)'| Random phase approximation calculation with exchange |'
|
|
|
|
write(*,*)'***********************************************************'
|
|
|
|
write(*,*)
|
|
|
|
|
2020-09-30 09:59:18 +02:00
|
|
|
! TDA
|
|
|
|
|
|
|
|
if(TDA) then
|
|
|
|
write(*,*) 'Tamm-Dancoff approximation activated!'
|
|
|
|
write(*,*) ' => RPAx + TDA = CIS '
|
|
|
|
write(*,*)
|
|
|
|
end if
|
|
|
|
|
2020-01-28 09:00:11 +01:00
|
|
|
! Initialization
|
|
|
|
|
2023-07-18 11:53:38 +02:00
|
|
|
dRPA = .false.
|
|
|
|
|
|
|
|
EcTr(:) = 0d0
|
|
|
|
EcAC(:) = 0d0
|
2020-01-28 09:00:11 +01:00
|
|
|
|
|
|
|
! Memory allocation
|
|
|
|
|
2023-07-18 11:53:38 +02:00
|
|
|
allocate(Om(nS),XpY(nS,nS),XmY(nS,nS),Aph(nS,nS))
|
|
|
|
if(.not.TDA) allocate(Bph(nS,nS))
|
2020-01-28 09:00:11 +01:00
|
|
|
|
|
|
|
! Singlet manifold
|
|
|
|
|
2020-09-23 09:46:44 +02:00
|
|
|
if(singlet) then
|
2020-01-28 09:00:11 +01:00
|
|
|
|
|
|
|
ispin = 1
|
|
|
|
|
2023-07-18 11:53:38 +02:00
|
|
|
call phLR_A(ispin,dRPA,nBas,nC,nO,nV,nR,nS,1d0,e,ERI,Aph)
|
|
|
|
if(.not.TDA) call phLR_B(ispin,dRPA,nBas,nC,nO,nV,nR,nS,1d0,ERI,Bph)
|
|
|
|
|
|
|
|
call phLR(TDA,nS,Aph,Bph,EcTr(ispin),Om,XpY,XmY)
|
|
|
|
call print_excitation('phRPAx@HF ',ispin,nS,Om)
|
2023-07-12 22:56:20 +02:00
|
|
|
call print_transition_vectors_ph(.true.,nBas,nC,nO,nV,nR,nS,dipole_int,Om,XpY,XmY)
|
2020-06-05 22:34:32 +02:00
|
|
|
|
2020-01-28 09:00:11 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
! Triplet manifold
|
|
|
|
|
2020-09-23 09:46:44 +02:00
|
|
|
if(triplet) then
|
2020-01-28 09:00:11 +01:00
|
|
|
|
|
|
|
ispin = 2
|
|
|
|
|
2023-07-18 11:53:38 +02:00
|
|
|
call phLR_A(ispin,dRPA,nBas,nC,nO,nV,nR,nS,1d0,e,ERI,Aph)
|
|
|
|
if(.not.TDA) call phLR_B(ispin,dRPA,nBas,nC,nO,nV,nR,nS,1d0,ERI,Bph)
|
|
|
|
|
|
|
|
call phLR(TDA,nS,Aph,Bph,EcTr(ispin),Om,XpY,XmY)
|
|
|
|
call print_excitation('phRPAx@HF ',ispin,nS,Om)
|
2023-07-12 22:56:20 +02:00
|
|
|
call print_transition_vectors_ph(.false.,nBas,nC,nO,nV,nR,nS,dipole_int,Om,XpY,XmY)
|
2020-01-28 09:00:11 +01:00
|
|
|
|
|
|
|
endif
|
|
|
|
|
2023-07-18 11:53:38 +02:00
|
|
|
if(exchange_kernel) then
|
2020-01-28 09:00:11 +01:00
|
|
|
|
2023-07-18 11:53:38 +02:00
|
|
|
EcTr(1) = 0.5d0*EcTr(1)
|
|
|
|
EcTr(2) = 1.5d0*EcTr(2)
|
2020-01-28 09:00:11 +01:00
|
|
|
|
2023-07-18 11:53:38 +02:00
|
|
|
end if
|
2020-01-28 09:00:11 +01:00
|
|
|
|
|
|
|
write(*,*)
|
|
|
|
write(*,*)'-------------------------------------------------------------------------------'
|
2023-07-18 11:53:38 +02:00
|
|
|
write(*,'(2X,A50,F20.10)') 'Tr@phRPAx correlation energy (singlet) =',EcTr(1)
|
|
|
|
write(*,'(2X,A50,F20.10)') 'Tr@phRPAx correlation energy (triplet) =',EcTr(2)
|
|
|
|
write(*,'(2X,A50,F20.10)') 'Tr@phRPAx correlation energy =',EcTr(1) + EcTr(2)
|
|
|
|
write(*,'(2X,A50,F20.10)') 'Tr@phRPAx total energy =',ENuc + EHF + EcTr(1) + EcTr(2)
|
2020-01-28 09:00:11 +01:00
|
|
|
write(*,*)'-------------------------------------------------------------------------------'
|
|
|
|
write(*,*)
|
|
|
|
|
2023-07-12 13:34:10 +02:00
|
|
|
! deallocate memory
|
|
|
|
|
2023-07-18 11:53:38 +02:00
|
|
|
deallocate(Om,XpY,XmY,Aph,Bph)
|
2023-07-12 13:34:10 +02:00
|
|
|
|
2020-01-28 09:00:11 +01:00
|
|
|
! Compute the correlation energy via the adiabatic connection
|
|
|
|
|
|
|
|
if(doACFDT) then
|
|
|
|
|
2023-07-18 11:53:38 +02:00
|
|
|
write(*,*) '---------------------------------------------------------'
|
|
|
|
write(*,*) 'Adiabatic connection version of phRPAx correlation energy'
|
|
|
|
write(*,*) '---------------------------------------------------------'
|
2020-01-28 09:00:11 +01:00
|
|
|
write(*,*)
|
|
|
|
|
2023-07-18 11:53:38 +02:00
|
|
|
call phACFDT(exchange_kernel,dRPA,TDA,singlet,triplet,nBas,nC,nO,nV,nR,nS,ERI,e,EcAC)
|
2020-01-28 09:00:11 +01:00
|
|
|
|
|
|
|
write(*,*)
|
|
|
|
write(*,*)'-------------------------------------------------------------------------------'
|
2023-07-18 11:53:38 +02:00
|
|
|
write(*,'(2X,A50,F20.10)') 'AC@phRPAx correlation energy (singlet) =',EcAC(1)
|
|
|
|
write(*,'(2X,A50,F20.10)') 'AC@phRPAx correlation energy (triplet) =',EcAC(2)
|
|
|
|
write(*,'(2X,A50,F20.10)') 'AC@phRPAx correlation energy =',EcAC(1) + EcAC(2)
|
|
|
|
write(*,'(2X,A50,F20.10)') 'AC@phRPAx total energy =',ENuc + EHF + EcAC(1) + EcAC(2)
|
2020-01-28 09:00:11 +01:00
|
|
|
write(*,*)'-------------------------------------------------------------------------------'
|
|
|
|
write(*,*)
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
2023-07-12 13:34:10 +02:00
|
|
|
end subroutine
|