Commit c3965064 authored by Matthias Redies's avatar Matthias Redies

pre-merge

parent 7753cb2d
......@@ -37,6 +37,7 @@ SUBROUTINE cdngen(eig_id,mpi,input,banddos,sliceplot,vacuum,&
USE m_banddos_io
USE m_metagga
USE m_unfold_band_kpts
use m_npy
#ifdef CPP_MPI
USE m_mpi_bc_potden
#endif
......@@ -118,6 +119,7 @@ SUBROUTINE cdngen(eig_id,mpi,input,banddos,sliceplot,vacuum,&
IF (noco%l_mperp) jspmax = 1
DO jspin = 1,jspmax
CALL cdnvalJob%init(mpi,input,kpts,noco,results,jspin,sliceplot,banddos)
call save_npy("cdngen_weights.npy", cdnvalJob%weights)
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)
do dim_idx =1,3
......@@ -243,6 +245,7 @@ subroutine save_kinED(xcpot, input, noco, stars, cell, sym)
integer :: dim_idx
real, allocatable :: tmp(:,:), kinED(:,:)
type(t_gradients) :: grad
character(len=1000) :: filename
call init_pw_grid(xcpot, stars, sym, cell)
do dim_idx = 1,3
......@@ -254,25 +257,17 @@ subroutine save_kinED(xcpot, input, noco, stars, cell, sym)
endif
kinEd = kinED + tmp
enddo
open(unit=69, file="kin_ED_rezi_x.dat")
write (69,'(ES17.10)') xcpot%comparison_kinED_pw(1)%pw
close(69)
open(unit=69, file="kin_ED_rezi_y.dat")
write (69,'(ES17.10)') xcpot%comparison_kinED_pw(2)%pw
close(69)
write (filename, '( "kED_pw_comp_", I1, ".npy" )') dim_idx
call save_npy(filename, xcpot%comparison_kinED_pw(dim_idx)%pw)
open(unit=69, file="kin_ED_rezi_z.dat")
write (69,'(ES17.10)') xcpot%comparison_kinED_pw(3)%pw
close(69)
write (filename, '( "kED_realspace_comp_", I1, ".npy" )') dim_idx
call save_npy(filename, tmp)
enddo
kinED = 0.5 * kinED
call finish_pw_grid()
write (*,*) "kED shape =", shape(kinED)
call save_npy("kin_ED_pwway.npy", kinED)
open(unit=69, file="kin_ED_pwway.dat")
write (69,'(ES17.10)') kinED
......
......@@ -51,6 +51,12 @@ CONTAINS
IF (noco%l_mtnocoPot) CALL rotate_mt_den_from_local(atoms,sphhar,sym,denRot,vtot)
ENDIF
write (*,*) "Set vTot to zero, except for const shift"
vTot%pw_w = 0.0
vTot%pw = 0.0
!write (*,*) "vTot const = ", vTot%pw_w(1,:), vTot%pw(1,:)
! Rescale vCoul%pw_w with number of stars
DO js = 1, SIZE(vCoul%pw_w,2)
DO i = 1, stars%ng3
......
......@@ -50,9 +50,9 @@ CONTAINS
TYPE(t_gradients) :: grad, tmp_grad
REAL, ALLOCATABLE :: rho(:,:), ED_rs(:,:), vTot_rs(:,:), kinED_rs(:,:)
REAL, ALLOCATABLE :: rho_conv(:,:), ED_conv(:,:), vTot_conv(:,:)
COMPLEX, ALLOCATABLE :: den_pw_w(:,:), EnergyDen_pw_w(:,:)
COMPLEX, ALLOCATABLE :: den_pw_w(:,:), EnergyDen_pw_w(:,:), vtot_pw_norm(:,:)
REAL, ALLOCATABLE :: v_x(:,:),v_xc(:,:),e_xc(:,:)
INTEGER :: jspin
INTEGER :: jspin, i, js
CALL init_pw_grid(xcpot,stars,sym,cell)
......@@ -77,29 +77,23 @@ CONTAINS
IF(ALLOCATED(EnergyDen%pw) .AND. xcpot%exc_is_MetaGGA()) THEN
allocate(den_pw_w, mold=vTot%pw_w)
allocate(EnergyDen_pw_w, mold=vTot%pw_w)
do jspin = 1,input%jspins
call convol(stars, vTot%pw_w(:,jspin), vTot%pw, stars%ufft)
call convol(stars, den_pw_w(:,jspin), den%pw, stars%ufft)
call convol(stars, EnergyDen_pw_w(:,jspin), EnergyDen%pw, stars%ufft)
enddo
CALL pw_to_grid(xcpot, input%jspins, noco%l_noco, stars, &
cell, vTot%pw_w, tmp_grad, vTot_conv)
CALL pw_to_grid(xcpot, input%jspins, noco%l_noco, stars, &
cell, den_pw_w, tmp_grad, rho_conv)
CALL pw_to_grid(xcpot, input%jspins, noco%l_noco, stars, &
cell, EnergyDen_pw_w, tmp_grad, ED_conv)
call save_npy("den_conv.npy", rho_conv)
call save_npy("EnergyDen_conv.npy", ED_conv)
call save_npy("vTot_conv.npy", vTot_conv)
call save_npy("kinED_schr_conv_precut.npy", ED_conv - vTot_conv*rho_conv)
allocate(vtot_pw_norm, mold=vTot%pw)
CALL pw_to_grid(xcpot, input%jspins, noco%l_noco, stars, &
cell, EnergyDen%pw, tmp_grad, ED_rs)
DO js=1,SIZE(vtot_pw_norm,2)
DO i=1,stars%ng3
vTot_pw_norm(i,js)=vTot%pw(i,js) / stars%nstr(i)
END DO
END DO
write (*,*) "set vtot = 0 again (except shift of course)"
vTot_pw_norm = 0.0
vTot%pw = 0.0
vTot%pw_w = 0.0
CALL pw_to_grid(xcpot, input%jspins, noco%l_noco, stars, &
cell, vTot%pw, tmp_grad, vTot_rs)
cell, vTot_pw_norm, tmp_grad, vTot_rs)
CALL calc_kinEnergyDen(ED_rs, vTot_rs, rho, kinED_rs, .True.)
ENDIF
......
......@@ -14,6 +14,7 @@ MODULE m_metagga
CONTAINS
SUBROUTINE calc_kinEnergyDen(EnergyDen_rs, vTot_rs, den_rs, kinEnergyDen_RS, is_pw)
USE m_juDFT_stop
use m_npy
!use m_cdngen
IMPLICIT NONE
REAL, INTENT(in) :: den_RS(:,:), EnergyDen_RS(:,:), vTot_RS(:,:)
......@@ -25,13 +26,13 @@ CONTAINS
!implicit allocation
kinEnergyDen_RS = EnergyDen_RS - vTot_RS * den_RS
!if(is_pw) then
!call save_npy("EnergyDen_RS.npy", EnergyDen_RS)
!call save_npy("vTot_RS.npy", vTot_RS)
!call save_npy("den_RS.npy", den_RS)
!call save_npy("vTot_RSxdenRS.npy", vtot_RS*den_RS)
!call save_npy("kinED_pw_schroeway_precut.npy",kinEnergyDen_RS)
!endif
if(is_pw) then
call save_npy("EnergyDen_RS.npy", EnergyDen_RS)
call save_npy("vTot_RS.npy", vTot_RS)
call save_npy("den_RS.npy", den_RS)
call save_npy("vTot_RSxdenRS.npy", vtot_RS*den_RS)
call save_npy("kinED_pw_schroeway_precut.npy",kinEnergyDen_RS)
endif
if(any(kinEnergyDen_RS < eps)) then
write (6,*) " lowest kinetic energy density cutoff = ", minval(kinEnergyDen_RS)
......@@ -39,7 +40,7 @@ CONTAINS
endif
if(is_pw) then
!call save_npy("kinED_pw_schroeway.npy",kinEnergyDen_RS)
call save_npy("kinED_pw_schroeway.npy",kinEnergyDen_RS)
write (*,*) "read new"
open(unit=69, file="kin_ED_pwway.dat")
......
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