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

146 lines
4.6 KiB
Fortran
Raw Normal View History

2022-08-17 15:52:13 +02:00
subroutine ppRPA(TDA,doACFDT,singlet,triplet,nBas,nC,nO,nV,nR,ENuc,ERHF,ERI,dipole_int,e)
2019-10-05 23:09:20 +02:00
! Perform pp-RPA calculation
implicit none
include 'parameters.h'
! Input variables
2021-10-18 22:05:26 +02:00
logical,intent(in) :: TDA
2021-11-10 22:41:40 +01:00
logical,intent(in) :: doACFDT
2021-10-18 22:05:26 +02:00
logical,intent(in) :: singlet
logical,intent(in) :: triplet
2019-10-05 23:09:20 +02:00
integer,intent(in) :: nBas
integer,intent(in) :: nC
integer,intent(in) :: nO
integer,intent(in) :: nV
integer,intent(in) :: nR
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)
2022-08-17 15:52:13 +02:00
double precision,intent(in) :: dipole_int(nBas,nBas,ncart)
2019-10-05 23:09:20 +02:00
! Local variables
integer :: ispin
2021-11-10 22:41:40 +01:00
integer :: nS
2022-08-17 15:52:13 +02:00
integer :: nOO
integer :: nVV
double precision,allocatable :: Omega1(:)
double precision,allocatable :: X1(:,:)
double precision,allocatable :: Y1(:,:)
double precision,allocatable :: Omega2(:)
double precision,allocatable :: X2(:,:)
double precision,allocatable :: Y2(:,:)
2019-10-05 23:09:20 +02:00
double precision :: Ec_ppRPA(nspin)
2021-11-10 22:41:40 +01:00
double precision :: EcAC(nspin)
2019-10-05 23:09:20 +02:00
! Hello world
write(*,*)
2019-10-05 23:32:17 +02:00
write(*,*)'****************************************'
write(*,*)'| particle-particle RPA calculation |'
write(*,*)'****************************************'
2019-10-05 23:09:20 +02:00
write(*,*)
! Initialization
Ec_ppRPA(:) = 0d0
2022-09-09 21:48:50 +02:00
EcAC(:) = 0d0
2019-10-05 23:09:20 +02:00
2021-11-10 22:41:40 +01:00
! Useful quantities
2019-10-05 23:09:20 +02:00
2022-09-09 21:48:50 +02:00
nS = nO*nV
2019-10-05 23:09:20 +02:00
2022-08-17 15:52:13 +02:00
! Singlet manifold
2019-10-05 23:09:20 +02:00
2022-08-17 15:52:13 +02:00
if(singlet) then
2019-10-07 22:31:45 +02:00
2022-09-09 21:48:50 +02:00
write(*,*) '****************'
write(*,*) '*** Singlets ***'
write(*,*) '****************'
write(*,*)
2022-08-17 15:52:13 +02:00
ispin = 1
2019-10-07 22:31:45 +02:00
2022-08-17 15:52:13 +02:00
nOO = nO*(nO+1)/2
nVV = nV*(nV+1)/2
2021-11-10 22:41:40 +01:00
2022-08-17 15:52:13 +02:00
allocate(Omega1(nVV),X1(nVV,nVV),Y1(nOO,nVV),Omega2(nOO),X2(nVV,nOO),Y2(nOO,nOO))
2021-11-10 22:41:40 +01:00
2022-08-17 15:52:13 +02:00
call linear_response_pp(ispin,TDA,nBas,nC,nO,nV,nR,nOO,nVV,1d0,e,ERI, &
Omega1,X1,Y1,Omega2,X2,Y2,Ec_ppRPA(ispin))
2019-10-07 22:31:45 +02:00
2022-09-27 14:07:31 +02:00
! call print_transition_vectors_pp(.true.,nBas,nC,nO,nV,nR,nOO,nVV,dipole_int,Omega1,X1,Y1,Omega2,X2,Y2)
2019-10-07 22:31:45 +02:00
2022-09-27 14:07:31 +02:00
call print_excitation('pp-BSE (N+2)',ispin,nVV,Omega1)
call print_excitation('pp-BSE (N-2)',ispin,nOO,Omega2)
2022-09-09 21:48:50 +02:00
2022-08-17 15:52:13 +02:00
deallocate(Omega1,X1,Y1,Omega2,X2,Y2)
2019-10-07 22:31:45 +02:00
2019-10-05 23:09:20 +02:00
endif
! Triplet manifold
2021-10-18 22:05:26 +02:00
if(triplet) then
2019-10-05 23:09:20 +02:00
2022-09-09 21:48:50 +02:00
write(*,*) '****************'
write(*,*) '*** Triplets ***'
write(*,*) '****************'
write(*,*)
2019-10-05 23:09:20 +02:00
ispin = 2
2022-08-17 15:52:13 +02:00
nOO = nO*(nO-1)/2
nVV = nV*(nV-1)/2
allocate(Omega1(nVV),X1(nVV,nVV),Y1(nOO,nVV),Omega2(nOO),X2(nVV,nOO),Y2(nOO,nOO))
call linear_response_pp(ispin,TDA,nBas,nC,nO,nV,nR,nOO,nVV,1d0,e,ERI, &
Omega1,X1,Y1,Omega2,X2,Y2,Ec_ppRPA(ispin))
2022-09-27 14:07:31 +02:00
! call print_transition_vectors_pp(.false.,nBas,nC,nO,nV,nR,nOO,nVV,dipole_int,Omega1,X1,Y1,Omega2,X2,Y2)
2019-10-07 22:31:45 +02:00
2022-09-27 14:07:31 +02:00
call print_excitation('pp-BSE (N+2)',ispin,nVV,Omega1)
call print_excitation('pp-BSE (N-2)',ispin,nOO,Omega2)
2022-09-09 21:48:50 +02:00
2022-08-17 15:52:13 +02:00
deallocate(Omega1,X1,Y1,Omega2,X2,Y2)
2019-10-07 22:31:45 +02:00
2019-10-05 23:09:20 +02:00
endif
write(*,*)
write(*,*)'-------------------------------------------------------------------------------'
2020-03-21 22:50:43 +01:00
write(*,'(2X,A50,F20.10)') 'Tr@ppRPA correlation energy (singlet) =',Ec_ppRPA(1)
write(*,'(2X,A50,F20.10)') 'Tr@ppRPA correlation energy (triplet) =',3d0*Ec_ppRPA(2)
write(*,'(2X,A50,F20.10)') 'Tr@ppRPA correlation energy =',Ec_ppRPA(1) + 3d0*Ec_ppRPA(2)
write(*,'(2X,A50,F20.10)') 'Tr@ppRPA total energy =',ENuc + ERHF + Ec_ppRPA(1) + 3d0*Ec_ppRPA(2)
2019-10-05 23:09:20 +02:00
write(*,*)'-------------------------------------------------------------------------------'
write(*,*)
2021-11-10 22:41:40 +01:00
! Compute the correlation energy via the adiabatic connection
if(doACFDT) then
write(*,*) '---------------------------------------------------------'
write(*,*) 'Adiabatic connection version of pp-RPA correlation energy'
write(*,*) '---------------------------------------------------------'
write(*,*)
2021-11-18 13:34:08 +01:00
call ACFDT_pp(TDA,singlet,triplet,nBas,nC,nO,nV,nR,nS,ERI,e,EcAC)
2021-11-10 22:41:40 +01:00
write(*,*)
write(*,*)'-------------------------------------------------------------------------------'
write(*,'(2X,A50,F20.10,A3)') 'AC@ppRPA correlation energy (singlet) =',EcAC(1),' au'
write(*,'(2X,A50,F20.10,A3)') 'AC@ppRPA correlation energy (triplet) =',EcAC(2),' au'
write(*,'(2X,A50,F20.10,A3)') 'AC@ppRPA correlation energy =',EcAC(1) + EcAC(2),' au'
write(*,'(2X,A50,F20.10,A3)') 'AC@ppRPA total energy =',ENuc + ERHF + EcAC(1) + EcAC(2),' au'
write(*,*)'-------------------------------------------------------------------------------'
write(*,*)
end if
2019-10-05 23:09:20 +02:00
end subroutine ppRPA