Commit ca7d27ac authored by Gregor Michalicek's avatar Gregor Michalicek

Some cleanup in preparation of introducing potden to cdnpot_io_hdf

Note: Two changes have been done in global/types.F90:

   1. MERGE(jsp,4,l_noco) -> MERGE(4,jsp,l_noco)
      (I think the new code is correcter. This change is required)

   2. Some dimension variable was replaced by stars%ng2.
      (Maybe this is not required and maybe the previous variable was more correct.)
parent 6836a825
......@@ -955,7 +955,7 @@ CONTAINS
TYPE(t_oneD),INTENT(IN) :: oneD
INTEGER,INTENT(IN) :: jsp, potden_type
LOGICAL,INTENT(IN) :: l_noco
CALL init_potden_simple(pd,stars%ng3,atoms%jmtd,sphhar%nlhd,atoms%ntype,jsp,l_noco,potden_type,vacuum%nmzd,vacuum%nmzxyd,oneD%odi%n2d)
CALL init_potden_simple(pd,stars%ng3,atoms%jmtd,sphhar%nlhd,atoms%ntype,jsp,l_noco,potden_type,vacuum%nmzd,vacuum%nmzxyd,stars%ng2)
END SUBROUTINE init_potden_types
SUBROUTINE init_potden_simple(pd,ng3,jmtd,nlhd,ntype,jsp,l_noco,potden_type,nmzd,nmzxyd,n2d)
......@@ -982,7 +982,7 @@ CONTAINS
ALLOCATE(pd%pw(ng3,jsp),stat=err(1))
ALLOCATE(pd%mt(jmtd,0:nlhd,ntype,jsp),stat=err(2))
IF (PRESENT(nmzd)) THEN
ALLOCATE(pd%vacz(nmzd,2,MERGE(jsp,4,l_noco)),stat=err(3))
ALLOCATE(pd%vacz(nmzd,2,MERGE(4,jsp,l_noco)),stat=err(3))
ALLOCATE(pd%vacxy(nmzxyd,n2d-1,2,jsp),stat=err(4))
ENDIF
IF (ANY(err>0)) CALL judft_error("Not enough memory allocating potential or density")
......
......@@ -313,15 +313,15 @@ MODULE m_cdn_io
SUBROUTINE writeDensity(stars,vacuum,atoms,cell,sphhar,input,sym,oneD,archiveType,inOrOutCDN,&
relCdnIndex,distance,fermiEnergy,l_qfix,den)
TYPE(t_stars),INTENT(IN) :: stars
TYPE(t_vacuum),INTENT(IN) :: vacuum
TYPE(t_atoms),INTENT(IN) :: atoms
TYPE(t_cell), INTENT(IN) :: cell
TYPE(t_sphhar),INTENT(IN) :: sphhar
TYPE(t_input),INTENT(IN) :: input
TYPE(t_sym),INTENT(IN) :: sym
TYPE(t_oneD),INTENT(IN) :: oneD
TYPE(t_potden),INTENT(IN) :: den
TYPE(t_stars),INTENT(IN) :: stars
TYPE(t_vacuum),INTENT(IN) :: vacuum
TYPE(t_atoms),INTENT(IN) :: atoms
TYPE(t_cell), INTENT(IN) :: cell
TYPE(t_sphhar),INTENT(IN) :: sphhar
TYPE(t_input),INTENT(IN) :: input
TYPE(t_sym),INTENT(IN) :: sym
TYPE(t_oneD),INTENT(IN) :: oneD
TYPE(t_potden),INTENT(INOUT) :: den
INTEGER, INTENT (IN) :: inOrOutCDN
INTEGER, INTENT (IN) :: relCdnIndex
......@@ -425,25 +425,19 @@ MODULE m_cdn_io
END IF
END IF
ALLOCATE (fzxyTemp(vacuum%nmzxyd,stars%ng2-1,2,input%jspins))
ALLOCATE (fzTemp(vacuum%nmzd,2,input%jspins))
fzTemp(:,:,:) = den%vacz(:,:,:)
fzxyTemp(:,:,:,:) = den%vacxy(:,:,:,:)
IF(vacuum%nvac.EQ.1) THEN
fzTemp(:,2,:)=fzTemp(:,1,:)
den%vacz(:,2,:)=den%vacz(:,1,:)
IF (sym%invs) THEN
fzxyTemp(:,:,2,:) = CONJG(fzxyTemp(:,:,1,:))
den%vacxy(:,:,2,:) = CONJG(den%vacxy(:,:,1,:))
ELSE
fzxyTemp(:,:,2,:) = fzxyTemp(:,:,1,:)
den%vacxy(:,:,2,:) = den%vacxy(:,:,1,:)
END IF
END IF
CALL writeDensityHDF(input, fileID, archiveName, densityType, previousDensityIndex,&
currentStarsIndex, currentLatharmsIndex, currentStructureIndex,&
currentStepfunctionIndex,date,time,distance,fermiEnergy,l_qfix,den%iter+relCdnIndex,&
den%mt,den%pw,fzTemp,fzxyTemp,den%cdom,den%cdomvz,den%cdomvxy)
DEALLOCATE(fzTemp,fzxyTemp)
den%mt,den%pw,den%vacz,den%vacxy,den%cdom,den%cdomvz,den%cdomvxy)
IF(l_storeIndices) THEN
CALL writeCDNHeaderData(fileID,currentStarsIndex,currentLatharmsIndex,currentStructureIndex,&
......
......@@ -96,7 +96,7 @@ SUBROUTINE cdngen(eig_id,mpi,input,banddos,sliceplot,vacuum,&
!pk non-collinear (end)
iter = inIter
CALL outDen%init(stars,atoms,sphhar,vacuum,oneD,DIMENSION%jspd,.FALSE.,POTDEN_TYPE_DEN)
CALL outDen%init(stars,atoms,sphhar,vacuum,oneD,input%jspins,.FALSE.,POTDEN_TYPE_DEN)
archiveType = CDN_ARCHIVE_TYPE_CDN1_const
IF(noco%l_noco) archiveType = CDN_ARCHIVE_TYPE_NOCO_const
......
......@@ -172,7 +172,7 @@ CONTAINS
IF (mpi%irank.EQ.0) CALL openXMLElementNoAttributes('scfLoop')
! Initialize and load inDen density (start)
CALL inDen%init(stars,atoms,sphhar,vacuum,oneD,DIMENSION%jspd,.FALSE.,POTDEN_TYPE_DEN)
CALL inDen%init(stars,atoms,sphhar,vacuum,oneD,input%jspins,.FALSE.,POTDEN_TYPE_DEN)
IF (noco%l_noco) THEN
ALLOCATE (inDen%cdom(stars%ng3),inDen%cdomvz(vacuum%nmzd,2))
ALLOCATE (inDen%cdomvxy(vacuum%nmzxyd,oneD%odi%n2d-1,2))
......
......@@ -81,7 +81,7 @@ CONTAINS
REAL dpj(atoms%jmtd)
CHARACTER(LEN=20) :: attributes(3)
CALL den%init(stars,atoms,sphhar,vacuum,oneD,DIMENSION%jspd,.FALSE.,POTDEN_TYPE_DEN)
CALL den%init(stars,atoms,sphhar,vacuum,oneD,input%jspins,.FALSE.,POTDEN_TYPE_DEN)
ALLOCATE (den%cdom(1),den%cdomvz(1,1),den%cdomvxy(1,1,1))
ALLOCATE (den%mmpMat(-lmaxU_const:lmaxU_const,-lmaxU_const:lmaxU_const,MAX(1,atoms%n_u),input%jspins))
den%mmpMat = CMPLX(0.0,0.0)
......
......@@ -130,7 +130,7 @@ CONTAINS
vpw_w(stars%ng3,dimension%jspd),vxpw_w(stars%ng3,dimension%jspd),psq(stars%ng3) )
vTot%iter = den%iter
CALL workDen%init(stars,atoms,sphhar,vacuum,oneD,DIMENSION%jspd,.FALSE.,POTDEN_TYPE_DEN)
CALL workDen%init(stars,atoms,sphhar,vacuum,oneD,input%jspins,.FALSE.,POTDEN_TYPE_DEN)
IF (noco%l_noco) THEN
ALLOCATE (workDen%cdom(stars%ng3),workDen%cdomvz(vacuum%nmzd,2))
ALLOCATE (workDen%cdomvxy(vacuum%nmzxyd,oneD%odi%n2d-1,2))
......
......@@ -55,7 +55,7 @@
& ("cdnsp: set jspins = 2 and remove fl7para!",calledby&
& ="cdnsp")
CALL den%init(stars,atoms,sphhar,vacuum,oneD,DIMENSION%jspd,.FALSE.,POTDEN_TYPE_DEN)
CALL den%init(stars,atoms,sphhar,vacuum,oneD,input%jspins,.FALSE.,POTDEN_TYPE_DEN)
ALLOCATE (den%cdom(1),den%cdomvz(1,1),den%cdomvxy(1,1,1))
ALLOCATE (den%mmpMat(-lmaxU_const:lmaxU_const,-lmaxU_const:lmaxU_const,MAX(1,atoms%n_u),input%jspins))
den%mmpMat = CMPLX(0.0,0.0)
......
......@@ -71,7 +71,7 @@ SUBROUTINE stden(mpi,sphhar,stars,atoms,sym,DIMENSION,vacuum,&
IF (input%jspins > DIMENSION%jspd) CALL juDFT_error("input%jspins > dimension%jspd", calledby = "stden")
CALL den%init(stars,atoms,sphhar,vacuum,oneD,DIMENSION%jspd,.FALSE.,POTDEN_TYPE_DEN)
CALL den%init(stars,atoms,sphhar,vacuum,oneD,input%jspins,.FALSE.,POTDEN_TYPE_DEN)
ALLOCATE (den%cdom(1),den%cdomvz(1,1),den%cdomvxy(1,1,1))
ALLOCATE (den%mmpMat(-lmaxU_const:lmaxU_const,-lmaxU_const:lmaxU_const,MAX(1,atoms%n_u),input%jspins))
den%mmpMat = CMPLX(0.0,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