10
1
mirror of https://github.com/pfloos/quack synced 2024-11-03 20:53:53 +01:00

remove XBSE

This commit is contained in:
Pierre-Francois Loos 2023-07-19 11:40:22 +02:00
parent ac0b9336df
commit ba40c9bdb8
5 changed files with 1 additions and 579 deletions

View File

@ -357,4 +357,4 @@ subroutine SRG_qsGW(maxSCF,thresh,max_diis,doACFDT,exchange_kernel,doXBS,BSE,BSE
end if end if
end subroutine SRG_qsGW end subroutine

View File

@ -1,132 +0,0 @@
subroutine XBSE(TDA_W,TDA,dBSE,dTDA,singlet,triplet,eta,nBas,nC,nO,nV,nR,nS,ERI,dipole_int,eW,eGW,EcBSE)
! Compute the Bethe-Salpeter excitation energies
implicit none
include 'parameters.h'
! Input variables
logical,intent(in) :: TDA_W
logical,intent(in) :: TDA
logical,intent(in) :: dBSE
logical,intent(in) :: dTDA
logical,intent(in) :: singlet
logical,intent(in) :: triplet
double precision,intent(in) :: eta
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) :: eW(nBas)
double precision,intent(in) :: eGW(nBas)
double precision,intent(in) :: ERI(nBas,nBas,nBas,nBas)
double precision,intent(in) :: dipole_int(nBas,nBas,ncart)
! Local variables
integer :: ispin
integer :: isp_W
double precision :: EcRPA
double precision,allocatable :: OmRPA(:)
double precision,allocatable :: XpY_RPA(:,:)
double precision,allocatable :: XmY_RPA(:,:)
double precision,allocatable :: rho_RPA(:,:,:)
double precision,allocatable :: OmBSE(:)
double precision,allocatable :: XpY_BSE(:,:)
double precision,allocatable :: XmY_BSE(:,:)
double precision,allocatable :: KA_sta(:,:)
double precision,allocatable :: KB_sta(:,:)
double precision,allocatable :: W(:,:,:,:)
double precision,allocatable :: KA2_sta(:,:)
! Output variables
double precision,intent(out) :: EcBSE(nspin)
! Memory allocation
allocate(OmRPA(nS),XpY_RPA(nS,nS),XmY_RPA(nS,nS),rho_RPA(nBas,nBas,nS),KA_sta(nS,nS), &
KB_sta(nS,nS),KA2_sta(nS,nS),OmBSE(nS),XpY_BSE(nS,nS),XmY_BSE(nS,nS))
KA2_sta(:,:) = 0d0
!---------------------------------
! Compute (singlet) RPA screening
!---------------------------------
isp_W = 1
EcRPA = 0d0
call phLR(isp_W,.true.,TDA_W,eta,nBas,nC,nO,nV,nR,nS,1d0,eW,ERI,EcRPA,OmRPA,XpY_RPA,XmY_RPA)
call GW_excitation_density(nBas,nC,nO,nR,nS,ERI,XpY_RPA,rho_RPA)
call XBSE_static_kernel_KA(eta,nBas,nC,nO,nV,nR,nS,1d0,ERI,OmRPA,rho_RPA,KA_sta,eW,eGW)
call XBSE_static_kernel_KB(eta,nBas,nC,nO,nV,nR,nS,1d0,ERI,OmRPA,rho_RPA,KB_sta,eW)
!-------------------
! Singlet manifold
!-------------------
if(singlet) then
ispin = 1
EcBSE(ispin) = 0d0
! Compute BSE excitation energies
call linear_response_BSE(ispin,.true.,TDA,.true.,eta,nBas,nC,nO,nV,nR,nS,1d0,eW,ERI,KA_sta,KB_sta,EcBSE(ispin), &
OmBSE,XpY_BSE,XmY_BSE)
call print_excitation('BSE@GW ',ispin,nS,OmBSE)
call print_transition_vectors_ph(.true.,nBas,nC,nO,nV,nR,nS,dipole_int,OmBSE,XpY_BSE,XmY_BSE)
!-------------------------------------------------
! Compute the dynamical screening at the BSE level
!-------------------------------------------------
if(dBSE) then
call Bethe_Salpeter_dynamic_perturbation(.false.,dTDA,eta,nBas,nC,nO,nV,nR,nS,eW,eW,dipole_int,OmRPA,rho_RPA, &
OmBSE,XpY_BSE,XmY_BSE,W,KA2_sta)
end if
end if
!-------------------
! Triplet manifold
!-------------------
if(triplet) then
ispin = 2
EcBSE(ispin) = 0d0
! Compute BSE excitation energies
call linear_response_BSE(ispin,.true.,TDA,.true.,eta,nBas,nC,nO,nV,nR,nS,1d0,eW,ERI,KA_sta,KB_sta,EcBSE,OmBSE,XpY_BSE,XmY_BSE)
call print_excitation('BSE@GW ',ispin,nS,OmBSE)
call print_transition_vectors_ph(.false.,nBas,nC,nO,nV,nR,nS,dipole_int,OmBSE,XpY_BSE,XmY_BSE)
!-------------------------------------------------
! Compute the dynamical screening at the BSE level
!-------------------------------------------------
if(dBSE) then
! Compute dynamic correction for BSE via perturbation theory (iterative or renormalized)
call Bethe_Salpeter_dynamic_perturbation(.false.,dTDA,eta,nBas,nC,nO,nV,nR,nS,eW,eW,dipole_int,OmRPA,rho_RPA, &
OmBSE,XpY_BSE,XmY_BSE,W,KA2_sta)
end if
end if
end subroutine

View File

@ -1,119 +0,0 @@
subroutine XBSE_static_kernel_KA(eta,nBas,nC,nO,nV,nR,nS,lambda,ERI,Om,rho,WA,eW,eGW)
! Compute the BSE static kernel for the resonant block
implicit none
include 'parameters.h'
! Input variables
integer,intent(in) :: nBas,nC,nO,nV,nR,nS
double precision,intent(in) :: eta
double precision,intent(in) :: lambda
double precision,intent(in) :: ERI(nBas,nBas,nBas,nBas)
double precision,intent(in) :: Om(nS)
double precision,intent(in) :: rho(nBas,nBas,nS)
double precision,intent(in) :: eW(nBas)
double precision,intent(in) :: eGW(nBas)
! Local variables
double precision :: chi
double precision :: eps
double precision :: num,den,ei,ea
integer :: i,j,k,a,b,c,ia,jb,m
double precision,external :: Kronecker_delta
! Output variables
double precision,intent(out) :: WA(nS,nS)
! Initialize
WA(:,:) = 0d0
ia = 0
do i=nC+1,nO
do a=nO+1,nBas-nR
ia = ia + 1
jb = 0
do j=nC+1,nO
do b=nO+1,nBas-nR
jb = jb + 1
! virtual quasiparticle term
ea = 0d0
do m=1,nS
do k=nC+1,nO
num = 1d0*rho(a,k,m)*rho(b,k,m)
den = eW(a) - eW(k) + Om(m)
ea = ea + Kronecker_delta(i,j)*num*den/(den**2+eta**2)
den = eW(b) - eW(k) + Om(m)
ea = ea + Kronecker_delta(i,j)*num*den/(den**2+eta**2)
end do
do c=nO+1,nBas-nR
num = 1d0*rho(a,c,m)*rho(b,c,m)
den = eW(a) - eW(c) - Om(m)
ea = ea + Kronecker_delta(i,j)*num*den/(den**2+eta**2)
den = eW(b) - eW(c) - Om(m)
ea = ea + Kronecker_delta(i,j)*num*den/(den**2+eta**2)
end do
end do
! occupied quasiparticle term
ei = 0d0
do m=1,nS
do k=nC+1,nO
num = 1d0*rho(i,k,m)*rho(j,k,m)
den = eW(i) - eW(k) + Om(m)
ei = ei + Kronecker_delta(a,b)*num*den/(den**2+eta**2)
den = eW(j) - eW(k) + Om(m)
ei = ei + Kronecker_delta(a,b)*num*den/(den**2+eta**2)
end do
do c=nO+1,nBas-nR
num = 1d0*rho(i,c,m)*rho(j,c,m)
den = eW(i) - eW(c) - Om(m)
ei = ei + Kronecker_delta(a,b)*num*den/(den**2+eta**2)
den = eW(j) - eW(c) - Om(m)
ei = ei + Kronecker_delta(a,b)*num*den/(den**2+eta**2)
end do
end do
! kernel term
chi = 0d0
do m=1,nS
eps = Om(m)**2 + eta**2
chi = chi + rho(i,j,m)*rho(a,b,m)*Om(m)/eps!&
! - rho(i,b,m)*rho(a,j,m)*Om(m)/eps
enddo
! WA(ia,jb) = WA(ia,jb) + lambda*ERI(i,b,j,a) - 4d0*lambda*chi &
! - (eGW(a) - eW(a))*Kronecker_delta(i,j)*Kronecker_delta(a,b) &
! + (eGW(i) - eW(i))*Kronecker_delta(i,j)*Kronecker_delta(a,b)
WA(ia,jb) = WA(ia,jb) - ea + ei + lambda*ERI(i,b,j,a) - 4d0*lambda*chi
enddo
enddo
enddo
enddo
end subroutine

View File

@ -1,59 +0,0 @@
subroutine XBSE_static_kernel_KB(eta,nBas,nC,nO,nV,nR,nS,lambda,ERI,Omega,rho,KB)
! Compute the BSE static kernel for the coupling block
implicit none
include 'parameters.h'
! Input variables
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) :: eta
double precision,intent(in) :: lambda
double precision,intent(in) :: ERI(nBas,nBas,nBas,nBas)
double precision,intent(in) :: Omega(nS)
double precision,intent(in) :: rho(nBas,nBas,nS)
! Local variables
double precision :: chi
double precision :: eps
integer :: i,j,a,b,ia,jb,kc
! Output variables
double precision,intent(out) :: KB(nS,nS)
! Initialize
KB(:,:) = 0d0
ia = 0
do i=nC+1,nO
do a=nO+1,nBas-nR
ia = ia + 1
jb = 0
do j=nC+1,nO
do b=nO+1,nBas-nR
jb = jb + 1
chi = 0d0
do kc=1,nS
eps = Omega(kc)**2 + eta**2
chi = chi + rho(i,b,kc)*rho(a,j,kc)*Omega(kc)/eps &
- rho(i,a,kc)*rho(j,b,kc)*Omega(kc)/eps
enddo
KB(ia,jb) = KB(ia,jb) + lambda*ERI(i,j,b,a) - 4d0*lambda*chi
enddo
enddo
enddo
enddo
end subroutine

View File

@ -1,268 +0,0 @@
subroutine ufXBSE(nBas,nC,nO,nV,nR,nS,ENuc,ERHF,ERI,eHF,OmRPA,sERI)
! Unfolded BSE+ equations
implicit none
include 'parameters.h'
! Input variables
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) :: ERI(nBas,nBas,nBas,nBas)
double precision,intent(in) :: eHF(nBas)
double precision,intent(in) :: OmRPA(nS)
double precision,intent(in) :: sERI(nBas,nBas,nS)
! Local variables
integer :: s
integer :: i,j,k,l
integer :: a,b,c,d
integer :: ia,jb,kc,iajb,kcld
integer,parameter :: maxH = 20
double precision :: eps1,eps2
double precision :: Ve,Vh,C2h2p
integer :: n1h1p,n2h2p,nH
double precision,external :: Kronecker_delta
double precision,allocatable :: H(:,:)
double precision,allocatable :: X(:,:)
double precision,allocatable :: Om(:)
double precision,allocatable :: Z(:)
! Output variables
! Hello world
write(*,*)
write(*,*)'**********************************************'
write(*,*)'| Unfolded BSE+ calculation |'
write(*,*)'**********************************************'
write(*,*)
! TDA for W
write(*,*) 'Tamm-Dancoff approximation by default!'
write(*,*)
! Dimension of the supermatrix
n1h1p = nO*nV
n2h2p = nO*nO*nV*nV
nH = n1h1p + n2h2p
! Memory allocation
allocate(H(nH,nH),X(nH,nH),Om(nH),Z(nH))
! Initialization
H(:,:) = 0d0
!---------------------------!
! Compute BSE+ supermatrix !
!---------------------------!
! !
! | A Ve-Vh | !
! H = | | !
! | Ve-Vh C2h2p | !
! !
!---------------------------!
!---------!
! Block A !
!---------!
ia = 0
do i=nC+1,nO
do a=nO+1,nBas-nR
ia = ia + 1
jb = 0
do j=nC+1,nO
do b=nO+1,nBas-nR
jb = jb + 1
H(ia,jb) = (eHF(a) - eHF(i))*Kronecker_delta(i,j)*Kronecker_delta(a,b) &
+ 2d0*ERI(i,b,a,j) - ERI(i,b,j,a)
do kc=1,nS
do l=nC+1,nO
eps1 = 1d0/(eHF(a) - eHF(l) + OmRPA(kc))
eps2 = 1d0/(eHF(b) - eHF(l) + OmRPA(kc))
H(ia,jb) = H(ia,jb) + Kronecker_delta(i,j)*sERI(a,l,kc)*sERI(b,l,kc)*(eps1+eps2)
enddo
do d=nO+1,nBas-nR
eps1 = 1d0/(- eHF(i) + eHF(d) + OmRPA(kc))
eps2 = 1d0/(- eHF(j) + eHF(d) + OmRPA(kc))
H(ia,jb) = H(ia,jb) + Kronecker_delta(a,b)*sERI(i,d,kc)*sERI(j,d,kc)*(eps1+eps2)
enddo
eps1 = 1d0/(eHF(a) - eHF(i) + OmRPA(kc))
eps2 = 1d0/(eHF(b) - eHF(j) + OmRPA(kc))
H(ia,jb) = H(ia,jb) - 2d0*sERI(i,a,kc)*sERI(j,b,kc)*(eps1+eps2)
end do
end do
end do
end do
end do
!----------------!
! Blocks Vp & Ve !
!----------------!
iajb=0
do i=nC+1,nO
do a=nO+1,nBas-nR
do j=nC+1,nO
do b=nO+1,nBas-nR
iajb = iajb + 1
kc = 0
do k=nC+1,nO
do c=nO+1,nBas-nR
kc = kc + 1
Ve = sqrt(2d0)*Kronecker_delta(k,j)*ERI(b,a,c,i)
Vh = sqrt(2d0)*Kronecker_delta(b,c)*ERI(a,k,i,j)
H(n1h1p+iajb,kc ) = Ve - Vh
H(kc ,n1h1p+iajb) = Ve - Vh
end do
end do
end do
end do
end do
end do
! iajb=0
! ia = 0
! do i=nC+1,nO
! do a=nO+1,nBas-nR
! ia = ia + 1
! do j=nC+1,nO
! do b=nO+1,nBas-nR
! iajb = iajb + 1
! kc = 0
! do k=nC+1,nO
! do c=nO+1,nBas-nR
! kc = kc + 1
! Ve = sqrt(2d0)*Kronecker_delta(k,j)*sERI(b,c,ia)
! Vh = sqrt(2d0)*Kronecker_delta(b,c)*sERI(k,j,ia)
! H(n1h1p+iajb,kc ) = Ve - Vh
! H(kc ,n1h1p+iajb) = Ve - Vh
!
! end do
! end do
! end do
! end do
! end do
! end do
!-------------!
! Block 2h2p !
!-------------!
iajb = 0
do i=nC+1,nO
do a=nO+1,nBas-nR
do j=nC+1,nO
do b=nO+1,nBas-nR
iajb = iajb + 1
kcld = 0
do k=nC+1,nO
do c=nO+1,nBas-nR
do l=nC+1,nO
do d=nO+1,nBas-nR
kcld = kcld + 1
C2h2p = ((eHF(a) + eHF(b) - eHF(i) - eHF(j))*Kronecker_delta(i,k)*Kronecker_delta(a,c) &
+ 2d0*ERI(a,k,i,c))*Kronecker_delta(j,l)*Kronecker_delta(b,d)
H(n1h1p+iajb,n1h1p+kcld) = C2h2p
end do
end do
end do
end do
end do
end do
end do
end do
! iajb = 0
! ia = 0
! do i=nC+1,nO
! do a=nO+1,nBas-nR
! ia = ia + 1
! do j=nC+1,nO
! do b=nO+1,nBas-nR
! iajb = iajb + 1
! H(n1h1p+iajb,n1h1p+iajb) = Om(ia) + eHF(b) - eHF(j)
! end do
! end do
! end do
! end do
!-------------------------!
! Diagonalize supermatrix !
!-------------------------!
X(:,:) = H(:,:)
call diagonalize_matrix(nH,X,Om)
!-----------------!
! Compute weights !
!-----------------!
Z(:) = 0d0
do s=1,nH
do ia=1,n1h1p
Z(s) = Z(s) + X(ia,s)**2
end do
end do
!--------------!
! Dump results !
!--------------!
write(*,*)'-------------------------------------------'
write(*,*)' BSE+ excitation energies (eV) '
write(*,*)'-------------------------------------------'
write(*,'(1X,A1,1X,A3,1X,A1,1X,A15,1X,A1,1X,A15,1X,A1,1X,A15,1X)') &
'|','#','|','Omega (eV)','|','Z','|'
write(*,*)'-------------------------------------------'
do s=1,min(nH,maxH)
if(Z(s) > 1d-7) &
write(*,'(1X,A1,1X,I3,1X,A1,1X,F15.6,1X,A1,1X,F15.6,1X,A1,1X)') &
'|',s,'|',Om(s)*HaToeV,'|',Z(s),'|'
enddo
write(*,*)'-------------------------------------------'
write(*,*)
end subroutine