Commit 25a42faf authored by Matthias Redies's avatar Matthias Redies

fix etot typo

parent 89a6a65b
...@@ -53,7 +53,6 @@ SUBROUTINE cdncore(mpi,dimension,oneD,input,vacuum,noco,sym,& ...@@ -53,7 +53,6 @@ SUBROUTINE cdncore(mpi,dimension,oneD,input,vacuum,noco,sym,&
REAL :: tec(atoms%ntype,DIMENSION%jspd) REAL :: tec(atoms%ntype,DIMENSION%jspd)
REAL :: rhTemp(dimension%msh,atoms%ntype,dimension%jspd) REAL :: rhTemp(dimension%msh,atoms%ntype,dimension%jspd)
write (*,*) "cdncore present(EnergyDen)", present(EnergyDen)
results%seigc = 0.0 results%seigc = 0.0
IF (mpi%irank==0) THEN IF (mpi%irank==0) THEN
......
...@@ -46,8 +46,6 @@ CONTAINS ...@@ -46,8 +46,6 @@ CONTAINS
REAL stateEnergies(29) REAL stateEnergies(29)
! .. ! ..
write (*,*) "cored present(EnergyDen)", present(EnergyDen)
c = c_light(1.0) c = c_light(1.0)
seig = 0. seig = 0.
! !
......
...@@ -1120,14 +1120,18 @@ input%preconditioning_param = evaluateFirstOnly(xmlGetAttributeValue('/fleurInpu ...@@ -1120,14 +1120,18 @@ input%preconditioning_param = evaluateFirstOnly(xmlGetAttributeValue('/fleurInpu
IF(xmlGetNumberOfNodes(TRIM(xPathA) // '/@etot_exchange') == 1) THEN IF(xmlGetNumberOfNodes(TRIM(xPathA) // '/@etot_exchange') == 1) THEN
exc_id_x = evaluateFirstOnly(xmlGetAttributeValue(xPathA // '/@etot_exchange')) exc_id_x = evaluateFirstOnly(xmlGetAttributeValue(xPathA // '/@etot_exchange'))
write (*,*) "read exc_id_x"
ELSE ELSE
exc_id_x = vxc_id_x exc_id_x = vxc_id_x
write (*,*) "ignore exc_id_x"
ENDIF ENDIF
IF(xmlGetNumberOfNodes(TRIM(xPathA) // '/@exc_correlation') == 1) THEN IF(xmlGetNumberOfNodes(TRIM(xPathA) // '/@exc_correlation') == 1) THEN
exc_id_c = evaluateFirstOnly(xmlGetAttributeValue(xPathA // '/@exc_correlation')) exc_id_c = evaluateFirstOnly(xmlGetAttributeValue(xPathA // '/@exc_correlation'))
write (*,*) "read exc_id_c"
ELSE ELSE
exc_id_c = vxc_id_c exc_id_c = vxc_id_c
write (*,*) "ignore exc_id_c"
ENDIF ENDIF
#else #else
CALL judft_error("To use libxc functionals you have to compile with libXC support") CALL judft_error("To use libxc functionals you have to compile with libXC support")
...@@ -1141,18 +1145,22 @@ input%preconditioning_param = evaluateFirstOnly(xmlGetAttributeValue('/fleurInpu ...@@ -1141,18 +1145,22 @@ input%preconditioning_param = evaluateFirstOnly(xmlGetAttributeValue('/fleurInpu
valueString = TRIM(ADJUSTL(xmlGetAttributeValue(TRIM(xPathB) // '/@correlation'))) valueString = TRIM(ADJUSTL(xmlGetAttributeValue(TRIM(xPathB) // '/@correlation')))
vxc_id_c = xc_f03_functional_get_number(TRIM(valueString)) vxc_id_c = xc_f03_functional_get_number(TRIM(valueString))
IF(xmlGetNumberOfNodes(TRIM(xPathB) // '/@exc_exchange') == 1) THEN IF(xmlGetNumberOfNodes(TRIM(xPathB) // '/@etot_exchange') == 1) THEN
valueString = TRIM(ADJUSTL(xmlGetAttributeValue(TRIM(xPathB) // '/@exc_exchange'))) valueString = TRIM(ADJUSTL(xmlGetAttributeValue(TRIM(xPathB) // '/@etot_exchange')))
exc_id_x = xc_f03_functional_get_number(TRIM(valueString)) exc_id_x = xc_f03_functional_get_number(TRIM(valueString))
write (*,*) "read exc_id_x"
ELSE ELSE
exc_id_x = vxc_id_x exc_id_x = vxc_id_x
write (*,*) "ignore exc_id_x"
ENDIF ENDIF
IF(xmlGetNumberOfNodes(TRIM(xPathB) // '/@exc_correlation') == 1) THEN IF(xmlGetNumberOfNodes(TRIM(xPathB) // '/@etot_correlation') == 1) THEN
valueString = TRIM(ADJUSTL(xmlGetAttributeValue(TRIM(xPathB) // '/@exc_correlation'))) valueString = TRIM(ADJUSTL(xmlGetAttributeValue(TRIM(xPathB) // '/@etot_correlation')))
exc_id_c = xc_f03_functional_get_number(TRIM(valueString)) exc_id_c = xc_f03_functional_get_number(TRIM(valueString))
write (*,*) "read exc_id_c"
ELSE ELSE
exc_id_c = vxc_id_c exc_id_c = vxc_id_c
write (*,*) "ignore exc_id_c"
ENDIF ENDIF
#else #else
CALL judft_error("To use libxc functionals you have to compile with libXC support") CALL judft_error("To use libxc functionals you have to compile with libXC support")
...@@ -2102,7 +2110,13 @@ input%preconditioning_param = evaluateFirstOnly(xmlGetAttributeValue('/fleurInpu ...@@ -2102,7 +2110,13 @@ input%preconditioning_param = evaluateFirstOnly(xmlGetAttributeValue('/fleurInpu
TYPE IS(t_xcpot_inbuild) TYPE IS(t_xcpot_inbuild)
CALL xcpot%init(namex(1:4),relcor,atoms%ntype) CALL xcpot%init(namex(1:4),relcor,atoms%ntype)
TYPE IS(t_xcpot_libxc) TYPE IS(t_xcpot_libxc)
write (*,*) "vxc_id_x", vxc_id_x
write (*,*) "vxc_id_c", vxc_id_c
write (*,*) "exc_id_x", exc_id_x
write (*,*) "exc_id_c", exc_id_c
CALL xcpot%init(jspins,vxc_id_x,vxc_id_c,exc_id_x,exc_id_c) CALL xcpot%init(jspins,vxc_id_x,vxc_id_c,exc_id_x,exc_id_c)
write (*,*) "is gga", xcpot%is_gga()
END SELECT END SELECT
END SUBROUTINE setXCParameters END SUBROUTINE setXCParameters
......
...@@ -12,111 +12,109 @@ ...@@ -12,111 +12,109 @@
!! In addition to overloading the t_xcpot datatype also mpi_bc_xcpot must be adjusted !! In addition to overloading the t_xcpot datatype also mpi_bc_xcpot must be adjusted
!! for additional implementations. !! for additional implementations.
MODULE m_types_xcpot MODULE m_types_xcpot
IMPLICIT NONE IMPLICIT NONE
PRIVATE PRIVATE
PUBLIC :: t_xcpot,t_gradients PUBLIC :: t_xcpot,t_gradients
TYPE,ABSTRACT :: t_xcpot TYPE,ABSTRACT :: t_xcpot
REAL :: gmaxxc REAL :: gmaxxc
CONTAINS CONTAINS
PROCEDURE :: is_gga=>xcpot_is_gga PROCEDURE :: is_gga=>xcpot_is_gga
PROCEDURE :: is_MetaGGA=>xcpot_is_MetaGGA PROCEDURE :: is_MetaGGA=>xcpot_is_MetaGGA
PROCEDURE :: needs_grad=>xcpot_needs_grad PROCEDURE :: needs_grad=>xcpot_needs_grad
PROCEDURE :: is_hybrid=>xcpot_is_hybrid PROCEDURE :: is_hybrid=>xcpot_is_hybrid
PROCEDURE :: get_exchange_weight=>xcpot_get_exchange_weight PROCEDURE :: get_exchange_weight=>xcpot_get_exchange_weight
PROCEDURE :: get_vxc=>xcpot_get_vxc PROCEDURE :: get_vxc=>xcpot_get_vxc
PROCEDURE :: get_exc=>xcpot_get_exc PROCEDURE :: get_exc=>xcpot_get_exc
PROCEDURE,NOPASS :: alloc_gradients=>xcpot_alloc_gradients PROCEDURE,NOPASS :: alloc_gradients=>xcpot_alloc_gradients
END TYPE t_xcpot END TYPE t_xcpot
TYPE t_gradients TYPE t_gradients
!Naming convention: !Naming convention:
!t,u,d as last letter for total,up,down !t,u,d as last letter for total,up,down
!agr for absolute value of gradient !agr for absolute value of gradient
!g2r for laplacien of gradient !g2r for laplacien of gradient
!+?? !+??
REAL,ALLOCATABLE :: agrt(:),agru(:),agrd(:) REAL,ALLOCATABLE :: agrt(:),agru(:),agrd(:)
REAL,ALLOCATABLE :: g2ru(:),g2rd(:),gggrt(:) REAL,ALLOCATABLE :: g2ru(:),g2rd(:),gggrt(:)
REAL,ALLOCATABLE :: gggru(:),gzgr(:),g2rt(:) REAL,ALLOCATABLE :: gggru(:),gzgr(:),g2rt(:)
REAL,ALLOCATABLE :: gggrd(:),grgru(:),grgrd(:) REAL,ALLOCATABLE :: gggrd(:),grgru(:),grgrd(:)
!These are the contracted Gradients used in libxc !These are the contracted Gradients used in libxc
REAL,ALLOCATABLE :: sigma(:,:) REAL,ALLOCATABLE :: sigma(:,:)
REAL,ALLOCATABLE :: vsigma(:,:) REAL,ALLOCATABLE :: vsigma(:,:)
REAL,ALLOCATABLE :: gr(:,:,:) REAL,ALLOCATABLE :: gr(:,:,:)
REAL,ALLOCATABLE :: laplace(:,:) REAL,ALLOCATABLE :: laplace(:,:)
END TYPE t_gradients END TYPE t_gradients
CONTAINS CONTAINS
LOGICAL FUNCTION xcpot_is_gga(xcpot)
LOGICAL FUNCTION xcpot_is_gga(xcpot) IMPLICIT NONE
IMPLICIT NONE CLASS(t_xcpot),INTENT(IN):: xcpot
CLASS(t_xcpot),INTENT(IN):: xcpot xcpot_is_gga=.false.
xcpot_is_gga=.false. END FUNCTION xcpot_is_gga
END FUNCTION xcpot_is_gga
LOGICAL FUNCTION xcpot_is_MetaGGA(xcpot)
IMPLICIT NONE
CLASS(t_xcpot),INTENT(IN):: xcpot
xcpot_is_MetaGGA=.false.
END FUNCTION xcpot_is_MetaGGA
LOGICAL FUNCTION xcpot_is_MetaGGA(xcpot) LOGICAL FUNCTION xcpot_needs_grad(xcpot)
IMPLICIT NONE IMPLICIT NONE
CLASS(t_xcpot),INTENT(IN):: xcpot CLASS(t_xcpot),INTENT(IN):: xcpot
xcpot_is_MetaGGA=.false.
END FUNCTION xcpot_is_MetaGGA
LOGICAL FUNCTION xcpot_needs_grad(xcpot) xcpot_needs_grad= xcpot%is_gga() .or. xcpot%is_MetaGGA()
IMPLICIT NONE END FUNCTION xcpot_needs_grad
CLASS(t_xcpot),INTENT(IN):: xcpot
xcpot_needs_grad= xcpot%is_gga() .or. xcpot%is_MetaGGA() LOGICAL FUNCTION xcpot_is_hybrid(xcpot)
END FUNCTION xcpot_needs_grad IMPLICIT NONE
CLASS(t_xcpot),INTENT(IN):: xcpot
xcpot_is_hybrid=.FALSE.
END FUNCTION xcpot_is_hybrid
FUNCTION xcpot_get_exchange_weight(xcpot) RESULT(a_ex)
USE m_judft
IMPLICIT NONE
CLASS(t_xcpot),INTENT(IN):: xcpot
REAL:: a_ex
a_ex=-1
END FUNCTION xcpot_get_exchange_weight
LOGICAL FUNCTION xcpot_is_hybrid(xcpot) SUBROUTINE xcpot_get_vxc(xcpot,jspins,rh,vxc,vx,grad)
IMPLICIT NONE CLASS(t_xcpot),INTENT(IN) :: xcpot
CLASS(t_xcpot),INTENT(IN):: xcpot INTEGER, INTENT (IN) :: jspins
xcpot_is_hybrid=.FALSE. !--> charge density
END FUNCTION xcpot_is_hybrid REAL,INTENT (IN) :: rh(:,:)
!---> xc potential
FUNCTION xcpot_get_exchange_weight(xcpot) RESULT(a_ex) REAL, INTENT (OUT) :: vxc (:,:),vx(:,:)
USE m_judft TYPE(t_gradients),OPTIONAL,INTENT(INOUT)::grad
IMPLICIT NONE END SUBROUTINE xcpot_get_vxc
CLASS(t_xcpot),INTENT(IN):: xcpot
REAL:: a_ex
a_ex=-1
END FUNCTION xcpot_get_exchange_weight
SUBROUTINE xcpot_get_vxc(xcpot,jspins,rh,vxc,vx,grad) SUBROUTINE xcpot_get_exc(xcpot,jspins,rh,exc,grad)
CLASS(t_xcpot),INTENT(IN) :: xcpot CLASS(t_xcpot),INTENT(IN) :: xcpot
INTEGER, INTENT (IN) :: jspins INTEGER, INTENT (IN) :: jspins
!--> charge density !--> charge density
REAL,INTENT (IN) :: rh(:,:) REAL,INTENT (IN) :: rh(:,:)
!---> xc potential !---> xc energy density
REAL, INTENT (OUT) :: vxc (:,:),vx(:,:) REAL, INTENT (OUT) :: exc (:)
TYPE(t_gradients),OPTIONAL,INTENT(INOUT)::grad TYPE(t_gradients),OPTIONAL,INTENT(IN)::grad
END SUBROUTINE xcpot_get_vxc END SUBROUTINE xcpot_get_exc
SUBROUTINE xcpot_get_exc(xcpot,jspins,rh,exc,grad) SUBROUTINE xcpot_alloc_gradients(ngrid,jspins,grad)
CLASS(t_xcpot),INTENT(IN) :: xcpot INTEGER, INTENT (IN) :: jspins,ngrid
INTEGER, INTENT (IN) :: jspins TYPE(t_gradients),INTENT(INOUT):: grad
!--> charge density
REAL,INTENT (IN) :: rh(:,:)
!---> xc energy density
REAL, INTENT (OUT) :: exc (:)
TYPE(t_gradients),OPTIONAL,INTENT(IN)::grad
END SUBROUTINE xcpot_get_exc
SUBROUTINE xcpot_alloc_gradients(ngrid,jspins,grad) IF (allocated(grad%agrt)) THEN
INTEGER, INTENT (IN) :: jspins,ngrid DEALLOCATE(grad%agrt,grad%agru,grad%agrd)
TYPE(t_gradients),INTENT(INOUT):: grad DEALLOCATE(grad%g2ru,grad%g2rd,grad%gggrt)
DEALLOCATE(grad%gggru,grad%gzgr,grad%g2rt)
DEALLOCATE(grad%gggrd,grad%grgru,grad%grgrd)
ENDIF
!For the in-build xc-pots
ALLOCATE(grad%agrt(ngrid),grad%agru(ngrid),grad%agrd(ngrid))
ALLOCATE(grad%g2ru(ngrid),grad%g2rd(ngrid),grad%gggrt(ngrid))
ALLOCATE(grad%gggru(ngrid),grad%gzgr(ngrid),grad%g2rt(ngrid))
ALLOCATE(grad%gggrd(ngrid),grad%grgru(ngrid),grad%grgrd(ngrid))
END SUBROUTINE xcpot_alloc_gradients
IF (allocated(grad%agrt)) THEN
DEALLOCATE(grad%agrt,grad%agru,grad%agrd)
DEALLOCATE(grad%g2ru,grad%g2rd,grad%gggrt)
DEALLOCATE(grad%gggru,grad%gzgr,grad%g2rt)
DEALLOCATE(grad%gggrd,grad%grgru,grad%grgrd)
ENDIF
!For the in-build xc-pots
ALLOCATE(grad%agrt(ngrid),grad%agru(ngrid),grad%agrd(ngrid))
ALLOCATE(grad%g2ru(ngrid),grad%g2rd(ngrid),grad%gggrt(ngrid))
ALLOCATE(grad%gggru(ngrid),grad%gzgr(ngrid),grad%g2rt(ngrid))
ALLOCATE(grad%gggrd(ngrid),grad%grgru(ngrid),grad%grgrd(ngrid))
END SUBROUTINE xcpot_alloc_gradients
END MODULE m_types_xcpot END MODULE m_types_xcpot
...@@ -105,6 +105,11 @@ CONTAINS ...@@ -105,6 +105,11 @@ CONTAINS
xcpot%DATA%exchange_weight=xcpot%get_exchange_weight() xcpot%DATA%exchange_weight=xcpot%get_exchange_weight()
END SUBROUTINE xcpot_init END SUBROUTINE xcpot_init
LOGICAL FUNCTION xcpot_is_gga(xcpot)
IMPLICIT NONE
CLASS(t_xcpot_inbuild),INTENT(IN):: xcpot
xcpot_is_gga=priv_LDA(xcpot%icorr)
END FUNCTION xcpot_is_gga
LOGICAL FUNCTION xcpot_is_gga(xcpot) LOGICAL FUNCTION xcpot_is_gga(xcpot)
IMPLICIT NONE IMPLICIT NONE
...@@ -132,7 +137,6 @@ CONTAINS ...@@ -132,7 +137,6 @@ CONTAINS
IF (xcpot%is_name("vhse")) a_ex=amix_hse IF (xcpot%is_name("vhse")) a_ex=amix_hse
END FUNCTION xcpot_get_exchange_weight END FUNCTION xcpot_get_exchange_weight
SUBROUTINE xcpot_get_vxc(xcpot,jspins,rh, vxc,vx, grad) SUBROUTINE xcpot_get_vxc(xcpot,jspins,rh, vxc,vx, grad)
! !
USE m_xcxal, ONLY : vxcxal USE m_xcxal, ONLY : vxcxal
......
...@@ -102,6 +102,8 @@ CONTAINS ...@@ -102,6 +102,8 @@ CONTAINS
ELSE ELSE
WRITE(*,*) "No Correlation functional for TotalE" WRITE(*,*) "No Correlation functional for TotalE"
ENDIF ENDIF
ELSE
write (*,*) "Using same functional for VXC and EXC"
END IF END IF
#else #else
CALL judft_error("You specified a libxc-exchange correlation potential but FLEUR is not linked against libxc", & CALL judft_error("You specified a libxc-exchange correlation potential but FLEUR is not linked against libxc", &
...@@ -122,19 +124,6 @@ CONTAINS ...@@ -122,19 +124,6 @@ CONTAINS
#endif #endif
END FUNCTION xcpot_is_gga END FUNCTION xcpot_is_gga
LOGICAL FUNCTION xcpot_is_LDA(xcpot)
IMPLICIT NONE
CLASS(t_xcpot_libxc),INTENT(IN):: xcpot
#ifdef CPP_LIBXC
TYPE(xc_f03_func_info_t) :: xc_info
xc_info = xc_f03_func_get_info(xcpot%exc_func_x)
xcpot_is_LDA= (XC_FAMILY_LDA==xc_f03_func_info_get_family(xc_info))
#else
xcpot_is_LDA=.false.
#endif
END FUNCTION xcpot_is_LDA
LOGICAL FUNCTION xcpot_is_MetaGGA(xcpot) LOGICAL FUNCTION xcpot_is_MetaGGA(xcpot)
IMPLICIT NONE IMPLICIT NONE
CLASS(t_xcpot_libxc),INTENT(IN):: xcpot CLASS(t_xcpot_libxc),INTENT(IN):: xcpot
...@@ -206,6 +195,8 @@ CONTAINS ...@@ -206,6 +195,8 @@ CONTAINS
CALL xc_f03_lda_vxc(xcpot%vxc_func_c, SIZE(rh,1), TRANSPOSE(rh), vxc_tmp) CALL xc_f03_lda_vxc(xcpot%vxc_func_c, SIZE(rh,1), TRANSPOSE(rh), vxc_tmp)
vxc_tmp=vxc_tmp+vx_tmp vxc_tmp=vxc_tmp+vx_tmp
ENDIF ENDIF
ELSE
call juDFT_error("xcpot Type not known")
ENDIF ENDIF
vx=TRANSPOSE(vx_tmp) vx=TRANSPOSE(vx_tmp)
vxc=TRANSPOSE(vxc_tmp) vxc=TRANSPOSE(vxc_tmp)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment