10
1
mirror of https://github.com/pfloos/quack synced 2024-12-23 04:43:42 +01:00

iterative dynamic correction for BSE

This commit is contained in:
Pierre-Francois Loos 2020-05-21 16:13:52 +02:00
parent 629a166e03
commit a02bebdd88
12 changed files with 311 additions and 124 deletions

View File

@ -2,4 +2,4 @@
2 1 1 0 0 2 1 1 0 0
# Znuc x y z # Znuc x y z
H 0. 0. 0. H 0. 0. 0.
H 0. 0. 3.7 H 0. 0. 1.4

View File

@ -1,5 +1,5 @@
# nAt nEla nElb nCore nRyd # nAt nEla nElb nCore nRyd
2 9 9 0 0 2 9 9 0 0
# Znuc x y z # Znuc x y z
H 0. 0. -0.02489783 H 0. 0. -0.02489783
Cl 0. 0. 2.38483140 Cl 0. 0. 2.38483140

View File

@ -1,71 +1,92 @@
1 9 1 14
S 8 S 8
1 9046.0000000 0.0007000 1 11420.0000000 0.0005230
2 1357.0000000 0.0053890 2 1712.0000000 0.0040450
3 309.3000000 0.0274060 3 389.3000000 0.0207750
4 87.7300000 0.1032070 4 110.0000000 0.0807270
5 28.5600000 0.2787230 5 35.5700000 0.2330740
6 10.2100000 0.4485400 6 12.5400000 0.4335010
7 3.8380000 0.2782380 7 4.6440000 0.3474720
8 0.7466000 0.0154400 8 0.5118000 -0.0085080
S 8 S 8
1 9046.0000000 -0.0001530 1 11420.0000000 -0.0001150
2 1357.0000000 -0.0012080 2 1712.0000000 -0.0008950
3 309.3000000 -0.0059920 3 389.3000000 -0.0046240
4 87.7300000 -0.0245440 4 110.0000000 -0.0185280
5 28.5600000 -0.0674590 5 35.5700000 -0.0573390
6 10.2100000 -0.1580780 6 12.5400000 -0.1320760
7 3.8380000 -0.1218310 7 4.6440000 -0.1725100
8 0.7466000 0.5490030 8 0.5118000 0.5999440
S 1 S 1
1 0.2248000 1.0000000 1 1.2930000 1.0000000
S 1 S 1
1 0.0612400 1.0000000 1 0.1787000 1.0000000
S 1
1 0.0576000 1.0000000
P 3 P 3
1 13.5500000 0.0399190 1 26.6300000 0.0146700
2 2.9170000 0.2171690 2 5.9480000 0.0917640
3 0.7973000 0.5103190 3 1.7420000 0.2986830
P 1 P 1
1 0.2185000 1.0000000 1 0.5550000 1.0000000
P 1 P 1
1 0.0561100 1.0000000 1 0.1725000 1.0000000
P 1
1 0.0491000 1.0000000
D 1 D 1
1 0.8170000 1.0000000 1 1.6540000 1.0000000
D 1 D 1
1 0.2300000 1.0000000 1 0.4690000 1.0000000
2 9 D 1
1 0.1510000 1.0000000
F 1
1 1.0930000 1.0000000
F 1
1 0.3640000 1.0000000
2 14
S 8 S 8
1 9046.0000000 0.0007000 1 11420.0000000 0.0005230
2 1357.0000000 0.0053890 2 1712.0000000 0.0040450
3 309.3000000 0.0274060 3 389.3000000 0.0207750
4 87.7300000 0.1032070 4 110.0000000 0.0807270
5 28.5600000 0.2787230 5 35.5700000 0.2330740
6 10.2100000 0.4485400 6 12.5400000 0.4335010
7 3.8380000 0.2782380 7 4.6440000 0.3474720
8 0.7466000 0.0154400 8 0.5118000 -0.0085080
S 8 S 8
1 9046.0000000 -0.0001530 1 11420.0000000 -0.0001150
2 1357.0000000 -0.0012080 2 1712.0000000 -0.0008950
3 309.3000000 -0.0059920 3 389.3000000 -0.0046240
4 87.7300000 -0.0245440 4 110.0000000 -0.0185280
5 28.5600000 -0.0674590 5 35.5700000 -0.0573390
6 10.2100000 -0.1580780 6 12.5400000 -0.1320760
7 3.8380000 -0.1218310 7 4.6440000 -0.1725100
8 0.7466000 0.5490030 8 0.5118000 0.5999440
S 1 S 1
1 0.2248000 1.0000000 1 1.2930000 1.0000000
S 1 S 1
1 0.0612400 1.0000000 1 0.1787000 1.0000000
S 1
1 0.0576000 1.0000000
P 3 P 3
1 13.5500000 0.0399190 1 26.6300000 0.0146700
2 2.9170000 0.2171690 2 5.9480000 0.0917640
3 0.7973000 0.5103190 3 1.7420000 0.2986830
P 1 P 1
1 0.2185000 1.0000000 1 0.5550000 1.0000000
P 1 P 1
1 0.0561100 1.0000000 1 0.1725000 1.0000000
P 1
1 0.0491000 1.0000000
D 1 D 1
1 0.8170000 1.0000000 1 1.6540000 1.0000000
D 1 D 1
1 0.2300000 1.0000000 1 0.4690000 1.0000000
D 1
1 0.1510000 1.0000000
F 1
1 1.0930000 1.0000000
F 1
1 0.3640000 1.0000000

View File

@ -13,7 +13,7 @@
# G0F2 evGF2 G0F3 evGF3 # G0F2 evGF2 G0F3 evGF3
F F F F F F F F
# G0W0 evGW qsGW # G0W0 evGW qsGW
T T F T F F
# G0T0 evGT qsGT # G0T0 evGT qsGT
F F F F F F
# MCMP2 # MCMP2

View File

@ -9,7 +9,7 @@
# GF: maxSCF thresh DIIS n_diis lin renorm # GF: maxSCF thresh DIIS n_diis lin renorm
256 0.00001 T 5 T 3 256 0.00001 T 5 T 3
# GW/GT: maxSCF thresh DIIS n_diis COHSEX SOSEX BSE TDA G0W GW0 lin eta # GW/GT: maxSCF thresh DIIS n_diis COHSEX SOSEX BSE TDA G0W GW0 lin eta
256 0.00001 T 5 F F T F F F T 0.00367493 256 0.00001 T 10 F F T F F F T 0.00367493
# ACFDT: AC Kx XBS # ACFDT: AC Kx XBS
F F T F F T
# MCMP2: nMC nEq nWalk dt nPrint iSeed doDrift # MCMP2: nMC nEq nWalk dt nPrint iSeed doDrift

View File

@ -1,71 +1,92 @@
1 9 1 14
S 8 S 8
1 9046.0000000 0.0007000 1 11420.0000000 0.0005230
2 1357.0000000 0.0053890 2 1712.0000000 0.0040450
3 309.3000000 0.0274060 3 389.3000000 0.0207750
4 87.7300000 0.1032070 4 110.0000000 0.0807270
5 28.5600000 0.2787230 5 35.5700000 0.2330740
6 10.2100000 0.4485400 6 12.5400000 0.4335010
7 3.8380000 0.2782380 7 4.6440000 0.3474720
8 0.7466000 0.0154400 8 0.5118000 -0.0085080
S 8 S 8
1 9046.0000000 -0.0001530 1 11420.0000000 -0.0001150
2 1357.0000000 -0.0012080 2 1712.0000000 -0.0008950
3 309.3000000 -0.0059920 3 389.3000000 -0.0046240
4 87.7300000 -0.0245440 4 110.0000000 -0.0185280
5 28.5600000 -0.0674590 5 35.5700000 -0.0573390
6 10.2100000 -0.1580780 6 12.5400000 -0.1320760
7 3.8380000 -0.1218310 7 4.6440000 -0.1725100
8 0.7466000 0.5490030 8 0.5118000 0.5999440
S 1 S 1
1 0.2248000 1.0000000 1 1.2930000 1.0000000
S 1 S 1
1 0.0612400 1.0000000 1 0.1787000 1.0000000
S 1
1 0.0576000 1.0000000
P 3 P 3
1 13.5500000 0.0399190 1 26.6300000 0.0146700
2 2.9170000 0.2171690 2 5.9480000 0.0917640
3 0.7973000 0.5103190 3 1.7420000 0.2986830
P 1 P 1
1 0.2185000 1.0000000 1 0.5550000 1.0000000
P 1 P 1
1 0.0561100 1.0000000 1 0.1725000 1.0000000
P 1
1 0.0491000 1.0000000
D 1 D 1
1 0.8170000 1.0000000 1 1.6540000 1.0000000
D 1 D 1
1 0.2300000 1.0000000 1 0.4690000 1.0000000
2 9 D 1
1 0.1510000 1.0000000
F 1
1 1.0930000 1.0000000
F 1
1 0.3640000 1.0000000
2 14
S 8 S 8
1 9046.0000000 0.0007000 1 11420.0000000 0.0005230
2 1357.0000000 0.0053890 2 1712.0000000 0.0040450
3 309.3000000 0.0274060 3 389.3000000 0.0207750
4 87.7300000 0.1032070 4 110.0000000 0.0807270
5 28.5600000 0.2787230 5 35.5700000 0.2330740
6 10.2100000 0.4485400 6 12.5400000 0.4335010
7 3.8380000 0.2782380 7 4.6440000 0.3474720
8 0.7466000 0.0154400 8 0.5118000 -0.0085080
S 8 S 8
1 9046.0000000 -0.0001530 1 11420.0000000 -0.0001150
2 1357.0000000 -0.0012080 2 1712.0000000 -0.0008950
3 309.3000000 -0.0059920 3 389.3000000 -0.0046240
4 87.7300000 -0.0245440 4 110.0000000 -0.0185280
5 28.5600000 -0.0674590 5 35.5700000 -0.0573390
6 10.2100000 -0.1580780 6 12.5400000 -0.1320760
7 3.8380000 -0.1218310 7 4.6440000 -0.1725100
8 0.7466000 0.5490030 8 0.5118000 0.5999440
S 1 S 1
1 0.2248000 1.0000000 1 1.2930000 1.0000000
S 1 S 1
1 0.0612400 1.0000000 1 0.1787000 1.0000000
S 1
1 0.0576000 1.0000000
P 3 P 3
1 13.5500000 0.0399190 1 26.6300000 0.0146700
2 2.9170000 0.2171690 2 5.9480000 0.0917640
3 0.7973000 0.5103190 3 1.7420000 0.2986830
P 1 P 1
1 0.2185000 1.0000000 1 0.5550000 1.0000000
P 1 P 1
1 0.0561100 1.0000000 1 0.1725000 1.0000000
P 1
1 0.0491000 1.0000000
D 1 D 1
1 0.8170000 1.0000000 1 1.6540000 1.0000000
D 1 D 1
1 0.2300000 1.0000000 1 0.4690000 1.0000000
D 1
1 0.1510000 1.0000000
F 1
1 1.0930000 1.0000000
F 1
1 0.3640000 1.0000000

View File

@ -25,6 +25,7 @@ subroutine Bethe_Salpeter(TDA,singlet_manifold,triplet_manifold,eta, &
! Local variables ! Local variables
logical :: evDyn = .false.
integer :: ispin integer :: ispin
double precision,allocatable :: OmBSE(:,:) double precision,allocatable :: OmBSE(:,:)
double precision,allocatable :: XpY_BSE(:,:,:) double precision,allocatable :: XpY_BSE(:,:,:)
@ -66,8 +67,15 @@ subroutine Bethe_Salpeter(TDA,singlet_manifold,triplet_manifold,eta, &
! Compute dynamic correction for BSE via perturbation theory ! Compute dynamic correction for BSE via perturbation theory
call Bethe_Salpeter_dynamic_perturbation(TDA,eta,nBas,nC,nO,nV,nR,nS,eGW(:),OmRPA(:,ispin),OmBSE(:,ispin), & if(evDyn) then
XpY_BSE(:,:,ispin),XmY_BSE(:,:,ispin),rho_RPA(:,:,:,ispin))
call Bethe_Salpeter_dynamic_perturbation_iterative(TDA,eta,nBas,nC,nO,nV,nR,nS,eGW(:),OmRPA(:,ispin),OmBSE(:,ispin), &
XpY_BSE(:,:,ispin),XmY_BSE(:,:,ispin),rho_RPA(:,:,:,ispin))
else
call Bethe_Salpeter_dynamic_perturbation(TDA,eta,nBas,nC,nO,nV,nR,nS,eGW(:),OmRPA(:,ispin),OmBSE(:,ispin), &
XpY_BSE(:,:,ispin),XmY_BSE(:,:,ispin),rho_RPA(:,:,:,ispin))
end if
end if end if
@ -97,9 +105,15 @@ subroutine Bethe_Salpeter(TDA,singlet_manifold,triplet_manifold,eta, &
! Compute dynamic correction for BSE via perturbation theory ! Compute dynamic correction for BSE via perturbation theory
call Bethe_Salpeter_dynamic_perturbation(TDA,eta,nBas,nC,nO,nV,nR,nS,eGW(:),OmRPA(:,ispin),OmBSE(:,ispin), & if(evDyn) then
XpY_BSE(:,:,ispin),XmY_BSE(:,:,ispin),rho_RPA(:,:,:,ispin))
call Bethe_Salpeter_dynamic_perturbation_iterative(TDA,eta,nBas,nC,nO,nV,nR,nS,eGW(:),OmRPA(:,ispin),OmBSE(:,ispin), &
XpY_BSE(:,:,ispin),XmY_BSE(:,:,ispin),rho_RPA(:,:,:,ispin))
else
call Bethe_Salpeter_dynamic_perturbation(TDA,eta,nBas,nC,nO,nV,nR,nS,eGW(:),OmRPA(:,ispin),OmBSE(:,ispin), &
XpY_BSE(:,:,ispin),XmY_BSE(:,:,ispin),rho_RPA(:,:,:,ispin))
end if
end if end if

View File

@ -48,12 +48,12 @@ subroutine Bethe_Salpeter_ZB_matrix_dynamic(eta,nBas,nC,nO,nV,nR,nS,lambda,eGW,O
chi = 0d0 chi = 0d0
do kc=1,maxS do kc=1,maxS
eps = (OmBSE - OmRPA(kc) - (eGW(a) - eGW(b)))**2 + eta**2
chi = chi + rho(i,b,kc)*rho(a,j,kc)*((OmBSE - OmRPA(kc) - (eGW(a) - eGW(b)))/eps)**2
eps = (OmBSE - OmRPA(kc) - (eGW(j) - eGW(i)))**2 + eta**2 eps = (OmBSE - OmRPA(kc) - (eGW(j) - eGW(i)))**2 + eta**2
chi = chi + rho(i,b,kc)*rho(a,j,kc)*((OmBSE - OmRPA(kc) - (eGW(j) - eGW(i)))/eps)**2 chi = chi + rho(i,b,kc)*rho(a,j,kc)*((OmBSE - OmRPA(kc) - (eGW(j) - eGW(i)))/eps)**2
eps = (OmBSE - OmRPA(kc) - (eGW(a) - eGW(b)))**2 + eta**2
chi = chi + rho(i,b,kc)*rho(a,j,kc)*((OmBSE - OmRPA(kc) - (eGW(a) - eGW(b)))/eps)**2
enddo enddo
ZB_dyn(ia,jb) = ZB_dyn(ia,jb) + 2d0*lambda*chi ZB_dyn(ia,jb) = ZB_dyn(ia,jb) + 2d0*lambda*chi

View File

@ -25,7 +25,7 @@ subroutine Bethe_Salpeter_dynamic_perturbation(TDA,eta,nBas,nC,nO,nV,nR,nS,eGW,O
! Local variables ! Local variables
logical :: TDA_dyn = .false. logical :: TDA_dyn = .true.
integer :: ia integer :: ia
integer,parameter :: maxS = 10 integer,parameter :: maxS = 10
double precision :: gapGW double precision :: gapGW

View File

@ -0,0 +1,133 @@
subroutine Bethe_Salpeter_dynamic_perturbation_iterative(TDA,eta,nBas,nC,nO,nV,nR,nS,eGW,OmRPA,OmBSE,XpY,XmY,rho)
! Compute self-consistently the dynamical effects via perturbation theory for BSE
implicit none
include 'parameters.h'
! Input variables
logical,intent(in) :: TDA
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) :: eGW(nBas)
double precision,intent(in) :: OmRPA(nS)
double precision,intent(in) :: OmBSE(nS)
double precision,intent(in) :: XpY(nS,nS)
double precision,intent(in) :: XmY(nS,nS)
double precision,intent(in) :: rho(nBas,nBas,nS)
! Local variables
logical :: TDA_dyn = .true.
integer :: ia
integer,parameter :: maxS = 10
double precision :: gapGW
integer :: nSCF
integer :: maxSCF = 10
double precision :: Conv
double precision :: thresh = 1d-5
double precision,allocatable :: OmDyn(:)
double precision,allocatable :: OmOld(:)
double precision,allocatable :: X(:)
double precision,allocatable :: Y(:)
double precision,allocatable :: A_dyn(:,:)
double precision,allocatable :: B_dyn(:,:)
double precision,allocatable :: ZA_dyn(:,:)
double precision,allocatable :: ZB_dyn(:,:)
! Memory allocation
allocate(OmDyn(nS),OmOld(nS),X(nS),Y(nS),A_dyn(nS,nS))
if(.not.TDA_dyn) allocate(B_dyn(nS,nS))
gapGW = eGW(nO+1) - eGW(nO)
Conv = 1d0
nSCF = 0
OmOld(:) = OmBSE(:)
write(*,*) '---------------------------------------------------------------------------------------------------'
write(*,*) ' First-order dynamical correction to static Bethe-Salpeter excitation energies '
write(*,*) '---------------------------------------------------------------------------------------------------'
write(*,*)
do while(Conv > thresh .and. nSCF < maxSCF)
nSCF = nSCF + 1
write(*,*) '---------------------------------------------------------------------------------------------------'
write(*,'(2X,A15,I3)') 'Iteration n.',nSCF
write(*,*) '---------------------------------------------------------------------------------------------------'
write(*,'(2X,A5,1X,A20,1X,A20,1X,A20)') '#','Static (eV)','Dynamic (eV)','Correction (eV)'
write(*,*) '---------------------------------------------------------------------------------------------------'
do ia=1,min(nS,maxS)
X(:) = 0.5d0*(XpY(ia,:) + XmY(ia,:))
Y(:) = 0.5d0*(XpY(ia,:) - XmY(ia,:))
! Resonant part of the BSE correction
call Bethe_Salpeter_A_matrix_dynamic(eta,nBas,nC,nO,nV,nR,nS,1d0,eGW(:),OmRPA(:),OmOld(ia),rho(:,:,:),A_dyn(:,:))
! First-order correction
if(TDA_dyn) then
OmDyn(ia) = dot_product(X(:),matmul(A_dyn(:,:),X(:)))
else
! Anti-resonant part of the BSE correction
call Bethe_Salpeter_B_matrix_dynamic(eta,nBas,nC,nO,nV,nR,nS,1d0,eGW(:),OmRPA(:),OmOld(ia),rho(:,:,:),B_dyn(:,:))
OmDyn(ia) = dot_product(X(:),matmul(A_dyn(:,:),X(:))) &
- dot_product(Y(:),matmul(A_dyn(:,:),Y(:))) &
+ dot_product(X(:),matmul(B_dyn(:,:),Y(:))) &
- dot_product(Y(:),matmul(B_dyn(:,:),X(:)))
end if
write(*,'(2X,I5,5X,F15.6,5X,F15.6,5X,F15.6)') &
ia,OmBSE(ia)*HaToeV,(OmBSE(ia)+OmDyn(ia))*HaToeV,OmDyn(ia)*HaToeV
if(OmBSE(ia) > gapGW) write(*,*) ' !!! BSE neutral excitation larger than the GW gap !!! '
end do
Conv = maxval(abs(OmBSE(:) + OmDyn(:) - OmOld(:)))
OmOld(:) = OmBSE(:) + OmDyn(:)
write(*,*) '---------------------------------------------------------------------------------------------------'
write(*,'(2X,A20,1X,F10.6)') ' Convergence = ',Conv
write(*,*) '---------------------------------------------------------------------------------------------------'
write(*,*)
end do
! Did it actually converge?
if(nSCF == maxSCF) then
write(*,*)
write(*,*)'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'
write(*,*)' Convergence failed '
write(*,*)'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'
write(*,*)
endif
end subroutine Bethe_Salpeter_dynamic_perturbation_iterative

View File

@ -13,7 +13,7 @@ subroutine orthogonalization_matrix(ortho_type,nBas,S,X)
logical :: debug logical :: debug
double precision,allocatable :: UVec(:,:),Uval(:) double precision,allocatable :: UVec(:,:),Uval(:)
double precision,parameter :: thresh = 1d-6 double precision,parameter :: thresh = 1d-8
integer :: i integer :: i
@ -43,16 +43,14 @@ subroutine orthogonalization_matrix(ortho_type,nBas,S,X)
do i=1,nBas do i=1,nBas
if(Uval(i) > thresh) then if(Uval(i) < thresh) then
Uval(i) = 1d0/sqrt(Uval(i)) write(*,*) 'Eigenvalue',i,'is very small in Lowdin orthogonalization = ',Uval(i)
else
write(*,*) 'Eigenvalue',i,'too small for Lowdin orthogonalization'
endif endif
Uval(i) = 1d0/sqrt(Uval(i))
enddo enddo
call ADAt(nBas,Uvec,Uval,X) call ADAt(nBas,Uvec,Uval,X)

View File

@ -37,7 +37,7 @@ subroutine read_molecule(nNuc,nEl,nO,nC,nR)
nO(:) = nEl(:) nO(:) = nEl(:)
nC(:) = nCore/2 nC(:) = nCore/2
nR(:) = nRyd/2 nR(:) = nRyd
! Print results ! Print results