Commit 3fb9ce80 authored by Matthias Redies's avatar Matthias Redies

some develop changes tbd

parent afa78cc7
......@@ -11,7 +11,7 @@ CONTAINS
SUBROUTINE cdngen(eig_id,mpi,input,banddos,sliceplot,vacuum,&
dimension,kpts,atoms,sphhar,stars,sym,&
enpara,cell,noco,vTot,results,oneD,coreSpecInput,&
xcpot, archiveType,outDen, kinEnergyDen)
archiveType, xcpot,outDen,EnergyDen)
!*****************************************************
! Charge density generator
......@@ -37,6 +37,7 @@ SUBROUTINE cdngen(eig_id,mpi,input,banddos,sliceplot,vacuum,&
USE m_doswrite
USE m_Ekwritesl
USE m_banddos_io
USE m_metagga
#ifdef CPP_MPI
USE m_mpi_bc_potden
#endif
......@@ -62,8 +63,8 @@ SUBROUTINE cdngen(eig_id,mpi,input,banddos,sliceplot,vacuum,&
TYPE(t_atoms),INTENT(IN) :: atoms
TYPE(t_coreSpecInput),INTENT(IN) :: coreSpecInput
TYPE(t_potden),INTENT(IN) :: vTot
CLASS(t_xcpot),INTENT(IN) :: xcpot
TYPE(t_potden),INTENT(INOUT) :: outDen, kinEnergyDen
CLASS(t_xcpot),INTENT(INOUT) :: xcpot
TYPE(t_potden),INTENT(INOUT) :: outDen, EnergyDen
!Scalar Arguments
INTEGER, INTENT (IN) :: eig_id, archiveType
......@@ -92,7 +93,9 @@ SUBROUTINE cdngen(eig_id,mpi,input,banddos,sliceplot,vacuum,&
CALL mcd%init1(banddos,dimension,input,atoms,kpts)
CALL slab%init(banddos,dimension,atoms,cell,input,kpts)
CALL orbcomp%init(input,banddos,dimension,atoms,kpts)
CALL outDen%init(stars,atoms,sphhar,vacuum,input%jspins,noco%l_noco,POTDEN_TYPE_DEN)
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)
IF (mpi%irank == 0) CALL openXMLElementNoAttributes('valenceDensity')
......@@ -106,12 +109,14 @@ SUBROUTINE cdngen(eig_id,mpi,input,banddos,sliceplot,vacuum,&
CALL cdnvalJob%init(mpi,input,kpts,noco,results,jspin,sliceplot,banddos)
CALL cdnval(eig_id,mpi,kpts,jspin,noco,input,banddos,cell,atoms,enpara,stars,vacuum,dimension,&
sphhar,sym,vTot,oneD,cdnvalJob,outDen,regCharges,dos,results,moments,coreSpecInput,mcd,slab,orbcomp)
!IF(xcpot%is_MetaGGA()) THEN
!CALL bla
!ENDIF
END DO
! 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)
endif
IF (mpi%irank == 0) THEN
IF (banddos%dos.or.banddos%vacdos.or.input%cdinf) THEN
#ifdef CPP_HDF
......
......@@ -64,6 +64,7 @@ CONTAINS
USE m_gen_map
USE m_dwigner
USE m_ylm
USE m_metagga
#ifdef CPP_MPI
USE m_mpi_bc_potden
#endif
......@@ -95,7 +96,7 @@ CONTAINS
TYPE(t_coreSpecInput) :: coreSpecInput
TYPE(t_wann) :: wann
TYPE(t_potden) :: vTot, vx, vCoul, vTemp
TYPE(t_potden) :: inDen, outDen, kinEnergyDen
TYPE(t_potden) :: inDen, outDen, EnergyDen
CLASS(t_xcpot), ALLOCATABLE :: xcpot
CLASS(t_forcetheo), ALLOCATABLE :: forcetheo
......@@ -234,7 +235,7 @@ CONTAINS
CALL timestart("generation of potential")
CALL vgen(hybrid,field,input,xcpot,DIMENSION,atoms,sphhar,stars,vacuum,sym,&
obsolete,cell,oneD,sliceplot,mpi,results,noco,inDen,vTot,vx,vCoul)
obsolete,cell,oneD,sliceplot,mpi,results,noco,EnergyDen,inDen,vTot,vx,vCoul)
CALL timestop("generation of potential")
#ifdef CPP_MPI
......@@ -343,8 +344,10 @@ CONTAINS
! charge density generation
CALL timestart("generation of new charge density (total)")
CALL cdngen(eig_id,mpi,input,banddos,sliceplot,vacuum,DIMENSION,kpts,atoms,sphhar,stars,sym,&
enpara,cell,noco,vTot,results,oneD,coreSpecInput,xcpot,archiveType,outDen,kinEnergyDen)
CALL cdngen(eig_id,mpi,input,banddos,sliceplot,vacuum,&
DIMENSION,kpts,atoms,sphhar,stars,sym,&
enpara,cell,noco,vTot,results,oneD,coreSpecInput,&
archiveType,xcpot,outDen,EnergyDen)
outDen%iter = inDen%iter
IF (.FALSE.) CALL rdmft(eig_id,mpi,input,kpts,banddos,cell,atoms,enpara,stars,vacuum,dimension,&
......
......@@ -14,10 +14,15 @@
MODULE m_types_xcpot
IMPLICIT NONE
PRIVATE
PUBLIC :: t_xcpot,t_gradients
PUBLIC :: t_xcpot,t_gradients,t_RS_potden
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
......@@ -104,6 +109,8 @@ CONTAINS
END FUNCTION xcpot_get_exchange_weight
SUBROUTINE xcpot_get_vxc(xcpot,jspins,rh,vxc,vx,grad)
IMPLICIT NONE
CLASS(t_xcpot),INTENT(IN) :: xcpot
INTEGER, INTENT (IN) :: jspins
!--> charge density
......@@ -114,16 +121,22 @@ CONTAINS
END SUBROUTINE xcpot_get_vxc
SUBROUTINE xcpot_get_exc(xcpot,jspins,rh,exc,grad)
USE m_types_misc
IMPLICIT NONE
CLASS(t_xcpot),INTENT(IN) :: xcpot
INTEGER, INTENT (IN) :: jspins
!--> charge density
REAL,INTENT (IN) :: rh(:,:)
!--> kinetic energy density
!---> 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)
IMPLICIT NONE
INTEGER, INTENT (IN) :: jspins,ngrid
TYPE(t_gradients),INTENT(INOUT):: 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)
!***********************************************************************
USE m_xcxal, ONLY : excxal
USE m_xcwgn, ONLY : excwgn
......@@ -286,6 +286,7 @@ CONTAINS
!c---> charge density
!c
REAL,INTENT (IN) :: rh(:,:)
!c
!c---> xc energy density
!c
......
......@@ -11,6 +11,7 @@ MODULE m_types_xcpot_libxc
#endif
USE m_types_xcpot
USE m_judft
use m_types_misc
IMPLICIT NONE
......@@ -26,6 +27,8 @@ MODULE m_types_xcpot_libxc
INTEGER :: func_vxc_id_c, func_vxc_id_x !> functionals to be used for potential & density convergence
INTEGER :: func_exc_id_c, func_exc_id_x !> functionals to be used in exc- & totale-calculations
INTEGER :: jspins
CONTAINS
PROCEDURE :: vxc_is_LDA => xcpot_vxc_is_LDA
PROCEDURE :: exc_is_LDA => xcpot_exc_is_LDA
......@@ -256,7 +259,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)
IMPLICIT NONE
CLASS(t_xcpot_libxc),INTENT(IN) :: xcpot
INTEGER, INTENT (IN) :: jspins
......@@ -264,6 +267,7 @@ CONTAINS
REAL, INTENT (OUT) :: exc(:) !points
! optional arguments for GGA
TYPE(t_gradients),OPTIONAL,INTENT(IN)::grad
REAL, INTENT(IN), OPTIONAL :: kinEnergyDen(:,:)
REAL :: excc(SIZE(exc))
#ifdef CPP_LIBXC
......@@ -281,8 +285,17 @@ CONTAINS
exc=exc+excc
END IF
ELSEIF(xcpot%exc_is_MetaGGA()) THEN
!call xc_f03_mgga_exc(xcpot%exc_func_x, SIZE(rh,1), TRANSPOSE(rh), grad%sigma, transpose(grad%laplace)
write (*,*) "have to implement that"
IF(PRESENT(kinEnergyDen)) THEN ! patch till vacuum can do LibXC
call xc_f03_mgga_exc(xcpot%exc_func_x, SIZE(rh,1), TRANSPOSE(rh), grad%sigma, &
transpose(grad%laplace), transpose(kinEnergyDen), exc)
IF (xcpot%func_exc_id_c>0) THEN
CALL xc_f03_mgga_exc(xcpot%exc_func_c, SIZE(rh,1), TRANSPOSE(rh), grad%sigma, &
transpose(grad%laplace), transpose(kinEnergyDen), excc)
exc=exc+excc
END IF
ELSE
call juDFT_error("MetaGGAs need kinetic energy density", hint="maybe you used vacuum with LibXC")
ENDIF
ELSE
call juDFT_error("exc is part of a known Family", calledby="xcpot_get_exc@libxc")
ENDIF
......
......@@ -3,15 +3,9 @@
! This file is part of FLEUR and available as free software under the conditions
! of the MIT license as expressed in the LICENSE file in more detail.
!--------------------------------------------------------------------------------
MODULE m_metagga
TYPE t_realspace_potden
REAL, ALLOCATABLE :: is(:,:), mt(:,:)
END TYPE t_realspace_potden
PUBLIC :: calc_EnergyDen
PRIVATE :: calc_EnergyDen_auxillary_weights, t_realspace_potden, subtract_RS, multiply_RS
PUBLIC :: calc_EnergyDen, t_RS_potden
PRIVATE :: calc_EnergyDen_auxillary_weights, subtract_RS, multiply_RS
INTERFACE OPERATOR (-)
PROCEDURE subtract_RS
......@@ -33,6 +27,7 @@ CONTAINS
USE m_types_regionCharges
USE m_types_dos
USE m_types_cdnval
USE m_types_xcpot
USE m_cdnval
......@@ -56,12 +51,12 @@ CONTAINS
TYPE(t_potden), INTENT(in) :: vTot
TYPE(t_oneD), INTENT(in) :: oneD
TYPE(t_results), INTENT(in) :: results
TYPE(t_realspace_potden), INTENT(inout) :: kinEnergyDen
TYPE(t_RS_potden), INTENT(inout) :: kinEnergyDen
! local vars
TYPE(t_potden) :: EnergyDen
TYPE(t_realspace_potden) :: den_RS, EnergyDen_RS, vTot_RS
TYPE(t_RS_potden) :: den_RS, EnergyDen_RS, vTot_RS
CALL calc_EnergyDen(eig_id, mpi, kpts, noco, input, banddos, cell, atoms, enpara, stars, &
......@@ -191,7 +186,7 @@ CONTAINS
TYPE(t_cell), INTENT(in) :: cell
TYPE(t_atoms), INTENT(in) :: atoms
TYPE(t_sphhar), INTENT(in) :: sphhar
TYPE(t_realspace_potden), INTENT(out) :: den_RS, EnergyDen_RS, vTot_RS ! could be changed to a real-space type
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
......@@ -232,25 +227,25 @@ CONTAINS
END SUBROUTINE transform_to_grid
FUNCTION subtract_RS(rs1, rs2) RESULT(rs_out)
USE m_types_xcpot
IMPLICIT NONE
TYPE(t_realspace_potden), INTENT(in) :: rs1, rs2
TYPE(t_realspace_potden) :: rs_out
WRITE (*,*) "MT subtraction not implemented"
TYPE(t_RS_potden), INTENT(in) :: rs1, rs2
TYPE(t_RS_potden) :: rs_out
rs_out%is = rs1%is - rs2%is
rs_out%mt = rs1%mt - rs2%mt
END FUNCTION subtract_RS
FUNCTION multiply_RS(rs1, rs2) RESULT(rs_out)
USE m_types_xcpot
IMPLICIT NONE
TYPE(t_realspace_potden), INTENT(in) :: rs1, rs2
TYPE(t_realspace_potden) :: rs_out
WRITE (*,*) "MT multiplication not implemented"
TYPE(t_RS_potden), INTENT(in) :: rs1, rs2
TYPE(t_RS_potden) :: rs_out
rs_out%is = rs1%is * rs2%is
rs_out%mt = rs1%mt * rs2%mt
END FUNCTION multiply_RS
END MODULE m_metagga
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