Commit dd0483f9 authored by Henning Janssen's avatar Henning Janssen

Fixed l_adjEnpara feature

parent 97de349c
......@@ -94,7 +94,7 @@ MODULE m_hubbard1_setup
f6(:,1) = (f6(:,1) + f6(:,input%jspins) ) / 2
CALL umtx(atoms%lda_u(indStart:indEnd),atoms%n_hia,f0(:,1),f2(:,1),f4(:,1),f6(:,1),u)
CALL v_mmp(sym,atoms,atoms%lda_u(indStart:indEnd),atoms%n_hia,input%jspins,.FALSE.,den%mmpMat(:,:,indStart:indEnd,:),&
CALL v_mmp(sym,atoms,atoms%lda_u(indStart:indEnd),atoms%n_hia,input%jspins,input%l_dftspinpol,den%mmpMat(:,:,indStart:indEnd,:),&
u,f0,f2,pot%mmpMat(:,:,indStart:indEnd,:),e_lda_hia)
IF(hub1%l_runthisiter.AND.(ANY(gdft%gmmpMat(:,:,:,:,:,:).NE.0.0)).AND.mpi%irank.EQ.0) THEN
......@@ -135,7 +135,7 @@ MODULE m_hubbard1_setup
ENDDO
ENDIF
!Initial Information
!Initial Information (We are already on irank 0)
WRITE(6,*)
WRITE(6,9010) nType
WRITE(6,"(A)") "Everything related to the solver (e.g. mu_dc) is given in eV"
......@@ -265,7 +265,7 @@ MODULE m_hubbard1_setup
!----------------------------------------------------------------------
! Calculate DFT+U potential correction
!----------------------------------------------------------------------
CALL v_mmp(sym,atoms,atoms%lda_u(indStart:indEnd),atoms%n_hia,input%jspins,.FALSE.,mmpMat,&
CALL v_mmp(sym,atoms,atoms%lda_u(indStart:indEnd),atoms%n_hia,input%jspins,input%l_dftspinpol,mmpMat,&
u,f0,f2,pot%mmpMat(:,:,indStart:indEnd,:),results%e_ldau)
!----------------------------------------------------------------------
! Calculate the distance and update the density matrix
......
......@@ -260,6 +260,8 @@ CONTAINS
CALL timestart("gen. of hamil. and diag. (total)")
CALL timestart("eigen")
vTemp = vTot
vTemp%mmpMat = 0.0 !To avoid errors later on (When ldaUAdjEnpara is T the density
!is carried over after vgen)
CALL timestart("Updating energy parameters")
CALL enpara%update(mpi,atoms,vacuum,input,vToT)
CALL timestop("Updating energy parameters")
......
......@@ -57,12 +57,22 @@ CONTAINS
TYPE(t_potden) :: workden,denRot
COMPLEX :: mmpmat(-lmaxU_const:lmaxU_const,-lmaxU_const:lmaxU_const,MAX(1,atoms%n_u+atoms%n_hia),input%jspins)
if (mpi%irank==0) WRITE (6,FMT=8000)
8000 FORMAT (/,/,t10,' p o t e n t i a l g e n e r a t o r',/)
IF(atoms%n_u+atoms%n_hia>0.AND.input%ldaUAdjEnpara) THEN
!In this case we need the last mmpmat after vgen
mmpmat = vTot%mmpmat
ENDIF
CALL vTot%resetPotDen()
CALL vCoul%resetPotDen()
CALL vx%resetPotDen()
IF(atoms%n_u+atoms%n_hia>0.AND.input%ldaUAdjEnpara) THEN
!In this case we need the last mmpmat after vgen
vTot%mmpmat = mmpmat
ENDIF
ALLOCATE(vx%pw_w,mold=vTot%pw)
vx%pw_w = 0.0
#ifndef CPP_OLDINTEL
......
......@@ -272,7 +272,10 @@ CONTAINS
!Set the energy parameters to the same value
!We want the shell where Hubbard 1 is applied to
!be non spin-polarized
IF(mpi%irank.EQ.0) WRITE(6,"(A)") "For Hubbard 1 we treat the correlated shell to be non spin-polarized"
IF(mpi%irank.EQ.0) THEN
WRITE(6,FMT=*)
WRITE(6,"(A)") "For Hubbard 1 we treat the correlated shell to be non spin-polarized"
ENDIF
DO j = atoms%n_u+1, atoms%n_u+atoms%n_hia
l = atoms%lda_u(j)%l
n = atoms%lda_u(j)%atomType
......@@ -284,7 +287,10 @@ CONTAINS
IF(input%ldauAdjEnpara.AND.atoms%n_u+atoms%n_hia>0) THEN
!If requested we can adjust the energy parameters to the LDA+U potential correction
IF(mpi%irank.EQ.0) WRITE(6,"(A)") "LDA+U corrections for the energy parameters"
IF(mpi%irank.EQ.0) THEN
WRITE(6,FMT=*)
WRITE(6,"(A)") "LDA+U corrections for the energy parameters"
ENDIF
DO j = 1, atoms%n_u+atoms%n_hia
l = atoms%lda_u(j)%l
n = atoms%lda_u(j)%atomType
......@@ -294,9 +300,10 @@ CONTAINS
DO i = -l,l
tr = tr + REAL(v%mmpMat(i,i,j,jsp))
ENDDO
enpara%el0(l,n,jsp) = enpara%el0(l,n,jsp) + tr/(2*l+1)
enpara%el0(l,n,jsp) = enpara%el0(l,n,jsp) + tr/REAL(2*l+1)
IF(mpi%irank.EQ.0) WRITE(6,"(A27,I3,A3,I1,A6,I1,A4,f16.10)")&
"New energy parameter atom ", n, " l ", l, " spin ", jsp,"--> ", enpara%el0(l,n,jsp)
ENDDO
IF(mpi%irank.EQ.0) WRITE(6,"(A27,I3,A3,I1,A6,I1,A4,f16.10)") "New energy parameter atom ", n, " l ", l, " spin ", jsp,"--> ", enpara%el0(l,n,jsp)
ENDDO
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