Commit c1499fa3 authored by Matthias Redies's avatar Matthias Redies

apply correction to temporary potential, not real one

parent 02dfc4f4
...@@ -70,8 +70,10 @@ CONTAINS ...@@ -70,8 +70,10 @@ CONTAINS
! use updated vTot for exc calculation ! use updated vTot for exc calculation
IF(ALLOCATED(EnergyDen%pw) .AND. xcpot%exc_is_MetaGGA()) THEN 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, &
CALL pw_to_grid(xcpot, input%jspins, noco%l_noco, stars, cell, vTot%pw, tmp_grad, vTot_rs) 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, rho, kinED_rs) CALL calc_kinEnergyDen(ED_rs, vTot_rs, rho, kinED_rs)
ENDIF ENDIF
......
...@@ -50,6 +50,7 @@ CONTAINS ...@@ -50,6 +50,7 @@ CONTAINS
! .. Local Scalars .. ! .. Local Scalars ..
TYPE(t_gradients) :: grad, tmp_grad TYPE(t_gradients) :: grad, tmp_grad
TYPE(t_xcpot_inbuild) :: xcpot_tmp TYPE(t_xcpot_inbuild) :: xcpot_tmp
TYPE(t_potden) :: vTot_tmp
REAL, ALLOCATABLE :: ch(:,:), ED_rs(:,:), vTot_rs(:,:), kinED_rs(:,:) REAL, ALLOCATABLE :: ch(:,:), ED_rs(:,:), vTot_rs(:,:), kinED_rs(:,:)
INTEGER :: n,nsp,nt,jr INTEGER :: n,nsp,nt,jr
REAL :: divi REAL :: divi
...@@ -118,8 +119,11 @@ CONTAINS ...@@ -118,8 +119,11 @@ CONTAINS
divi = 1.0 / (atoms%rmsh(atoms%jri(n),n) - atoms%rmsh(1,n)) divi = 1.0 / (atoms%rmsh(atoms%jri(n),n) - atoms%rmsh(1,n))
nt=0 nt=0
DO jr=1,atoms%jri(n) DO jr=1,atoms%jri(n)
v_xc(nt+1:nt+nsp,:) = ( xcl(nt+1:nt+nsp,:) * ( atoms%rmsh(atoms%jri(n),n) - atoms%rmsh(jr,n) ) +& v_xc(nt+1:nt+nsp,:) = ( xcl(nt+1:nt+nsp,:) * ( atoms%rmsh(atoms%jri(n),n) &
v_xc(nt+1:nt+nsp,:) * ( atoms%rmsh(jr,n) - atoms%rmsh(1,n) ) ) * divi - atoms%rmsh(jr,n) ) &
+ v_xc(nt+1:nt+nsp,:) * ( atoms%rmsh(jr,n) &
- atoms%rmsh(1,n) ) &
) * divi
nt=nt+nsp nt=nt+nsp
ENDDO ENDDO
ENDIF ENDIF
...@@ -132,14 +136,17 @@ CONTAINS ...@@ -132,14 +136,17 @@ CONTAINS
! use updated vTot for exc calculation ! use updated vTot for exc calculation
IF(perform_MetaGGA) THEN IF(perform_MetaGGA) THEN
CALL mt_to_grid(xcpot, input%jspins, atoms,sphhar,EnergyDen%mt(:,0:,n,:),nsp,n,tmp_grad,ED_rs) CALL mt_to_grid(xcpot, input%jspins, atoms, sphhar, EnergyDen%mt(:,0:,n,:), &
nsp, n, tmp_grad, ED_rs)
! multiply potentials with r^2, because mt_to_grid is made for densities, ! multiply potentials with r^2, because mt_to_grid is made for densities,
! which are stored with a factor r^2 ! which are stored with a factor r^2
vTot_tmp = vTot
DO jr=1,atoms%jri(n) DO jr=1,atoms%jri(n)
vTot%mt(jr,0:,n,:) = vTot%mt(jr,0:,n,:) * atoms%rmsh(jr,n)**2 vTot_tmp%mt(jr,0:,n,:) = vTot_tmp%mt(jr,0:,n,:) * atoms%rmsh(jr,n)**2
ENDDO ENDDO
CALL mt_to_grid(xcpot, input%jspins, atoms,sphhar,vTot%mt(:,0:,n,:),nsp,n,tmp_grad,vTot_rs) CALL mt_to_grid(xcpot, input%jspins, atoms, sphhar, vTot_tmp%mt(:,0:,n,:), &
nsp, n, tmp_grad, vTot_rs)
CALL calc_kinEnergyDen(ED_rs, vTot_rs, ch, kinED_rs) CALL calc_kinEnergyDen(ED_rs, vTot_rs, ch, kinED_rs)
ENDIF ENDIF
......
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