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