4
1
mirror of https://github.com/pfloos/quack synced 2024-06-19 03:36:42 +02:00
quack/src/RPA/ppRPA.f90

115 lines
3.5 KiB
Fortran
Raw Normal View History

2020-03-21 16:31:39 +01:00
subroutine ppRPA(singlet_manifold,triplet_manifold,nBas,nC,nO,nV,nR,ENuc,ERHF,ERI,e)
2019-10-05 23:09:20 +02:00
! Perform pp-RPA calculation
implicit none
include 'parameters.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
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
2019-10-06 22:35:36 +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)
! 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
! Singlet manifold
if(singlet_manifold) then
ispin = 1
2019-10-14 23:11:29 +02:00
! Useful quantities
2019-10-07 22:31:45 +02:00
nOO = nO*(nO+1)/2
nVV = nV*(nV+1)/2
! Memory allocation
allocate(Omega1(nVV,nspin),X1(nVV,nVV,nspin),Y1(nOO,nVV,nspin), &
Omega2(nOO,nspin),X2(nVV,nOO,nspin),Y2(nOO,nOO,nspin))
2020-03-21 16:31:39 +01:00
call linear_response_pp(ispin,.false.,.false.,nBas,nC,nO,nV,nR,nOO,nVV,e,ERI, &
2020-01-14 19:53:52 +01:00
Omega1(:,ispin),X1(:,:,ispin),Y1(:,:,ispin), &
Omega2(:,ispin),X2(:,:,ispin),Y2(:,:,ispin), &
2019-10-06 22:35:36 +02:00
Ec_ppRPA(ispin))
2019-10-07 22:31:45 +02:00
2019-10-06 22:35:36 +02:00
call print_excitation('pp-RPA (N+2)',ispin,nVV,Omega1(:,ispin))
call print_excitation('pp-RPA (N-2)',ispin,nOO,Omega2(:,ispin))
2019-10-05 23:09:20 +02:00
2019-10-07 22:31:45 +02:00
deallocate(Omega1,X1,Y1,Omega2,X2,Y2)
2019-10-05 23:09:20 +02:00
endif
! Triplet manifold
if(triplet_manifold) then
ispin = 2
2019-10-14 23:11:29 +02:00
! Useful quantities
2019-10-07 22:31:45 +02:00
nOO = nO*(nO-1)/2
nVV = nV*(nV-1)/2
! Memory allocation
allocate(Omega1(nVV,nspin),X1(nVV,nVV,nspin),Y1(nOO,nVV,nspin), &
Omega2(nOO,nspin),X2(nVV,nOO,nspin),Y2(nOO,nOO,nspin))
2020-03-21 16:31:39 +01:00
call linear_response_pp(ispin,.false.,.false.,nBas,nC,nO,nV,nR,nOO,nVV,e,ERI, &
Omega1(:,ispin),X1(:,:,ispin),Y1(:,:,ispin), &
Omega2(:,ispin),X2(:,:,ispin),Y2(:,:,ispin), &
2019-10-06 22:35:36 +02:00
Ec_ppRPA(ispin))
2019-10-07 22:31:45 +02:00
2019-10-06 22:35:36 +02:00
call print_excitation('pp-RPA (N+2)',ispin,nVV,Omega1(:,ispin))
call print_excitation('pp-RPA (N-2)',ispin,nOO,Omega2(:,ispin))
2019-10-05 23:09:20 +02:00
2019-10-07 22:31:45 +02:00
deallocate(Omega1,X1,Y1,Omega2,X2,Y2)
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(*,*)
end subroutine ppRPA