XClib - funct into XClib - atomic

This commit is contained in:
fabrizio22 2020-10-09 12:27:56 +02:00
parent 499af8a6be
commit b19c3518ed
14 changed files with 56 additions and 49 deletions

View File

@ -770,7 +770,7 @@ CONTAINS
!
SUBROUTINE compute_onecenter_energy ( totenergy_, veff_, &
pawset_, vcharge_, nlcc_, ccharge_, nspin_, iint, vloc, energies_ , unit_)
USE funct, ONLY: dft_is_gradient
USE xc_interfaces, ONLY: xclib_dft_is
USE radial_grids, ONLY: hartree
USE io_global, ONLY : stdout, ionode
IMPLICIT NONE
@ -855,7 +855,7 @@ CONTAINS
aux(i)=exc * rhovtot(i)
END IF
END DO
IF (dft_is_gradient()) THEN
IF (xclib_dft_is('gradient')) THEN
IF (nlcc_) THEN
CALL vxcgc(ndmx,pawset_%grid%mesh,nspin_,pawset_%grid%r,&
pawset_%grid%r2,vcharge_,ccharge_,vgc,egc, &

View File

@ -420,8 +420,7 @@ subroutine dvxc_dn(mesh, rho, dvxc)
! compute the derivative of xc-potential w.r.t local density.
! some routine in PH and flibs will be called
!
use funct, only : dft_is_gradient
use xc_interfaces, only : dmxc, xclib_set_threshold
use xc_interfaces, only : dmxc, xclib_set_threshold, xclib_dft_is
!
implicit none
!
@ -437,7 +436,7 @@ subroutine dvxc_dn(mesh, rho, dvxc)
!
!
!
if ( dft_is_gradient() ) &
if ( xclib_dft_is('gradient') ) &
call errore ('dvxc_dn', 'gradient correction to dvxc not yet implemented', 1)
!
! LDA only

View File

@ -18,7 +18,7 @@ subroutine elsd ( zed, grid, rho, vxt, vh, vxc, exc, excgga, nwf,&
use kinds, only : DP
use constants, only: fpi
use radial_grids, only: ndmx, radial_grid_type
use funct, only: get_iexch, dft_is_meta
use xc_interfaces, only: xclib_get_id, xclib_dft_is
use ld1inc, only: vx, noscf, tau, vtau
implicit none
integer, intent(in) :: nwf, nspin
@ -34,10 +34,10 @@ subroutine elsd ( zed, grid, rho, vxt, vh, vxc, exc, excgga, nwf,&
logical:: oep, meta, kli
if (noscf) return
oep = get_iexch().eq.4
kli = get_iexch().eq.10
oep = xclib_get_id('LDA','EXCH').eq.4
kli = xclib_get_id('LDA','EXCH').eq.10
meta = dft_is_meta()
meta = xclib_dft_is('meta')
allocate(f1(grid%mesh),stat=ierr)
allocate(f2(grid%mesh),stat=ierr)

View File

@ -23,7 +23,7 @@ subroutine elsdps
etots, pseudotype, phits, ikk, nbeta, betas, bmat, &
nwfts, rel, jjts, llts, octs, enlts, jjs, lls, &
vxc, exc, excgga
use funct, only : dft_is_gradient
use xc_interfaces, only: xclib_dft_is
implicit none
real(DP) :: &
excc, vxcc(2), & ! exch-corr energy from core charge
@ -70,7 +70,7 @@ subroutine elsdps
call vxc_t(lsd,rh0,rhc,excc,vxcc)
exccc(i) = excc*rhoc(i)
enddo
if (dft_is_gradient()) then
if (xclib_dft_is('gradient')) then
allocate(rho_aux(ndmx,2), stat=ierr)
allocate(vgc(ndmx,2),stat=ierr)
allocate(egc(ndmx),stat=ierr)

View File

@ -19,7 +19,8 @@ subroutine elsdps_paw( )
use ld1inc, only : nlcc, grid, nspin, rhoc, lsd, &
encl, ehrt, ecxc, evxt, ekin, ecc, epseu, &
nwfts, enlts, octs, paw_energy
use funct, only : dft_is_gradient
use xc_interfaces, only : xclib_dft_is
!
implicit none
real(DP) :: &
excc, vxcc(2), & ! exch-corr energy from core charge
@ -55,7 +56,7 @@ subroutine elsdps_paw( )
call vxc_t(lsd,rh0,rhc,excc,vxcc)
exccc(i) = excc*rhoc(i)
enddo
if (dft_is_gradient()) then
if (xclib_dft_is('gradient')) then
allocate(rho_aux(ndmx,2), stat=ierr)
allocate(vgc(ndmx,2),stat=ierr)
allocate(egc(ndmx),stat=ierr)

View File

@ -24,7 +24,9 @@ SUBROUTINE ld1_setup
nwfs, lls, jjs, els, isws, ocs, &
nwfts, nnts, llts, jjts, elts, iswts, octs, nstoaets, &
nwftsc, nntsc, lltsc, jjtsc, eltsc, iswtsc, octsc, nstoaec, lpaw
USE funct, ONLY : get_iexch, dft_is_meta, start_exx, dft_is_nonlocc
USE funct, ONLY : dft_is_nonlocc
USE xc_interfaces, ONLY : xclib_get_id, xclib_dft_is, start_exx
!
IMPLICIT NONE
INTEGER :: n, n1, nc
@ -32,16 +34,16 @@ SUBROUTINE ld1_setup
real(DP) :: ocs_loc
!
!
meta = dft_is_meta()
meta = xclib_dft_is('meta')
IF ( meta .and. rel > 1 ) &
CALL errore('ld1_setup','meta-GGA not implemented for fully-relativistic case', 1)
IF ( meta .and. lsd == 1 ) &
CALL errore('ld1_setup','meta-GGA not implemented for LSDA', 2)
IF ( meta .and. iswitch > 1 ) &
CALL errore('ld1_setup','meta-GGA implemented only for all-electron case', 3)
hf = get_iexch()==5
hf = xclib_get_id('LDA','EXCH')==5
IF (hf) CALL errore('ld1_setup','HF not implemented yet',1)
oep = get_iexch()==4
oep = xclib_get_id('LDA','EXCH')==4
IF (oep.and.iswitch>1) &
CALL errore('ld1_setup','OEP is implemented only for all-electron calc.',1)
IF (oep.and.rel>0) &

View File

@ -112,7 +112,8 @@ subroutine write_rrkj (iunps)
els, nns, lls, rcut, rcutus, betas, phis, grid, &
nwfs, nbeta, bmat, qq, qvan, ikk, rhoc, rhos, &
vpsloc, ocs, rcloc
use funct, only: get_iexch, get_icorr, get_igcx, get_igcc, dft_is_nonlocc
use funct, only: dft_is_nonlocc
use xc_interfaces, only: xclib_get_id
implicit none
!
integer, intent(in):: iunps ! I/O unit
@ -136,10 +137,10 @@ subroutine write_rrkj (iunps)
else
write( iunps, '(2l5)',err=100, iostat=ios ) .false., nlcc
endif
iexch = get_iexch()
icorr = get_icorr()
igcx = get_igcx()
igcc = get_igcc()
iexch = xclib_get_id('LDA','EXCH')
icorr = xclib_get_id('LDA','CORR')
igcx = xclib_get_id('GGA','EXCH')
igcc = xclib_get_id('GGA','CORR')
write( iunps, '(4i5)',err=100, iostat=ios ) iexch, icorr, igcx, igcc

View File

@ -16,7 +16,8 @@ subroutine new_potential &
use constants, only: fpi, e2
use radial_grids, only: radial_grid_type, hartree
use kinds, only : DP
use funct, only : get_iexch, dft_is_meta, dft_is_gradient
use xc_interfaces, only: xclib_get_id, xclib_dft_is
use ld1inc, only : nwf, vx, vxc, exc, excgga, tau, vtau
use kli, only : compute_kli_potential
implicit none
@ -34,11 +35,11 @@ subroutine new_potential &
if (mesh.ne.grid%mesh) &
call errore('new_potential','mesh dimension is not as expected',1)
gga = dft_is_gradient()
meta = dft_is_meta()
gga = xclib_dft_is('gradient')
meta = xclib_dft_is('meta')
oep = get_iexch().eq.4
kli_= get_iexch().eq.10
oep = xclib_get_id('LDA','EXCH').eq.4
kli_= xclib_get_id('LDA','EXCH').eq.10
nspin = 1
if (lsd.eq.1) nspin = 2

View File

@ -13,7 +13,7 @@ SUBROUTINE scf(ic)
! self-interaction-correction allowed
!
USE kinds, ONLY : dp
USE funct, ONLY : dft_is_meta
USE xc_interfaces, ONLY : xclib_dft_is
USE radial_grids, ONLY : ndmx
USE constants, ONLY: e2
USE ld1inc, ONLY : grid, zed, psi, isic, vpot, vh, vxt, rho, iter, &
@ -31,7 +31,7 @@ SUBROUTINE scf(ic)
real(DP), PARAMETER :: thresh=1.0e-10_dp
!
!
meta = dft_is_meta()
meta = xclib_dft_is('meta')
ze2 = - zed * e2
rhoc1=0.0_dp
IF (.not.frozen_core.or.ic==1) psi=0.0_dp

View File

@ -16,7 +16,7 @@ subroutine sic_correction(n,vhn1,vhn2,egc)
use radial_grids, only : ndmx
use constants, only: e2, fpi
use ld1inc, only : nspin, lsd, rel, nlcc, rhoc, grid, psi
use funct, only: dft_is_gradient
use xc_interfaces, only : xclib_dft_is
use radial_grids, only: hartree
implicit none
integer :: n
@ -31,7 +31,7 @@ subroutine sic_correction(n,vhn1,vhn2,egc)
vhn1=0.0_dp
vhn2=0.0_dp
gga=dft_is_gradient()
gga=xclib_dft_is('gradient')
nspin=1
if (lsd.eq.1) nspin=2
!

View File

@ -14,7 +14,7 @@ subroutine v_of_rho_at (rho,rhoc,vh,vxc,exc,excgga,vnew,nlcc,iflag)
use kinds, only : DP
use constants, only: fpi, e2
use radial_grids, only: ndmx, hartree
use funct, only : get_iexch, dft_is_gradient
use xc_interfaces, only: xclib_get_id, xclib_dft_is
use ld1inc, only : nwf, grid, vx, vxt, lsd, zed, enne, latt, nspin
implicit none
integer, intent(in) :: iflag
@ -34,8 +34,8 @@ subroutine v_of_rho_at (rho,rhoc,vh,vxc,exc,excgga,vnew,nlcc,iflag)
real(DP),allocatable:: vgc(:,:), egc(:), rhotot(:)
real(DP),allocatable:: dchi0(:,:)
gga=dft_is_gradient()
oep=get_iexch().eq.4
gga=xclib_dft_is('gradient')
oep=xclib_get_id('LDA','EXCH').eq.4
!
! compute hartree potential with the total charge
!

View File

@ -78,8 +78,8 @@ subroutine vxcgc( ndm, mesh, nspin, r, r2, rho, rhoc, vgc, egc, &
!
use kinds, only : DP
use constants, only : fpi, e2
use funct, only : dft_is_meta
use xc_interfaces, only : xc_gcx, xc_metagcx, xclib_set_threshold
use xc_interfaces, only : xc_gcx, xc_metagcx, xclib_set_threshold, &
xclib_dft_is
implicit none
integer, intent(in) :: ndm,mesh,nspin,iflag
real(DP), intent(in) :: r(mesh), r2(mesh), rho(ndm,2), rhoc(ndm)
@ -133,7 +133,7 @@ subroutine vxcgc( ndm, mesh, nspin, r, r2, rho, rhoc, vgc, egc, &
allocate( v1x_v(mesh,nspin), v2x_v(mesh,nspin) )
allocate( v1c_v(mesh,nspin), v2c_v(mesh,nspin) )
if (nspin==2) allocate( v2c_ud(mesh) )
if ( dft_is_meta() ) then
if ( xclib_dft_is('meta') ) then
np = 1
IF (nspin==2) np=3
allocate( v2cm_v(np,mesh,nspin) )
@ -142,7 +142,7 @@ subroutine vxcgc( ndm, mesh, nspin, r, r2, rho, rhoc, vgc, egc, &
!
if (nspin.eq.1) then
!
IF ( dft_is_meta () ) THEN
IF ( xclib_dft_is('meta') ) THEN
!
! meta-GGA case
!
@ -219,7 +219,7 @@ subroutine vxcgc( ndm, mesh, nspin, r, r2, rho, rhoc, vgc, egc, &
deallocate( v1x_v , v2x_v )
deallocate( v1c_v , v2c_v )
IF (nspin==2) deallocate( v2c_ud )
if ( dft_is_meta() ) then
if ( xclib_dft_is('meta') ) then
deallocate( v2cm_v, v3x_v, v3c_v )
endif
!
@ -241,7 +241,7 @@ subroutine vxcgc( ndm, mesh, nspin, r, r2, rho, rhoc, vgc, egc, &
! vgc(i,1)
enddo
enddo
IF ( dft_is_meta() ) vtau(:) = e2*vtau(:)
IF ( xclib_dft_is('meta') ) vtau(:) = e2*vtau(:)
deallocate(dh)
deallocate(h)

View File

@ -13,16 +13,18 @@ subroutine which_cpmd_dft &
(dft,mfxcx, mfxcc, mgcx, mgcc)
!-----------------------------------------------------------------------
!
use funct, only : get_iexch, get_icorr, get_igcx, get_igcc, set_dft_from_name
use funct, only : set_dft_from_name
use xc_interfaces, only: xclib_get_id
implicit none
character(len=*), intent(IN) :: dft
integer , intent(OUT) :: mfxcx, mfxcc, mgcx, mgcc
call set_dft_from_name(dft)
mfxcx = get_iexch()
mfxcc = get_icorr()
mgcx = get_igcx()
mgcc = get_igcc()
mfxcx = xclib_get_id('LDA','EXCH')
mfxcc = xclib_get_id('LDA','CORR')
mgcx = xclib_get_id('GGA','EXCH')
mgcc = xclib_get_id('GGA','CORR')
! in CPMD PW91 and LYP are swapped.
if (mgcc.eq.3) then

View File

@ -22,8 +22,9 @@ subroutine write_results
core_state, ekinc, ekinv, ae_fc_energy, cau_fact, &
relpert, evel, edar, eso, noscf, iswitch, rho, &
file_charge, max_out_wfc, vx
use funct, only : get_iexch, get_dft_name, write_dft_name
use funct, only : get_dft_name, write_dft_name
use xc_interfaces, only : xclib_get_id
implicit none
integer :: is, i, j, n, m, im(40), ios, counter, ismax
@ -63,8 +64,8 @@ subroutine write_results
1000 format(/5x, &
'n l nl e(Ry) ',' e(Ha) e(eV)')
oep = get_iexch() .eq. 4
kli = get_iexch() .eq. 10
oep = xclib_get_id('LDA','EXCH') .eq. 4
kli = xclib_get_id('LDA','EXCH') .eq. 10
if (oep) enl(1:nwf) = enl(1:nwf) - enzero(isw(1:nwf))
do n=1,nwf
if (oc(n)>-eps6) then