Commit 777ec7f5 authored by Matthias Redies's avatar Matthias Redies

implements split scheme

parent 3fb9ce80
......@@ -20,13 +20,13 @@ MODULE m_constants
REAL, PARAMETER :: eVac0Default_const = -0.25
CHARACTER(len=9), PARAMETER :: version_const = 'fleur 27'
INTEGER, PARAMETER :: POTDEN_TYPE_OTHER = 0 ! POTDEN_TYPE <= 0 ==> undefined
INTEGER, PARAMETER :: POTDEN_TYPE_POTTOT = 1 ! 0 < POTDEN_TYPE <= 1000 ==> potential
INTEGER, PARAMETER :: POTDEN_TYPE_POTCOUL = 2
INTEGER, PARAMETER :: POTDEN_TYPE_POTX = 3
INTEGER, PARAMETER :: POTDEN_TYPE_POTYUK = 4
INTEGER, PARAMETER :: POTDEN_TYPE_kinEnergyDen = 5
INTEGER, PARAMETER :: POTDEN_TYPE_DEN = 1001 ! 1000 < POTDEN_TYPE ==> density
INTEGER, PARAMETER :: POTDEN_TYPE_OTHER = 0 ! POTDEN_TYPE <= 0 ==> undefined
INTEGER, PARAMETER :: POTDEN_TYPE_POTTOT = 1 ! 0 < POTDEN_TYPE <= 1000 ==> potential
INTEGER, PARAMETER :: POTDEN_TYPE_POTCOUL = 2
INTEGER, PARAMETER :: POTDEN_TYPE_POTX = 3
INTEGER, PARAMETER :: POTDEN_TYPE_POTYUK = 4
INTEGER, PARAMETER :: POTDEN_TYPE_EnergyDen = 5
INTEGER, PARAMETER :: POTDEN_TYPE_DEN = 1001 ! 1000 < POTDEN_TYPE ==> density
CHARACTER(2),DIMENSION(0:103),PARAMETER :: namat_const=(/&
'va',' H','He','Li','Be',' B',' C',' N',' O',' F','Ne',&
......
......@@ -95,7 +95,7 @@ SUBROUTINE cdngen(eig_id,mpi,input,banddos,sliceplot,vacuum,&
CALL orbcomp%init(input,banddos,dimension,atoms,kpts)
CALL outDen%init(stars, atoms, sphhar, vacuum, input%jspins, noco%l_noco, POTDEN_TYPE_DEN)
CALL EnergyDen%init(stars, atoms, sphhar, vacuum, input%jspins, noco%l_noco, POTDEN_TYPE_kinEnergyDen)
CALL EnergyDen%init(stars, atoms, sphhar, vacuum, input%jspins, noco%l_noco, POTDEN_TYPE_EnergyDen)
IF (mpi%irank == 0) CALL openXMLElementNoAttributes('valenceDensity')
......@@ -114,7 +114,7 @@ SUBROUTINE cdngen(eig_id,mpi,input,banddos,sliceplot,vacuum,&
! calculate kinetic energy density for MetaGGAs
if(xcpot%exc_is_metagga()) then
CALL calc_kinEnergyDen(eig_id, mpi, kpts, noco, input, banddos, cell, outDen, atoms, enpara, stars,&
vacuum, DIMENSION, sphhar, sym, vTot, oneD, results, xcpot%kinEnergyDen)
vacuum, DIMENSION, sphhar, sym, vTot, oneD, results, EnergyDen)
endif
IF (mpi%irank == 0) THEN
......
......@@ -14,15 +14,10 @@
MODULE m_types_xcpot
IMPLICIT NONE
PRIVATE
PUBLIC :: t_xcpot,t_gradients,t_RS_potden
PUBLIC :: t_xcpot,t_gradients
TYPE t_RS_potden
REAL, ALLOCATABLE :: is(:,:), mt(:,:)
END TYPE t_RS_potden
TYPE,ABSTRACT :: t_xcpot
REAL :: gmaxxc
TYPE(t_RS_potden) :: kinEnergyDen
CONTAINS
PROCEDURE :: vxc_is_LDA=>xcpot_vxc_is_LDA
PROCEDURE :: exc_is_LDA=>xcpot_exc_is_LDA
......@@ -109,6 +104,7 @@ CONTAINS
END FUNCTION xcpot_get_exchange_weight
SUBROUTINE xcpot_get_vxc(xcpot,jspins,rh,vxc,vx,grad)
USE m_judft
IMPLICIT NONE
CLASS(t_xcpot),INTENT(IN) :: xcpot
......@@ -118,20 +114,29 @@ CONTAINS
!---> xc potential
REAL, INTENT (OUT) :: vxc (:,:),vx(:,:)
TYPE(t_gradients),OPTIONAL,INTENT(INOUT)::grad
vxc = 0.0
vx = 0.0
call juDFT_error("Can't use XC-parrent class")
END SUBROUTINE xcpot_get_vxc
SUBROUTINE xcpot_get_exc(xcpot,jspins,rh,exc,grad)
SUBROUTINE xcpot_get_exc(xcpot,jspins,rh,exc,grad,kinEnergyDen)
USE m_types_misc
USE, INTRINSIC :: IEEE_ARITHMETIC
IMPLICIT NONE
CLASS(t_xcpot),INTENT(IN) :: xcpot
INTEGER, INTENT (IN) :: jspins
CLASS(t_xcpot),INTENT(IN) :: xcpot
INTEGER, INTENT (IN) :: jspins
!--> charge density
REAL,INTENT (IN) :: rh(:,:)
REAL,INTENT (IN) :: rh(:,:)
!--> kinetic energy density
!---> xc energy density
REAL, INTENT (OUT) :: exc (:)
TYPE(t_gradients),OPTIONAL,INTENT(IN)::grad
REAL, INTENT (OUT) :: exc (:)
TYPE(t_gradients),OPTIONAL,INTENT(IN) :: grad
REAL, INTENT(IN), OPTIONAL :: kinEnergyDen(:,:)
exc = 0.0
call juDFT_error("Can't use XC-parrent class")
END SUBROUTINE xcpot_get_exc
SUBROUTINE xcpot_alloc_gradients(ngrid,jspins,grad)
......
......@@ -265,7 +265,7 @@ CONTAINS
END SUBROUTINE xcpot_get_vxc
!***********************************************************************
SUBROUTINE xcpot_get_exc(xcpot,jspins,rh,exc,grad)
SUBROUTINE xcpot_get_exc(xcpot,jspins,rh,exc,grad,kinEnergyDen)
!***********************************************************************
USE m_xcxal, ONLY : excxal
USE m_xcwgn, ONLY : excwgn
......@@ -277,23 +277,14 @@ CONTAINS
USE m_excpw91
USE m_excepbe
IMPLICIT NONE
!c
!c---> running mode parameters
!c
CLASS(t_xcpot_inbuild),INTENT(IN) :: xcpot
INTEGER, INTENT (IN) :: jspins
!c
!c---> charge density
!c
REAL,INTENT (IN) :: rh(:,:)
!c
!c---> xc energy density
!c
REAL, INTENT (OUT) :: exc(:)
CLASS(t_xcpot_inbuild),INTENT(IN) :: xcpot
INTEGER, INTENT (IN) :: jspins
REAL,INTENT (IN) :: rh(:,:)
REAL, INTENT (OUT) :: exc(:)
TYPE(t_gradients),OPTIONAL,INTENT(IN) ::grad
REAL, INTENT(IN), OPTIONAL :: kinEnergyDen(:,:)
! optional arguments for GGA
TYPE(t_gradients),OPTIONAL,INTENT(IN)::grad
!c
!c ---> local scalars
INTEGER :: ngrid
......
......@@ -259,7 +259,7 @@ CONTAINS
END SUBROUTINE xcpot_get_vxc
SUBROUTINE xcpot_get_exc(xcpot,jspins,rh,exc,grad,kinEnergyDen)
SUBROUTINE xcpot_get_exc(xcpot,jspins,rh,exc,grad, kinEnergyDen)
IMPLICIT NONE
CLASS(t_xcpot_libxc),INTENT(IN) :: xcpot
INTEGER, INTENT (IN) :: jspins
......
......@@ -4,7 +4,7 @@
! of the MIT license as expressed in the LICENSE file in more detail.
!--------------------------------------------------------------------------------
MODULE m_metagga
PUBLIC :: calc_EnergyDen, t_RS_potden
PUBLIC :: calc_EnergyDen
PRIVATE :: calc_EnergyDen_auxillary_weights, subtract_RS, multiply_RS
INTERFACE OPERATOR (-)
......@@ -51,18 +51,18 @@ CONTAINS
TYPE(t_potden), INTENT(in) :: vTot
TYPE(t_oneD), INTENT(in) :: oneD
TYPE(t_results), INTENT(in) :: results
TYPE(t_RS_potden), INTENT(inout) :: kinEnergyDen
REAL, INTENT(inout) :: kinEnergyDen(:,:)
! local vars
TYPE(t_potden) :: EnergyDen
TYPE(t_RS_potden) :: den_RS, EnergyDen_RS, vTot_RS
TYPE(t_potden) :: EnergyDen
REAL :: den_RS(:,:), EnergyDen_RS(:,:), vTot_RS(:,:)
CALL calc_EnergyDen(eig_id, mpi, kpts, noco, input, banddos, cell, atoms, enpara, stars, &
vacuum, DIMENSION, sphhar, sym, vTot, oneD, results, EnergyDen)
CALL transform_to_grid(input, noco, sym, stars, cell, den, atoms, sphhar, EnergyDen, vTot, den_RS, EnergyDen_RS, vTot_RS)
!CALL transform_to_grid(input, noco, sym, stars, cell, den, atoms, sphhar, EnergyDen, vTot, den_RS, EnergyDen_RS, vTot_RS)
kinEnergyDen = EnergyDen_RS - vTot_RS * den_RS
#else
......@@ -167,64 +167,64 @@ CONTAINS
ENDDO
END SUBROUTINE calc_EnergyDen_auxillary_weights
SUBROUTINE transform_to_grid(input, noco, sym, stars, cell, den, atoms, sphhar, EnergyDen, vTot, den_RS, EnergyDen_RS, vTot_RS)
USE m_types_potden
USE m_types_setup
USE m_types_xcpot_libxc
USE m_types_xcpot
USE m_juDFT_stop
USE m_pw_tofrom_grid
USE m_mt_tofrom_grid
!SUBROUTINE transform_to_grid(input, noco, sym, stars, cell, den, atoms, sphhar, EnergyDen, vTot, den_RS, EnergyDen_RS, vTot_RS)
!USE m_types_potden
!USE m_types_setup
!USE m_types_xcpot_libxc
!USE m_types_xcpot
!USE m_juDFT_stop
!USE m_pw_tofrom_grid
!USE m_mt_tofrom_grid
IMPLICIT NONE
!IMPLICIT NONE
TYPE(t_potden), INTENT(in) :: den, EnergyDen, vTot
TYPE(t_input), INTENT(in) :: input
TYPE(t_noco), INTENT(in) :: noco
TYPE(t_sym), INTENT(in) :: sym
TYPE(t_stars), INTENT(in) :: stars
TYPE(t_cell), INTENT(in) :: cell
TYPE(t_atoms), INTENT(in) :: atoms
TYPE(t_sphhar), INTENT(in) :: sphhar
TYPE(t_RS_potden), INTENT(out) :: den_RS, EnergyDen_RS, vTot_RS ! could be changed to a real-space type
!local vars
TYPE(t_xcpot_libxc) ::aux_xcpot
TYPE(t_gradients) :: tmp_grad
INTEGER, PARAMETER :: id_corr = 9, id_exch = 1
INTEGER :: nsp, n
!make some auxillary xcpot, that is not a GGA (we don't need gradients)
CALL aux_xcpot%init(input%jspins, id_exch, id_corr, id_exch, id_corr)
IF(aux_xcpot%vxc_is_gga()) CALL juDFT_error("aux_xcpot must not be GGA", &
hint="choose id_corr and id_exch correctly")
! interstitial part
CALL init_pw_grid(aux_xcpot,stars,sym,cell)
CALL pw_to_grid(aux_xcpot, input%jspins, noco%l_noco, stars, cell, den%pw, tmp_grad, den_RS%is)
CALL pw_to_grid(aux_xcpot, input%jspins, noco%l_noco, stars, cell, EnergyDen%pw, tmp_grad, EnergyDen_RS%is)
CALL pw_to_grid(aux_xcpot, input%jspins, noco%l_noco, stars, cell, vTot%pw, tmp_grad, vTot_RS%is)
CALL finish_pw_grid()
! muffin tins
nsp=(atoms%lmaxd+1+MOD(atoms%lmaxd+1,2))*(2*atoms%lmaxd+1)
CALL init_mt_grid(nsp,input%jspins,atoms,sphhar,aux_xcpot,sym)
DO n = 1,atoms%ntype
CALL mt_to_grid(aux_xcpot, input%jspins, atoms, sphhar, den%mt(:,0:,n,:), &
nsp, n, tmp_grad, den_RS%mt)
CALL mt_to_grid(aux_xcpot, input%jspins, atoms, sphhar, EnergyDen%mt(:,0:,n,:), &
nsp, n, tmp_grad, EnergyDen_RS%mt)
CALL mt_to_grid(aux_xcpot, input%jspins, atoms, sphhar, vTot%mt(:,0:,n,:), &
nsp, n, tmp_grad, vTot_RS%mt)
ENDDO
CALL finish_mt_grid()
END SUBROUTINE transform_to_grid
!TYPE(t_potden), INTENT(in) :: den, EnergyDen, vTot
!TYPE(t_input), INTENT(in) :: input
!TYPE(t_noco), INTENT(in) :: noco
!TYPE(t_sym), INTENT(in) :: sym
!TYPE(t_stars), INTENT(in) :: stars
!TYPE(t_cell), INTENT(in) :: cell
!TYPE(t_atoms), INTENT(in) :: atoms
!TYPE(t_sphhar), INTENT(in) :: sphhar
!REAL(:,:), INTENT(out) :: den_RS, EnergyDen_RS, vTot_RS ! could be changed to a real-space type
!!local vars
!TYPE(t_xcpot_libxc) ::aux_xcpot
!TYPE(t_gradients) :: tmp_grad
!INTEGER, PARAMETER :: id_corr = 9, id_exch = 1
!INTEGER :: nsp, n
!!make some auxillary xcpot, that is not a GGA (we don't need gradients)
!CALL aux_xcpot%init(input%jspins, id_exch, id_corr, id_exch, id_corr)
!IF(aux_xcpot%vxc_is_gga()) CALL juDFT_error("aux_xcpot must not be GGA", &
!hint="choose id_corr and id_exch correctly")
!! interstitial part
!CALL init_pw_grid(aux_xcpot,stars,sym,cell)
!CALL pw_to_grid(aux_xcpot, input%jspins, noco%l_noco, stars, cell, den%pw, tmp_grad, den_RS%is)
!CALL pw_to_grid(aux_xcpot, input%jspins, noco%l_noco, stars, cell, EnergyDen%pw, tmp_grad, EnergyDen_RS%is)
!CALL pw_to_grid(aux_xcpot, input%jspins, noco%l_noco, stars, cell, vTot%pw, tmp_grad, vTot_RS%is)
!CALL finish_pw_grid()
!! muffin tins
!nsp=(atoms%lmaxd+1+MOD(atoms%lmaxd+1,2))*(2*atoms%lmaxd+1)
!CALL init_mt_grid(nsp,input%jspins,atoms,sphhar,aux_xcpot,sym)
!DO n = 1,atoms%ntype
!CALL mt_to_grid(aux_xcpot, input%jspins, atoms, sphhar, den%mt(:,0:,n,:), &
!nsp, n, tmp_grad, den_RS%mt)
!CALL mt_to_grid(aux_xcpot, input%jspins, atoms, sphhar, EnergyDen%mt(:,0:,n,:), &
!nsp, n, tmp_grad, EnergyDen_RS%mt)
!CALL mt_to_grid(aux_xcpot, input%jspins, atoms, sphhar, vTot%mt(:,0:,n,:), &
!nsp, n, tmp_grad, vTot_RS%mt)
!ENDDO
!CALL finish_mt_grid()
!END SUBROUTINE transform_to_grid
FUNCTION subtract_RS(rs1, rs2) RESULT(rs_out)
USE m_types_xcpot
......
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