Commit 15fddc25 authored by Matthias Redies's avatar Matthias Redies

some stuff and indentation

parent 9a1765b6
......@@ -294,7 +294,8 @@ CONTAINS
exc=exc+excc
END IF
ELSE
call juDFT_error("MetaGGAs need kinetic energy density", hint="maybe you used vacuum with LibXC")
call juDFT_error("MetaGGAs needs the 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")
......
......@@ -9,72 +9,83 @@
! of the MIT license as expressed in the LICENSE file in more detail.
!--------------------------------------------------------------------------------
MODULE m_vis_xc
USE m_juDFT
! ******************************************************
! subroutine generates the exchange-correlation potential
! in the interstitial region c.l.fu
! including gradient corrections. t.a. 1996.
! ******************************************************
USE m_juDFT
! ******************************************************
! subroutine generates the exchange-correlation potential
! in the interstitial region c.l.fu
! including gradient corrections. t.a. 1996.
! ******************************************************
CONTAINS
SUBROUTINE vis_xc(stars,sym,cell,den,xcpot,input,noco, vxc,vx,exc)
SUBROUTINE vis_xc(stars,sym,cell,den,xcpot,input,noco,EnergyDen, vxc,vx,exc)
! ******************************************************
! instead of visxcor.f: the different exchange-correlation
! potentials defined through the key icorr are called through
! the driver subroutine vxcallg.f,for the energy density - excallg
! subroutines vectorized
! ** r.pentcheva 22.01.96
! *********************************************************
! in case of total = .true. calculates the ex-corr. energy
! density
! ** r.pentcheva 08.05.96
! ******************************************************************
USE m_pw_tofrom_grid
USE m_types
USE m_types_xcpot_libxc
USE m_libxc_postprocess_gga
IMPLICIT NONE
! ******************************************************
! instead of visxcor.f: the different exchange-correlation
! potentials defined through the key icorr are called through
! the driver subroutine vxcallg.f,for the energy density - excallg
! subroutines vectorized
! ** r.pentcheva 22.01.96
! *********************************************************
! in case of total = .true. calculates the ex-corr. energy
! density
! ** r.pentcheva 08.05.96
! ******************************************************************
USE m_pw_tofrom_grid
USE m_types
USE m_types_xcpot_libxc
USE m_libxc_postprocess_gga
IMPLICIT NONE
CLASS(t_xcpot),INTENT(IN) :: xcpot
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_potden),INTENT(IN) :: den
TYPE(t_potden),INTENT(INOUT) :: vxc,vx,exc
TYPE(t_gradients) :: grad
REAL, ALLOCATABLE :: rho(:,:)
REAL, ALLOCATABLE :: v_x(:,:),v_xc(:,:),e_xc(:,:)
CALL init_pw_grid(xcpot,stars,sym,cell)
CLASS(t_xcpot),INTENT(IN) :: xcpot
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_potden),INTENT(IN) :: den, EnergyDen
TYPE(t_potden),INTENT(INOUT) :: vxc,vx,exc
!Put the charge on the grid, in GGA case also calculate gradients
CALL pw_to_grid(xcpot,input%jspins,noco%l_noco,stars,cell,den%pw,grad,rho)
ALLOCATE(v_xc,mold=rho)
ALLOCATE(v_x,mold=rho)
TYPE(t_gradients) :: grad, tmp_grad
REAL, ALLOCATABLE :: rho(:,:), ED_rs(:,:), vtot_rs(:,:), kinED_rs(:,:)
REAL, ALLOCATABLE :: v_x(:,:),v_xc(:,:),e_xc(:,:)
CALL xcpot%get_vxc(input%jspins,rho,v_xc,v_x,grad)
CALL init_pw_grid(xcpot,stars,sym,cell)
IF (xcpot%needs_grad()) THEN
SELECT TYPE(xcpot)
TYPE IS (t_xcpot_libxc)
CALL libxc_postprocess_gga_pw(xcpot,stars,cell,v_xc,grad)
END SELECT
ENDIF
!Put the potentials in rez. space.
CALL pw_from_grid(xcpot,stars,input%total,v_xc,vxc%pw,vxc%pw_w)
CALL pw_from_grid(xcpot,stars,input%total,v_x,vx%pw,vx%pw_w)
!Put the charge on the grid, in GGA case also calculate gradients
CALL pw_to_grid(xcpot,input%jspins,noco%l_noco,stars,cell,den%pw,grad,rho)
ALLOCATE(v_xc,mold=rho)
ALLOCATE(v_x,mold=rho)
!calculate the ex.-cor energy density
IF (ALLOCATED(exc%pw_w)) THEN
ALLOCATE ( e_xc(SIZE(rho,1),1) );e_xc=0.0
CALL xcpot%get_exc(input%jspins,rho,e_xc(:,1),grad)
CALL pw_from_grid(xcpot,stars,.TRUE.,e_xc,exc%pw,exc%pw_w)
ENDIF
CALL xcpot%get_vxc(input%jspins,rho,v_xc,v_x,grad)
CALL finish_pw_grid()
END SUBROUTINE vis_xc
IF (xcpot%needs_grad()) THEN
SELECT TYPE(xcpot)
TYPE IS (t_xcpot_libxc)
CALL libxc_postprocess_gga_pw(xcpot,stars,cell,v_xc,grad)
END SELECT
ENDIF
!Put the potentials in rez. space.
CALL pw_from_grid(xcpot,stars,input%total,v_xc,vxc%pw,vxc%pw_w)
CALL pw_from_grid(xcpot,stars,input%total,v_x,vx%pw,vx%pw_w)
if(allocated(EnergyDen%pw) .and. xcpot%exc_is_MetaGGA) then
CALL pw_to_grid(xcpot, input%jspins, noco%l_noco, stars, cell, EnergyDen%pw, tmp_grad, ED_rs)
CALL pw_to_grid(xcpot, input%jspins, noco%l_noco, stars, cell, vtot%pw, tmp_grad, vtot_rs)
CALL calc_kinEnergyDen(ED_rs, vtot_rs, kinED_rs)
endif
!calculate the ex.-cor energy density
IF (ALLOCATED(exc%pw_w)) THEN
ALLOCATE ( e_xc(SIZE(rho,1),1) ); e_xc=0.0
if(allocated(kinED_rs)) then
CALL xcpot%get_exc(input%jspins,rho,e_xc(:,1),grad,kinED_rs)
else
CALL xcpot%get_exc(input%jspins,rho,e_xc(:,1),grad)
endif
CALL pw_from_grid(xcpot,stars,.TRUE.,e_xc,exc%pw,exc%pw_w)
ENDIF
CALL finish_pw_grid()
END SUBROUTINE vis_xc
END MODULE m_vis_xc
This diff is collapsed.
......@@ -7,6 +7,11 @@ MODULE m_metagga
PUBLIC :: calc_EnergyDen
PRIVATE :: calc_EnergyDen_auxillary_weights, subtract_RS, multiply_RS
type t_RS_potden
REAL, ALLOCATABLE :: is(:,:), mt(:,:)
end type t_RS_potden
INTERFACE OPERATOR (-)
PROCEDURE subtract_RS
END INTERFACE OPERATOR (-)
......@@ -15,55 +20,13 @@ MODULE m_metagga
PROCEDURE multiply_RS
END INTERFACE OPERATOR (*)
CONTAINS
SUBROUTINE calc_kinEnergyDen(eig_id, mpi, kpts, noco, input, banddos, cell, den, atoms, enpara, stars,&
vacuum, DIMENSION, sphhar, sym, vTot, oneD, results, kinEnergyDen)
SUBROUTINE calc_kinEnergyDen(EnergyDen_rs, vTot_rs, den_rs, kinEnergyDen_rs)
#ifdef CPP_LIBXC
USE m_types_setup
USE m_types_potden
USE m_types_kpts
USE m_types_mpi
USE m_types_enpara
USE m_types_misc
USE m_types_regionCharges
USE m_types_dos
USE m_types_cdnval
USE m_types_xcpot
USE m_cdnval
IMPLICIT NONE
REAL, INTENT(in) :: den_RS(:,:), EnergyDen_RS(:,:), vTot_RS(:,:)
REAL, INTENT(inout), allocatable :: kinEnergyDen_rs(:,:)
INTEGER, INTENT(in) :: eig_id
TYPE(t_mpi), INTENT(in) :: mpi
TYPE(t_kpts), INTENT(in) :: kpts
TYPE(t_noco), INTENT(in) :: noco
TYPE(t_input), INTENT(in) :: input
TYPE(t_banddos), INTENT(in) :: banddos
TYPE(t_cell), INTENT(in) :: cell
TYPE(t_potden), INTENT(in) :: den
TYPE(t_atoms), INTENT(in) :: atoms
TYPE(t_enpara), INTENT(in) :: enpara
TYPE(t_stars), INTENT(in) :: stars
TYPE(t_vacuum), INTENT(in) :: vacuum
TYPE(t_dimension), INTENT(in) :: DIMENSION
TYPE(t_sphhar), INTENT(in) :: sphhar
TYPE(t_sym), INTENT(in) :: sym
TYPE(t_potden), INTENT(in) :: vTot
TYPE(t_oneD), INTENT(in) :: oneD
TYPE(t_results), INTENT(in) :: results
REAL, INTENT(inout) :: kinEnergyDen(:,:)
! local vars
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)
!implicit allocation
kinEnergyDen = EnergyDen_RS - vTot_RS * den_RS
#else
USE m_juDFT_stop
......
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