4
1
mirror of https://github.com/pfloos/quack synced 2024-11-06 22:24:03 +01:00
This commit is contained in:
Pierre-Francois Loos 2022-01-17 08:02:11 +01:00
parent 23c7dfdf08
commit 16431bcd33
10 changed files with 170 additions and 125 deletions

View File

@ -13,9 +13,9 @@
# G0F2* evGF2* qsGF2* G0F3 evGF3
F F F F F
# G0W0* evGW* qsGW* ufG0W0 ufGW
F F F F F
F F F T F
# G0T0 evGT qsGT
T F F
F F F
# MCMP2
F
# * unrestricted version available

View File

@ -1,4 +1,4 @@
2
H 0. 0. 0.
H 0. 0. 0.7
H 0. 0. 1.500000

View File

@ -131,6 +131,25 @@ subroutine Bethe_Salpeter_Tmatrix(TDA_T,TDA,dBSE,dTDA,evDyn,singlet,triplet,eta,
call print_transition_vectors(.true.,nBas,nC,nO,nV,nR,nS,dipole_int, &
OmBSE(:,ispin),XpY_BSE(:,:,ispin),XmY_BSE(:,:,ispin))
if(dBSE) then
! Compute dynamic correction for BSE via perturbation theory (iterative or renormalized)
if(evDyn) then
print*, ' Iterative dynamical correction for BSE@GT NYI'
! call Bethe_Salpeter_dynamic_perturbation_iterative(dTDA,eta,nBas,nC,nO,nV,nR,nS,eGW,dipole_int,OmRPA,rho_RPA, &
! OmBSE(:,ispin),XpY_BSE(:,:,ispin),XmY_BSE(:,:,ispin))
else
call Bethe_Salpeter_Tmatrix_dynamic_perturbation(ispin,dTDA,eta,nBas,nC,nO,nV,nR,nS,nOOs,nVVs,nOOt,nVVt, &
Omega1s,Omega2s,Omega1t,Omega2t,rho1s,rho2s,rho1t,rho2t,eT,eGT, &
dipole_int,OmBSE(:,ispin),XpY_BSE(:,:,ispin),XmY_BSE(:,:,ispin), &
TAs,TBs,TAt,TBt)
end if
end if
end if
!------------------!
@ -150,12 +169,6 @@ subroutine Bethe_Salpeter_Tmatrix(TDA_T,TDA,dBSE,dTDA,evDyn,singlet,triplet,eta,
call print_transition_vectors(.false.,nBas,nC,nO,nV,nR,nS,dipole_int, &
OmBSE(:,ispin),XpY_BSE(:,:,ispin),XmY_BSE(:,:,ispin))
end if
!--------------------------------------------------!
! Compute the dynamical screening at the BSE level !
!--------------------------------------------------!
if(dBSE) then
! Compute dynamic correction for BSE via perturbation theory (iterative or renormalized)
@ -167,9 +180,12 @@ subroutine Bethe_Salpeter_Tmatrix(TDA_T,TDA,dBSE,dTDA,evDyn,singlet,triplet,eta,
! OmBSE(:,ispin),XpY_BSE(:,:,ispin),XmY_BSE(:,:,ispin))
else
call Bethe_Salpeter_Tmatrix_dynamic_perturbation(singlet,triplet,dTDA,eta,nBas,nC,nO,nV,nR,nS,nOOs,nVVs,nOOt,nVVt, &
call Bethe_Salpeter_Tmatrix_dynamic_perturbation(ispin,dTDA,eta,nBas,nC,nO,nV,nR,nS,nOOs,nVVs,nOOt,nVVt, &
Omega1s,Omega2s,Omega1t,Omega2t,rho1s,rho2s,rho1t,rho2t,eT,eGT, &
dipole_int,OmBSE,XpY_BSE,XmY_BSE,TAs,TBs,TAt,TBt)
dipole_int,OmBSE(:,ispin),XpY_BSE(:,:,ispin),XmY_BSE(:,:,ispin), &
TAs,TBs,TAt,TBt)
end if
end if
end if

View File

@ -1,4 +1,4 @@
subroutine Bethe_Salpeter_Tmatrix_dynamic_perturbation(singlet,triplet,dTDA,eta,nBas,nC,nO,nV,nR,nS,nOOs,nVVs,nOOt,nVVt, &
subroutine Bethe_Salpeter_Tmatrix_dynamic_perturbation(ispin,dTDA,eta,nBas,nC,nO,nV,nR,nS,nOOs,nVVs,nOOt,nVVt, &
Omega1s,Omega2s,Omega1t,Omega2t,rho1s,rho2s,rho1t,rho2t,eT,eGT, &
dipole_int,OmBSE,XpY,XmY,TAs,TBs,TAt,TBt)
@ -9,8 +9,7 @@ subroutine Bethe_Salpeter_Tmatrix_dynamic_perturbation(singlet,triplet,dTDA,eta,
! Input variables
logical,intent(in) :: singlet
logical,intent(in) :: triplet
integer,intent(in) :: ispin
logical,intent(in) :: dTDA
double precision,intent(in) :: eta
integer,intent(in) :: nBas
@ -28,9 +27,9 @@ subroutine Bethe_Salpeter_Tmatrix_dynamic_perturbation(singlet,triplet,dTDA,eta,
double precision,intent(in) :: eT(nBas)
double precision,intent(in) :: eGT(nBas)
double precision,intent(in) :: dipole_int(nBas,nBas,ncart)
double precision,intent(in) :: OmBSE(nS,nspin)
double precision,intent(in) :: XpY(nS,nS,nspin)
double precision,intent(in) :: XmY(nS,nS,nspin)
double precision,intent(in) :: OmBSE(nS)
double precision,intent(in) :: XpY(nS,nS)
double precision,intent(in) :: XmY(nS,nS)
double precision,intent(in) :: Omega1s(nVVs)
double precision,intent(in) :: Omega2s(nOOs)
@ -49,13 +48,12 @@ subroutine Bethe_Salpeter_Tmatrix_dynamic_perturbation(singlet,triplet,dTDA,eta,
! Local variables
integer :: ia
integer :: ispin
integer :: maxS = 10
double precision :: gapGT
double precision,allocatable :: OmDyn(:,:)
double precision,allocatable :: ZDyn(:,:)
double precision,allocatable :: OmDyn(:)
double precision,allocatable :: ZDyn(:)
double precision,allocatable :: X(:)
double precision,allocatable :: Y(:)
@ -68,7 +66,7 @@ subroutine Bethe_Salpeter_Tmatrix_dynamic_perturbation(singlet,triplet,dTDA,eta,
! Memory allocation
maxS = min(nS,maxS)
allocate(OmDyn(maxS,nspin),ZDyn(maxS,nspin),X(nS),Y(nS),dTAs(nS,nS),ZAs(nS,nS),dTAt(nS,nS),ZAt(nS,nS))
allocate(OmDyn(maxS),ZDyn(maxS),X(nS),Y(nS),dTAs(nS,nS),ZAs(nS,nS),dTAt(nS,nS),ZAt(nS,nS))
if(dTDA) then
write(*,*)
@ -79,42 +77,36 @@ subroutine Bethe_Salpeter_Tmatrix_dynamic_perturbation(singlet,triplet,dTDA,eta,
return
end if
OmDyn(:,:) = 0d0
ZDyn(:,:) = 0d0
OmDyn(:) = 0d0
ZDyn(:) = 0d0
do ia=1,maxS
! Compute dynamical T-matrix for alpha-beta block !
! Compute dynamical T-matrix for alpha-beta block
ispin = 1
call dynamic_Tmatrix_A(eta,nBas,nC,nO,nV,nR,nS,nOOs,nVVs,1d0,eGT,Omega1s,Omega2s,rho1s,rho2s,OmBSE(ia,ispin),dTAs,ZAs)
call dynamic_Tmatrix_A(eta,nBas,nC,nO,nV,nR,nS,nOOs,nVVs,1d0,eGT,Omega1s,Omega2s,rho1s,rho2s,OmBSE(ia),dTAs,ZAs)
! Compute dynamical T-matrix for alpha-beta block !
! Compute dynamical T-matrix for alpha-beta block
ispin = 2
call dynamic_Tmatrix_A(eta,nBas,nC,nO,nV,nR,nS,nOOt,nVVt,1d0,eGT,Omega1t,Omega2t,rho1t,rho2t,OmBSE(ia,ispin),dTAt,ZAt)
call dynamic_Tmatrix_A(eta,nBas,nC,nO,nV,nR,nS,nOOt,nVVt,1d0,eGT,Omega1t,Omega2t,rho1t,rho2t,OmBSE(ia),dTAt,ZAt)
do ispin=1,nspin
X(:) = 0.5d0*(XpY(ia,:,ispin) + XmY(ia,:,ispin))
Y(:) = 0.5d0*(XpY(ia,:,ispin) - XmY(ia,:,ispin))
X(:) = 0.5d0*(XpY(ia,:) + XmY(ia,:))
Y(:) = 0.5d0*(XpY(ia,:) - XmY(ia,:))
! First-order correction
if(ispin == 1) then
ZDyn(ia,ispin) = dot_product(X,matmul(ZAt+ZAs,X))
OmDyn(ia,ispin) = dot_product(X,matmul(dTAt+dTAs,X)) - dot_product(X,matmul(TAt+TAs,X))
ZDyn(ia) = dot_product(X,matmul(ZAt+ZAs,X))
OmDyn(ia) = dot_product(X,matmul(dTAt+dTAs,X)) - dot_product(X,matmul(TAt+TAs,X))
end if
if(ispin == 2) then
ZDyn(ia,ispin) = dot_product(X,matmul(ZAt-ZAs,X))
OmDyn(ia,ispin) = dot_product(X,matmul(dTAt-dTAs,X)) - dot_product(X,matmul(TAt-TAs,X))
ZDyn(ia) = dot_product(X,matmul(ZAt-ZAs,X))
OmDyn(ia) = dot_product(X,matmul(dTAt-dTAs,X)) - dot_product(X,matmul(TAt-TAs,X))
end if
ZDyn(ia,ispin) = 1d0/(1d0 - ZDyn(ia,ispin))
OmDyn(ia,ispin) = ZDyn(ia,ispin)*OmDyn(ia,ispin)
end do
ZDyn(ia) = 1d0/(1d0 - ZDyn(ia))
OmDyn(ia) = ZDyn(ia)*OmDyn(ia)
end do
@ -124,12 +116,8 @@ subroutine Bethe_Salpeter_Tmatrix_dynamic_perturbation(singlet,triplet,dTDA,eta,
gapGT = eGT(nO+1) - eGT(nO)
if(singlet) then
ispin = 1
write(*,*) '---------------------------------------------------------------------------------------------------'
write(*,*) ' First-order dynamical correction to static singlet Bethe-Salpeter excitation energies '
write(*,*) ' First-order dynamical correction to static Bethe-Salpeter excitation energies '
write(*,*) '---------------------------------------------------------------------------------------------------'
write(*,'(A57,F10.6,A3)') ' BSE neutral excitation must be lower than the GT gap = ',gapGT*HaToeV,' eV'
write(*,*) '---------------------------------------------------------------------------------------------------'
@ -138,34 +126,10 @@ subroutine Bethe_Salpeter_Tmatrix_dynamic_perturbation(singlet,triplet,dTDA,eta,
do ia=1,maxS
write(*,'(2X,I5,5X,F15.6,5X,F15.6,5X,F15.6,5X,F15.6)') &
ia,OmBSE(ia,ispin)*HaToeV,(OmBSE(ia,ispin)+OmDyn(ia,ispin))*HaToeV,OmDyn(ia,ispin)*HaToeV,ZDyn(ia,ispin)
ia,OmBSE(ia)*HaToeV,(OmBSE(ia)+OmDyn(ia))*HaToeV,OmDyn(ia)*HaToeV,ZDyn(ia)
end do
write(*,*) '---------------------------------------------------------------------------------------------------'
write(*,*)
end if
if(triplet) then
ispin = 2
write(*,*) '---------------------------------------------------------------------------------------------------'
write(*,*) ' First-order dynamical correction to static triplet Bethe-Salpeter excitation energies '
write(*,*) '---------------------------------------------------------------------------------------------------'
write(*,'(A57,F10.6,A3)') ' BSE neutral excitation must be lower than the GT gap = ',gapGT*HaToeV,' eV'
write(*,*) '---------------------------------------------------------------------------------------------------'
write(*,'(2X,A5,1X,A20,1X,A20,1X,A20,1X,A20)') '#','Static (eV)','Dynamic (eV)','Correction (eV)','Renorm. (eV)'
write(*,*) '---------------------------------------------------------------------------------------------------'
do ia=1,maxS
write(*,'(2X,I5,5X,F15.6,5X,F15.6,5X,F15.6,5X,F15.6)') &
ia,OmBSE(ia,ispin)*HaToeV,(OmBSE(ia,ispin)+OmDyn(ia,ispin))*HaToeV,OmDyn(ia,ispin)*HaToeV,ZDyn(ia,ispin)
end do
write(*,*) '---------------------------------------------------------------------------------------------------'
write(*,*)
end if
end subroutine Bethe_Salpeter_Tmatrix_dynamic_perturbation

View File

@ -75,10 +75,10 @@ subroutine G0T0(doACFDT,exchange_kernel,doXBS,BSE,TDA_T,TDA,dBSE,dTDA,evDyn,sing
! Dimensions of the pp-RPA linear reponse matrices
! nOOs = nO*(nO + 1)/2
! nVVs = nV*(nV + 1)/2
nOOs = nO*nO
nVVs = nV*nV
! nOOs = nO*(nO + 1)/2
! nVVs = nV*(nV + 1)/2
nOOt = nO*(nO - 1)/2
nVVt = nV*(nV - 1)/2
@ -98,8 +98,8 @@ subroutine G0T0(doACFDT,exchange_kernel,doXBS,BSE,TDA_T,TDA,dBSE,dTDA,evDyn,sing
!----------------------------------------------
ispin = 1
! iblock = 1
iblock = 3
! iblock = 1
! Compute linear response
@ -137,8 +137,8 @@ subroutine G0T0(doACFDT,exchange_kernel,doXBS,BSE,TDA_T,TDA,dBSE,dTDA,evDyn,sing
SigT(:) = 0d0
Z(:) = 0d0
! iblock = 1
iblock = 3
! iblock = 1
call excitation_density_Tmatrix(iblock,nBas,nC,nO,nV,nR,nOOs,nVVs,ERI_MO,X1s,Y1s,rho1s,X2s,Y2s,rho2s)

View File

@ -59,12 +59,12 @@ subroutine dynamic_Tmatrix_A(eta,nBas,nC,nO,nV,nR,nS,nOO,nVV,lambda,eGT,Omega1,O
do cd=1,nVV
eps = + OmBSE - Omega1(cd) + (eGT(i) + eGT(j))
chi = chi + rho1(i,b,cd)*rho1(j,a,cd)*eps/(eps**2 + eta**2)
chi = chi + rho1(i,b,cd)*rho1(a,j,cd)*eps/(eps**2 + eta**2)
end do
do kl=1,nOO
eps = + OmBSE + Omega2(kl) - (eGT(a) + eGT(b))
chi = chi + rho2(i,b,kl)*rho2(j,a,kl)*eps/(eps**2 + eta**2)
chi = chi + rho2(i,b,kl)*rho2(a,j,kl)*eps/(eps**2 + eta**2)
end do
TA(ia,jb) = TA(ia,jb) + lambda*chi
@ -73,12 +73,12 @@ subroutine dynamic_Tmatrix_A(eta,nBas,nC,nO,nV,nR,nS,nOO,nVV,lambda,eGT,Omega1,O
do cd=1,nVV
eps = + OmBSE - Omega1(cd) + (eGT(i) + eGT(j))
chi = chi + rho1(i,b,cd)*rho1(j,a,cd)*(eps**2 - eta**2)/(eps**2 + eta**2)**2
chi = chi + rho1(i,b,cd)*rho1(a,j,cd)*(eps**2 - eta**2)/(eps**2 + eta**2)**2
end do
do kl=1,nOO
eps = + OmBSE + Omega2(kl) - (eGT(a) + eGT(b))
chi = chi + rho2(i,b,kl)*rho2(j,a,kl)*(eps**2 - eta**2)/(eps**2 + eta**2)**2
chi = chi + rho2(i,b,kl)*rho2(a,j,kl)*(eps**2 - eta**2)/(eps**2 + eta**2)**2
end do
ZA(ia,jb) = ZA(ia,jb) - lambda*chi

View File

@ -55,22 +55,24 @@ subroutine excitation_density_Tmatrix(ispin,nBas,nC,nO,nV,nR,nOO,nVV,ERI,X1,Y1,r
cd = 0
do c=nO+1,nBas-nR
! do d=nO+1,c
do d=c,nBas-nR
cd = cd + 1
rho1(p,q,ab) = rho1(p,q,ab) &
+ ERI(p,q,c,d)*X1(cd,ab)
! + ERI(p,q,c,d)*X1(cd,ab)/sqrt((1d0 + Kronecker_delta(a,b))*(1d0 + Kronecker_delta(c,d)))
+ (1d0*ERI(p,q,c,d) + 0d0*ERI(p,q,d,c))*X1(cd,ab)
! + ERI(p,q,c,d)*X1(cd,ab)/sqrt((1d0 + Kronecker_delta(c,d)))
! + (ERI(p,q,c,d) + ERI(p,q,d,c))*X1(cd,ab)/sqrt((1d0 + Kronecker_delta(a,b))*(1d0 + Kronecker_delta(c,d)))
end do
end do
kl = 0
do k=nC+1,nO
! do l=nC+1,k
do l=k,nO
kl = kl + 1
rho1(p,q,ab) = rho1(p,q,ab) &
+ ERI(p,q,k,l)*Y1(kl,ab)
! + ERI(p,q,k,l)*Y1(kl,ab)/sqrt((1d0 + Kronecker_delta(a,b))*(1d0 + Kronecker_delta(k,l)))
+ (1d0*ERI(p,q,k,l) + 0d0*ERI(p,q,l,k))*Y1(kl,ab)
! + ERI(p,q,k,l)*Y1(kl,ab)/sqrt((1d0 + Kronecker_delta(k,l)))
! + (ERI(p,q,k,l) + ERI(p,q,l,k))*Y1(kl,ab)/sqrt((1d0 + Kronecker_delta(a,b))*(1d0 + Kronecker_delta(k,l)))
end do
end do
@ -86,22 +88,24 @@ subroutine excitation_density_Tmatrix(ispin,nBas,nC,nO,nV,nR,nOO,nVV,ERI,X1,Y1,r
cd = 0
do c=nO+1,nBas-nR
! do d=nO+1,c
do d=c,nBas-nR
cd = cd + 1
rho2(p,q,ij) = rho2(p,q,ij) &
+ ERI(p,q,c,d)*X2(cd,ij)
! + ERI(p,q,c,d)*X2(cd,ij)/sqrt((1d0 + Kronecker_delta(i,j))*(1d0 + Kronecker_delta(c,d)))
+ (1d0*ERI(p,q,c,d) + 0d0*ERI(p,q,d,c))*X2(cd,ij)
! + ERI(p,q,c,d)*X2(cd,ij)/sqrt((1d0 + Kronecker_delta(c,d)))
! + (ERI(p,q,c,d) + ERI(p,q,d,c))*X2(cd,ij)/sqrt((1d0 + Kronecker_delta(i,j))*(1d0 + Kronecker_delta(c,d)))
end do
end do
kl = 0
do k=nC+1,nO
! do l=nC+1,k
do l=k,nO
kl = kl + 1
rho2(p,q,ij) = rho2(p,q,ij) &
+ ERI(p,q,k,l)*Y2(kl,ij)
! + ERI(p,q,k,l)*Y2(kl,ij)/sqrt((1d0 + Kronecker_delta(i,j))*(1d0 + Kronecker_delta(k,l)))
+ (1d0*ERI(p,q,k,l) + 0d0*ERI(p,q,l,k))*Y2(kl,ij)
! + ERI(p,q,k,l)*Y2(kl,ij)/sqrt((1d0 + Kronecker_delta(k,l)))
! + (ERI(p,q,k,l) + ERI(p,q,l,k))*Y2(kl,ij)/sqrt((1d0 + Kronecker_delta(i,j))*(1d0 + Kronecker_delta(k,l)))
end do
end do

View File

@ -33,6 +33,10 @@ subroutine ufG0W0(nBas,nC,nO,nV,nR,nS,ENuc,ERHF,ERI,eHF)
double precision,allocatable :: eGW(:)
double precision,allocatable :: Z(:)
logical :: verbose = .true.
double precision,parameter :: cutoff1 = 0.01d0
double precision,parameter :: cutoff2 = 0.01d0
! Output variables
! Hello world
@ -183,9 +187,8 @@ subroutine ufG0W0(nBas,nC,nO,nV,nR,nS,ENuc,ERHF,ERI,eHF)
! Compute weights !
!-----------------!
Z(:) = 0d0
do s=1,nH
Z(s) = Z(s) + cGW(1,s)**2
Z(s) = cGW(1,s)**2
end do
!--------------!
@ -207,6 +210,64 @@ subroutine ufG0W0(nBas,nC,nO,nV,nR,nS,ENuc,ERHF,ERI,eHF)
write(*,*)'-------------------------------------------'
write(*,*)
if(verbose) then
do s=1,nH
if(Z(s) > cutoff1) then
write(*,*)'*************************************************************'
write(*,'(1X,A20,I3,A6,I3)')'Vector for orbital ',p,' and #',s
write(*,'(1X,A7,F10.6,A13,F10.6,1X)')' e_QP = ',eGW(s)*HaToeV,' eV and Z = ',Z(s)
write(*,*)'*************************************************************'
write(*,'(1X,A20,1X,A20,1X,A15,1X)') &
' Configuration ',' Coefficient ',' Weight '
write(*,*)'*************************************************************'
if(p <= nO) &
write(*,'(1X,A7,I3,A16,1X,F15.6,1X,F15.6)') &
' (',p,') ',cGW(1,s),cGW(1,s)**2
if(p > nO) &
write(*,'(1X,A16,I3,A7,1X,F15.6,1X,F15.6)') &
' (',p,') ',cGW(1,s),cGW(1,s)**2
klc = 0
do k=nC+1,nO
do l=nC+1,nO
do c=nO+1,nBas-nR
klc = klc + 1
! if(abs(cGW(1+klc,s)) > cutoff2) &
write(*,'(1X,A3,I3,A1,I3,A6,I3,A7,1X,F15.6,1X,F15.6)') &
' (',k,',',l,') -> (',c,') ',cGW(1+klc,s),cGW(1+klc,s)**2
end do
end do
end do
kcd = 0
do k=nC+1,nO
do c=nO+1,nBas-nR
do d=nO+1,nBas-nR
kcd = kcd + 1
! if(abs(cGW(1+n2h1p+kcd,s)) > cutoff2) &
write(*,'(1X,A7,I3,A6,I3,A1,I3,A3,1X,F15.6,1X,F15.6)') &
' (',k,') -> (',c,',',d,') ',cGW(1+n2h1p+kcd,s),cGW(1+n2h1p+kcd,s)**2
end do
end do
end do
write(*,*)'*************************************************************'
write(*,*)
end if
end do
end if
end do
end subroutine ufG0W0