4
1
mirror of https://github.com/pfloos/quack synced 2024-11-07 06:33:55 +01:00

merge with Clotilde

This commit is contained in:
Pierre-Francois Loos 2022-02-07 10:48:46 +01:00
commit 15a04fd253
21 changed files with 1054 additions and 34 deletions

View File

@ -6,24 +6,24 @@
# GGA = 2: B88,G96,PBE # GGA = 2: B88,G96,PBE
# MGGA = 3: # MGGA = 3:
# Hybrid = 4 HF,B3LYP,PBE # Hybrid = 4 HF,B3LYP,PBE
1 S51 1 S51
# correlation rung: # correlation rung:
# Hartree = 0: H # Hartree = 0: H
# LDA = 1: PW92,VWN3,VWN5,eVWN5 # LDA = 1: PW92,VWN3,VWN5,eVWN5
# GGA = 2: LYP,PBE # GGA = 2: LYP,PBE
# MGGA = 3: # MGGA = 3:
# Hybrid = 4: HF,B3LYP,PBE # Hybrid = 4: HF,B3LYP,PBE
1 VWN5 1 VWN5
# quadrature grid SG-n # quadrature grid SG-n
1 1
# Number of states in ensemble (nEns) # Number of states in ensemble (nEns)
2 4
# occupation numbers # occupation numbers
1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
@ -36,8 +36,8 @@
F F
# Parameters for CC weight-dependent exchange functional # Parameters for CC weight-dependent exchange functional
4 4
0.642674 -0.07818 -0.0280307 0.00144198 -0.718713,-0.133321,0.226288,-0.250718
0.254939 -0.0893405 0.00765581 0. -0.525899,0.687216,-0.13866,-0.0226579
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
# choice of UCC exchange coefficient : 1 for Cx1, 2 for Cx2, 3 for Cx1*Cx2 # choice of UCC exchange coefficient : 1 for Cx1, 2 for Cx2, 3 for Cx1*Cx2
1 1

View File

@ -1,5 +1,5 @@
# RHF UHF KS MOM # RHF UHF KS MOM
T F F F F T F F
# MP2* MP3 MP2-F12 # MP2* MP3 MP2-F12
F F F F F F
# CCD pCCD DCD CCSD CCSD(T) # CCD pCCD DCD CCSD CCSD(T)
@ -13,7 +13,7 @@
# G0F2* evGF2* qsGF2* G0F3 evGF3 # G0F2* evGF2* qsGF2* G0F3 evGF3
F F F F F F F F F F
# G0W0* evGW* qsGW* ufG0W0 ufGW # G0W0* evGW* qsGW* ufG0W0 ufGW
T F F F F F F F F F
# G0T0 evGT qsGT # G0T0 evGT qsGT
T F F T F F
# MCMP2 # MCMP2

View File

@ -15,6 +15,6 @@
# ACFDT: AC Kx XBS # ACFDT: AC Kx XBS
F F T F F T
# BSE: BSE dBSE dTDA evDyn # BSE: BSE dBSE dTDA evDyn
T T T F F F T F
# MCMP2: nMC nEq nWalk dt nPrint iSeed doDrift # MCMP2: nMC nEq nWalk dt nPrint iSeed doDrift
1000000 100000 10 0.3 10000 1234 T 1000000 100000 10 0.3 10000 1234 T

View File

@ -1,4 +1,4 @@
2 2
H 0. 0. 0. H 0. 0. 0.
H 0. 0. 0.741 H 0. 0. 0.741

301
src/GT/UG0T0.f90 Normal file
View File

@ -0,0 +1,301 @@
subroutine UG0T0(doACFDT,exchange_kernel,doXBS,BSE,TDA_T,TDA,dBSE,dTDA,evDyn, &
spin_conserved,spin_flip,linearize,eta,regularize,nBas,nC,nO,nV, &
nR,nS,ENuc,EUHF,ERI,ERI_aaaa,ERI_aabb,ERI_bbbb, &
dipole_int_aa,dipole_int_bb,PHF,cHF,eHF,Vxc,eG0T0)
! Perform one-shot calculation with a T-matrix self-energy (G0T0)
implicit none
include 'parameters.h'
! Input variables
logical,intent(in) :: doACFDT
logical,intent(in) :: exchange_kernel
logical,intent(in) :: doXBS
logical,intent(in) :: BSE
logical,intent(in) :: TDA_T
logical,intent(in) :: TDA
logical,intent(in) :: dBSE
logical,intent(in) :: dTDA
logical,intent(in) :: evDyn
logical,intent(in) :: spin_conserved
logical,intent(in) :: spin_flip
logical,intent(in) :: linearize
double precision,intent(in) :: eta
logical,intent(in) :: regularize
integer,intent(in) :: nBas
integer,intent(in) :: nC(nspin)
integer,intent(in) :: nO(nspin)
integer,intent(in) :: nV(nspin)
integer,intent(in) :: nR(nspin)
integer,intent(in) :: nS(nspin)
double precision,intent(in) :: ENuc
double precision,intent(in) :: EUHF
double precision,intent(in) :: Vxc(nBas,nspin)
double precision,intent(in) :: eHF(nBas,nspin)
double precision,intent(in) :: cHF(nBas,nBas,nspin)
double precision,intent(in) :: PHF(nBas,nBas,nspin)
double precision,intent(in) :: ERI(nBas,nBas,nBas,nBas)
double precision,intent(in) :: ERI_aaaa(nBas,nBas,nBas,nBas)
double precision,intent(in) :: ERI_aabb(nBas,nBas,nBas,nBas)
double precision,intent(in) :: ERI_bbbb(nBas,nBas,nBas,nBas)
double precision,intent(in) :: dipole_int_aa(nBas,nBas,ncart)
double precision,intent(in) :: dipole_int_bb(nBas,nBas,ncart)
! Local variables
integer :: ispin,is
integer :: iblock
integer :: nH_sc,nH_sf,nHaa,nHab,nHbb
integer :: nP_sc,nP_sf,nPaa,nPab,nPbb
double precision :: EcRPA(nspin),Ecaa,Ecbb
double precision :: EcBSE(nspin)
double precision :: EcAC(nspin)
double precision :: EcGM
double precision,allocatable :: Omega1ab(:),Omega1aa(:),Omega1bb(:)
double precision,allocatable :: X1ab(:,:),X1aa(:,:),X1bb(:,:)
double precision,allocatable :: Y1ab(:,:),Y1aa(:,:),Y1bb(:,:)
double precision,allocatable :: rho1ab(:,:,:),rho1aa(:,:,:),rho1bb(:,:,:)
double precision,allocatable :: Omega2ab(:),Omega2aa(:),Omega2bb(:)
double precision,allocatable :: X2ab(:,:),X2aa(:,:),X2bb(:,:)
double precision,allocatable :: Y2ab(:,:),Y2aa(:,:),Y2bb(:,:)
double precision,allocatable :: rho2ab(:,:,:),rho2aa(:,:,:),rho2bb(:,:,:)
double precision,allocatable :: SigX(:,:)
double precision,allocatable :: SigT(:,:)
double precision,allocatable :: Z(:,:)
! Output variables
double precision,intent(out) :: eG0T0(nBas,nspin)
! Hello world
write(*,*)
write(*,*)'************************************************'
write(*,*)'| One-shot G0T0 calculation |'
write(*,*)'| *** Unrestricted version *** |'
write(*,*)'************************************************'
write(*,*)
! Dimensions of the pp-URPA linear reponse matrices
nPaa = nV(1)*(nV(1)-1)/2
nPbb = nV(2)*(nV(2)-1)/2
nHaa = nO(1)*(nO(1)-1)/2;
nHbb = nO(2)*(nO(2)-1)/2;
nPab = nV(1)*nV(2)
nHab = nO(1)*nO(2)
nP_sc = nPab
nH_sc = nHab
nP_sf = nPaa + nPbb
nH_sf = nHaa + nHbb
! Memory allocation
allocate(Omega1ab(nPab),X1ab(nPab,nPab),Y1ab(nHab,nPab), &
Omega2ab(nHab),X2ab(nPab,nHab),Y2ab(nHab,nHab), &
rho1ab(nBas,nBas,nPab),rho2ab(nBas,nBas,nHab), &
Omega1aa(nPaa),X1aa(nPaa,nPaa),Y1aa(nHaa,nPaa), &
Omega2aa(nHaa),X2aa(nPaa,nHaa),Y2aa(nHaa,nHaa), &
rho1aa(nBas,nBas,nPaa),rho2aa(nBas,nBas,nHaa), &
Omega1bb(nPbb),X1bb(nPbb,nPbb),Y1bb(nHbb,nPbb), &
rho1bb(nBas,nBas,nPbb),rho2bb(nBas,nBas,nHbb), &
SigX(nBas,nspin),SigT(nBas,nspin),Z(nBas,nspin))
!----------------------------------------------
! alpha-beta block
!----------------------------------------------
ispin = 1
iblock = 1
! iblock = 1
! Compute linear response
call unrestricted_linear_response_pp(iblock,TDA,nBas,nC,nO,nV,nR,nPaa,nPab,nPbb, &
nP_sc,nHaa,nHab,nHbb,nH_sc,1d0,eHF,ERI_aaaa, &
ERI_aabb,ERI_bbbb,Omega1ab,X1ab,Y1ab, &
Omega2ab,X2ab,Y2ab,EcRPA(ispin))
! EcRPA(ispin) = 1d0*EcRPA(ispin)
call print_excitation('pp-RPA (N+2)',iblock,nPab,Omega1ab(:))
call print_excitation('pp-RPA (N-2)',iblock,nHab,Omega2ab(:))
!----------------------------------------------
! alpha-alpha block
!----------------------------------------------
ispin = 2
iblock = 2
! Compute linear response
call unrestricted_linear_response_pp(iblock,TDA,nBas,nC,nO,nV,nR,nPaa,nPab,nPbb, &
nP_sf,nHaa,nHab,nHbb,nH_sc,1d0,eHF,ERI_aaaa, &
ERI_aabb,ERI_bbbb,Omega1aa,X1aa,Y1aa, &
Omega2aa,X2aa,Y2aa,EcRPA(ispin))
! EcRPA(ispin) = 2d0*EcRPA(ispin)
! EcRPA(ispin) = 3d0*EcRPA(ispin)
call print_excitation('pp-RPA (N+2)',iblock,nPaa,Omega1aa(:))
call print_excitation('pp-RPA (N-2)',iblock,nHaa,Omega2aa(:))
!----------------------------------------------
! beta-beta block
!----------------------------------------------
ispin = 2
iblock = 3
! Compute linear response
call unrestricted_linear_response_pp(iblock,TDA,nBas,nC,nO,nV,nR,nPaa,nPab,nPbb, &
nP_sc,nHaa,nHab,nHbb,nH_sf,1d0,eHF,ERI_aaaa, &
ERI_aabb,ERI_bbbb,Omega1bb,X1bb,Y1bb, &
Omega2bb,X2bb,Y2bb,EcRPA(ispin))
! EcRPA(ispin) = 2d0*EcRPA(ispin)
! EcRPA(ispin) = 3d0*EcRPA(ispin)
call print_excitation('pp-RPA (N+2)',iblock,nPbb,Omega1bb(:))
call print_excitation('pp-RPA (N-2)',iblock,nHbb,Omega2bb(:))
!----------------------------------------------
! Compute T-matrix version of the self-energy
!----------------------------------------------
EcGM = 0d0
SigT(:,:) = 0d0
Z(:,:) = 0d0
!alpha-beta block
ispin = 1
iblock = 1
call unrestricted_excitation_density_Tmatrix(iblock,nBas,nC,nO,nV,nR,nHab,nPab, &
ERI_aaaa,ERI_aabb,ERI_bbbb,X1ab,Y1ab, &
rho1ab,X2ab,Y2ab,rho2ab)
call unrestricted_self_energy_Tmatrix_diag(ispin,eta,nBas,nC,nO,nV,nR,nHab,nPab,eHF, &
Omega1ab,rho1ab,Omega2ab,rho2ab,EcGM,SigT)
call unrestricted_renormalization_factor_Tmatrix(eta,nBas,nC,nO,nV,nR,nHab,nPab,eHF, &
Omega1ab,rho1ab,Omega2ab,rho2ab,Z)
!alpha-alpha block
ispin = 2
iblock = 2
call unrestricted_excitation_density_Tmatrix(iblock,nBas,nC,nO,nV,nR,nHaa,nPaa, &
ERI_aaaa,ERI_aabb,ERI_bbbb,X1aa,Y1aa, &
rho1aa,X2aa,Y2aa,rho2aa)
call unrestricted_self_energy_Tmatrix_diag(ispin,eta,nBas,nC,nO,nV,nR,nHaa,nPaa,eHF, &
Omega1aa,rho1aa,Omega2aa,rho2aa,EcGM,SigT)
call unrestricted_renormalization_factor_Tmatrix(eta,nBas,nC,nO,nV,nR,nHaa,nPaa,eHF, &
Omega1aa,rho1aa,Omega2aa,rho2aa,Z)
!beta-beta block
ispin = 2
iblock = 3
call unrestricted_excitation_density_Tmatrix(iblock,nBas,nC,nO,nV,nR,nHbb,nPbb, &
ERI_aaaa,ERI_aabb,ERI_bbbb,X1bb,Y1bb, &
rho1bb,X2bb,Y2bb,rho2bb)
call unrestricted_self_energy_Tmatrix_diag(ispin,eta,nBas,nC,nO,nV,nR,nHbb,nPbb,eHF, &
Omega1bb,rho1bb,Omega2bb,rho2bb,EcGM,SigT)
call unrestricted_renormalization_factor_Tmatrix(eta,nBas,nC,nO,nV,nR,nHbb,nPbb,eHF, &
Omega1bb,rho1bb,Omega2bb,rho2bb,Z)
Z(:,:) = 1d0/(1d0 - Z(:,:))
!----------------------------------------------
! Compute the exchange part of the self-energy
!----------------------------------------------
do is=1,nspin
call self_energy_exchange_diag(nBas,cHF(:,:,is),PHF(:,:,is),ERI,SigX(:,is))
end do
!----------------------------------------------
! Solve the quasi-particle equation
!----------------------------------------------
if(linearize) then
! eG0T0(:) = eHF(:) + Z(:)*SigT(:)
eG0T0(:,:) = eHF(:,:) + Z(:,:)*(SigX(:,:) + SigT(:,:) - Vxc(:,:))
! call matout(nBas,1,SigX)
! call matout(nBas,1,Vxc)
else
eG0T0(:,:) = eHF(:,:) + SigX(:,:) + SigT(:,:) - Vxc(:,:)
end if
!----------------------------------------------
! Dump results
!----------------------------------------------
! Compute the ppRPA correlation energy
!alpha-beta block
ispin = 1
iblock = 1
call unrestricted_linear_response_pp(iblock,TDA,nBas,nC,nO,nV,nR,nPaa,nPab,nPbb, &
nP_sc,nHaa,nHab,nHbb,nH_sc,1d0,eG0T0,ERI_aaaa, &
ERI_aabb,ERI_bbbb,Omega1ab,X1ab,Y1ab, &
Omega2ab,X2ab,Y2ab,EcRPA(ispin))
!alpha-alpha block
ispin = 2
iblock = 2
call unrestricted_linear_response_pp(iblock,TDA,nBas,nC,nO,nV,nR,nPaa,nPab,nPbb, &
nP_sc,nHaa,nHab,nHbb,nH_sc,1d0,eG0T0,ERI_aaaa, &
ERI_aabb,ERI_bbbb,Omega1aa,X1aa,Y1aa, &
Omega2aa,X2aa,Y2aa,EcRPA(ispin))
Ecaa = EcRPA(2)
!beta-beta block
iblock = 3
call unrestricted_linear_response_pp(iblock,TDA,nBas,nC,nO,nV,nR,nPaa,nPab,nPbb, &
nP_sc,nHaa,nHab,nHbb,nH_sc,1d0,eG0T0,ERI_aaaa, &
ERI_aabb,ERI_bbbb,Omega1bb,X1bb,Y1bb, &
Omega2bb,X2bb,Y2bb,EcRPA(ispin))
Ecbb = EcRPA(2)
EcRPA(2) = Ecaa + Ecbb
EcRPA(1) = EcRPA(1) - EcRPA(2)
EcRPA(2) = 3d0*EcRPA(2)
! call print_G0T0(nBas,nO,eHF,ENuc,ERHF,SigT,Z,eG0T0,EcGM,EcRPA)
! Free memory
deallocate(Omega1ab,X1ab,Y1ab,Omega2ab,X2ab,Y2ab,rho1ab,rho2ab, &
Omega1aa,X1aa,Y1aa,Omega2aa,X2aa,Y2aa,rho1aa,rho2aa, &
Omega1bb,X1bb,Y1bb,Omega2bb,X2bb,Y2bb,rho1bb,rho2bb)
end subroutine UG0T0

View File

@ -0,0 +1,222 @@
subroutine unrestricted_excitation_density_Tmatrix(ispin,nBas,nC,nO,nV,nR,nH,nP,ERI_aaaa,ERI_aabb,ERI_bbbb,X1,Y1,rho1,X2,Y2,rho2)
! Compute excitation densities for T-matrix self-energy
implicit none
include 'parameters.h'
! Input variables
integer,intent(in) :: ispin
integer,intent(in) :: nBas
integer,intent(in) :: nC(nspin)
integer,intent(in) :: nO(nspin)
integer,intent(in) :: nV(nspin)
integer,intent(in) :: nR(nspin)
double precision,intent(in) :: ERI_aaaa(nBas,nBas,nBas,nBas)
double precision,intent(in) :: ERI_aabb(nBas,nBas,nBas,nBas)
double precision,intent(in) :: ERI_bbbb(nBas,nBas,nBas,nBas)
integer,intent(in) :: nH
integer,intent(in) :: nP
double precision,intent(in) :: X1(nP,nP)
double precision,intent(in) :: Y1(nH,nP)
double precision,intent(in) :: X2(nP,nH)
double precision,intent(in) :: Y2(nH,nH)
! Local variables
integer :: i,j,k,l
integer :: a,b,c,d
integer :: p,q
integer :: ab,cd,ij,kl
double precision,external :: Kronecker_delta
! Output variables
double precision,intent(out) :: rho1(nBas,nBas,nP)
double precision,intent(out) :: rho2(nBas,nBas,nH)
! Initialization
rho1(:,:,:) = 0d0
rho2(:,:,:) = 0d0
!----------------------------------------------
! alpha-beta block
!----------------------------------------------
if(ispin == 1) then
do p=nC(1)+1,nBas-nR(1)
do q=nC(2)+1,nBas-nR(2)
do ab=1,nP
cd = 0
do c=nO(1)+1,nBas-nR(1)
do d=nO(2),nBas-nR(1)
cd = cd + 1
rho1(p,q,ab) = rho1(p,q,ab) &
+ (1d0*ERI_aabb(p,q,c,d) + 0d0*ERI_aabb(p,q,d,c))*X1(cd,ab)
end do
end do
kl = 0
do k=nC(1)+1,nO(1)
do l=nC(1)+1,nO(1)
kl = kl + 1
rho1(p,q,ab) = rho1(p,q,ab) &
+ (1d0*ERI_aabb(p,q,k,l) + 0d0*ERI_aabb(p,q,l,k))*Y1(kl,ab)
end do
end do
end do
ij = 0
do i=nC(1)+1,nO(1)
do j=nC(2)+1,nO(2)
ij = ij + 1
cd = 0
do c=nO(1)+1,nBas-nR(1)
do d=nO(2)+1,nBas-nR(2)
cd = cd + 1
rho2(p,q,ij) = rho2(p,q,ij) &
+ (1d0*ERI_aabb(p,q,c,d) + 0d0*ERI_aabb(p,q,d,c))*X2(cd,ij)
end do
end do
kl = 0
do k=nC(1)+1,nO(1)
do l=nC(1)+1,nO(1)
kl = kl + 1
rho2(p,q,ij) = rho2(p,q,ij) &
+ (1d0*ERI_aabb(p,q,k,l) + 0d0*ERI_aabb(p,q,l,k))*Y2(kl,ij)
end do
end do
end do
end do
end do
end do
end if
!----------------------------------------------
! alpha-alpha block
!----------------------------------------------
if(ispin == 2) then
do p=nC(1)+1,nBas-nR(1)
do q=nC(1)+1,nBas-nR(1)
do ab=1,nP
cd = 0
do c=nO(1)+1,nBas-nR(1)
do d=c+1,nBas-nR(1)
cd = cd + 1
rho1(p,q,ab) = rho1(p,q,ab) &
+ (ERI_aaaa(p,q,c,d) - ERI_aaaa(p,q,d,c))*X1(cd,ab)
end do
end do
kl = 0
do k=nC(1)+1,nO(1)
do l=k+1,nO(1)
kl = kl + 1
rho1(p,q,ab) = rho1(p,q,ab) &
+ (ERI_aaaa(p,q,k,l) - ERI_aaaa(p,q,l,k))*Y1(kl,ab)
end do
end do
end do
do ij=1,nH
cd = 0
do c=nO(1)+1,nBas-nR(1)
do d=c+1,nBas-nR(1)
cd = cd + 1
rho2(p,q,ij) = rho2(p,q,ij) &
+ (ERI_aaaa(p,q,c,d) - ERI_aaaa(p,q,d,c))*X2(cd,ij)
end do
end do
kl = 0
do k=nC(1)+1,nO(1)
do l=k+1,nO(1)
kl = kl + 1
rho2(p,q,ij) = rho2(p,q,ij) &
+ (ERI_aaaa(p,q,k,l) - ERI_aaaa(p,q,l,k))*Y2(kl,ij)
end do
end do
end do
end do
end do
end if
!----------------------------------------------
! beta-beta block
!----------------------------------------------
if(ispin == 3) then
do p=nC(2)+1,nBas-nR(2)
do q=nC(2)+1,nBas-nR(2)
do ab=1,nP
cd = 0
do c=nO(2)+1,nBas-nR(2)
do d=c+1,nBas-nR(2)
cd = cd + 1
rho1(p,q,ab) = rho1(p,q,ab) + (ERI_bbbb(p,q,c,d)-ERI_bbbb(p,q,d,c))*X1(cd,ab)
end do
end do
kl = 0
do k=nC(2)+1,nO(2)
do l=k+1,nO(2)
kl = kl + 1
rho1(p,q,ab) = rho1(p,q,ab) + (ERI_bbbb(p,q,k,l)-ERI_bbbb(p,q,l,k))*Y1(kl,ab)
end do
end do
end do
do ij=1,nH
cd = 0
do c=nO(2)+1,nBas-nR(2)
do d=c+1,nBas-nR(2)
cd = cd + 1
rho2(p,q,ij) = rho2(p,q,ij) + (ERI_bbbb(p,q,c,d)-ERI_bbbb(p,q,d,c))*X2(cd,ij)
end do
end do
kl = 0
do k=nC(2)+1,nO(2)
do l=k+1,nO(2)
kl = kl + 1
rho2(p,q,ij) = rho2(p,q,ij) + (ERI_bbbb(p,q,k,l)-ERI_bbbb(p,q,l,k))*Y2(kl,ij)
end do
end do
end do
end do
end do
end if
end subroutine unrestricted_excitation_density_Tmatrix

View File

@ -0,0 +1,81 @@
subroutine unrestricted_renormalization_factor_Tmatrix(ispin,eta,nBas,nC,nO,nV,nR,nH,nP,e,Omega1,rho1,Omega2,rho2,Z)
! Compute renormalization factor of the T-matrix self-energy
implicit none
include 'parameters.h'
! Input variables
double precision,intent(in) :: eta
integer,intent(in) :: nBas,nC(nspin),nO(nspin),nV(nspin),nR(nspin)
integer,intent(in) :: nH,ispin
integer,intent(in) :: nP
double precision,intent(in) :: e(nBas,nspin)
double precision,intent(in) :: Omega1(nP)
double precision,intent(in) :: rho1(nBas,nBas,nP,nspin)
double precision,intent(in) :: Omega2(nH)
double precision,intent(in) :: rho2(nBas,nBas,nH,nspin)
! Local variables
integer :: i,a,p,cd,kl
double precision :: eps
! Output variables
double precision,intent(out) :: Z(nBas,nspin)
! Occupied part of the T-matrix self-energy
if(ispin==1) then
do p=nC(1)+1,nBas-nR(1)
do i=nC(1)+1,nO(1)
do cd=1,nP
eps = e(p,1) + e(i,1) - Omega1(cd)
Z(p,1) = Z(p,1) - rho1(p,i,cd,1)**2*(eps/(eps**2 + eta**2))**2
enddo
enddo
enddo
! Virtual part of the T-matrix self-energy
do p=nC(1)+1,nBas-nR(1)
do a=nO(1)+1,nBas-nR(1)
do kl=1,nH
eps = e(p,1) + e(a,1) - Omega2(kl)
Z(p,1) = Z(p,1) - rho2(p,a,kl,1)**2*(eps/(eps**2 + eta**2))**2
enddo
enddo
enddo
end if
! Occupied part of the T-matrix self-energy
if(ispin==2) then
do p=nC(2)+1,nBas-nR(2)
do i=nC(2)+1,nO(2)
do cd=1,nP
eps = e(p,2) + e(i,2) - Omega1(cd)
Z(p,2) = Z(p,2) - rho1(p,i,cd,2)**2*(eps/(eps**2 + eta**2))**2
enddo
enddo
enddo
! Virtual part of the T-matrix self-energy
do p=nC(2)+1,nBas-nR(2)
do a=nO(2)+1,nBas-nR(2)
do kl=1,nH
eps = e(p,2) + e(a,2) - Omega2(kl)
Z(p,2) = Z(p,2) - rho2(p,a,kl,2)**2*(eps/(eps**2 + eta**2))**2
enddo
enddo
enddo
end if
end subroutine unrestricted_renormalization_factor_Tmatrix

View File

@ -0,0 +1,147 @@
subroutine unrestricted_self_energy_Tmatrix_diag(ispin,eta,nBas,nC,nO,nV,nR,nH,nP,e,Omega1,rho1,Omega2,rho2,EcGM,SigT)
! Compute diagonal of the correlation part of the T-matrix self-energy
implicit none
include 'parameters.h'
! Input variables
double precision,intent(in) :: eta
integer,intent(in) :: nBas
integer,intent(in) :: nC(nspin)
integer,intent(in) :: nO(nspin)
integer,intent(in) :: nV(nspin)
integer,intent(in) :: nR(nspin)
integer,intent(in) :: nH,ispin
integer,intent(in) :: nP
double precision,intent(in) :: e(nBas,nspin)
double precision,intent(in) :: Omega1(nP)
double precision,intent(in) :: rho1(nBas,nBas,nP,nspin)
double precision,intent(in) :: Omega2(nH)
double precision,intent(in) :: rho2(nBas,nBas,nH,nspin)
! Local variables
integer :: i,j,a,b,p,cd,kl
double precision :: eps
! Output variables
double precision,intent(inout) :: EcGM(nspin)
double precision,intent(inout) :: SigT(nBas,nspin)
!----------------------------------------------
! Occupied part of the T-matrix self-energy
!----------------------------------------------
if(ispin==1) then
do p=nC(1)+1,nBas-nR(1)
do i=nC(1)+1,nO(1)
do cd=1,nP
eps = e(p,1) + e(i,1) - Omega1(cd)
SigT(p,1) = SigT(p,1) + rho1(p,i,cd,1)**2*eps/(eps**2 + eta**2)
enddo
enddo
enddo
end if
!beta part
if(ispin==2) then
do p=nC(2)+1,nBas-nR(2)
do i=nC(2)+1,nO(2)
do cd=1,nP
eps = e(p,2) + e(i,2) - Omega1(cd)
SigT(p,2) = SigT(p,2) + rho1(p,i,cd,2)**2*eps/(eps**2 + eta**2)
enddo
enddo
enddo
end if
!----------------------------------------------
! Virtual part of the T-matrix self-energy
!----------------------------------------------
!alpha part
if(ispin==1) then
do p=nC(1)+1,nBas-nR(1)
do a=nO(1)+1,nBas-nR(1)
do kl=1,nH
eps = e(p,1) + e(a,1) - Omega2(kl)
SigT(p,1) = SigT(p,1) + rho2(p,a,kl,1)**2*eps/(eps**2 + eta**2)
enddo
enddo
enddo
end if
!alpha part
if(ispin==2) then
do p=nC(2)+1,nBas-nR(2)
do a=nO(2)+1,nBas-nR(2)
do kl=1,nH
eps = e(p,2) + e(a,2) - Omega2(kl)
SigT(p,2) = SigT(p,2) + rho2(p,a,kl,2)**2*eps/(eps**2 + eta**2)
enddo
enddo
enddo
end if
!----------------------------------------------
! Galitskii-Migdal correlation energy
!----------------------------------------------
if(ispin==1) then
do i=nC(1)+1,nO(1)
do j=nC(1)+1,nO(1)
do cd=1,nP
eps = e(i,1) + e(j,1) - Omega1(cd)
EcGM(1) = EcGM(1) + rho1(i,j,cd,1)*rho1(i,j,cd,1)*eps/(eps**2 + eta**2)
enddo
enddo
enddo
do a=nO(1)+1,nBas-nR(1)
do b=nO(1)+1,nBas-nR(1)
do kl=1,nH
eps = e(a,1) + e(b,1) - Omega2(kl)
EcGM(1) = EcGM(1) - rho2(a,b,kl,1)*rho2(a,b,kl,1)*eps/(eps**2 + eta**2)
enddo
enddo
enddo
end if
if(ispin==2) then
do i=nC(2)+1,nO(2)
do j=nC(2)+1,nO(2)
do cd=1,nP
eps = e(i,2) + e(j,2) - Omega1(cd)
EcGM(2) = EcGM(2) + rho1(i,j,cd,2)*rho1(i,j,cd,2)*eps/(eps**2 + eta**2)
enddo
enddo
enddo
do a=nO(2)+1,nBas-nR(2)
do b=nO(2)+1,nBas-nR(2)
do kl=1,nH
eps = e(a,2) + e(b,2) - Omega2(kl)
EcGM(2) = EcGM(2) - rho2(a,b,kl,2)*rho2(a,b,kl,2)*eps/(eps**2 + eta**2)
enddo
enddo
enddo
end if
end subroutine unrestricted_self_energy_Tmatrix_diag

View File

@ -1155,7 +1155,11 @@ program QuAcK
if(unrestricted) then if(unrestricted) then
print*,'!!! G0T0 NYI at the unrestricted level !!!' !print*,'!!! G0T0 NYI at the unrestricted level !!!'
call UG0T0(doACFDT,exchange_kernel,doXBS,BSE,TDA_T,TDA,dBSE,dTDA,evDyn, &
spin_conserved,spin_flip,linGT,eta_GT,regGT,nBas,nC,nO,nV, &
nR,nS,ENuc,EUHF,ERI_AO,ERI_MO_aaaa,ERI_MO_aabb,ERI_MO_bbbb, &
dipole_int_aa,dipole_int_bb,PHF,cHF,eHF,Vxc,eG0T0)
else else

View File

@ -0,0 +1,100 @@
subroutine CC_B88_gga_exchange_energy(nEns,wEns,nCC,aCC,nGrid,weight,&
rho,drho,Cx_choice,Ex)
! Compute the unrestricted version of the curvature-corrected exchange functional
implicit none
include 'parameters.h'
! Input variables
integer,intent(in) :: nEns
double precision,intent(in) :: wEns(nEns)
integer,intent(in) :: nCC
double precision,intent(in) :: aCC(nCC,nEns-1)
integer,intent(in) :: nGrid
double precision,intent(in) :: weight(nGrid)
double precision,intent(in) :: rho(nGrid)
double precision,intent(in) :: drho(3,nGrid)
integer,intent(in) :: Cx_choice
! Local variables
integer :: iG
double precision :: b
double precision :: r,g,x
double precision :: a1,b1,c1,d1,w1
double precision :: a2,b2,c2,d2,w2
double precision :: Fx1,Fx2,Cx
! Output variables
double precision :: Ex
! Coefficients for B88 GGA exchange functional
b = 0.0042d0
! Defining enhancements factor for weight-dependent functionals
! Parameters for first state
a1 = aCC(1,1)
b1 = aCC(2,1)
c1 = aCC(3,1)
d1 = aCC(4,1)
! Parameters for second state
a2 = aCC(1,2)
b2 = aCC(2,2)
c2 = aCC(3,2)
d2 = aCC(4,2)
w1 = wEns(2)
Fx1 = 1d0 + a1*w1 + b1*w1**2 + c1*w1**3 + d1*w1**4
w2 = wEns(3)
Fx2 = 1d0 + a2*w2 + b2*w2**2 + c2*w2**3 + d2*w2**4
select case (Cx_choice)
case(1)
Cx = Fx1
case(2)
Cx = Fx2
case(3)
Cx = Fx2*Fx1
case default
Cx = 1.d0
end select
! Compute GIC-GGA exchange energy
Ex = 0d0
do iG=1,nGrid
r = max(0d0,rho(iG))
if(r > threshold) then
g = drho(1,iG)**2 + drho(2,iG)**2 + drho(3,iG)**2
x = sqrt(g)/r**(4d0/3d0)
Ex = Ex + weight(iG)*r**(4d0/3d0)*(CxLSDA - b*x**2/(1d0 + 6d0*b*x*asinh(x)))
end if
end do
Ex = Cx*Ex
end subroutine CC_B88_gga_exchange_energy

View File

@ -0,0 +1,125 @@
subroutine CC_B88_gga_exchange_potential(nEns,wEns,nCC,aCC,nGrid,weight,nBas,&
AO,dAO,rho,drho,Cx_choice,doNcentered,Fx)
! Compute the unrestricted version of the curvature-corrected exchange potential
implicit none
include 'parameters.h'
! Input variables
integer,intent(in) :: nEns
double precision,intent(in) :: wEns(nEns)
integer,intent(in) :: nCC
double precision,intent(in) :: aCC(nCC,nEns-1)
integer,intent(in) :: nGrid
double precision,intent(in) :: weight(nGrid)
integer,intent(in) :: nBas
double precision,intent(in) :: AO(nBas,nGrid)
double precision,intent(in) :: dAO(3,nBas,nGrid)
double precision,intent(in) :: rho(nGrid)
double precision,intent(in) :: drho(3,nGrid)
integer,intent(in) :: Cx_choice
logical,intent(in) :: doNcentered
! Local variables
integer :: mu,nu,iG
double precision :: b
double precision :: vAO,gAO
double precision :: r,g,x,dxdr,dxdg,f
double precision :: a1,b1,c1,d1,w1
double precision :: a2,b2,c2,d2,w2
double precision :: Fx1,Fx2,Cx
! Output variables
double precision,intent(out) :: Fx(nBas,nBas)
! Coefficients for B88 GGA exchange functional
b = 0.0042d0
! Defining enhancements factor for weight-dependent functionals
! Parameters for first state
a1 = aCC(1,1)
b1 = aCC(2,1)
c1 = aCC(3,1)
d1 = aCC(4,1)
! Parameters for second state
a2 = aCC(1,2)
b2 = aCC(2,2)
c2 = aCC(3,2)
d2 = aCC(4,2)
w1 = wEns(2)
Fx1 = 1d0 + a1*w1 + b1*w1**2 + c1*w1**3 + d1*w1**4
w2 = wEns(3)
Fx2 = 1d0 + a2*w2 + b2*w2**2 + c2*w2**3 + d2*w2**4
select case (Cx_choice)
case(1)
Cx = Fx1
case(2)
Cx = Fx2
case(3)
Cx = Fx2*Fx1
case default
Cx = 1.d0
end select
! Compute GGA exchange matrix in the AO basis
Fx(:,:) = 0d0
do mu=1,nBas
do nu=1,nBas
do iG=1,nGrid
r = max(0d0,rho(iG))
if(r > threshold) then
vAO = weight(iG)*AO(mu,iG)*AO(nu,iG)
g = drho(1,iG)**2 + drho(2,iG)**2 + drho(3,iG)**2
x = sqrt(g)/r**(4d0/3d0)
dxdr = - 4d0*sqrt(g)/(3d0*r**(7d0/3d0))/x
dxdg = + 1d0/(2d0*sqrt(g)*r**(4d0/3d0))/x
f = b*x**2/(1d0 + 6d0*b*x*asinh(x))
Fx(mu,nu) = Fx(mu,nu) + vAO*( &
4d0/3d0*r**(1d0/3d0)*(CxLSDA - f) &
- 2d0*r**(4d0/3d0)*dxdr*f &
+ r**(4d0/3d0)*dxdr*(6d0*b*x*asinh(x) + 6d0*b*x**2/sqrt(1d0+x**2))*f/(1d0 + 6d0*b*x*asinh(x)) )
gAO = drho(1,iG)*(dAO(1,mu,iG)*AO(nu,iG) + AO(mu,iG)*dAO(1,nu,iG)) &
+ drho(2,iG)*(dAO(2,mu,iG)*AO(nu,iG) + AO(mu,iG)*dAO(2,nu,iG)) &
+ drho(3,iG)*(dAO(3,mu,iG)*AO(nu,iG) + AO(mu,iG)*dAO(3,nu,iG))
gAO = weight(iG)*gAO
Fx(mu,nu) = Fx(mu,nu) + 2d0*gAO*r**(4d0/3d0)*dxdg*( &
- 2d0*f + (6d0*b*x*asinh(x) + 6d0*b*x**2/sqrt(1d0+x**2))*f/(1d0 + 6d0*b*x*asinh(x)) )
end if
end do
end do
end do
Fx(:,:) = Cx*Fx(:,:)
end subroutine CC_B88_gga_exchange_potential

View File

@ -1,4 +1,6 @@
subroutine CC_lda_exchange_derivative_discontinuity(nEns,wEns,nCC,aCC,nGrid,weight,rhow,Cx_choice,doNcentered,ExDD) subroutine CC_lda_exchange_derivative_discontinuity(nEns,wEns,nCC,aCC,nGrid,weight,rhow,Cx_choice,&
doNcentered,kappa,ExDD)
! Compute the unrestricted version of the curvature-corrected exchange ensemble derivative ! Compute the unrestricted version of the curvature-corrected exchange ensemble derivative
@ -16,6 +18,7 @@ subroutine CC_lda_exchange_derivative_discontinuity(nEns,wEns,nCC,aCC,nGrid,weig
double precision,intent(in) :: rhow(nGrid) double precision,intent(in) :: rhow(nGrid)
integer,intent(in) :: Cx_choice integer,intent(in) :: Cx_choice
logical,intent(in) :: doNcentered logical,intent(in) :: doNcentered
double precision,intent(in) :: kappa(nEns)
! Local variables ! Local variables
@ -153,7 +156,13 @@ subroutine CC_lda_exchange_derivative_discontinuity(nEns,wEns,nCC,aCC,nGrid,weig
do iEns=1,nEns do iEns=1,nEns
do jEns=2,nEns do jEns=2,nEns
ExDD(iEns) = ExDD(iEns) + (Kronecker_delta(iEns,jEns) - wEns(jEns))*dExdw(jEns) if(doNcentered) then
ExDD(iEns) = ExDD(iEns) + (Kronecker_delta(iEns,jEns) - kappa(iEns)*wEns(jEns))*dExdw(jEns)
else
ExDD(iEns) = ExDD(iEns) + (Kronecker_delta(iEns,jEns) - wEns(jEns))*dExdw(jEns)
end if
end do end do
end do end do

View File

@ -352,6 +352,9 @@ subroutine UKS(x_rung,x_DFA,c_rung,c_DFA,nEns,wEns,nCC,aCC,nGrid,weight,maxSCF,t
end do end do
write(*,*)'------------------------------------------------------------------------------------------' write(*,*)'------------------------------------------------------------------------------------------'
! print*,'Ensemble energy:',Ew + ENuc,'au'
!------------------------------------------------------------------------ !------------------------------------------------------------------------
! End of SCF loop ! End of SCF loop
!------------------------------------------------------------------------ !------------------------------------------------------------------------

View File

@ -1,5 +1,5 @@
subroutine exchange_derivative_discontinuity(rung,DFA,nEns,wEns,nCC,aCC,nGrid,weight,rhow,drhow,& subroutine exchange_derivative_discontinuity(rung,DFA,nEns,wEns,nCC,aCC,nGrid,weight,rhow,drhow,&
Cx_choice,doNcentered,ExDD) Cx_choice,doNcentered,kappa,ExDD)
! Compute the exchange part of the derivative discontinuity ! Compute the exchange part of the derivative discontinuity
@ -20,11 +20,12 @@ subroutine exchange_derivative_discontinuity(rung,DFA,nEns,wEns,nCC,aCC,nGrid,we
double precision,intent(in) :: drhow(ncart,nGrid) double precision,intent(in) :: drhow(ncart,nGrid)
integer,intent(in) :: Cx_choice integer,intent(in) :: Cx_choice
logical,intent(in) :: doNcentered logical,intent(in) :: doNcentered
double precision,intent(in) :: kappa(nEns)
! Local variables !Local variables
! Output variables !Output variables
double precision,intent(out) :: ExDD(nEns) double precision,intent(out) :: ExDD(nEns)
@ -41,7 +42,7 @@ subroutine exchange_derivative_discontinuity(rung,DFA,nEns,wEns,nCC,aCC,nGrid,we
case(1) case(1)
call lda_exchange_derivative_discontinuity(DFA,nEns,wEns(:),nCC,aCC,nGrid,weight(:),& call lda_exchange_derivative_discontinuity(DFA,nEns,wEns(:),nCC,aCC,nGrid,weight(:),&
rhow(:),Cx_choice,doNcentered,ExDD(:)) rhow(:),Cx_choice,doNcentered,kappa,ExDD(:))
! GGA functionals ! GGA functionals
case(2) case(2)

View File

@ -49,7 +49,7 @@ subroutine exchange_energy(rung,DFA,LDA_centered,nEns,wEns,nCC,aCC,nGrid,weight,
case(2) case(2)
call gga_exchange_energy(DFA,nEns,wEns,nGrid,weight,rho,drho,Ex) call gga_exchange_energy(DFA,nEns,wEns,nCC,aCC,nGrid,weight,rho,drho,Cx_choice,Ex)
! MGGA functionals ! MGGA functionals

View File

@ -59,7 +59,8 @@ subroutine exchange_potential(rung,DFA,LDA_centered,nEns,wEns,nCC,aCC,nGrid,weig
case(2) case(2)
call gga_exchange_potential(DFA,nEns,wEns,nGrid,weight,nBas,AO,dAO,rho,drho,Fx) call gga_exchange_potential(DFA,nEns,wEns,nCC,aCC,nGrid,weight,nBas,AO,dAO,rho,drho,&
Cx_choice,Fx)
! MGGA functionals ! MGGA functionals

View File

@ -1,4 +1,4 @@
subroutine gga_exchange_energy(DFA,nEns,wEns,nGrid,weight,rho,drho,Ex) subroutine gga_exchange_energy(DFA,nEns,wEns,nCC,aCC,nGrid,weight,rho,drho,Cx_choice,Ex)
! Select GGA exchange functional for energy calculation ! Select GGA exchange functional for energy calculation
@ -11,11 +11,15 @@ subroutine gga_exchange_energy(DFA,nEns,wEns,nGrid,weight,rho,drho,Ex)
integer,intent(in) :: DFA integer,intent(in) :: DFA
integer,intent(in) :: nEns integer,intent(in) :: nEns
double precision,intent(in) :: wEns(nEns) double precision,intent(in) :: wEns(nEns)
integer,intent(in) :: nCC
double precision,intent(in) :: aCC(nCC,nEns-1)
integer,intent(in) :: nGrid integer,intent(in) :: nGrid
double precision,intent(in) :: weight(nGrid) double precision,intent(in) :: weight(nGrid)
double precision,intent(in) :: rho(nGrid) double precision,intent(in) :: rho(nGrid)
integer,intent(in) :: Cx_choice
double precision,intent(in) :: drho(ncart,nGrid) double precision,intent(in) :: drho(ncart,nGrid)
! Output variables ! Output variables
double precision :: Ex double precision :: Ex
@ -34,6 +38,11 @@ subroutine gga_exchange_energy(DFA,nEns,wEns,nGrid,weight,rho,drho,Ex)
call PBE_gga_exchange_energy(nGrid,weight,rho,drho,Ex) call PBE_gga_exchange_energy(nGrid,weight,rho,drho,Ex)
case (4)
call CC_B88_gga_exchange_energy(nEns,wEns,nCC,aCC,nGrid,weight,rho,drho,&
Cx_choice,Ex)
case default case default
call print_warning('!!! GGA exchange energy not available !!!') call print_warning('!!! GGA exchange energy not available !!!')

View File

@ -1,4 +1,5 @@
subroutine gga_exchange_potential(DFA,nEns,wEns,nGrid,weight,nBas,AO,dAO,rho,drho,Fx) subroutine gga_exchange_potential(DFA,nEns,wEns,nCC,aCC,nGrid,weight,nBas,AO,dAO,&
rho,drho,Cx_choice,Fx)
! Select GGA exchange functional for potential calculation ! Select GGA exchange functional for potential calculation
@ -10,6 +11,8 @@ subroutine gga_exchange_potential(DFA,nEns,wEns,nGrid,weight,nBas,AO,dAO,rho,drh
integer,intent(in) :: DFA integer,intent(in) :: DFA
integer,intent(in) :: nEns integer,intent(in) :: nEns
double precision,intent(in) :: wEns(nEns) double precision,intent(in) :: wEns(nEns)
integer,intent(in) :: nCC
double precision,intent(in) :: aCC(nCC,nEns-1)
integer,intent(in) :: nGrid integer,intent(in) :: nGrid
double precision,intent(in) :: weight(nGrid) double precision,intent(in) :: weight(nGrid)
integer,intent(in) :: nBas integer,intent(in) :: nBas
@ -17,6 +20,7 @@ subroutine gga_exchange_potential(DFA,nEns,wEns,nGrid,weight,nBas,AO,dAO,rho,drh
double precision,intent(in) :: dAO(3,nBas,nGrid) double precision,intent(in) :: dAO(3,nBas,nGrid)
double precision,intent(in) :: rho(nGrid) double precision,intent(in) :: rho(nGrid)
double precision,intent(in) :: drho(3,nGrid) double precision,intent(in) :: drho(3,nGrid)
integer,intent(in) :: Cx_choice
! Output variables ! Output variables
@ -38,6 +42,11 @@ subroutine gga_exchange_potential(DFA,nEns,wEns,nGrid,weight,nBas,AO,dAO,rho,drh
call PBE_gga_exchange_potential(nGrid,weight,nBas,AO,dAO,rho,drho,Fx) call PBE_gga_exchange_potential(nGrid,weight,nBas,AO,dAO,rho,drho,Fx)
case (4)
call CC_B88_gga_exchange_potential(nEns,wEns,nCC,aCC,nGrid,weight,nBas,AO,dAO,rho,drho,&
Cx_choice,Fx)
case default case default
call print_warning('!!! GGA exchange potential not available !!!') call print_warning('!!! GGA exchange potential not available !!!')

View File

@ -150,21 +150,22 @@ subroutine individual_energy(x_rung,x_DFA,c_rung,c_DFA,LDA_centered,nEns,wEns,nC
do ispin=1,nspin do ispin=1,nspin
call exchange_derivative_discontinuity(x_rung,x_DFA,nEns,wEns,nCC,aCC,nGrid,weight, & call exchange_derivative_discontinuity(x_rung,x_DFA,nEns,wEns,nCC,aCC,nGrid,weight, &
rhow(:,ispin),drhow(:,:,ispin),Cx_choice,doNcentered,ExDD(ispin,:)) rhow(:,ispin),drhow(:,:,ispin),Cx_choice,&
doNcentered,kappa,ExDD(ispin,:))
end do end do
call correlation_derivative_discontinuity(c_rung,c_DFA,nEns,wEns,nGrid,weight,rhow,drhow,EcDD) call correlation_derivative_discontinuity(c_rung,c_DFA,nEns,wEns,nGrid,weight,rhow,drhow,EcDD)
! Scaling derivative discontinuity for N-centered ensembles ! Scaling derivative discontinuity for N-centered ensembles
if(doNcentered) then ! if(doNcentered) then
do iEns=1,nEns ! do iEns=1,nEns
ExDD(:,iEns) = (1d0 - kappa(iEns))*ExDD(:,iEns) ! ExDD(:,iEns) = (1d0 - kappa(iEns))*ExDD(:,iEns)
EcDD(:,iEns) = (1d0 - kappa(iEns))*EcDD(:,iEns) ! EcDD(:,iEns) = (1d0 - kappa(iEns))*EcDD(:,iEns)
end do ! end do
end if ! end if
!------------------------------------------------------------------------ !------------------------------------------------------------------------
! Total energy ! Total energy
@ -187,6 +188,8 @@ subroutine individual_energy(x_rung,x_DFA,c_rung,c_DFA,LDA_centered,nEns,wEns,nC
end do end do
end if end if
print*,'LZshift=',sum(LZH(:)) + sum(LZx(:)) + sum(LZc(:))
! do iEns=1,nEns ! do iEns=1,nEns
! E(iEns) = sum(ET(:,iEns)) + sum(EV(:,iEns)) & ! E(iEns) = sum(ET(:,iEns)) + sum(EV(:,iEns)) &

View File

@ -1,5 +1,5 @@
subroutine lda_exchange_derivative_discontinuity(DFA,nEns,wEns,nCC,aCC,nGrid,weight,rhow,& subroutine lda_exchange_derivative_discontinuity(DFA,nEns,wEns,nCC,aCC,nGrid,weight,rhow,&
Cx_choice,doNcentered,ExDD) Cx_choice,doNcentered,kappa,ExDD)
! Compute the exchange LDA part of the derivative discontinuity ! Compute the exchange LDA part of the derivative discontinuity
@ -19,6 +19,7 @@ subroutine lda_exchange_derivative_discontinuity(DFA,nEns,wEns,nCC,aCC,nGrid,wei
double precision,intent(in) :: rhow(nGrid) double precision,intent(in) :: rhow(nGrid)
integer,intent(in) :: Cx_choice integer,intent(in) :: Cx_choice
logical,intent(in) :: doNcentered logical,intent(in) :: doNcentered
double precision,intent(in) :: kappa(nEns)
! Local variables ! Local variables
@ -38,7 +39,7 @@ subroutine lda_exchange_derivative_discontinuity(DFA,nEns,wEns,nCC,aCC,nGrid,wei
case (2) case (2)
call CC_lda_exchange_derivative_discontinuity(nEns,wEns,nCC,aCC,nGrid,weight,rhow,& call CC_lda_exchange_derivative_discontinuity(nEns,wEns,nCC,aCC,nGrid,weight,rhow,&
Cx_choice,doNcentered,ExDD) Cx_choice,doNcentered,kappa,ExDD)
case default case default

View File

@ -117,7 +117,11 @@ subroutine read_options_dft(nBas,method,x_rung,x_DFA,c_rung,c_DFA,SGn,nEns,wEns,
case ('PBE') case ('PBE')
x_DFA = 3 x_DFA = 3
case ('CC-B88')
x_DFA = 4
case default case default
call print_warning('!!! GGA exchange functional not available !!!') call print_warning('!!! GGA exchange functional not available !!!')