10
1
mirror of https://github.com/pfloos/quack synced 2024-11-03 20:53:53 +01:00

adding Ncentered for correlation

This commit is contained in:
Pierre-Francois Loos 2021-10-14 10:38:53 +02:00
parent 09c43513e5
commit e6ae8b0001
9 changed files with 39 additions and 23 deletions

View File

@ -61,7 +61,6 @@ subroutine US51_lda_exchange_individual_energy(nGrid,weight,rhow,rho,doNcentered
endif
Ex = Exrr + ExrI + ExrrI
end subroutine US51_lda_exchange_individual_energy

View File

@ -1,4 +1,4 @@
subroutine UVWN3_lda_correlation_individual_energy(nGrid,weight,rhow,rho,Ec)
subroutine UVWN3_lda_correlation_individual_energy(nGrid,weight,rhow,rho,doNcentered,kappa,Ec)
! Compute VWN3 LDA correlation potential
@ -12,6 +12,8 @@ subroutine UVWN3_lda_correlation_individual_energy(nGrid,weight,rhow,rho,Ec)
double precision,intent(in) :: weight(nGrid)
double precision,intent(in) :: rhow(nGrid,nspin)
double precision,intent(in) :: rho(nGrid,nspin)
logical,intent(in) :: doNcentered
double precision,intent(in) :: kappa
! Local variables
@ -197,6 +199,10 @@ subroutine UVWN3_lda_correlation_individual_energy(nGrid,weight,rhow,rho,Ec)
end do
! De-scaling for N-centered
if(doNcentered) Ec(:) = kappa*Ec(:)
Ec(2) = Ec(2) - Ec(1) - Ec(3)
end subroutine UVWN3_lda_correlation_individual_energy

View File

@ -1,4 +1,4 @@
subroutine UVWN5_lda_correlation_individual_energy(nGrid,weight,rhow,rho,Ec)
subroutine UVWN5_lda_correlation_individual_energy(nGrid,weight,rhow,rho,doNcentered,kappa,Ec)
! Compute VWN5 LDA correlation potential
@ -12,6 +12,8 @@ subroutine UVWN5_lda_correlation_individual_energy(nGrid,weight,rhow,rho,Ec)
double precision,intent(in) :: weight(nGrid)
double precision,intent(in) :: rhow(nGrid,nspin)
double precision,intent(in) :: rho(nGrid,nspin)
logical,intent(in) :: doNcentered
double precision,intent(in) :: kappa
! Local variables
@ -197,6 +199,10 @@ subroutine UVWN5_lda_correlation_individual_energy(nGrid,weight,rhow,rho,Ec)
end do
! De-scaling for N-centered
if(doNcentered) Ec(:) = kappa*Ec(:)
Ec(2) = Ec(2) - Ec(1) - Ec(3)
end subroutine UVWN5_lda_correlation_individual_energy

View File

@ -140,11 +140,8 @@ subroutine read_options_dft(nBas,method,x_rung,x_DFA,c_rung,c_DFA,SGn,nEns,wEns,
wEns(2) = (nEl(1)/nEl(2))*wEns(2)
wEns(3) = (nEl(1)/nEl(3))*wEns(3)
else
! wEns(1) = 1d0 - nEl(2)/nEl(1)*wEns(2) - nEl(3)/nEl(1)*wEns(3)
wEns(1) = 1d0 - wEns(2) - wEns(3)
end if

View File

@ -1,4 +1,4 @@
subroutine unrestricted_correlation_derivative_discontinuity(rung,DFA,nEns,wEns,nGrid,weight,rhow,drhow,Ec)
subroutine unrestricted_correlation_derivative_discontinuity(rung,DFA,nEns,wEns,nGrid,weight,rhow,drhow,kappa,Ec)
! Compute the correlation part of the derivative discontinuity
@ -15,6 +15,7 @@ subroutine unrestricted_correlation_derivative_discontinuity(rung,DFA,nEns,wEns,
double precision,intent(in) :: weight(nGrid)
double precision,intent(in) :: rhow(nGrid,nspin)
double precision,intent(in) :: drhow(ncart,nGrid,nspin)
double precision,intent(in) :: kappa(nEns)
! Local variables

View File

@ -1,4 +1,5 @@
subroutine unrestricted_correlation_individual_energy(rung,DFA,LDA_centered,nEns,wEns,nGrid,weight,rhow,drhow,rho,drho,Ec)
subroutine unrestricted_correlation_individual_energy(rung,DFA,LDA_centered,nEns,wEns,nGrid,weight,rhow,drhow,rho,drho, &
doNcentered,kappa,Ec)
! Compute the correlation energy of individual states
@ -18,6 +19,8 @@ subroutine unrestricted_correlation_individual_energy(rung,DFA,LDA_centered,nEns
double precision,intent(in) :: drhow(ncart,nGrid,nspin)
double precision,intent(in) :: rho(nGrid,nspin)
double precision,intent(in) :: drho(ncart,nGrid,nspin)
logical,intent(in) :: doNcentered
double precision,intent(in) :: kappa
! Local variables
@ -41,7 +44,8 @@ subroutine unrestricted_correlation_individual_energy(rung,DFA,LDA_centered,nEns
case(1)
call unrestricted_lda_correlation_individual_energy(DFA,LDA_centered,nEns,wEns,nGrid,weight,rhow,rho,Ec)
call unrestricted_lda_correlation_individual_energy(DFA,LDA_centered,nEns,wEns,nGrid,weight,rhow,rho, &
doNcentered,kappa,Ec)
! GGA functionals

View File

@ -124,15 +124,15 @@ subroutine unrestricted_individual_energy(x_rung,x_DFA,c_rung,c_DFA,LDA_centered
if(doNcentered) then
EJ(1,iEns) = kappa(iEns)*trace_matrix(nBas,matmul(P(:,:,1,iEns),J(:,:,1))) &
-0.5d0*kappa(iEns)*kappa(iEns)*trace_matrix(nBas,matmul(Pw(:,:,1),J(:,:,1)))
- 0.5d0*kappa(iEns)*kappa(iEns)*trace_matrix(nBas,matmul(Pw(:,:,1),J(:,:,1)))
EJ(2,iEns) = kappa(iEns)*trace_matrix(nBas,matmul(P(:,:,1,iEns),J(:,:,2))) &
+ kappa(iEns)*trace_matrix(nBas,matmul(P(:,:,2,iEns),J(:,:,1))) &
-0.5d0*kappa(iEns)*kappa(iEns)*trace_matrix(nBas,matmul(Pw(:,:,1),J(:,:,2))) &
- 0.5d0*kappa(iEns)*kappa(iEns)*trace_matrix(nBas,matmul(Pw(:,:,1),J(:,:,2))) &
- 0.5d0*kappa(iEns)*kappa(iEns)*trace_matrix(nBas,matmul(Pw(:,:,2),J(:,:,1)))
EJ(3,iEns) = kappa(iEns)*trace_matrix(nBas,matmul(P(:,:,2,iEns),J(:,:,2))) &
-0.5d0*kappa(iEns)*kappa(iEns)*trace_matrix(nBas,matmul(Pw(:,:,2),J(:,:,2)))
- 0.5d0*kappa(iEns)*kappa(iEns)*trace_matrix(nBas,matmul(Pw(:,:,2),J(:,:,2)))
else
@ -212,7 +212,7 @@ subroutine unrestricted_individual_energy(x_rung,x_DFA,c_rung,c_DFA,LDA_centered
do iEns=1,nEns
call unrestricted_correlation_individual_energy(c_rung,c_DFA,LDA_centered,nEns,wEns,nGrid,weight, &
rhow,drhow,rho(:,:,iEns),drho(:,:,:,iEns),Ec(:,iEns))
rhow,drhow,rho(:,:,iEns),drho(:,:,:,iEns),kappa(iEns),Ec(:,iEns))
end do
!------------------------------------------------------------------------
@ -231,7 +231,7 @@ subroutine unrestricted_individual_energy(x_rung,x_DFA,c_rung,c_DFA,LDA_centered
rhow(:,ispin),drhow(:,:,ispin),Cx_choice,doNcentered,kappa,ExDD(ispin,:))
end do
call unrestricted_correlation_derivative_discontinuity(c_rung,c_DFA,nEns,wEns,nGrid,weight,rhow,drhow,EcDD)
call unrestricted_correlation_derivative_discontinuity(c_rung,c_DFA,nEns,wEns,nGrid,weight,rhow,drhow,kappa,EcDD)
ExcDD(1,:) = ExDD(1,:) + EcDD(1,:)
ExcDD(2,:) = EcDD(2,:)

View File

@ -1,4 +1,5 @@
subroutine unrestricted_lda_correlation_individual_energy(DFA,LDA_centered,nEns,wEns,nGrid,weight,rhow,rho,Ec)
subroutine unrestricted_lda_correlation_individual_energy(DFA,LDA_centered,nEns,wEns,nGrid,weight,rhow,rho, &
doNcentered,kappa,Ec)
! Compute LDA correlation energy for individual states
@ -15,6 +16,8 @@ subroutine unrestricted_lda_correlation_individual_energy(DFA,LDA_centered,nEns,
double precision,intent(in) :: weight(nGrid)
double precision,intent(in) :: rhow(nGrid,nspin)
double precision,intent(in) :: rho(nGrid,nspin)
logical,intent(in) :: doNcentered
double precision,intent(in) :: kappa
! Output variables
@ -28,11 +31,11 @@ subroutine unrestricted_lda_correlation_individual_energy(DFA,LDA_centered,nEns,
case ('VWN3')
call UVWN3_lda_correlation_individual_energy(nGrid,weight,rhow,rho,Ec)
call UVWN3_lda_correlation_individual_energy(nGrid,weight,rhow,rho,doNcentered,kappa,Ec)
case ('VWN5')
call UVWN5_lda_correlation_individual_energy(nGrid,weight,rhow,rho,Ec)
call UVWN5_lda_correlation_individual_energy(nGrid,weight,rhow,rho,doNcentered,kappa,Ec)
case default