Commit 2c6549f3 authored by Gregor Michalicek's avatar Gregor Michalicek

1st try to fix the new problem with LDA+U

I couldn't identify the original bug so I did some major changes and
now everything is different.

There still is a problem but it is different now.
parent a110fd43
......@@ -193,8 +193,22 @@ CONTAINS
0,-1.0,0.0,.FALSE.,inDen%iter,inDen%mt,inDen%pw,inDen%vacz,inDen%vacxy,inDen%cdom,&
inDen%cdomvz,inDen%cdomvxy)
END IF
ALLOCATE (inDen%mmpMat(-lmaxU_const:lmaxU_const,-lmaxU_const:lmaxU_const,MAX(1,atoms%n_u),input%jspins))
! Initialize and load inDen density without density matrix(end)
! Initialize mixDen density (start)
CALL mixDen%init(stars,atoms,sphhar,vacuum,oneD,input%jspins,.FALSE.)
IF (noco%l_noco) THEN
ALLOCATE (mixDen%cdom(stars%ng3),mixDen%cdomvz(vacuum%nmzd,2))
ALLOCATE (mixDen%cdomvxy(vacuum%nmzxyd,oneD%odi%n2d-1,2))
archiveType = CDN_ARCHIVE_TYPE_NOCO_const
ELSE
ALLOCATE (mixDen%cdom(1),mixDen%cdomvz(1,1),mixDen%cdomvxy(1,1,1))
archiveType = CDN_ARCHIVE_TYPE_CDN1_const
ENDIF
ALLOCATE (mixDen%mmpMat(-lmaxU_const:lmaxU_const,-lmaxU_const:lmaxU_const,MAX(1,atoms%n_u),input%jspins))
! Initialize mixDen density (end)
DO WHILE (l_cont)
it = it + 1
......@@ -253,19 +267,14 @@ CONTAINS
END IF
! Initialize and load inDen density matrix and broadcast inDen(start)
WRITE(*,*) 'test-1'
IF (ALLOCATED(inDen%mmpMat)) DEALLOCATE (inDen%mmpMat)
IF(mpi%irank.EQ.0) THEN
IF (isDensityMatrixPresent().AND.atoms%n_u>0) THEN
ALLOCATE (inDen%mmpMat(-lmaxU_const:lmaxU_const,-lmaxU_const:lmaxU_const,atoms%n_u,input%jspins))
CALL readDensityMatrix(input,atoms,inDen%mmpMat,l_error)
IF(l_error) CALL juDFT_error('Error in reading density matrix!',calledby='fleur')
ELSE
ALLOCATE (inDen%mmpMat(-lmaxU_const:-lmaxU_const,-lmaxU_const:-lmaxU_const,1,input%jspins))
inDen%mmpMat = CMPLX(0.0,0.0)
END IF
END IF
WRITE(*,*) 'test-2'
#ifdef CPP_MPI
CALL mpi_bc_potden(mpi,stars,sphhar,atoms,input,vacuum,oneD,noco,inDen)
#endif
......
......@@ -46,7 +46,7 @@ SUBROUTINE mix(stars,atoms,sphhar,vacuum,input,sym,cell,noco,oneD,&
TYPE(t_atoms),INTENT(INOUT) :: atoms !n_u is modified temporarily
TYPE(t_potden),INTENT(IN) :: inDen, outDen
TYPE(t_results),INTENT(INOUT) :: results
TYPE(t_potden),INTENT(OUT) :: mixDen
TYPE(t_potden),INTENT(INOUT) :: mixDen
!Local Scalars
REAL fix,intfac,vacfac
......@@ -198,20 +198,6 @@ SUBROUTINE mix(stars,atoms,sphhar,vacuum,input,sym,cell,noco,oneD,&
END IF
!initiatlize mixed density and extract it with brysh2 call
CALL mixDen%init(stars,atoms,sphhar,vacuum,oneD,input%jspins,.FALSE.)
IF (noco%l_noco) THEN
ALLOCATE (mixDen%cdom(stars%ng3),mixDen%cdomvz(vacuum%nmzd,2))
ALLOCATE (mixDen%cdomvxy(vacuum%nmzxyd,oneD%odi%n2d-1,2))
archiveType = CDN_ARCHIVE_TYPE_NOCO_const
ELSE
ALLOCATE (mixDen%cdom(1),mixDen%cdomvz(1,1),mixDen%cdomvxy(1,1,1))
archiveType = CDN_ARCHIVE_TYPE_CDN1_const
ENDIF
IF (atoms%n_u.GT.0) THEN
ALLOCATE (mixDen%mmpMat(-lmaxU_const:lmaxU_const,-lmaxU_const:lmaxU_const,atoms%n_u,input%jspins))
ELSE
ALLOCATE (mixDen%mmpMat(-lmaxU_const:-lmaxU_const,-lmaxU_const:-lmaxU_const,1,input%jspins))
END IF
mixDen%cdom = CMPLX(0.0,0.0)
mixDen%cdomvz = CMPLX(0.0,0.0)
mixDen%cdomvxy = CMPLX(0.0,0.0)
......@@ -291,6 +277,7 @@ SUBROUTINE mix(stars,atoms,sphhar,vacuum,input,sym,cell,noco,oneD,&
CALL writeDensity(stars,vacuum,atoms,cell,sphhar,input,sym,oneD,archiveType,CDN_INPUT_DEN_const,&
1,results%last_distance,results%ef,.TRUE.,iter,mixDen%mt,mixDen%pw,mixDen%vacz,&
mixDen%vacxy,mixDen%cdom,mixDen%cdomvz,mixDen%cdomvxy)
mixDen%iter = inDen%iter + 1
IF (atoms%n_u > 0) THEN
OPEN (69,file='n_mmp_mat',status='replace',form='formatted')
......
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