Commit 7aa13587 authored by Matthias Redies's avatar Matthias Redies

develop with deugging

parent 13992254
......@@ -74,6 +74,54 @@ CONTAINS
END DO ! loop over spins
END SUBROUTINE integrate_cdn
SUBROUTINE integrate_realspace(xcpot, atoms, sym, sphhar, input, &
stars, cell, oneD, vacuum, noco, mt, is, hint)
use m_types
use m_mt_tofrom_grid
use m_pw_tofrom_grid
use m_constants
implicit none
CLASS(t_xcpot), INTENT(inout) :: xcpot
TYPE(t_atoms),INTENT(IN) :: atoms
TYPE(t_sym), INTENT(in) :: sym
TYPE(t_sphhar), INTENT(IN) :: sphhar
TYPE(t_input), INTENT(IN) :: input
TYPE(t_stars), INTENT(IN) :: stars
TYPE(t_cell), INTENT(IN) :: cell
TYPE(t_oneD), INTENT(in) :: oneD
TYPE(t_vacuum), INTENT(in) :: vacuum
TYPE(t_noco), INTENT(in) :: noco
real, intent(inout) :: mt(:,:,:), is(:,:)
character(len=*), intent(in), optional :: hint
integer :: n_atm, i
TYPE(t_potden) :: tmp_potden
REAL :: q(input%jspins), qis(input%jspins), &
qmt(atoms%ntype,input%jspins), qvac(2,input%jspins),&
qtot, qistot
call tmp_potden%init(stars, atoms, sphhar, vacuum, noco, input%jspins, POTDEN_TYPE_DEN)
call init_mt_grid(input%jspins, atoms, sphhar, xcpot, sym)
do n_atm =1,atoms%ntype
call mt_from_grid(atoms, sphhar, n_atm, input%jspins, mt(:,:,n_atm), &
do i=1,atoms%jri(n_atm)
tmp_potden%mt(i,:,n_atm,:) = tmp_potden%mt(i,:,n_atm,:) * atoms%rmsh(i,n_atm)**2
call finish_mt_grid()
call init_pw_grid(xcpot, stars, sym, cell)
call pw_from_grid(xcpot, stars, .False., is, tmp_potden%pw)
call finish_pw_grid()
call integrate_cdn(stars,atoms,sym,vacuum,input,cell,oneD, tmp_potden, &
q, qis, qmt, qvac, qtot, qistot)
call print_cdn_inte(q, qis, qmt, qvac, qtot, qistot, hint)
END SUBROUTINE integrate_realspace
SUBROUTINE cdntot(stars,atoms,sym,vacuum,input,cell,oneD,&
......@@ -154,4 +202,28 @@ CONTAINS
CALL timestop("cdntot")
SUBROUTINE print_cdn_inte(q, qis, qmt, qvac, qtot, qistot, hint)
use ieee_arithmetic
implicit none
REAL, INTENT(in) :: q(:), qis(:), qmt(:,:), qvac(:,:), qtot, qistot
character(len=*), intent(in), optional :: hint
integer :: n_mt
if(present(hint)) write (*,*) "DEN of ", hint
write (*,*) "q = ", q
write (*,*) "qis = ", qis
write (*,*) "qmt"
do n_mt = 1,size(qmt, dim=1)
write (*,*) "mt = ", n_mt, qmt(n_mt,:)
if(.not. any(ieee_is_nan(qvac))) then
write (*, *) "qvac", qvac
write (*, *) "qtot", qtot
write (*, *) "qis_tot", qistot
END SUBROUTINE print_cdn_inte
END MODULE m_cdntot
......@@ -258,6 +258,8 @@ CONTAINS
#ifdef CPP_LIBXC
TYPE(xc_f03_func_info_t) :: xc_info
write (*,*) "check for hybrid"
xc_info = xc_f03_func_get_info(xcpot%vxc_func_x)
xcpot_is_hybrid=ANY([XC_FAMILY_HYB_MGGA, XC_FAMILY_HYB_GGA]==xc_f03_func_info_get_family(xc_info))
......@@ -32,6 +32,7 @@ CONTAINS
USE m_checkdopall
USE m_cdn_io
USE m_convol
use m_cdntot
......@@ -136,7 +137,10 @@ CONTAINS
CALL vmt_xc(DIMENSION, mpi, sphhar, atoms, den, xcpot, input, sym, &
obsolete, EnergyDen, vTot, vx, exc)
if(allocated(xcpot%kinED%mt) .and. allocated(xcpot%kinED%is)) then
call integrate_realspace(xcpot, atoms, sym, sphhar, input, stars, cell, oneD,&
vacuum, noco, xcpot%kinED%mt, xcpot%kinED%is, "kinED")
! add MT EXX potential to vr
IF (mpi%irank == 0) THEN
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