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

Move qvac,qvlay allocation back from cdnval to cdngen

Someone moved the allocation of qvac and qvlay from cdngen to cdnval.
This made problems for noco film calculations. In this case it is
important that these arrays are allocated and set to zero outside the
spin loop directly around cdnval.

The problem that actually occured was a wrong writing of the enpara
file. because pvac and svac were 0 in cdnval, mix_enpara.

Please note: There are more arrays that were moved from cdngen to
cdnval. Maybe it should be checked at some point whether there is
another, similar problem due to this.
parent 0b725d31
......@@ -3,7 +3,7 @@ MODULE m_cdnval
CONTAINS
SUBROUTINE cdnval(eig_id, mpi,kpts,jspin,sliceplot,noco, input,banddos,cell,atoms,enpara,stars,&
vacuum,dimension, sphhar, sym,obsolete, igq_fft,vr, vz, oneD, n_mmp,results, qpw,rhtxy,&
rho,rht,cdom,cdomvz,cdomvxy,qa21, chmom,clmom)
rho,rht,cdom,cdomvz,cdomvxy,qvac,qvlay,qa21, chmom,clmom)
!
! ***********************************************************
! this subroutin is a modified version of cdnval.F.
......@@ -123,6 +123,8 @@ CONTAINS
REAL, INTENT (OUT) :: chmom(atoms%ntype,dimension%jspd),clmom(3,atoms%ntype,dimension%jspd)
REAL, INTENT (INOUT) :: rho(atoms%jmtd,0:sphhar%nlhd,atoms%ntype,dimension%jspd)
REAL, INTENT (INOUT) :: rht(vacuum%nmzd,2,dimension%jspd)
REAL, INTENT (INOUT) :: qvac(dimension%neigd,2,kpts%nkpt,dimension%jspd)
REAL, INTENT (INOUT) :: qvlay(dimension%neigd,vacuum%layerd,2,kpts%nkpt,dimension%jspd)
COMPLEX, INTENT(INOUT) :: n_mmp(-3:3,-3:3,atoms%n_u)
#ifdef CPP_MPI
......@@ -158,7 +160,7 @@ CONTAINS
REAL, ALLOCATABLE :: volintsl(:)
REAL, ALLOCATABLE :: qintsl(:,:),qmtsl(:,:)
REAL, ALLOCATABLE :: orbcomp(:,:,:),qmtp(:,:)
REAL, ALLOCATABLE :: qis(:,:,:),qvac(:,:,:,:),qvlay(:,:,:,:,:)
REAL, ALLOCATABLE :: qis(:,:,:)
!-new_sl
!-dw
INTEGER, ALLOCATABLE :: gvac1d(:),gvac2d(:) ,kveclo(:)
......@@ -349,10 +351,7 @@ CONTAINS
aclo(:,:,:) = 0.0 ; bclo(:,:,:) = 0.0 ; ccnmt(:,:,:,:,:) = 0.0
acnmt(:,:,:,:,:)=0.0 ; bcnmt(:,:,:,:,:)=0.0 ; cclo(:,:,:,:)=0.0
ALLOCATE ( qis(dimension%neigd,kpts%nkpt,dimension%jspd), &
qvac(dimension%neigd,2,kpts%nkpt,dimension%jspd), &
qvlay(dimension%neigd,vacuum%layerd,2,kpts%nkpt,dimension%jspd) )
qvac(:,:,:,:)=0.0 ; qvlay(:,:,:,:,:)=0.0
ALLOCATE ( qis(dimension%neigd,kpts%nkpt,dimension%jspd))
skip_tt = dot_product(enpara%skiplo(:atoms%ntype,jspin),atoms%neq(:atoms%ntype))
IF (noco%l_soc.OR.noco%l_noco) skip_tt = 2 * skip_tt
......@@ -919,6 +918,7 @@ CONTAINS
ener(0,1,ispin),sqal(0,1,ispin),&
enerlo(1,1,ispin),&
sqlo(1,1,ispin))
CALL w_enpara(&
atoms,jspin,input%film,&
enpara,16)
......
......@@ -76,6 +76,7 @@
INTEGER,ALLOCATABLE :: igq_fft(:)
REAL ,ALLOCATABLE :: vz(:,:,:),vr(:,:,:,:)
REAL ,ALLOCATABLE :: rht(:,:,:),rho(:,:,:,:)
REAL ,ALLOCATABLE :: qvac(:,:,:,:),qvlay(:,:,:,:,:)
COMPLEX,ALLOCATABLE :: vpw(:,:),vzxy(:,:,:,:)
COMPLEX,ALLOCATABLE :: qpw(:,:),rhtxy(:,:,:,:)
COMPLEX,ALLOCATABLE :: n_mmp(:,:,:,:)
......@@ -124,14 +125,18 @@
INQUIRE(file='enpara',exist=l_enpara)
IF (l_enpara) OPEN (40,file ='enpara',form = 'formatted',status ='unknown')
ENDIF
ALLOCATE ( cdom(stars%ng3),cdomvz(vacuum%nmzd,2),cdomvxy(vacuum%nmzxyd,oneD%odi%n2d-1,2) )
ALLOCATE ( qa21(atoms%ntype) )
ALLOCATE ( igq_fft(0:stars%kq1_fft*stars%kq2_fft*stars%kq3_fft-1) )
ALLOCATE (cdom(stars%ng3),cdomvz(vacuum%nmzd,2),cdomvxy(vacuum%nmzxyd,oneD%odi%n2d-1,2))
ALLOCATE (qa21(atoms%ntype))
ALLOCATE (qvac(dimension%neigd,2,kpts%nkpt,dimension%jspd))
ALLOCATE (qvlay(dimension%neigd,vacuum%layerd,2,kpts%nkpt,dimension%jspd))
ALLOCATE (igq_fft(0:stars%kq1_fft*stars%kq2_fft*stars%kq3_fft-1))
!
!
!---> initialize density arrays with zero
!
qa21(:) = cmplx(0.0,0.0)
qvac(:,:,:,:) = 0.0
qvlay(:,:,:,:,:) = 0.0
rho(:,:,:,:) = 0.0
qpw(:,:) = cmplx(0.0,0.0)
cdom(:) = cmplx(0.0,0.0)
......@@ -176,7 +181,7 @@
CALL cdnval(eig_id,&
mpi,kpts,jspin,sliceplot,noco, input,banddos,cell,atoms,enpara,stars, vacuum,dimension,&
sphhar, sym,obsolete, igq_fft, vr,vz(:,:,jspin), oneD,&
n_mmp(-3:,-3:,:,jspin),results, qpw,rhtxy,rho,rht,cdom,cdomvz,cdomvxy,qa21, chmom,clmom)
n_mmp(-3:,-3:,:,jspin),results, qpw,rhtxy,rho,rht,cdom,cdomvz,cdomvxy,qvac,qvlay,qa21, chmom,clmom)
CALL timestop("cdngen: cdnval")
!-fo
END DO
......@@ -506,7 +511,7 @@
rho,qpw,rht,rhtxy,cdom,cdomvz,cdomvxy)
ENDIF
DEALLOCATE (cdom,cdomvz,cdomvxy,qa21)
DEALLOCATE (cdom,cdomvz,cdomvxy,qvac,qvlay,qa21)
DEALLOCATE (qpw,rhtxy,rho,rht,igq_fft)
IF (sliceplot%slice) CALL juDFT_end("sliceplot%slice OK",mpi%irank)
......
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