Commit 2085015f authored by Henning Janssen's avatar Henning Janssen

Slightly change the check for LOs and uniqueElements function in preparation...

Slightly change the check for LOs and uniqueElements function in preparation of LO+radial dependence
parent a464e3e2
......@@ -163,7 +163,7 @@ SUBROUTINE cdnval(eig_id, fmpi,kpts,jspin,noco,nococonv,input,banddos,cell,atoms
!Greens function always considers the empty states
IF(gfinp%n>0 .AND. PRESENT(greensfImagPart)) THEN
IF(greensfImagPart%l_calc) &
CALL greensfBZintCoeffs%init(gfinp,input,noco,jsp_start,jsp_end,&
CALL greensfBZintCoeffs%init(gfinp,atoms,input,noco,jsp_start,jsp_end,&
SIZE(cdnvalJob%k_list),SIZE(cdnvalJob%ev_list))
ENDIF
......
......@@ -88,7 +88,7 @@ MODULE m_types_gfinp
PROCEDURE :: eMesh => eMesh_gfinp
PROCEDURE :: checkRadial => checkRadial_gfinp
PROCEDURE :: checkSphavg => checkSphavg_gfinp
PROCEDURE :: checkforLO => checkforLO_gfinp
PROCEDURE :: countLOs => countLOs_gfinp
PROCEDURE :: addNearestNeighbours => addNearestNeighbours_gfelem
END TYPE t_gfinp
......@@ -541,29 +541,38 @@ CONTAINS
END SUBROUTINE init_gfinp
FUNCTION uniqueElements_gfinp(this,ind,l_sphavg,indUnique) Result(uniqueElements)
FUNCTION uniqueElements_gfinp(this,atoms,ind,l_sphavg,lo,indUnique,maxLO) Result(uniqueElements)
USE m_types_atoms
CLASS(t_gfinp), INTENT(IN) :: this
TYPE(t_atoms), INTENT(IN) :: atoms
INTEGER, OPTIONAL,INTENT(IN) :: ind
LOGICAL, OPTIONAL,INTENT(IN) :: l_sphavg !uniqueElements are determined separately for radial dependence and spherically averaging
LOGICAL, OPTIONAL,INTENT(IN) :: lo !We are interested in unique LO elems (radial dependence)
INTEGER, OPTIONAL,INTENT(INOUT) :: indUnique !Position of the corresponding unique Element for a given ind
INTEGER, OPTIONAL,INTENT(INOUT) :: maxLO !Maximum number of Elements associated with a GF element
INTEGER :: uniqueElements !Number of unique elements before ind or in the whole array (if ind is not present)
INTEGER :: maxGF
INTEGER :: l,lp,atomType,atomTypep,iUnique,iContour,i_gf
LOGICAL :: l_sphavgArg, l_sphavgElem
LOGICAL :: l_sphavgArg, l_sphavgElem,loArg
l_sphavgArg = .TRUE.
IF(PRESENT(l_sphavg)) l_sphavgArg = l_sphavg
loArg = .FALSE.
IF(PRESENT(lo)) loArg = lo
uniqueElements = 0
IF(PRESENT(maxLO)) maxLO = 0
IF(PRESENT(ind)) THEN
maxGF = ind
ELSE
maxGF = this%n
ENDIF
DO i_gf = 1, maxGF
l = this%elem(i_gf)%l
lp = this%elem(i_gf)%lp
......@@ -575,7 +584,17 @@ CONTAINS
iUnique = this%find(l,atomType,iContour,l_sphavgElem,lp=lp,nTypep=atomTypep,&
uniqueMax=i_gf)
IF(iUnique == i_gf) uniqueElements = uniqueElements +1
IF(iUnique == i_gf) THEN
IF(loArg.AND..NOT.l_sphavgElem) THEN
nLO = this%countLOs(atoms,i_gf)
IF(nLO/=0) uniqueElements = uniqueElements +1
IF(PRESENT(maxLO)) THEN
IF(nLO>maxLO) maxLO = nLO
ENDIF
ELSE
uniqueElements = uniqueElements +1
ENDIF
ENDIF
ENDDO
IF(PRESENT(indUnique)) THEN
......@@ -876,8 +895,9 @@ CONTAINS
END FUNCTION checkSphavg_gfinp
PURE LOGICAL FUNCTION checkforLO_gfinp(this,atoms,i_gf)
PURE INTEGER FUNCTION countLOs_gfinp(this,atoms,i_gf)
!Counts the number of LOs associated with this green's function element
USE m_types_atoms
CLASS(t_gfinp), INTENT(IN) :: this
......@@ -891,16 +911,18 @@ CONTAINS
atomType = this%elem(i_gf)%atomType
atomTypep = this%elem(i_gf)%atomTypep
checkforLO_gfinp = .FALSE.
countLOs_gfinp = 0
DO ilo = 1, atoms%nlo(atomType)
IF(atoms%llo(ilo,atomType).NE.l) CYCLE
checkforLO_gfinp = .TRUE.
countLOs_gfinp = countLOs_gfinp + 1
ENDDO
DO ilop = 1, atoms%nlo(atomTypep)
IF(atoms%llo(ilop,atomType).NE.lp) CYCLE
checkforLO_gfinp = .TRUE.
ENDDO
IF(l.NE.lp.OR.atomType.NE.atomTypep) THEN
DO ilop = 1, atoms%nlo(atomTypep)
IF(atoms%llo(ilop,atomType).NE.lp) CYCLE
countLOs_gfinp = countLOs_gfinp + 1
ENDDO
ENDIF
END FUNCTION checkforLO_gfinp
......
......@@ -9,9 +9,10 @@ MODULE m_excSplitting
CONTAINS
SUBROUTINE excSplitting(gfinp,input,greensfImagPart,ef)
SUBROUTINE excSplitting(gfinp,atoms,input,greensfImagPart,ef)
TYPE(t_gfinp), INTENT(IN) :: gfinp
TYPE(t_atoms), INTENT(IN) :: atoms
TYPE(t_input), INTENT(IN) :: input
TYPE(t_greensfImagPart), INTENT(IN) :: greensfImagPart
REAL, INTENT(IN) :: ef
......@@ -50,7 +51,7 @@ MODULE m_excSplitting
IF(atomType /= atomTypep) CYCLE
IF(.NOT.l_sphavg) CYCLE
i_elem = gfinp%uniqueElements(ind=i_gf,l_sphavg=l_sphavg,indUnique=indUnique)
i_elem = gfinp%uniqueElements(atoms,ind=i_gf,l_sphavg=l_sphavg,indUnique=indUnique)
IF(i_gf /= indUnique) CYCLE
!-------------------------------------------------
......
......@@ -56,7 +56,7 @@ MODULE m_greensfBZint
atomFactor = MERGE(1.0,1.0/atoms%neq(atomType),l.NE.lp)
atomFactor = MERGE(1.0,atomFactor,atomType.NE.atomTypep)
i_elem = gfinp%uniqueElements(ind=i_gf,l_sphavg=l_sphavg,indUnique=indUnique)
i_elem = gfinp%uniqueElements(atoms,ind=i_gf,l_sphavg=l_sphavg,indUnique=indUnique)
IF(i_gf/=indUnique) CYCLE
......
......@@ -88,7 +88,7 @@ MODULE m_greensfCalcImagPart
lp = gfinp%elem(i_gf)%lp
l_sphavg = gfinp%elem(i_gf)%l_sphavg
i_elem = gfinp%uniqueElements(ind=i_gf,l_sphavg=l_sphavg,indUnique=indUnique)
i_elem = gfinp%uniqueElements(atoms,ind=i_gf,l_sphavg=l_sphavg,indUnique=indUnique)
IF(i_gf/=indUnique) CYCLE
......
......@@ -70,7 +70,7 @@ MODULE m_greensfCalcRealPart
fixedCutoff = g(i_gf)%elem%fixedCutoff
refCutoff = g(i_gf)%elem%refCutoff
i_elem = gfinp%uniqueElements(ind=i_gf,l_sphavg=l_sphavg,indUnique=indUnique)
i_elem = gfinp%uniqueElements(atoms,ind=i_gf,l_sphavg=l_sphavg,indUnique=indUnique)
IF(i_gf /= indUnique.AND..NOT.l_fixedCutoffset.AND.refCutoff==-1&
.AND..NOT.g(indUnique)%elem%l_fixedCutoffset.AND.g(indUnique)%elem%refCutoff==-1) THEN
......@@ -79,7 +79,7 @@ MODULE m_greensfCalcRealPart
ELSE
!Is the current element suitable for automatic finding of the cutoff
l_onsite = nType.EQ.nTypep.AND.l.EQ.lp
IF(l_onsite.AND..NOT.l_fixedCutoffset.AND.refCutoff==-1 .AND..NOT.gfinp%checkforLO(atoms,i_gf)) THEN
IF(l_onsite.AND..NOT.l_fixedCutoffset.AND.refCutoff==-1 .AND.gfinp%countLOs(atoms,i_gf)==0) THEN
!
!Check the integral over the fDOS to define a cutoff for the Kramer-Kronigs-Integration
! with LOs I just use a fixed cutoff or reference otherwise I would need to check whether
......@@ -116,7 +116,7 @@ MODULE m_greensfCalcRealPart
fixedCutoff = g(i_gf)%elem%fixedCutoff
refCutoff = g(i_gf)%elem%refCutoff
l_sphavg = g(i_gf)%elem%l_sphavg
i_elem = gfinp%uniqueElements(ind=i_gf,l_sphavg=l_sphavg,indUnique=indUnique)
i_elem = gfinp%uniqueElements(atoms,ind=i_gf,l_sphavg=l_sphavg,indUnique=indUnique)
IF(refCutoff/=-1) THEN
!Overwrite cutoff with reference from other elements
......@@ -185,7 +185,7 @@ MODULE m_greensfCalcRealPart
l_sphavg = g(i_gf)%elem%l_sphavg
contourShape = gfinp%contour(g(i_gf)%elem%iContour)%shape
i_elem = gfinp%uniqueElements(ind=i_gf,l_sphavg=l_sphavg)
i_elem = gfinp%uniqueElements(atoms,ind=i_gf,l_sphavg=l_sphavg)
CALL timestart("Green's Function: Kramer-Kronigs-Integration")
DO jspin = spin_start, spin_end
......
......@@ -70,7 +70,7 @@ MODULE m_greensfPostProcess
CALL crystal_field(atoms,gfinp,hub1inp,input,nococonv,greensfImagPart,vTot,results%ef,hub1data)
ENDIF
CALL excSplitting(gfinp,input,greensfImagPart,results%ef)
CALL excSplitting(gfinp,atoms,input,greensfImagPart,results%ef)
IF(gfinp%checkRadial()) THEN
CALL timestart("Green's Function: Radial Functions")
......@@ -92,7 +92,7 @@ MODULE m_greensfPostProcess
l_sphavg = gfinp%elem(i_gf)%l_sphavg
IF(l_sphavg) CYCLE
i_elem = gfinp%uniqueElements(ind=i_gf,l_sphavg=l_sphavg,indUnique=indUnique)
i_elem = gfinp%uniqueElements(atoms,ind=i_gf,l_sphavg=l_sphavg,indUnique=indUnique)
IF(i_gf/=indUnique) THEN
u(:,:,:,:,:,i_gf) = u(:,:,:,:,:,indUnique)
......@@ -142,7 +142,7 @@ MODULE m_greensfPostProcess
l_sphavg = gfinp%elem(i_gf)%l_sphavg
IF(l.NE.lp) CYCLE
IF(atomType.NE.atomTypep) CYCLE
l_check = .NOT.gfinp%checkforLO(atoms,i_gf)
l_check = gfinp%countLOs(atoms,i_gf)==0 !If there are SCLOs present the occupations can get bigger than 1
IF(l_sphavg) THEN
CALL occmtx(greensFunction(i_gf),gfinp,input,mmpmat(:,:,i_gf,:),l_write=.TRUE.,check=l_check)
ELSE IF(.NOT.gfinp%l_mperp) THEN
......
......@@ -57,7 +57,7 @@ MODULE m_crystalfield
nType = atoms%lda_u(atoms%n_u+i_hia)%atomType
i_gf = gfinp%hiaElem(i_hia)
i_elem = gfinp%uniqueElements(ind=i_gf,l_sphavg=.TRUE.)
i_elem = gfinp%uniqueElements(atoms,ind=i_gf,l_sphavg=.TRUE.)
!---------------------------------------------------------
! Perform the integration
!---------------------------------------------------------
......
......@@ -132,7 +132,7 @@ SUBROUTINE cdngen(eig_id,fmpi,input,banddos,sliceplot,vacuum,&
greensFunction(i_gf)%contour = contour(iContour)
CALL greensFunction(i_gf)%reset()
ENDDO
CALL greensfImagPart%init(gfinp,input,noco,ANY(greensFunction(:)%l_calc))
CALL greensfImagPart%init(gfinp,atoms,input,noco,ANY(greensFunction(:)%l_calc))
IF(atoms%n_hia.GT.0 .AND. fmpi%irank==0 .AND.PRESENT(hub1data)) hub1data%mag_mom = 0.0
ENDIF
......
......@@ -60,10 +60,11 @@ MODULE m_types_greensfCoeffs
CONTAINS
SUBROUTINE greensfBZintCoeffs_init(this,gfinp,input,noco,jsp_start,jsp_end,nkpts,nbands)
SUBROUTINE greensfBZintCoeffs_init(this,gfinp,atoms,input,noco,jsp_start,jsp_end,nkpts,nbands)
CLASS(t_greensfBZintCoeffs), INTENT(INOUT) :: this
TYPE(t_gfinp), INTENT(IN) :: gfinp
TYPE(t_atoms), INTENT(IN) :: atoms
TYPE(t_input), INTENT(IN) :: input
TYPE(t_noco), INTENT(IN) :: noco
INTEGER, INTENT(IN) :: jsp_start,jsp_end
......@@ -80,8 +81,8 @@ MODULE m_types_greensfCoeffs
ENDIF
!Determine number of unique gf elements
uniqueElementsSphavg = gfinp%uniqueElements(l_sphavg=.TRUE.) !How many spherically averaged elements
uniqueElementsRadial = gfinp%uniqueElements(l_sphavg=.FALSE.) !How many elements with radial dependence
uniqueElementsSphavg = gfinp%uniqueElements(atoms,l_sphavg=.TRUE.) !How many spherically averaged elements
uniqueElementsRadial = gfinp%uniqueElements(atoms,l_sphavg=.FALSE.) !How many elements with radial dependence
IF(uniqueElementsSphavg>0) THEN
ALLOCATE (this%sphavg(nbands,-lmax:lmax,-lmax:lmax,uniqueElementsSphavg,nkpts,jsp_start:maxSpin),source=cmplx_0)
......@@ -96,10 +97,11 @@ MODULE m_types_greensfCoeffs
END SUBROUTINE greensfBZintCoeffs_init
SUBROUTINE greensfImagPart_init(this,gfinp,input,noco,l_calc)
SUBROUTINE greensfImagPart_init(this,gfinp,atoms,input,noco,l_calc)
CLASS(t_greensfImagPart), INTENT(INOUT) :: this
TYPE(t_gfinp), INTENT(IN) :: gfinp
TYPE(t_atoms), INTENT(IN) :: atoms
TYPE(t_input), INTENT(IN) :: input
TYPE(t_noco), INTENT(IN) :: noco
LOGICAL, INTENT(IN) :: l_calc
......@@ -112,8 +114,8 @@ MODULE m_types_greensfCoeffs
this%l_calc = l_calc
!Determine number of unique gf elements
uniqueElementsSphavg = gfinp%uniqueElements(l_sphavg=.TRUE.) !How many spherically averaged elements
uniqueElementsRadial = gfinp%uniqueElements(l_sphavg=.FALSE.) !How many elements with radial dependence
uniqueElementsSphavg = gfinp%uniqueElements(atoms,l_sphavg=.TRUE.) !How many spherically averaged elements
uniqueElementsRadial = gfinp%uniqueElements(atoms,l_sphavg=.FALSE.) !How many elements with radial dependence
ALLOCATE (this%kkintgr_cutoff(gfinp%n,input%jspins,2),source=0)
IF(uniqueElementsSphavg>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