From 16431bcd3379036d4ffee068b63032c12294d04d Mon Sep 17 00:00:00 2001 From: Pierre-Francois Loos Date: Mon, 17 Jan 2022 08:02:11 +0100 Subject: [PATCH] ufG0W0 --- input/methods | 4 +- mol/h2.xyz | 2 +- src/CI/CID.f90 | 4 +- src/CI/CISD.f90 | 6 +- src/GT/Bethe_Salpeter_Tmatrix.f90 | 56 +++++--- ..._Salpeter_Tmatrix_dynamic_perturbation.f90 | 122 ++++++------------ src/GT/G0T0.f90 | 8 +- src/GT/dynamic_Tmatrix_A.f90 | 8 +- src/GT/excitation_density_Tmatrix.f90 | 20 +-- src/GW/ufG0W0.f90 | 65 +++++++++- 10 files changed, 170 insertions(+), 125 deletions(-) diff --git a/input/methods b/input/methods index 07cc57d..d83b758 100644 --- a/input/methods +++ b/input/methods @@ -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 diff --git a/mol/h2.xyz b/mol/h2.xyz index d955cc4..ad42467 100644 --- a/mol/h2.xyz +++ b/mol/h2.xyz @@ -1,4 +1,4 @@ 2 H 0. 0. 0. -H 0. 0. 0.7 +H 0. 0. 1.500000 diff --git a/src/CI/CID.f90 b/src/CI/CID.f90 index ca6a78d..b8f52d6 100644 --- a/src/CI/CID.f90 +++ b/src/CI/CID.f90 @@ -96,7 +96,7 @@ subroutine CID(singlet_manifold,triplet_manifold,nBasin,nCin,nOin,nVin,nRin,ERIi H(ishift+1,jshift+1) = E0 - print*,'00 block done...' + print*,'00 block done...' ! 0D blocks @@ -193,7 +193,7 @@ subroutine CID(singlet_manifold,triplet_manifold,nBasin,nCin,nOin,nVin,nRin,ERIi end do end do - print*,'DD block done...' + print*,'DD block done...' write(*,*) write(*,*) 'Diagonalizing CID matrix...' diff --git a/src/CI/CISD.f90 b/src/CI/CISD.f90 index 1037d11..a6f623c 100644 --- a/src/CI/CISD.f90 +++ b/src/CI/CISD.f90 @@ -99,7 +99,7 @@ subroutine CISD(singlet_manifold,triplet_manifold,nBasin,nCin,nOin,nVin,nRin,ERI H(ishift+1,jshift+1) = E0 - print*,'00 block done...' + print*,'00 block done...' ! 0S blocks @@ -172,7 +172,7 @@ subroutine CISD(singlet_manifold,triplet_manifold,nBasin,nCin,nOin,nVin,nRin,ERI end do end do - print*,'SS block done...' + print*,'SS block done...' ! SD blocks @@ -285,7 +285,7 @@ subroutine CISD(singlet_manifold,triplet_manifold,nBasin,nCin,nOin,nVin,nRin,ERI end do end do - print*,'DD block done...' + print*,'DD block done...' write(*,*) write(*,*) 'Diagonalizing CISD matrix...' diff --git a/src/GT/Bethe_Salpeter_Tmatrix.f90 b/src/GT/Bethe_Salpeter_Tmatrix.f90 index bab1596..b038740 100644 --- a/src/GT/Bethe_Salpeter_Tmatrix.f90 +++ b/src/GT/Bethe_Salpeter_Tmatrix.f90 @@ -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,26 +169,23 @@ 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) - - 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(singlet,triplet,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) + 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 diff --git a/src/GT/Bethe_Salpeter_Tmatrix_dynamic_perturbation.f90 b/src/GT/Bethe_Salpeter_Tmatrix_dynamic_perturbation.f90 index 6724290..1aa1130 100644 --- a/src/GT/Bethe_Salpeter_Tmatrix_dynamic_perturbation.f90 +++ b/src/GT/Bethe_Salpeter_Tmatrix_dynamic_perturbation.f90 @@ -1,5 +1,5 @@ -subroutine Bethe_Salpeter_Tmatrix_dynamic_perturbation(singlet,triplet,dTDA,eta,nBas,nC,nO,nV,nR,nS,nOOs,nVVs,nOOt,nVVt, & - Omega1s,Omega2s,Omega1t,Omega2t,rho1s,rho2s,rho1t,rho2t,eT,eGT, & +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) ! Compute dynamical effects via perturbation theory for BSE@GT @@ -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) - - do ispin=1,nspin + call dynamic_Tmatrix_A(eta,nBas,nC,nO,nV,nR,nS,nOOt,nVVt,1d0,eGT,Omega1t,Omega2t,rho1t,rho2t,OmBSE(ia),dTAt,ZAt) - 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)) - end if + ! First-order correction + + if(ispin == 1) then + 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)) - end if - - ZDyn(ia,ispin) = 1d0/(1d0 - ZDyn(ia,ispin)) - OmDyn(ia,ispin) = ZDyn(ia,ispin)*OmDyn(ia,ispin) - - end do + if(ispin == 2) then + 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) = 1d0/(1d0 - ZDyn(ia)) + OmDyn(ia) = ZDyn(ia)*OmDyn(ia) end do @@ -124,48 +116,20 @@ subroutine Bethe_Salpeter_Tmatrix_dynamic_perturbation(singlet,triplet,dTDA,eta, gapGT = eGT(nO+1) - eGT(nO) - if(singlet) then + write(*,*) '---------------------------------------------------------------------------------------------------' + 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(*,*) '---------------------------------------------------------------------------------------------------' + write(*,'(2X,A5,1X,A20,1X,A20,1X,A20,1X,A20)') '#','Static (eV)','Dynamic (eV)','Correction (eV)','Renorm. (eV)' + write(*,*) '---------------------------------------------------------------------------------------------------' - ispin = 1 + do ia=1,maxS + write(*,'(2X,I5,5X,F15.6,5X,F15.6,5X,F15.6,5X,F15.6)') & + ia,OmBSE(ia)*HaToeV,(OmBSE(ia)+OmDyn(ia))*HaToeV,OmDyn(ia)*HaToeV,ZDyn(ia) + end do - write(*,*) '---------------------------------------------------------------------------------------------------' - write(*,*) ' First-order dynamical correction to static singlet 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 - - 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 + write(*,*) '---------------------------------------------------------------------------------------------------' + write(*,*) end subroutine Bethe_Salpeter_Tmatrix_dynamic_perturbation diff --git a/src/GT/G0T0.f90 b/src/GT/G0T0.f90 index f852f1c..11f4415 100644 --- a/src/GT/G0T0.f90 +++ b/src/GT/G0T0.f90 @@ -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) diff --git a/src/GT/dynamic_Tmatrix_A.f90 b/src/GT/dynamic_Tmatrix_A.f90 index 78a0460..9428346 100644 --- a/src/GT/dynamic_Tmatrix_A.f90 +++ b/src/GT/dynamic_Tmatrix_A.f90 @@ -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 diff --git a/src/GT/excitation_density_Tmatrix.f90 b/src/GT/excitation_density_Tmatrix.f90 index 2a366b8..fa58d75 100644 --- a/src/GT/excitation_density_Tmatrix.f90 +++ b/src/GT/excitation_density_Tmatrix.f90 @@ -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 diff --git a/src/GW/ufG0W0.f90 b/src/GW/ufG0W0.f90 index 51ac629..ad9f079 100644 --- a/src/GW/ufG0W0.f90 +++ b/src/GW/ufG0W0.f90 @@ -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