2021-11-24 10:25:48 +01:00
|
|
|
subroutine read_options_dft(nBas,method,x_rung,x_DFA,c_rung,c_DFA,SGn,nEns,wEns,nCC,aCC, &
|
2020-10-14 09:44:03 +02:00
|
|
|
doNcentered,occnum,Cx_choice)
|
2019-03-13 11:07:31 +01:00
|
|
|
|
|
|
|
! Read DFT options
|
|
|
|
|
|
|
|
implicit none
|
|
|
|
|
|
|
|
include 'parameters.h'
|
|
|
|
|
2020-09-11 11:55:04 +02:00
|
|
|
! Input variables
|
2021-11-24 10:25:48 +01:00
|
|
|
integer,intent(in) :: nBas
|
2020-09-11 11:55:04 +02:00
|
|
|
|
2019-03-13 11:07:31 +01:00
|
|
|
! Local variables
|
|
|
|
|
2020-09-11 11:55:04 +02:00
|
|
|
integer :: iBas
|
|
|
|
integer :: iEns
|
2021-11-24 10:25:48 +01:00
|
|
|
integer :: iCC
|
2020-09-11 11:55:04 +02:00
|
|
|
character(len=1) :: answer
|
|
|
|
double precision,allocatable :: nEl(:)
|
2021-11-24 10:25:48 +01:00
|
|
|
character(len=12) :: x_func
|
|
|
|
character(len=12) :: c_func
|
2019-03-13 11:07:31 +01:00
|
|
|
|
|
|
|
! Output variables
|
|
|
|
|
2020-06-23 15:59:19 +02:00
|
|
|
character(len=8),intent(out) :: method
|
2019-03-13 11:07:31 +01:00
|
|
|
integer,intent(out) :: x_rung,c_rung
|
2021-10-25 12:20:25 +02:00
|
|
|
integer,intent(out) :: x_DFA,c_DFA
|
2019-03-13 11:07:31 +01:00
|
|
|
integer,intent(out) :: SGn
|
2020-09-11 11:55:04 +02:00
|
|
|
integer,intent(out) :: nEns
|
2020-09-29 11:47:18 +02:00
|
|
|
logical,intent(out) :: doNcentered
|
2019-03-13 11:07:31 +01:00
|
|
|
double precision,intent(out) :: wEns(maxEns)
|
2021-11-24 10:25:48 +01:00
|
|
|
integer,intent(out) :: nCC
|
|
|
|
double precision,intent(out) :: aCC(maxCC,maxEns-1)
|
2020-09-11 11:55:04 +02:00
|
|
|
double precision,intent(out) :: occnum(nBas,nspin,maxEns)
|
2019-03-13 11:07:31 +01:00
|
|
|
|
2020-08-02 13:09:30 +02:00
|
|
|
integer,intent(out) :: Cx_choice
|
2019-03-13 11:07:31 +01:00
|
|
|
|
|
|
|
! Open file with method specification
|
|
|
|
|
2020-03-15 14:33:53 +01:00
|
|
|
open(unit=1,file='input/dft')
|
2019-03-13 11:07:31 +01:00
|
|
|
|
|
|
|
! Default values
|
|
|
|
|
2021-10-22 21:10:31 +02:00
|
|
|
method = 'eDFT-UKS'
|
2019-03-13 11:07:31 +01:00
|
|
|
x_rung = 1
|
|
|
|
c_rung = 1
|
2021-10-25 12:20:25 +02:00
|
|
|
x_DFA = 1
|
|
|
|
c_DFA = 1
|
2019-03-13 11:07:31 +01:00
|
|
|
SGn = 0
|
|
|
|
wEns(:) = 0d0
|
|
|
|
|
2020-03-15 08:23:01 +01:00
|
|
|
! Restricted or unrestricted calculation
|
|
|
|
|
|
|
|
read(1,*)
|
|
|
|
read(1,*) method
|
|
|
|
|
2021-10-25 12:20:25 +02:00
|
|
|
!---------------------------------------!
|
|
|
|
! EXCHANGE: read rung of Jacob's ladder !
|
|
|
|
!---------------------------------------!
|
2019-03-13 11:07:31 +01:00
|
|
|
|
2020-03-17 11:29:20 +01:00
|
|
|
read(1,*)
|
|
|
|
read(1,*)
|
|
|
|
read(1,*)
|
|
|
|
read(1,*)
|
|
|
|
read(1,*)
|
2019-03-13 11:07:31 +01:00
|
|
|
read(1,*)
|
2021-10-25 12:20:25 +02:00
|
|
|
read(1,*) x_rung,x_func
|
2019-03-13 11:07:31 +01:00
|
|
|
|
2021-10-25 12:20:25 +02:00
|
|
|
select case (x_rung) ! exchange functionals
|
|
|
|
|
|
|
|
case (0) ! Hartree
|
|
|
|
|
|
|
|
select case (x_func)
|
|
|
|
|
|
|
|
case ('H')
|
|
|
|
|
|
|
|
x_DFA = 1
|
|
|
|
|
|
|
|
case default
|
|
|
|
|
|
|
|
call print_warning('!!! Hartree exchange functional not available !!!')
|
|
|
|
stop
|
|
|
|
|
|
|
|
end select
|
|
|
|
|
|
|
|
case (1) ! LDA
|
|
|
|
|
|
|
|
select case (x_func)
|
|
|
|
|
|
|
|
case ('S51')
|
|
|
|
|
|
|
|
x_DFA = 1
|
|
|
|
|
|
|
|
case ('CC-S51')
|
|
|
|
|
|
|
|
x_DFA = 2
|
|
|
|
|
|
|
|
case default
|
|
|
|
|
|
|
|
call print_warning('!!! LDA exchange functional not available !!!')
|
|
|
|
stop
|
|
|
|
|
|
|
|
end select
|
|
|
|
|
|
|
|
case (2) ! GGA
|
|
|
|
|
|
|
|
select case (x_func)
|
|
|
|
|
|
|
|
case ('G96')
|
|
|
|
|
|
|
|
x_DFA = 1
|
|
|
|
|
|
|
|
case ('B88')
|
|
|
|
|
|
|
|
x_DFA = 2
|
|
|
|
|
|
|
|
case ('PBE')
|
|
|
|
|
|
|
|
x_DFA = 3
|
|
|
|
|
|
|
|
case default
|
|
|
|
|
|
|
|
call print_warning('!!! GGA exchange functional not available !!!')
|
|
|
|
stop
|
|
|
|
|
|
|
|
end select
|
|
|
|
|
|
|
|
case (3) ! MGGA
|
|
|
|
|
|
|
|
select case (x_func)
|
|
|
|
|
|
|
|
case default
|
|
|
|
|
|
|
|
call print_warning('!!! MGGA exchange functional not available !!!')
|
|
|
|
stop
|
|
|
|
|
|
|
|
end select
|
|
|
|
|
|
|
|
case (4) ! Hybrid
|
|
|
|
|
|
|
|
select case (x_func)
|
|
|
|
|
|
|
|
case ('HF')
|
|
|
|
|
|
|
|
x_DFA = 1
|
|
|
|
|
|
|
|
case ('B3LYP')
|
|
|
|
|
|
|
|
x_DFA = 2
|
|
|
|
|
|
|
|
case ('BHHLYP')
|
|
|
|
|
|
|
|
x_DFA = 3
|
|
|
|
|
|
|
|
case ('PBE')
|
|
|
|
|
|
|
|
x_DFA = 4
|
|
|
|
|
|
|
|
case default
|
|
|
|
|
|
|
|
call print_warning('!!! Hybrid exchange functional not available !!!')
|
|
|
|
stop
|
|
|
|
|
|
|
|
end select
|
|
|
|
|
|
|
|
case default
|
|
|
|
|
|
|
|
call print_warning('!!! Exchange rung not available !!!')
|
|
|
|
stop
|
|
|
|
|
|
|
|
end select
|
|
|
|
|
|
|
|
! Select rung for exchange
|
|
|
|
|
|
|
|
write(*,*)
|
|
|
|
write(*,*) '*******************************************************************'
|
|
|
|
write(*,*) '* Exchange rung *'
|
|
|
|
write(*,*) '*******************************************************************'
|
|
|
|
|
|
|
|
call select_rung(x_rung,x_func)
|
|
|
|
|
|
|
|
!------------------------------------------!
|
|
|
|
! CORRELATION: read rung of Jacob's ladder !
|
|
|
|
!------------------------------------------!
|
2019-03-13 11:07:31 +01:00
|
|
|
|
2020-03-17 11:29:20 +01:00
|
|
|
read(1,*)
|
|
|
|
read(1,*)
|
|
|
|
read(1,*)
|
|
|
|
read(1,*)
|
|
|
|
read(1,*)
|
2019-03-13 11:07:31 +01:00
|
|
|
read(1,*)
|
2021-10-25 12:20:25 +02:00
|
|
|
read(1,*) c_rung,c_func
|
|
|
|
|
|
|
|
select case (c_rung) ! correlation functionals
|
|
|
|
|
|
|
|
case (0) ! Hartree
|
|
|
|
|
|
|
|
select case (c_func)
|
|
|
|
|
|
|
|
case ('H')
|
|
|
|
|
|
|
|
c_DFA = 1
|
|
|
|
|
|
|
|
case default
|
|
|
|
|
|
|
|
call print_warning('!!! Hartree correlation functional not available !!!')
|
|
|
|
stop
|
|
|
|
|
|
|
|
end select
|
|
|
|
|
|
|
|
case (1) ! LDA
|
|
|
|
|
|
|
|
select case (c_func)
|
|
|
|
|
|
|
|
case ('W38')
|
|
|
|
|
|
|
|
c_DFA = 1
|
|
|
|
|
|
|
|
case ('PW92')
|
|
|
|
|
|
|
|
c_DFA = 2
|
|
|
|
|
|
|
|
case ('VWN3')
|
|
|
|
|
|
|
|
c_DFA = 3
|
|
|
|
|
|
|
|
case ('VWN5')
|
|
|
|
|
|
|
|
c_DFA = 4
|
|
|
|
|
|
|
|
case ('eVWN5')
|
|
|
|
|
|
|
|
c_DFA = 5
|
|
|
|
|
|
|
|
case default
|
|
|
|
|
|
|
|
call print_warning('!!! LDA correlation functional not available !!!')
|
|
|
|
stop
|
|
|
|
|
|
|
|
end select
|
|
|
|
|
|
|
|
case (2) ! GGA
|
|
|
|
|
|
|
|
select case (c_func)
|
|
|
|
|
|
|
|
case ('LYP')
|
|
|
|
|
|
|
|
c_DFA = 1
|
|
|
|
|
|
|
|
case ('PBE')
|
|
|
|
|
|
|
|
c_DFA = 2
|
|
|
|
|
|
|
|
case default
|
|
|
|
|
|
|
|
call print_warning('!!! GGA correlation functional not available !!!')
|
|
|
|
stop
|
|
|
|
|
|
|
|
end select
|
|
|
|
|
|
|
|
case (3) ! MGGA
|
|
|
|
|
|
|
|
select case (c_func)
|
|
|
|
|
|
|
|
case default
|
|
|
|
|
|
|
|
call print_warning('!!! MGGA correlation functional not available !!!')
|
|
|
|
stop
|
|
|
|
|
|
|
|
end select
|
|
|
|
|
|
|
|
case (4) ! Hybrid
|
|
|
|
|
|
|
|
select case (c_func)
|
|
|
|
|
|
|
|
case ('HF')
|
|
|
|
|
|
|
|
c_DFA = 1
|
|
|
|
|
|
|
|
case ('B3LYP')
|
|
|
|
|
|
|
|
c_DFA = 2
|
|
|
|
|
|
|
|
case ('BHHLYP')
|
|
|
|
|
|
|
|
c_DFA = 3
|
|
|
|
|
|
|
|
case ('PBE')
|
|
|
|
|
|
|
|
c_DFA = 4
|
|
|
|
|
|
|
|
case default
|
|
|
|
|
|
|
|
call print_warning('!!! Hybrid correlation functional not available !!!')
|
|
|
|
stop
|
|
|
|
|
|
|
|
end select
|
|
|
|
|
|
|
|
case default
|
|
|
|
|
|
|
|
call print_warning('!!! Correlation rung not available !!!')
|
|
|
|
stop
|
|
|
|
|
|
|
|
end select
|
|
|
|
|
|
|
|
! Select rung for correlation
|
|
|
|
|
|
|
|
write(*,*)
|
|
|
|
write(*,*) '*******************************************************************'
|
|
|
|
write(*,*) '* Correlation rung *'
|
|
|
|
write(*,*) '*******************************************************************'
|
|
|
|
|
|
|
|
call select_rung(c_rung,c_func)
|
2019-03-13 11:07:31 +01:00
|
|
|
|
|
|
|
! Read SG-n grid
|
|
|
|
|
|
|
|
read(1,*)
|
|
|
|
read(1,*) SGn
|
|
|
|
|
|
|
|
! Read number of states in ensemble
|
|
|
|
|
|
|
|
read(1,*)
|
|
|
|
read(1,*) nEns
|
|
|
|
|
|
|
|
if(nEns.gt.maxEns) then
|
|
|
|
write(*,*) ' Number of states in ensemble too big!! '
|
|
|
|
stop
|
|
|
|
endif
|
|
|
|
|
|
|
|
write(*,*)'----------------------------------------------------------'
|
|
|
|
write(*,'(A33,I3)')' Number of states in ensemble = ',nEns
|
|
|
|
write(*,*)'----------------------------------------------------------'
|
|
|
|
write(*,*)
|
|
|
|
|
2020-09-11 11:55:04 +02:00
|
|
|
! Read occupation numbers for orbitals nO and nO+1
|
2020-08-01 11:45:17 +02:00
|
|
|
|
2020-09-11 11:55:04 +02:00
|
|
|
occnum(:,:,:) = 0d0
|
|
|
|
|
2021-02-15 17:27:06 +01:00
|
|
|
do iEns=1,maxEns
|
2020-09-11 11:55:04 +02:00
|
|
|
read(1,*)
|
|
|
|
read(1,*) (occnum(iBas,1,iEns),iBas=1,nBas)
|
|
|
|
read(1,*) (occnum(iBas,2,iEns),iBas=1,nBas)
|
|
|
|
end do
|
|
|
|
|
|
|
|
do iEns=1,nEns
|
|
|
|
write(*,*)
|
|
|
|
write(*,*) '==============='
|
|
|
|
write(*,*) 'State n.',iEns
|
|
|
|
write(*,*) '==============='
|
|
|
|
write(*,*)
|
|
|
|
write(*,*) 'Spin-up occupation numbers'
|
|
|
|
write(*,*) (int(occnum(iBas,1,iEns)),iBas=1,nBas)
|
|
|
|
write(*,*) 'Spin-down occupation numbers'
|
|
|
|
write(*,*) (int(occnum(iBas,2,iEns)),iBas=1,nBas)
|
|
|
|
write(*,*)
|
|
|
|
end do
|
2021-01-26 21:28:05 +01:00
|
|
|
|
2020-08-01 11:45:17 +02:00
|
|
|
! Read ensemble weights for real physical (fractional number of electrons) ensemble (w1,w2)
|
2020-09-11 11:55:04 +02:00
|
|
|
|
2021-02-15 17:27:06 +01:00
|
|
|
allocate(nEl(maxEns))
|
2020-09-11 11:55:04 +02:00
|
|
|
nEl(:) = 0d0
|
2021-02-15 17:27:06 +01:00
|
|
|
do iEns=1,maxEns
|
2020-09-11 11:55:04 +02:00
|
|
|
do iBas=1,nBas
|
|
|
|
nEl(iEns) = nEl(iEns) + occnum(iBas,1,iEns) + occnum(iBas,2,iEns)
|
|
|
|
end do
|
|
|
|
end do
|
2020-09-29 11:47:18 +02:00
|
|
|
|
|
|
|
doNcentered = .false.
|
2020-09-11 11:55:04 +02:00
|
|
|
|
2019-03-13 11:07:31 +01:00
|
|
|
read(1,*)
|
2020-09-11 11:55:04 +02:00
|
|
|
read(1,*) (wEns(iEns),iEns=2,nEns)
|
2020-08-02 13:09:30 +02:00
|
|
|
read(1,*)
|
2020-09-29 11:47:18 +02:00
|
|
|
read(1,*) answer
|
|
|
|
|
|
|
|
if(answer == 'T') doNcentered = .true.
|
2020-09-11 11:55:04 +02:00
|
|
|
|
2021-10-22 21:10:31 +02:00
|
|
|
wEns(1) = 1d0
|
|
|
|
do iEns=2,nEns
|
|
|
|
wEns(1) = wEns(1) - wEns(iEns)
|
|
|
|
end do
|
2021-10-13 18:06:16 +02:00
|
|
|
|
2021-10-22 21:10:31 +02:00
|
|
|
if (doNcentered) then
|
2020-09-11 11:55:04 +02:00
|
|
|
|
2021-10-22 21:10:31 +02:00
|
|
|
do iEns=2,nEns
|
2021-11-24 14:09:12 +01:00
|
|
|
if(nEl(iEns) > 0d0) then
|
|
|
|
wEns(iEns) = (nEl(1)/nEl(iEns))*wEns(iEns)
|
|
|
|
else
|
|
|
|
wEns(iENs) = 0d0
|
|
|
|
end if
|
2021-10-22 21:10:31 +02:00
|
|
|
end do
|
2020-09-11 11:55:04 +02:00
|
|
|
|
2020-08-02 13:09:30 +02:00
|
|
|
end if
|
2020-09-11 11:55:04 +02:00
|
|
|
|
2019-03-13 11:07:31 +01:00
|
|
|
write(*,*)'----------------------------------------------------------'
|
|
|
|
write(*,*)' Ensemble weights '
|
|
|
|
write(*,*)'----------------------------------------------------------'
|
|
|
|
call matout(nEns,1,wEns)
|
|
|
|
write(*,*)
|
2020-07-02 15:40:30 +02:00
|
|
|
|
|
|
|
! Read parameters for weight-dependent functional
|
|
|
|
read(1,*)
|
2021-11-24 10:25:48 +01:00
|
|
|
read(1,*) nCC
|
|
|
|
do iEns=2,nEns
|
|
|
|
read(1,*) (aCC(iCC,iEns-1),iCC=1,nCC)
|
|
|
|
end do
|
|
|
|
|
2020-08-02 13:09:30 +02:00
|
|
|
! Read choice of exchange coefficient
|
|
|
|
read(1,*)
|
|
|
|
read(1,*) Cx_choice
|
2020-07-02 15:40:30 +02:00
|
|
|
|
2020-07-02 22:15:29 +02:00
|
|
|
write(*,*)'----------------------------------------------------------'
|
2021-11-24 10:25:48 +01:00
|
|
|
write(*,*)' Parameters for weight-dependent exchange functional '
|
2020-07-02 22:15:29 +02:00
|
|
|
write(*,*)'----------------------------------------------------------'
|
2021-11-24 10:25:48 +01:00
|
|
|
do iEns=2,nEns
|
|
|
|
write(*,'(A6,I2,A2)') 'State ',iEns,':'
|
|
|
|
do iCC=1,nCC
|
|
|
|
write(*,'(I2,F10.6)') iCC,aCC(iCC,iEns-1)
|
|
|
|
end do
|
|
|
|
end do
|
2020-07-02 22:15:29 +02:00
|
|
|
write(*,*)
|
|
|
|
|
2019-03-13 11:07:31 +01:00
|
|
|
! Close file with options
|
|
|
|
|
2020-03-15 14:33:53 +01:00
|
|
|
close(unit=1)
|
2019-03-13 11:07:31 +01:00
|
|
|
|
2020-10-01 23:05:23 +02:00
|
|
|
end subroutine read_options_dft
|