4
1
mirror of https://github.com/pfloos/quack synced 2024-10-31 19:23:52 +01:00

Merge branch 'master' of github.com:pfloos/quack

This commit is contained in:
Clotilde Marut 2022-02-07 10:47:34 +01:00
commit 7c092f6f6a
7 changed files with 760 additions and 5 deletions

View File

@ -1,9 +1,9 @@
# RHF UHF KS MOM
T F F F
F T F F
# MP2* MP3 MP2-F12
F F F
# CCD pCCD DCD CCSD CCSD(T)
F F F T F
F F F F F
# drCCD rCCD crCCD lCCD
F F F F
# CIS* CIS(D) CID CISD FCI
@ -13,7 +13,7 @@
# G0F2* evGF2* qsGF2* G0F3 evGF3
F F F F F
# G0W0* evGW* qsGW* ufG0W0 ufGW
T F F F F
F F F F F
# G0T0 evGT qsGT
T F F
# MCMP2

View File

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

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
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