Commit c8f4d88f authored by Gregor Michalicek's avatar Gregor Michalicek

Move regCharges definition to cdngen

1. This fixes the problem from the previous commit.
2. Also in this commit: move qmat array to cdn/qal_21.f90 as it is used nowhere else.
parent e31807ef
......@@ -2,7 +2,7 @@ MODULE m_cdnval
use m_juDFT
CONTAINS
SUBROUTINE cdnval(eig_id, mpi,kpts,jspin,sliceplot,noco, input,banddos,cell,atoms,enpara,stars,&
vacuum,dimension,sphhar,sym,obsolete,vTot,oneD,coreSpecInput,den,results,&
vacuum,dimension,sphhar,sym,obsolete,vTot,oneD,coreSpecInput,den,regCharges,results,&
qa21,chmom,clmom)
!
! ***********************************************************
......@@ -106,6 +106,7 @@ CONTAINS
TYPE(t_coreSpecInput),INTENT(IN) :: coreSpecInput
TYPE(t_potden),INTENT(IN) :: vTot
TYPE(t_potden),INTENT(INOUT) :: den
TYPE(t_regionCharges),INTENT(INOUT) :: regCharges
! .. Scalar Arguments ..
INTEGER, INTENT(IN) :: eig_id,jspin
......@@ -134,7 +135,6 @@ CONTAINS
INTEGER, ALLOCATABLE :: jsym(:),ksym(:)
REAL, ALLOCATABLE :: we(:)
REAL, ALLOCATABLE :: f(:,:,:,:),g(:,:,:,:),flo(:,:,:,:) ! radial functions
REAL, ALLOCATABLE :: qmat(:,:,:,:)
COMPLEX, ALLOCATABLE :: qstars(:,:,:,:)
TYPE (t_lapw) :: lapw
......@@ -145,7 +145,6 @@ CONTAINS
TYPE (t_slab) :: slab
TYPE (t_eigVecCoeffs) :: eigVecCoeffs
TYPE (t_mcd) :: mcd
TYPE (t_regionCharges) :: regCharges
TYPE (t_usdus) :: usdus
TYPE (t_zMat) :: zMat
......@@ -163,11 +162,9 @@ CONTAINS
!---> added. if l_mperp = F, these loops run only from jspin - jspin.
jsp_start = 1
jsp_end = 2
ALLOCATE ( qmat(0:3,atoms%ntype,dimension%neigd,4) )
ELSE
jsp_start = jspin
jsp_end = jspin
ALLOCATE (qmat(1,1,1,1) )
ENDIF
!---> if l_mperp = F, these variables are only needed for one spin
!---> at a time, otherwise for both spins:
......@@ -184,7 +181,6 @@ CONTAINS
CALL denCoeffs%init(atoms,sphhar,jsp_start,jsp_end)
CALL denCoeffsOffdiag%init(atoms,noco,sphhar,l_fmpl)
CALL force%init1(input,atoms)
CALL regCharges%init(atoms,dimension,kpts,vacuum,jsp_start,jsp_end)
CALL orb%init(atoms,noco,jsp_start,jsp_end)
CALL mcd%init1(banddos,dimension,input,atoms)
......@@ -496,7 +492,7 @@ CONTAINS
skip_t,l_evp,eigVecCoeffs,usdus,regCharges,mcd,banddos%l_mcd)
IF (noco%l_mperp.AND.(ispin == jsp_end)) THEN
CALL qal_21(atoms,input,noccbd,noco,eigVecCoeffs,denCoeffsOffdiag,regCharges,qmat)
CALL qal_21(dimension,atoms,input,noccbd,noco,eigVecCoeffs,denCoeffsOffdiag,regCharges)
END IF
END IF
......
......@@ -5,24 +5,22 @@ MODULE m_qal21
!***********************************************************************
!
CONTAINS
SUBROUTINE qal_21(atoms,input,noccbd,noco,eigVecCoeffs,denCoeffsOffdiag,regCharges,qmat)
SUBROUTINE qal_21(dimension,atoms,input,noccbd,noco,eigVecCoeffs,denCoeffsOffdiag,regCharges)
USE m_rotdenmat
USE m_types
IMPLICIT NONE
TYPE(t_dimension), INTENT(IN) :: dimension
TYPE(t_input), INTENT(IN) :: input
TYPE(t_noco), INTENT(IN) :: noco
TYPE(t_atoms), INTENT(IN) :: atoms
TYPE(t_eigVecCoeffs), INTENT(IN) :: eigVecCoeffs
TYPE (t_denCoeffsOffdiag), INTENT(IN) :: denCoeffsOffdiag
TYPE(t_denCoeffsOffdiag), INTENT(IN) :: denCoeffsOffdiag
TYPE(t_regionCharges), INTENT(INOUT) :: regCharges
! .. Scalar Arguments ..
INTEGER, INTENT (IN) :: noccbd
! .. Array Arguments ..
REAL, INTENT (OUT) :: qmat(0:,:,:,:)!(0:3,atoms%ntype,DIMENSION%neigd,4)
! ..
! .. Local Scalars ..
INTEGER i,l,lo,lop ,natom,nn,ntyp
INTEGER nt1,nt2,lm,n,ll1,ipol,icore,index,m
......@@ -30,19 +28,18 @@ CONTAINS
COMPLEX sumaa,sumbb,sumab,sumba
COMPLEX, PARAMETER :: ci = (0.0,1.0)
! ..
! .. Local Arrays ..
COMPLEX qlo(noccbd,atoms%nlod,atoms%nlod,atoms%ntype)
COMPLEX qaclo(noccbd,atoms%nlod,atoms%ntype),qbclo(noccbd,atoms%nlod,atoms%ntype)
COMPLEX qcloa(noccbd,atoms%nlod,atoms%ntype),qclob(noccbd,atoms%nlod,atoms%ntype)
COMPLEX qal21(0:3,atoms%ntype,size(qmat,3))
COMPLEX qal21(0:3,atoms%ntype,dimension%neigd)
COMPLEX q_loc(2,2),q_hlp(2,2),chi(2,2)
! ..
REAL qmat(0:3,atoms%ntype,dimension%neigd,4)
! .. Intrinsic Functions ..
INTRINSIC conjg
!
!---> l-decomposed density for each occupied state
!
states : DO i = 1, noccbd
nt1 = 1
types_loop : DO n = 1 ,atoms%ntype
......
......@@ -67,6 +67,7 @@ SUBROUTINE cdngen(eig_id,mpi,input,banddos,sliceplot,vacuum,&
! Local type instances
TYPE(t_noco) :: noco_new
TYPE(t_regionCharges) :: regCharges
!Local Scalars
REAL fix,qtot,dummy
......@@ -84,6 +85,8 @@ SUBROUTINE cdngen(eig_id,mpi,input,banddos,sliceplot,vacuum,&
IF (mpi%irank.EQ.0) CALL openXMLElementNoAttributes('valenceDensity')
CALL regCharges%init(input,atoms,dimension,kpts,vacuum)
!In a non-collinear calcuation where the off-diagonal part of the
!density matrix in the muffin-tins is calculated, the a- and
!b-coef. for both spins are needed at once. Thus, cdnval is only
......@@ -95,7 +98,7 @@ SUBROUTINE cdngen(eig_id,mpi,input,banddos,sliceplot,vacuum,&
CALL cdnval(eig_id,&
mpi,kpts,jspin,sliceplot,noco,input,banddos,cell,atoms,enpara,stars,vacuum,dimension,&
sphhar,sym,obsolete,vTot,oneD,coreSpecInput,&
outDen,results,qa21,chmom,clmom)
outDen,regCharges,results,qa21,chmom,clmom)
CALL timestop("cdngen: cdnval")
END DO
......
......@@ -599,7 +599,7 @@ SUBROUTINE mcd_init1(thisMCD,banddos,dimension,input,atoms)
END SUBROUTINE mcd_init1
SUBROUTINE regionCharges_init(thisRegCharges,atoms,dimension,kpts,vacuum,jsp_start,jsp_end)
SUBROUTINE regionCharges_init(thisRegCharges,input,atoms,dimension,kpts,vacuum)
USE m_types_setup
USE m_types_kpts
......@@ -607,26 +607,25 @@ SUBROUTINE regionCharges_init(thisRegCharges,atoms,dimension,kpts,vacuum,jsp_sta
IMPLICIT NONE
CLASS(t_regionCharges), INTENT(INOUT) :: thisRegCharges
TYPE(t_input), INTENT(IN) :: input
TYPE(t_atoms), INTENT(IN) :: atoms
TYPE(t_dimension), INTENT(IN) :: dimension
TYPE(t_kpts), INTENT(IN) :: kpts
TYPE(t_vacuum), INTENT(IN) :: vacuum
INTEGER, INTENT(IN) :: jsp_start
INTEGER, INTENT(IN) :: jsp_end
ALLOCATE(thisRegCharges%qis(dimension%neigd,kpts%nkpt,dimension%jspd))
ALLOCATE(thisRegCharges%qis(dimension%neigd,kpts%nkpt,input%jspins))
ALLOCATE(thisRegCharges%qal(0:3,atoms%ntype,dimension%neigd,jsp_start:jsp_end))
ALLOCATE(thisRegCharges%sqal(0:3,atoms%ntype,jsp_start:jsp_end))
ALLOCATE(thisRegCharges%ener(0:3,atoms%ntype,jsp_start:jsp_end))
ALLOCATE(thisRegCharges%qal(0:3,atoms%ntype,dimension%neigd,input%jspins))
ALLOCATE(thisRegCharges%sqal(0:3,atoms%ntype,input%jspins))
ALLOCATE(thisRegCharges%ener(0:3,atoms%ntype,input%jspins))
ALLOCATE(thisRegCharges%sqlo(atoms%nlod,atoms%ntype,jsp_start:jsp_end))
ALLOCATE(thisRegCharges%enerlo(atoms%nlod,atoms%ntype,jsp_start:jsp_end))
ALLOCATE(thisRegCharges%sqlo(atoms%nlod,atoms%ntype,input%jspins))
ALLOCATE(thisRegCharges%enerlo(atoms%nlod,atoms%ntype,input%jspins))
ALLOCATE(thisRegCharges%qvac(dimension%neigd,2,kpts%nkpt,dimension%jspd))
ALLOCATE(thisRegCharges%svac(2,jsp_start:jsp_end))
ALLOCATE(thisRegCharges%pvac(2,jsp_start:jsp_end))
ALLOCATE(thisRegCharges%qvlay(dimension%neigd,vacuum%layerd,2,kpts%nkpt,dimension%jspd))
ALLOCATE(thisRegCharges%qvac(dimension%neigd,2,kpts%nkpt,input%jspins))
ALLOCATE(thisRegCharges%svac(2,input%jspins))
ALLOCATE(thisRegCharges%pvac(2,input%jspins))
ALLOCATE(thisRegCharges%qvlay(dimension%neigd,vacuum%layerd,2,kpts%nkpt,input%jspins))
thisRegCharges%qis = 0.0
......
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