2023-11-11 23:00:00 +01:00
|
|
|
subroutine phRRPAx(dotest,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
|
|
|
|
|
2023-11-11 23:00:00 +01:00
|
|
|
logical,intent(in) :: dotest
|
|
|
|
|
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-31 16:01:12 +02:00
|
|
|
double precision :: EcRPA(nspin)
|
2020-01-28 09:00:11 +01:00
|
|
|
|
|
|
|
! Hello world
|
|
|
|
|
|
|
|
write(*,*)
|
2023-11-14 13:50:53 +01:00
|
|
|
write(*,*)'**********************************'
|
|
|
|
write(*,*)'* Restricted ph-RPAx Calculation *'
|
|
|
|
write(*,*)'**********************************'
|
2020-01-28 09:00:11 +01:00
|
|
|
write(*,*)
|
|
|
|
|
2020-09-30 09:59:18 +02:00
|
|
|
! TDA
|
|
|
|
|
|
|
|
if(TDA) then
|
|
|
|
write(*,*) 'Tamm-Dancoff approximation activated!'
|
|
|
|
write(*,*)
|
|
|
|
end if
|
|
|
|
|
2020-01-28 09:00:11 +01:00
|
|
|
! Initialization
|
|
|
|
|
2023-07-18 11:53:38 +02:00
|
|
|
dRPA = .false.
|
|
|
|
|
2023-07-31 16:01:12 +02:00
|
|
|
EcRPA(:) = 0d0
|
2020-01-28 09:00:11 +01:00
|
|
|
|
|
|
|
! Memory allocation
|
|
|
|
|
2023-11-20 21:34:08 +01:00
|
|
|
allocate(Om(nS),XpY(nS,nS),XmY(nS,nS),Aph(nS,nS),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)
|
|
|
|
|
2023-07-31 16:01:12 +02:00
|
|
|
call phLR(TDA,nS,Aph,Bph,EcRPA(ispin),Om,XpY,XmY)
|
2023-11-22 14:54:05 +01:00
|
|
|
call print_excitation_energies('phRPAx@RHF','singlet',nS,Om)
|
2023-07-28 14:14:35 +02:00
|
|
|
call phLR_transition_vectors(.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)
|
|
|
|
|
2023-07-31 16:01:12 +02:00
|
|
|
call phLR(TDA,nS,Aph,Bph,EcRPA(ispin),Om,XpY,XmY)
|
2023-11-22 14:54:05 +01:00
|
|
|
call print_excitation_energies('phRPAx@RHF','triplet',nS,Om)
|
2023-07-28 14:14:35 +02:00
|
|
|
call phLR_transition_vectors(.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-31 16:01:12 +02:00
|
|
|
EcRPA(1) = 0.5d0*EcRPA(1)
|
|
|
|
EcRPA(2) = 1.5d0*EcRPA(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-11-11 23:00:00 +01:00
|
|
|
write(*,'(2X,A50,F20.10,A3)') 'Tr@phRRPAx correlation energy (singlet) = ',EcRPA(1),' au'
|
|
|
|
write(*,'(2X,A50,F20.10,A3)') 'Tr@phRRPAx correlation energy (triplet) = ',EcRPA(2),' au'
|
|
|
|
write(*,'(2X,A50,F20.10,A3)') 'Tr@phRRPAx correlation energy = ',sum(EcRPA),' au'
|
|
|
|
write(*,'(2X,A50,F20.10,A3)') 'Tr@phRRPAx total energy = ',ENuc + EHF + sum(EcRPA),' au'
|
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-31 16:01:12 +02:00
|
|
|
call phACFDT(exchange_kernel,dRPA,TDA,singlet,triplet,nBas,nC,nO,nV,nR,nS,ERI,e,EcRPA)
|
2020-01-28 09:00:11 +01:00
|
|
|
|
|
|
|
write(*,*)
|
|
|
|
write(*,*)'-------------------------------------------------------------------------------'
|
2023-11-11 23:00:00 +01:00
|
|
|
write(*,'(2X,A50,F20.10,A3)') 'AC@phRRPAx correlation energy (singlet) = ',EcRPA(1),' au'
|
|
|
|
write(*,'(2X,A50,F20.10,A3)') 'AC@phRRPAx correlation energy (triplet) = ',EcRPA(2),' au'
|
|
|
|
write(*,'(2X,A50,F20.10,A3)') 'AC@phRRPAx correlation energy = ',sum(EcRPA),' au'
|
|
|
|
write(*,'(2X,A50,F20.10,A3)') 'AC@phRRPAx total energy = ',ENuc + EHF + sum(EcRPA),' au'
|
2020-01-28 09:00:11 +01:00
|
|
|
write(*,*)'-------------------------------------------------------------------------------'
|
|
|
|
write(*,*)
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
2023-11-14 14:31:27 +01:00
|
|
|
! Testing zone
|
|
|
|
|
2023-11-11 23:00:00 +01:00
|
|
|
if(dotest) then
|
|
|
|
|
2023-11-14 14:31:27 +01:00
|
|
|
call dump_test_value('R','phRPAx correlation energy',sum(EcRPA))
|
2023-11-11 23:00:00 +01:00
|
|
|
|
|
|
|
end if
|
|
|
|
|
2023-07-12 13:34:10 +02:00
|
|
|
end subroutine
|