4
1
mirror of https://github.com/pfloos/quack synced 2024-11-07 22:53:59 +01:00
quack/src/QuAcK/RPA.f90

102 lines
3.1 KiB
Fortran
Raw Normal View History

2020-01-13 23:08:03 +01:00
subroutine RPA(singlet_manifold,triplet_manifold,nBas,nC,nO,nV,nR,nS,ENuc,ERHF,ERI,e)
! Perform a direct random phase approximation calculation
implicit none
include 'parameters.h'
include 'quadrature.h'
! Input variables
logical,intent(in) :: singlet_manifold
logical,intent(in) :: triplet_manifold
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
double precision,intent(in) :: ERHF
double precision,intent(in) :: e(nBas)
double precision,intent(in) :: ERI(nBas,nBas,nBas,nBas)
! Local variables
integer :: ispin
double precision,allocatable :: Omega(:,:)
double precision,allocatable :: XpY(:,:,:)
2020-01-14 14:44:01 +01:00
double precision,allocatable :: XmY(:,:,:)
2020-01-13 23:08:03 +01:00
double precision :: rho
double precision :: EcRPA(nspin)
2020-01-14 16:36:11 +01:00
logical :: adiabatic_connection
2020-01-13 23:08:03 +01:00
! Hello world
write(*,*)
write(*,*)'***********************************************'
write(*,*)'| random-phase approximation calculation |'
write(*,*)'***********************************************'
write(*,*)
! Initialization
EcRPA(:) = 0d0
! Memory allocation
2020-01-14 14:44:01 +01:00
allocate(Omega(nS,nspin),XpY(nS,nS,nspin),XmY(nS,nS,nspin))
2020-01-13 23:08:03 +01:00
! Singlet manifold
if(singlet_manifold) then
ispin = 1
2020-01-14 16:36:11 +01:00
call linear_response(ispin,.true.,.false.,.false.,nBas,nC,nO,nV,nR,nS,1d0,e,ERI,rho, &
2020-01-14 14:44:01 +01:00
EcRPA(ispin),Omega(:,ispin),XpY(:,:,ispin),XmY(:,:,ispin))
2020-01-13 23:08:03 +01:00
call print_excitation('RPA ',ispin,nS,Omega(:,ispin))
endif
! Triplet manifold
if(triplet_manifold) then
ispin = 2
2020-01-14 16:36:11 +01:00
call linear_response(ispin,.true.,.false.,.false.,nBas,nC,nO,nV,nR,nS,1d0,e,ERI,rho, &
2020-01-14 14:44:01 +01:00
EcRPA(ispin),Omega(:,ispin),XpY(:,:,ispin),XmY(:,:,ispin))
2020-01-13 23:08:03 +01:00
call print_excitation('RPA ',ispin,nS,Omega(:,ispin))
endif
write(*,*)
write(*,*)'-------------------------------------------------------------------------------'
2020-01-14 16:36:11 +01:00
write(*,'(2X,A40,F15.6)') 'Tr@RPA correlation energy (singlet) =',EcRPA(1)
write(*,'(2X,A40,F15.6)') 'Tr@RPA correlation energy (triplet) =',EcRPA(2)
write(*,'(2X,A40,F15.6)') 'Tr@RPA correlation energy =',EcRPA(1) + EcRPA(2)
write(*,'(2X,A40,F15.6)') 'Tr@RPA total energy =',ENuc + ERHF + EcRPA(1) + EcRPA(2)
2020-01-13 23:08:03 +01:00
write(*,*)'-------------------------------------------------------------------------------'
write(*,*)
2020-01-14 16:36:11 +01:00
! Compute the correlation energy via the adiabatic connection
2020-01-13 23:08:03 +01:00
2020-01-14 16:36:11 +01:00
adiabatic_connection = .true.
2020-01-13 23:08:03 +01:00
2020-01-14 16:36:11 +01:00
if(adiabatic_connection) then
2020-01-13 23:08:03 +01:00
2020-01-14 16:36:11 +01:00
write(*,*) '------------------------------------------------------'
write(*,*) 'Adiabatic connection version of RPA correlation energy'
write(*,*) '------------------------------------------------------'
write(*,*)
2020-01-13 23:08:03 +01:00
2020-01-14 19:53:52 +01:00
call ACFDT(.false.,.true.,.false.,.false.,singlet_manifold,triplet_manifold, &
2020-01-14 16:36:11 +01:00
nBas,nC,nO,nV,nR,nS,ERI,e,Omega,XpY,XmY,rho)
2020-01-13 23:08:03 +01:00
2020-01-14 16:36:11 +01:00
end if
2020-01-13 23:08:03 +01:00
end subroutine RPA