4
1
mirror of https://github.com/pfloos/quack synced 2024-07-11 13:53:46 +02:00

fix eDFT for fractional spin

This commit is contained in:
Pierre-Francois Loos 2021-01-26 21:28:05 +01:00
parent 724284fe0c
commit e1bb48eac8
9 changed files with 28 additions and 37 deletions

View File

@ -6,7 +6,7 @@
# GGA = 2: RB88 # GGA = 2: RB88
# Hybrid = 4 # Hybrid = 4
# Hartree-Fock = 666 # Hartree-Fock = 666
1 S51 666 HF
# correlation rung: # correlation rung:
# Hartree = 0 # Hartree = 0
# LDA = 1: RVWN5,RMFL20 # LDA = 1: RVWN5,RMFL20
@ -19,20 +19,20 @@
# Number of states in ensemble (nEns) # Number of states in ensemble (nEns)
3 3
# occupation numbers of orbitals nO and nO+1 # occupation numbers of orbitals nO and nO+1
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
# Ensemble weights: wEns(1),...,wEns(nEns-1) # Ensemble weights: wEns(1),...,wEns(nEns-1)
0.00 1.00 0.25 0.0
# N-centered? # N-centered?
T F
# Parameters for CC weight-dependent exchange functional # Parameters for CC weight-dependent exchange functional
0.445525 0.0901503 -0.286898 0.0 0.0 0.0
0.191734 -0.0364788 -0.017035 0.0 0.0 0.0
# choice of UCC exchange coefficient : 1 for Cx1, 2 for Cx2, 3 for Cx1*Cx2 # choice of UCC exchange coefficient : 1 for Cx1, 2 for Cx2, 3 for Cx1*Cx2
2 2

View File

@ -1,11 +1,11 @@
# RHF UHF KS MOM # RHF UHF KS MOM
T F F F F F T F
# MP2* MP3 MP2-F12 # MP2* MP3 MP2-F12
F F F F F F
# CCD DCD CCSD CCSD(T) # CCD DCD CCSD CCSD(T)
F F F F F F F F
# drCCD rCCD lCCD pCCD # drCCD rCCD lCCD pCCD
F F F T F F F F
# CIS* CIS(D) CID CISD # CIS* CIS(D) CID CISD
F F F F F F F F
# RPA* RPAx* ppRPA # RPA* RPAx* ppRPA

View File

@ -1,11 +1,11 @@
# HF: maxSCF thresh DIIS n_diis guess_type ortho_type mix_guess # HF: maxSCF thresh DIIS n_diis guess_type ortho_type mix_guess
128 0.0000001 T 5 1 1 T 128 0.000001 T 5 1 1 F
# MP: # MP:
# CC: maxSCF thresh DIIS n_diis # CC: maxSCF thresh DIIS n_diis
64 0.00001 T 5 64 0.00001 T 5
# spin: TDA singlet triplet spin_conserved spin_flip # spin: TDA singlet triplet spin_conserved spin_flip
F T T T F T T T T T
# GF: maxSCF thresh DIIS n_diis lin eta renorm # GF: maxSCF thresh DIIS n_diis lin eta renorm
256 0.00001 T 5 T 0.0 3 256 0.00001 T 5 T 0.0 3
# GW/GT: maxSCF thresh DIIS n_diis lin eta COHSEX SOSEX TDA_W G0W GW0 # GW/GT: maxSCF thresh DIIS n_diis lin eta COHSEX SOSEX TDA_W G0W GW0
@ -13,6 +13,6 @@
# ACFDT: AC Kx XBS # ACFDT: AC Kx XBS
F F T F F T
# BSE: BSE dBSE dTDA evDyn # BSE: BSE dBSE dTDA evDyn
T F T F T T T F
# MCMP2: nMC nEq nWalk dt nPrint iSeed doDrift # MCMP2: nMC nEq nWalk dt nPrint iSeed doDrift
1000000 100000 10 0.3 10000 1234 T 1000000 100000 10 0.3 10000 1234 T

View File

@ -1,4 +1,4 @@
2 2
H 0.0 0.0 0.0 H 0.0 0.0 0.0
H 0.0 0.0 0.740848 H 0.0 0.0 0.741

View File

@ -4,7 +4,7 @@ subroutine eDFT(maxSCF,thresh,max_diis,guess_type,nNuc,ZNuc,rNuc,ENuc,nBas,nEl,n
! exchange-correlation density-functional theory calculations ! exchange-correlation density-functional theory calculations
use xc_f90_lib_m ! use xc_f90_lib_m
implicit none implicit none
include 'parameters.h' include 'parameters.h'
@ -92,8 +92,8 @@ subroutine eDFT(maxSCF,thresh,max_diis,guess_type,nNuc,ZNuc,rNuc,ENuc,nBas,nEl,n
! Libxc version ! Libxc version
call xc_f90_version(vmajor, vminor, vmicro) ! call xc_f90_version(vmajor, vminor, vmicro)
write(*,'("Libxc version: ",I1,".",I1,".",I1)') vmajor, vminor, vmicro ! write(*,'("Libxc version: ",I1,".",I1,".",I1)') vmajor, vminor, vmicro
! call xcinfo() ! call xcinfo()

View File

@ -337,7 +337,6 @@ subroutine eDFT_UKS(x_rung,x_DFA,c_rung,c_DFA,nEns,wEns,aCC_w1,aCC_w2,nGrid,weig
nEl(ispin) = electron_number(nGrid,weight,rhow(:,ispin)) nEl(ispin) = electron_number(nGrid,weight,rhow(:,ispin))
end do end do
! Dump results ! Dump results
write(*,'(1X,A1,1X,I3,1X,A1,1X,F16.10,1X,A1,1X,F16.10,1X,A1,1X,F16.10,1X,A1,1X,F10.6,1X,A1,1X,F10.6,1X,A1,1X)') & write(*,'(1X,A1,1X,I3,1X,A1,1X,F16.10,1X,A1,1X,F16.10,1X,A1,1X,F16.10,1X,A1,1X,F10.6,1X,A1,1X,F10.6,1X,A1,1X)') &
@ -364,12 +363,11 @@ subroutine eDFT_UKS(x_rung,x_DFA,c_rung,c_DFA,nEns,wEns,aCC_w1,aCC_w2,nGrid,weig
end if end if
!!!!! !!!!!
do iEns=1,nEns ! do iEns=1,nEns
print*,'occnum=',occnum(1,1,iEns),occnum(2,1,iEns),occnum(1,2,iEns),occnum(2,2,iEns) ! print*,'occnum=',occnum(1,1,iEns),occnum(2,1,iEns),occnum(1,2,iEns),occnum(2,2,iEns)
print*,'nel up and down and total=', electron_number(nGrid,weight,& ! print*,'nel up and down and total=', electron_number(nGrid,weight,&
rho(:,1,iEns)),electron_number(nGrid,weight,rho(:,2,iEns)),sum(nEl(:)) ! rho(:,1,iEns)),electron_number(nGrid,weight,rho(:,2,iEns)),sum(nEl(:))
! end do
end do
!!!!! !!!!!
! Compute final KS energy ! Compute final KS energy

View File

@ -114,6 +114,7 @@ subroutine read_options_dft(nBas,method,x_rung,x_DFA,c_rung,c_DFA,SGn,nEns,wEns,
write(*,*) (int(occnum(iBas,2,iEns)),iBas=1,nBas) write(*,*) (int(occnum(iBas,2,iEns)),iBas=1,nBas)
write(*,*) write(*,*)
end do end do
! Read ensemble weights for real physical (fractional number of electrons) ensemble (w1,w2) ! Read ensemble weights for real physical (fractional number of electrons) ensemble (w1,w2)
allocate(nEl(nEns)) allocate(nEl(nEns))
@ -123,8 +124,6 @@ subroutine read_options_dft(nBas,method,x_rung,x_DFA,c_rung,c_DFA,SGn,nEns,wEns,
nEl(iEns) = nEl(iEns) + occnum(iBas,1,iEns) + occnum(iBas,2,iEns) nEl(iEns) = nEl(iEns) + occnum(iBas,1,iEns) + occnum(iBas,2,iEns)
end do end do
end do end do
print*,'nEl'
print*,nEl
doNcentered = .false. doNcentered = .false.
@ -164,13 +163,13 @@ subroutine read_options_dft(nBas,method,x_rung,x_DFA,c_rung,c_DFA,SGn,nEns,wEns,
read(1,*) Cx_choice read(1,*) Cx_choice
write(*,*)'----------------------------------------------------------' write(*,*)'----------------------------------------------------------'
write(*,*)' parameters for w1-dependant exchange functional coefficient ' write(*,*)' parameters for w1-dependent exchange functional coefficient '
write(*,*)'----------------------------------------------------------' write(*,*)'----------------------------------------------------------'
call matout(3,1,aCC_w1) call matout(3,1,aCC_w1)
write(*,*) write(*,*)
write(*,*)'----------------------------------------------------------' write(*,*)'----------------------------------------------------------'
write(*,*)' parameters for w2-dependant exchange functional coefficient ' write(*,*)' parameters for w2-dependent exchange functional coefficient '
write(*,*)'----------------------------------------------------------' write(*,*)'----------------------------------------------------------'
call matout(3,1,aCC_w2) call matout(3,1,aCC_w2)
write(*,*) write(*,*)

View File

@ -20,6 +20,6 @@ subroutine unrestricted_fock_exchange_energy(nBas,P,Fx,Ex)
! Compute HF exchange energy ! Compute HF exchange energy
Ex = trace_matrix(nBas,matmul(P,Fx)) Ex = 0.5d0*trace_matrix(nBas,matmul(P,Fx))
end subroutine unrestricted_fock_exchange_energy end subroutine unrestricted_fock_exchange_energy

View File

@ -89,8 +89,6 @@ subroutine unrestricted_individual_energy(x_rung,x_DFA,c_rung,c_DFA,LDA_centered
kappa(iEns) = nEl(iEns)/nEl(1) kappa(iEns) = nEl(iEns)/nEl(1)
end do end do
print*,'test1'
!------------------------------------------------------------------------ !------------------------------------------------------------------------
! Kinetic energy ! Kinetic energy
!------------------------------------------------------------------------ !------------------------------------------------------------------------
@ -104,7 +102,6 @@ subroutine unrestricted_individual_energy(x_rung,x_DFA,c_rung,c_DFA,LDA_centered
end if end if
end do end do
end do end do
print*,'test2'
!------------------------------------------------------------------------ !------------------------------------------------------------------------
! Potential energy ! Potential energy
@ -120,7 +117,6 @@ subroutine unrestricted_individual_energy(x_rung,x_DFA,c_rung,c_DFA,LDA_centered
end do end do
end do end do
print*,'test3'
!------------------------------------------------------------------------ !------------------------------------------------------------------------
! Individual Hartree energy ! Individual Hartree energy
!------------------------------------------------------------------------ !------------------------------------------------------------------------
@ -145,7 +141,7 @@ subroutine unrestricted_individual_energy(x_rung,x_DFA,c_rung,c_DFA,LDA_centered
if(doNcentered) EJ(:,iEns) = kappa(iEns)*EJ(:,iEns) if(doNcentered) EJ(:,iEns) = kappa(iEns)*EJ(:,iEns)
end do end do
print*,'test4'
!------------------------------------------------------------------------ !------------------------------------------------------------------------
! Checking Hartree contributions for each individual states ! Checking Hartree contributions for each individual states
!------------------------------------------------------------------------ !------------------------------------------------------------------------
@ -174,8 +170,6 @@ subroutine unrestricted_individual_energy(x_rung,x_DFA,c_rung,c_DFA,LDA_centered
end do end do
end do end do
print*,'test5'
!------------------------------------------------------------------------ !------------------------------------------------------------------------
! Checking exchange contributions for each individual states ! Checking exchange contributions for each individual states
!------------------------------------------------------------------------ !------------------------------------------------------------------------