diff --git a/src/GW/GWC_spectral_function.f90 b/src/GW/GWC_spectral_function.f90 new file mode 100644 index 0000000..35e1215 --- /dev/null +++ b/src/GW/GWC_spectral_function.f90 @@ -0,0 +1,136 @@ +subroutine GWC_spectral_function(nBas,nC,nO,nV,nR,nS,eHF,eGW,Om,rho) + +! Plot the spectral function at the GW+C level + + 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) :: eHF(nBas) + double precision,intent(in) :: eGW(nBas) + double precision,intent(in) :: Om(nS) + double precision,intent(in) :: rho(nBas,nBas,nS) + +! Local variables + + double precision :: eta + integer :: p,g + integer :: nGrid + double precision :: wmin,wmax,dw + double precision,external :: GW_ReSigC,GW_ImSigC,GW_RedSigC,GW_ImdSigC + double precision,allocatable :: w(:) + double precision,allocatable :: ReSigC(:,:),ImSigC(:,:) + double precision,allocatable :: RedSigC(:,:),ImdSigC(:,:) + double precision,allocatable :: A(:,:) + +! Broadening parameter + + eta = 0.01d0 + +! Construct grid + + nGrid = 5000 + allocate(w(nGrid),A(nBas,nGrid)) + +! Minimum and maximum frequency values + + wmin = -5d0 + wmax = +5d0 + dw = (wmax - wmin)/dble(ngrid) + + do g=1,nGrid + w(g) = wmin + dble(g)*dw + end do + +! Compute QP part of the spectral function + + allocate(ReSigC(nBas,nGrid),ImSigC(nBas,nGrid)) + + do g=1,nGrid + do p=nC+1,nBas-nR + + ReSigC(p,g) = GW_ReSigC(p,eGW(p),eta,nBas,nC,nO,nV,nR,nS,eGW,Om,rho) + ImSigC(p,g) = GW_ImSigC(p,eGW(p),eta,nBas,nC,nO,nV,nR,nS,eGW,Om,rho) + + end do + end do + + do g=1,nGrid + do p=nC+1,nBas-nR + A(p,g) = abs(ImSigC(p,g))/((w(g) - eHF(p) - ReSigC(p,g))**2 + ImSigC(p,g)**2) + end do + end do + + A(:,:) = A(:,:)/pi + + deallocate(ReSigC,ImSigC) + +! Dump quantities in files as a function of w + + open(unit=11 ,file='GWC_AQP.dat') + + do g=1,nGrid + write(11,*) w(g)*HaToeV,(A(p,g),p=nC+1,nBas-nR) + end do + +! Closing files + + close(unit=11) + +! Compute cumulant part of the spectral function + + allocate(RedSigC(nBas,nGrid),ImdSigC(nBas,nGrid)) + + do g=1,nGrid + do p=nC+1,nBas-nR + + RedSigC(p,g) = GW_RedSigC(p,0d0,eta,nBas,nC,nO,nV,nR,nS,eGW,Om,rho) + ImdSigC(p,g) = GW_ImdSigC(p,0d0,eta,nBas,nC,nO,nV,nR,nS,eGW,Om,rho) + + end do + end do + + do g=1,nGrid + do p=nC+1,nBas-nR + A(p,g) = RedSigC(p,g) + (w(g) - eHF(p))*ImdSigC(p,g) + end do + end do + + do g=1,nGrid + do p=nC+1,nBas-nR + + RedSigC(p,g) = GW_RedSigC(p,eHF(p)-w(g),eta,nBas,nC,nO,nV,nR,nS,eGW,Om,rho) + + end do + end do + + do g=1,nGrid + do p=nC+1,nBas-nR + A(p,g) = (RedSigC(p,g) - A(p,g))/(w(g) - eHF(p))**2 + end do + end do + + A(:,:) = A(:,:)/pi + + deallocate(RedSigC,ImdSigC) + +! Dump quantities in files as a function of w + + open(unit=12 ,file='GWC_AC.dat') + + do g=1,nGrid + write(12,*) w(g)*HaToeV,(A(p,g),p=nC+1,nBas-nR) + end do + +! Closing files + + close(unit=12) + +end subroutine diff --git a/src/GW/GW_dSigC.f90 b/src/GW/GW_ImdSigC.f90 similarity index 82% rename from src/GW/GW_dSigC.f90 rename to src/GW/GW_ImdSigC.f90 index aad9921..6e89e71 100644 --- a/src/GW/GW_dSigC.f90 +++ b/src/GW/GW_ImdSigC.f90 @@ -1,4 +1,4 @@ -double precision function GW_dSigC(p,w,eta,nBas,nC,nO,nV,nR,nS,e,Om,rho) +double precision function GW_ImdSigC(p,w,eta,nBas,nC,nO,nV,nR,nS,e,Om,rho) ! Compute the derivative of the correlation part of the self-energy @@ -27,7 +27,7 @@ double precision function GW_dSigC(p,w,eta,nBas,nC,nO,nV,nR,nS,e,Om,rho) ! Initialize - GW_dSigC = 0d0 + GW_ImdSigC = 0d0 ! Occupied part of the correlation self-energy @@ -35,7 +35,7 @@ double precision function GW_dSigC(p,w,eta,nBas,nC,nO,nV,nR,nS,e,Om,rho) do m=1,nS eps = w - e(i) + Om(m) num = 2d0*rho(p,i,m)**2 - GW_dSigC = GW_dSigC - num*(eps**2 - eta**2)/(eps**2 + eta**2)**2 + GW_ImdSigC = GW_ImdSigC - 2d0*num*eps*eta/(eps**2 + eta**2)**2 end do end do @@ -45,7 +45,7 @@ double precision function GW_dSigC(p,w,eta,nBas,nC,nO,nV,nR,nS,e,Om,rho) do m=1,nS eps = w - e(a) - Om(m) num = 2d0*rho(p,a,m)**2 - GW_dSigC = GW_dSigC - num*(eps**2 - eta**2)/(eps**2 + eta**2)**2 + GW_ImdSigC = GW_ImdSigC + 2d0*num*eps*eta/(eps**2 + eta**2)**2 end do end do diff --git a/src/GW/GW_QP_graph.f90 b/src/GW/GW_QP_graph.f90 index cf240fd..9a879bf 100644 --- a/src/GW/GW_QP_graph.f90 +++ b/src/GW/GW_QP_graph.f90 @@ -28,7 +28,7 @@ subroutine GW_QP_graph(eta,nBas,nC,nO,nV,nR,nS,eHF,Om,rho,eGWlin,eOld,eGW,Z) integer :: nIt integer,parameter :: maxIt = 64 double precision,parameter :: thresh = 1d-6 - double precision,external :: GW_SigC,GW_dSigC + double precision,external :: GW_ReSigC,GW_RedSigC double precision :: SigC,dSigC double precision :: f,df double precision :: w @@ -54,8 +54,8 @@ subroutine GW_QP_graph(eta,nBas,nC,nO,nV,nR,nS,eHF,Om,rho,eGWlin,eOld,eGW,Z) nIt = nIt + 1 - SigC = GW_SigC(p,w,eta,nBas,nC,nO,nV,nR,nS,eOld,Om,rho) - dSigC = GW_dSigC(p,w,eta,nBas,nC,nO,nV,nR,nS,eOld,Om,rho) + SigC = GW_ReSigC(p,w,eta,nBas,nC,nO,nV,nR,nS,eOld,Om,rho) + dSigC = GW_RedSigC(p,w,eta,nBas,nC,nO,nV,nR,nS,eOld,Om,rho) f = w - eHF(p) - SigC df = 1d0/(1d0 - dSigC) w = w - df*f diff --git a/src/GW/GW_SigC.f90 b/src/GW/GW_ReSigC.f90 similarity index 83% rename from src/GW/GW_SigC.f90 rename to src/GW/GW_ReSigC.f90 index bff10fc..21453c5 100644 --- a/src/GW/GW_SigC.f90 +++ b/src/GW/GW_ReSigC.f90 @@ -1,4 +1,4 @@ -double precision function GW_SigC(p,w,eta,nBas,nC,nO,nV,nR,nS,e,Om,rho) +double precision function GW_ReSigC(p,w,eta,nBas,nC,nO,nV,nR,nS,e,Om,rho) ! Compute diagonal of the correlation part of the self-energy @@ -27,7 +27,7 @@ double precision function GW_SigC(p,w,eta,nBas,nC,nO,nV,nR,nS,e,Om,rho) ! Initialize - GW_SigC = 0d0 + GW_ReSigC = 0d0 ! Occupied part of the correlation self-energy @@ -35,7 +35,7 @@ double precision function GW_SigC(p,w,eta,nBas,nC,nO,nV,nR,nS,e,Om,rho) do m=1,nS eps = w - e(i) + Om(m) num = 2d0*rho(p,i,m)**2 - GW_SigC = GW_SigC + num*eps/(eps**2 + eta**2) + GW_ReSigC = GW_ReSigC + num*eps/(eps**2 + eta**2) end do end do @@ -45,7 +45,7 @@ double precision function GW_SigC(p,w,eta,nBas,nC,nO,nV,nR,nS,e,Om,rho) do m=1,nS eps = w - e(a) - Om(m) num = 2d0*rho(p,a,m)**2 - GW_SigC = GW_SigC + num*eps/(eps**2 + eta**2) + GW_ReSigC = GW_ReSigC + num*eps/(eps**2 + eta**2) end do end do diff --git a/src/GW/GW_RedSigC.f90 b/src/GW/GW_RedSigC.f90 new file mode 100644 index 0000000..6530e53 --- /dev/null +++ b/src/GW/GW_RedSigC.f90 @@ -0,0 +1,52 @@ +double precision function GW_RedSigC(p,w,eta,nBas,nC,nO,nV,nR,nS,e,Om,rho) + +! Compute the derivative of the correlation part of the self-energy + + implicit none + include 'parameters.h' + +! Input variables + + integer,intent(in) :: p + double precision,intent(in) :: w + 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) :: e(nBas) + double precision,intent(in) :: Om(nS) + double precision,intent(in) :: rho(nBas,nBas,nS) + +! Local variables + + integer :: i,a,m + double precision :: num,eps + +! Initialize + + GW_RedSigC = 0d0 + +! Occupied part of the correlation self-energy + + do i=nC+1,nO + do m=1,nS + eps = w - e(i) + Om(m) + num = 2d0*rho(p,i,m)**2 + GW_RedSigC = GW_RedSigC - num*(eps**2 - eta**2)/(eps**2 + eta**2)**2 + end do + end do + +! Virtual part of the correlation self-energy + + do a=nO+1,nBas-nR + do m=1,nS + eps = w - e(a) - Om(m) + num = 2d0*rho(p,a,m)**2 + GW_RedSigC = GW_RedSigC - num*(eps**2 - eta**2)/(eps**2 + eta**2)**2 + end do + end do + +end function diff --git a/src/GW/GW_plot_self_energy.f90 b/src/GW/GW_plot_self_energy.f90 index 0978c39..d668700 100644 --- a/src/GW/GW_plot_self_energy.f90 +++ b/src/GW/GW_plot_self_energy.f90 @@ -24,11 +24,11 @@ subroutine GW_plot_self_energy(nBas,nC,nO,nV,nR,nS,eHF,eGW,Om,rho) integer :: p,g integer :: nGrid double precision :: wmin,wmax,dw - double precision,external :: GW_SigC,GW_ImSigC,GW_dSigC + double precision,external :: GW_ReSigC,GW_ImSigC,GW_RedSigC double precision,allocatable :: w(:) double precision,allocatable :: ReSigC(:,:),ImSigC(:,:) double precision,allocatable :: Z(:,:) - double precision,allocatable :: S(:,:) + double precision,allocatable :: A(:,:) ! Broadening parameter @@ -37,7 +37,7 @@ subroutine GW_plot_self_energy(nBas,nC,nO,nV,nR,nS,eHF,eGW,Om,rho) ! Construct grid nGrid = 5000 - allocate(w(nGrid),ReSigC(nBas,nGrid),ImSigC(nBas,nGrid),Z(nBas,nGrid),S(nBas,nGrid)) + allocate(w(nGrid),ReSigC(nBas,nGrid),ImSigC(nBas,nGrid),Z(nBas,nGrid),A(nBas,nGrid)) ! Initialize @@ -60,9 +60,9 @@ subroutine GW_plot_self_energy(nBas,nC,nO,nV,nR,nS,eHF,eGW,Om,rho) do g=1,nGrid do p=nC+1,nBas-nR - ReSigC(p,g) = GW_SigC(p,w(g),eta,nBas,nC,nO,nV,nR,nS,eGW,Om,rho) + ReSigC(p,g) = GW_ReSigC(p,w(g),eta,nBas,nC,nO,nV,nR,nS,eGW,Om,rho) ImSigC(p,g) = GW_ImSigC(p,w(g),eta,nBas,nC,nO,nV,nR,nS,eGW,Om,rho) - Z(p,g) = GW_dSigC(p,w(g),eta,nBas,nC,nO,nV,nR,nS,eGW,Om,rho) + Z(p,g) = GW_RedSigC(p,w(g),eta,nBas,nC,nO,nV,nR,nS,eGW,Om,rho) end do end do @@ -73,11 +73,11 @@ subroutine GW_plot_self_energy(nBas,nC,nO,nV,nR,nS,eHF,eGW,Om,rho) do g=1,nGrid do p=nC+1,nBas-nR - S(p,g) = abs(ImSigC(p,g))/((w(g) - eHF(p) - ReSigC(p,g))**2 + ImSigC(p,g)**2) + A(p,g) = abs(ImSigC(p,g))/((w(g) - eHF(p) - ReSigC(p,g))**2 + ImSigC(p,g)**2) end do end do - S(:,:) = S(:,:)/pi + A(:,:) = A(:,:)/pi ! Dump quantities in files as a function of w @@ -90,7 +90,7 @@ subroutine GW_plot_self_energy(nBas,nC,nO,nV,nR,nS,eHF,eGW,Om,rho) write(8 ,*) w(g)*HaToeV,(ReSigC(p,g)*HaToeV,p=nC+1,nBas-nR) write(9 ,*) w(g)*HaToeV,((w(g)-eHF(p))*HaToeV,p=nC+1,nBas-nR) write(10,*) w(g)*HaToeV,(Z(p,g),p=nC+1,nBas-nR) - write(11,*) w(g)*HaToeV,(S(p,g),p=nC+1,nBas-nR) + write(11,*) w(g)*HaToeV,(A(p,g),p=nC+1,nBas-nR) end do ! Closing files diff --git a/src/GW/RG0W0.f90 b/src/GW/RG0W0.f90 index 97f0766..e19152a 100644 --- a/src/GW/RG0W0.f90 +++ b/src/GW/RG0W0.f90 @@ -146,13 +146,16 @@ subroutine RG0W0(dotest,doACFDT,exchange_kernel,doXBS,dophBSE,dophBSE2,TDA_W,TDA end if +! Plot self-energy, renormalization factor, and spectral function + + call GW_plot_self_energy(nBas,nC,nO,nV,nR,nS,eHF,eHF,Om,rho) + !--------------------! ! Cumulant expansion ! !--------------------! call RGWC(dotest,nBas,nC,nO,nR,nS,Om,rho,eGW,Z) - -! call GW_plot_self_energy(nBas,nC,nO,nV,nR,nS,eHF,eHF,Om,rho) + call GWC_spectral_function(nBas,nC,nO,nV,nR,nS,eHF,eHF,Om,rho) ! Compute the RPA correlation energy