From 444a9f7bf1b5f706e316f9461f8ae8251f88603d Mon Sep 17 00:00:00 2001 From: Pierre-Francois Loos Date: Sun, 15 Mar 2020 20:33:18 +0100 Subject: [PATCH] RVWN5 --- examples/molecule.F2 | 2 +- src/eDFT/LF19_lda_correlation_potential.f90 | 82 ------------------- ....f90 => RMFL20_lda_correlation_energy.f90} | 31 ++++--- src/eDFT/RMFL20_lda_correlation_potential.f90 | 78 ++++++++++++++++++ src/eDFT/RMFL20_lda_exchange_energy.f90 | 3 +- src/eDFT/RVWN5_lda_correlation_energy.f90 | 62 ++++++++++++++ src/eDFT/RVWN5_lda_correlation_potential.f90 | 78 ++++++++++++++++++ src/eDFT/lda_correlation_energy.f90 | 6 +- src/eDFT/lda_correlation_potential.f90 | 6 +- 9 files changed, 241 insertions(+), 107 deletions(-) delete mode 100644 src/eDFT/LF19_lda_correlation_potential.f90 rename src/eDFT/{LF19_lda_correlation_energy.f90 => RMFL20_lda_correlation_energy.f90} (62%) create mode 100644 src/eDFT/RMFL20_lda_correlation_potential.f90 create mode 100644 src/eDFT/RVWN5_lda_correlation_energy.f90 create mode 100644 src/eDFT/RVWN5_lda_correlation_potential.f90 diff --git a/examples/molecule.F2 b/examples/molecule.F2 index 12bba91..9c99be9 100644 --- a/examples/molecule.F2 +++ b/examples/molecule.F2 @@ -2,4 +2,4 @@ 2 9 9 0 0 # Znuc x y z F 0. 0. 0. - F 0. 0. 3.3 + F 0. 0. 2 diff --git a/src/eDFT/LF19_lda_correlation_potential.f90 b/src/eDFT/LF19_lda_correlation_potential.f90 deleted file mode 100644 index c2e1a67..0000000 --- a/src/eDFT/LF19_lda_correlation_potential.f90 +++ /dev/null @@ -1,82 +0,0 @@ -subroutine LF19_lda_correlation_potential(nEns,wEns,nGrid,weight,nBas,AO,rho,Fc) - -! Compute Loos-Fromager weight-dependent LDA correlation potential - - implicit none -include 'parameters.h' - -! Input variables - - integer,intent(in) :: nEns - double precision,intent(in) :: wEns(nEns) - 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) :: rho(nGrid,nspin) - -! Local variables - - logical :: LDA_centered = .false. - integer :: iEns - double precision,allocatable :: aLF(:,:) - double precision,allocatable :: FcLDA(:,:,:) - double precision,allocatable :: FceLDA(:,:,:,:) - -! Output variables - - double precision,intent(out) :: Fc(nBas,nBas,nspin) - -! Allocation - - allocate(aLF(3,nEns),FcLDA(nBas,nBas,nspin),FceLDA(nBas,nBas,nspin,nEns)) - -! Parameters for weight-dependent LDA correlation functional - - aLF(1,1) = -0.0238184d0 - aLF(2,1) = +0.00575719d0 - aLF(3,1) = +0.0830576d0 - - aLF(1,2) = -0.0282814d0 - aLF(2,2) = +0.00340758d0 - aLF(3,2) = +0.0663967d0 - - aLF(1,3) = -0.0144633d0 - aLF(2,3) = -0.0504501d0 - aLF(3,3) = +0.0331287d0 - -! Compute correlation energy for ground, singly-excited and doubly-excited states - - do iEns=1,nEns - - call elda_correlation_potential(nEns,aLF(:,iEns),nGrid,weight,nBas,AO,rho,FceLDA(:,:,:,iEns)) - - end do - -! LDA-centered functional - - FcLDA(:,:,:) = 0d0 - - if(LDA_centered) then - - call VWN5_lda_correlation_potential(nGrid,weight,nBas,AO,rho,FcLDA) - - do iEns=1,nEns - - FceLDA(:,:,:,iEns) = FceLDA(:,:,:,iEns) + FcLDA(:,:,:) - FceLDA(:,:,:,1) - - end do - - end if - -! Weight-denpendent functional for ensembles - - Fc(:,:,:) = 0d0 - - do iEns=1,nEns - - Fc(:,:,:) = Fc(:,:,:) + wEns(iEns)*FceLDA(:,:,:,iEns) - - enddo - -end subroutine LF19_lda_correlation_potential diff --git a/src/eDFT/LF19_lda_correlation_energy.f90 b/src/eDFT/RMFL20_lda_correlation_energy.f90 similarity index 62% rename from src/eDFT/LF19_lda_correlation_energy.f90 rename to src/eDFT/RMFL20_lda_correlation_energy.f90 index e7713f3..6a5f736 100644 --- a/src/eDFT/LF19_lda_correlation_energy.f90 +++ b/src/eDFT/RMFL20_lda_correlation_energy.f90 @@ -1,6 +1,7 @@ -subroutine LF19_lda_correlation_energy(nEns,wEns,nGrid,weight,rho,Ec) +subroutine RMFL20_lda_correlation_energy(nEns,wEns,nGrid,weight,rho,Ec) -! Compute eLDA correlation energy +! Compute the restricted version of the Marut-Fromager-Loos weight-dependent correlation functional +! The RMFL20 is a two-state, single-weight correlation functional for spin-unpolarized systems implicit none include 'parameters.h' @@ -15,10 +16,10 @@ subroutine LF19_lda_correlation_energy(nEns,wEns,nGrid,weight,rho,Ec) ! Local variables - logical :: LDA_centered = .false. + logical :: LDA_centered = .true. integer :: iEns,isp double precision :: EcLDA(nsp) - double precision,allocatable :: aLF(:,:) + double precision,allocatable :: aMFL(:,:) double precision,allocatable :: EceLDA(:,:) ! Output variables @@ -27,27 +28,23 @@ subroutine LF19_lda_correlation_energy(nEns,wEns,nGrid,weight,rho,Ec) ! Allocation - allocate(aLF(3,nEns),EceLDA(nsp,nEns)) + allocate(aMFL(3,nEns),EceLDA(nsp,nEns)) ! Parameters for weight-dependent LDA correlation functional - aLF(1,1) = -0.0238184d0 - aLF(2,1) = +0.00575719d0 - aLF(3,1) = +0.0830576d0 + aMFL(1,1) = -0.0238184d0 + aMFL(2,1) = +0.00540994d0 + aMFL(3,1) = +0.0830766d0 - aLF(1,2) = -0.0282814d0 - aLF(2,2) = +0.00340758d0 - aLF(3,2) = +0.0663967d0 - - aLF(1,3) = -0.0144633d0 - aLF(2,3) = -0.0504501d0 - aLF(3,3) = +0.0331287d0 + aMFL(1,2) = -0.0144633d0 + aMFL(2,2) = -0.0506019d0 + aMFL(3,2) = +0.0331417d0 ! Compute correlation energy for ground, singly-excited and doubly-excited states do iEns=1,nEns - call elda_correlation_energy(nEns,aLF(:,iEns),nGrid,weight(:),rho(:,:),EceLDA(:,iEns)) + call elda_correlation_energy(nEns,aMFL(:,iEns),nGrid,weight(:),rho(:,:),EceLDA(:,iEns)) end do @@ -81,4 +78,4 @@ subroutine LF19_lda_correlation_energy(nEns,wEns,nGrid,weight,rho,Ec) end do end do -end subroutine LF19_lda_correlation_energy +end subroutine RMFL20_lda_correlation_energy diff --git a/src/eDFT/RMFL20_lda_correlation_potential.f90 b/src/eDFT/RMFL20_lda_correlation_potential.f90 new file mode 100644 index 0000000..1281591 --- /dev/null +++ b/src/eDFT/RMFL20_lda_correlation_potential.f90 @@ -0,0 +1,78 @@ +subroutine RMFL20_lda_correlation_potential(nEns,wEns,nGrid,weight,nBas,AO,rho,Fc) + +! Compute Loos-Fromager weight-dependent LDA correlation potential + + implicit none +include 'parameters.h' + +! Input variables + + integer,intent(in) :: nEns + double precision,intent(in) :: wEns(nEns) + 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) :: rho(nGrid) + +! Local variables + + logical :: LDA_centered = .true. + integer :: iEns + double precision,allocatable :: aMFL(:,:) + double precision,allocatable :: FcLDA(:,:) + double precision,allocatable :: FceLDA(:,:,:) + +! Output variables + + double precision,intent(out) :: Fc(nBas,nBas) + +! Allocation + + allocate(aMFL(3,nEns),FcLDA(nBas,nBas),FceLDA(nBas,nBas,nEns)) + +! Parameters for weight-dependent LDA correlation functional + + aMFL(1,1) = -0.0238184d0 + aMFL(2,1) = +0.00540994d0 + aMFL(3,1) = +0.0830766d0 + + aMFL(1,2) = -0.0144633d0 + aMFL(2,2) = -0.0506019d0 + aMFL(3,2) = +0.0331417d0 + +! Compute correlation energy for ground, singly-excited and doubly-excited states + + do iEns=1,nEns + + call elda_correlation_potential(nEns,aMFL(:,iEns),nGrid,weight,nBas,AO,rho,FceLDA(:,:,iEns)) + + end do + +! LDA-centered functional + + FcLDA(:,:) = 0d0 + + if(LDA_centered) then + + call RVWN5_lda_correlation_potential(nGrid,weight,nBas,AO,rho,FcLDA) + + do iEns=1,nEns + + FceLDA(:,:,iEns) = FceLDA(:,:,iEns) + FcLDA(:,:) - FceLDA(:,:,1) + + end do + + end if + +! Weight-denpendent functional for ensembles + + Fc(:,:) = 0d0 + + do iEns=1,nEns + + Fc(:,:) = Fc(:,:) + wEns(iEns)*FceLDA(:,:,iEns) + + enddo + +end subroutine RMFL20_lda_correlation_potential diff --git a/src/eDFT/RMFL20_lda_exchange_energy.f90 b/src/eDFT/RMFL20_lda_exchange_energy.f90 index 33adeb3..2fd6a33 100644 --- a/src/eDFT/RMFL20_lda_exchange_energy.f90 +++ b/src/eDFT/RMFL20_lda_exchange_energy.f90 @@ -1,6 +1,7 @@ subroutine RMFL20_lda_exchange_energy(nEns,wEns,nGrid,weight,rho,Ex) -! Compute restricted version of Marut-Fromager-Loos weight-dependent LDA exchange energy +! Compute the restricted version of the Marut-Fromager-Loos weight-dependent exchange functional +! The RMFL20 is a two-state, single-weight exchange functional implicit none include 'parameters.h' diff --git a/src/eDFT/RVWN5_lda_correlation_energy.f90 b/src/eDFT/RVWN5_lda_correlation_energy.f90 new file mode 100644 index 0000000..34bc6cb --- /dev/null +++ b/src/eDFT/RVWN5_lda_correlation_energy.f90 @@ -0,0 +1,62 @@ +subroutine RVWN5_lda_correlation_energy(nGrid,weight,rho,Ec) + +! Compute the restricted VWN5 LDA correlation energy + + implicit none + + include 'parameters.h' + +! Input variables + + integer,intent(in) :: nGrid + double precision,intent(in) :: weight(nGrid) + double precision,intent(in) :: rho(nGrid) + +! Local variables + + integer :: iG + double precision :: r,rs,x + double precision :: a_p,x0_p,xx0_p,b_p,c_p,x_p,q_p + + double precision :: ec_p + +! Output variables + + double precision :: Ec(nsp) + +! Parameters of the functional + + a_p = +0.0621814D0/2D0 + x0_p = -0.10498d0 + b_p = +3.72744d0 + c_p = +12.9352d0 + +! Initialization + + Ec = 0d0 + + do iG=1,nGrid + + r = max(0d0,rho(iG)) + + if(r > threshold) then + + rs = (4d0*pi*r/3d0)**(-1d0/3d0) + x = sqrt(rs) + + x_p = x*x + b_p*x + c_p + + xx0_p = x0_p*x0_p + b_p*x0_p + c_p + + q_p = sqrt(4d0*c_p - b_p*b_p) + + ec_p = a_p*( log(x**2/x_p) + 2d0*b_p/q_p*atan(q_p/(2d0*x + b_p)) & + - b_p*x0_p/xx0_p*( log((x - x0_p)**2/x_p) + 2d0*(b_p + 2d0*x0_p)/q_p*atan(q_p/(2d0*x + b_p)) ) ) + + Ec = Ec + weight(iG)*ec_p*r + + end if + + end do + +end subroutine RVWN5_lda_correlation_energy diff --git a/src/eDFT/RVWN5_lda_correlation_potential.f90 b/src/eDFT/RVWN5_lda_correlation_potential.f90 new file mode 100644 index 0000000..72a6f35 --- /dev/null +++ b/src/eDFT/RVWN5_lda_correlation_potential.f90 @@ -0,0 +1,78 @@ +subroutine RVWN5_lda_correlation_potential(nGrid,weight,nBas,AO,rho,Fc) + +! Compute the restricted VWN5 LDA correlation potential + + implicit none + + include 'parameters.h' + +! Input variables + + 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) :: rho(nGrid) + +! Local variables + + integer :: mu,nu,iG + double precision :: r,rs,x + double precision :: a_p,x0_p,xx0_p,b_p,c_p,x_p,q_p + double precision :: dxdrs,dxdx_p,decdx_p + double precision :: drsdra,decdra_p + + double precision :: ec_p + +! Output variables + + double precision :: Fc(nBas,nBas) + +! Parameters of the functional + + a_p = +0.0621814D0/2D0 + x0_p = -0.10498d0 + b_p = +3.72744d0 + c_p = +12.9352d0 + +! Initialization + + Fc(:,:) = 0d0 + + do mu=1,nBas + do nu=1,nBas + do iG=1,nGrid + + r = max(0d0,rho(iG)) + + if(r > threshold) then + + rs = (4d0*pi*r/3d0)**(-1d0/3d0) + x = sqrt(rs) + + x_p = x*x + b_p*x + c_p + xx0_p = x0_p*x0_p + b_p*x0_p + c_p + q_p = sqrt(4d0*c_p - b_p*b_p) + + ec_p = a_p*( log(x**2/x_p) + 2d0*b_p/q_p*atan(q_p/(2d0*x + b_p)) & + - b_p*x0_p/xx0_p*( log((x - x0_p)**2/x_p) + 2d0*(b_p + 2d0*x0_p)/q_p*atan(q_p/(2d0*x + b_p)) ) ) + + drsdra = - (36d0*pi)**(-1d0/3d0)*r**(-4d0/3d0) + dxdrs = 0.5d0/sqrt(rs) + + dxdx_p = 2d0*x + b_p + + decdx_p = a_p*( 2d0/x - 4d0*b_p/( (b_p+2d0*x)**2 + q_p**2) - dxdx_p/x_p & + - b_p*x0_p/xx0_p*( 2/(x-x0_p) - 4d0*(b_p+2d0*x0_p)/( (b_p+2d0*x)**2 + q_p**2) - dxdx_p/x_p ) ) + + decdra_p = drsdra*dxdrs*decdx_p + + Fc(mu,nu,1) = Fc(mu,nu,1) + weight(iG)*AO(mu,iG)*AO(nu,iG)*(ec_p + decdra_p*r) + + end if + + end do + end do + end do + +end subroutine RVWN5_lda_correlation_potential diff --git a/src/eDFT/lda_correlation_energy.f90 b/src/eDFT/lda_correlation_energy.f90 index b5c96d0..b82100f 100644 --- a/src/eDFT/lda_correlation_energy.f90 +++ b/src/eDFT/lda_correlation_energy.f90 @@ -44,11 +44,11 @@ subroutine lda_correlation_energy(DFA,nEns,wEns,nGrid,weight,rho,Ec) call C16_lda_correlation_energy(nGrid,weight(:),rho(:,:),Ec(:)) -! Loos-Fromager weight-dependent correlation functional: Loos and Fromager (in preparation) +! Restricted version of the Marut-Fromager-Loos weight-dependent correlation functional - case ('LF19') + case ('RMFL20') - call LF19_lda_correlation_energy(nEns,wEns(:),nGrid,weight(:),rho(:,:),Ec(:)) + call RMFL20_lda_correlation_energy(nEns,wEns(:),nGrid,weight(:),rho(:,:),Ec(:)) case default diff --git a/src/eDFT/lda_correlation_potential.f90 b/src/eDFT/lda_correlation_potential.f90 index f6a6b15..6172ce5 100644 --- a/src/eDFT/lda_correlation_potential.f90 +++ b/src/eDFT/lda_correlation_potential.f90 @@ -48,11 +48,11 @@ include 'parameters.h' call C16_lda_correlation_potential(nGrid,weight(:),nBas,AO(:,:),rho(:,:),Fc(:,:,:)) -! Loos-Fromager weight-dependent correlation functional: Loos and Fromager (in preparation) +! Restricted version of the Marut-Fromager-Loos weight-dependent correlation functional - case ('LF19') + case ('RMFL20') - call LF19_lda_correlation_potential(nEns,wEns(:),nGrid,weight(:),nBas,AO(:,:),rho(:,:),Fc(:,:,:)) + call RMFL20_lda_correlation_potential(nEns,wEns(:),nGrid,weight(:),nBas,AO(:,:),rho(:,:),Fc(:,:,:)) case default