Commit 5f4a5e0c authored by Gregor Michalicek's avatar Gregor Michalicek

Adapt readDensity subroutine signature to t_potden type

parent 2d564403
......@@ -134,30 +134,24 @@ MODULE m_cdn_io
SUBROUTINE readDensity(stars,vacuum,atoms,cell,sphhar,input,sym,oneD,archiveType,inOrOutCDN,&
relCdnIndex,fermiEnergy,l_qfix,iter,fr,fpw,fz,fzxy,cdom,cdomvz,cdomvxy)
relCdnIndex,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_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
INTEGER, INTENT (OUT) :: iter
INTEGER, INTENT (IN) :: archiveType
REAL, INTENT (OUT) :: fermiEnergy
LOGICAL, INTENT (OUT) :: l_qfix
! ..
! .. Array Arguments ..
COMPLEX, INTENT (OUT) :: fpw(stars%ng3,input%jspins), fzxy(vacuum%nmzxyd,stars%ng2-1,2,input%jspins)
COMPLEX, INTENT (OUT) :: cdom(:), cdomvz(:,:), cdomvxy(:,:,:)
REAL, INTENT (OUT) :: fr(atoms%jmtd,0:sphhar%nlhd,atoms%ntype,input%jspins), fz(vacuum%nmzd,2,input%jspins)
! local variables
INTEGER :: mode, datend, k, i, iVac, j, iUnit, l
LOGICAL :: l_exist, l_rhomatFile, l_DimChange
......@@ -221,13 +215,13 @@ MODULE m_cdn_io
currentStepfunctionIndex,readDensityIndex,lastDensityIndex)
CALL readDensityHDF(fileID, input, stars, sphhar, atoms, vacuum, oneD, archiveName, densityType,&
fermiEnergy,l_qfix,l_DimChange,iter,fr,fpw,fz,fzxy,cdom,cdomvz,cdomvxy)
fermiEnergy,l_qfix,l_DimChange,den%iter,den%mt,den%pw,den%vacz,den%vacxy,den%cdom,den%cdomvz,den%cdomvxy)
CALL closeCDNPOT_HDF(fileID)
IF(l_DimChange) THEN
CALL writeDensity(stars,vacuum,atoms,cell,sphhar,input,sym,oneD,archiveType,inOrOutCDN,&
1,-1.0,fermiEnergy,l_qfix,iter,fr,fpw,fz,fzxy,cdom,cdomvz,cdomvxy)
1,-1.0,fermiEnergy,l_qfix,den%iter,den%mt,den%pw,den%vacz,den%vacxy,den%cdom,den%cdomvz,den%cdomvxy)
END IF
ELSE
WRITE(*,*) 'cdn.hdf file or relevant density entry not found.'
......@@ -276,20 +270,20 @@ MODULE m_cdn_io
IF ((inOrOutCDN.EQ.CDN_OUTPUT_DEN_const).AND.(archiveType.NE.CDN_ARCHIVE_TYPE_NOCO_const)) THEN
! call loddop to move the file position to the output density
CALL loddop(stars,vacuum,atoms,sphhar,input,sym,&
iUnit,iter,fr,fpw,fz,fzxy)
iUnit,den%iter,den%mt,den%pw,den%vacz,den%vacxy)
END IF
! read in the density
CALL loddop(stars,vacuum,atoms,sphhar,input,sym,&
iUnit,iter,fr,fpw,fz,fzxy)
iUnit,den%iter,den%mt,den%pw,den%vacz,den%vacxy)
! read in additional data if l_noco and data is present
IF ((archiveType.EQ.CDN_ARCHIVE_TYPE_NOCO_const).AND.l_rhomatFile) THEN
READ (iUnit,iostat=datend) (cdom(k),k=1,stars%ng3)
READ (iUnit,iostat=datend) (den%cdom(k),k=1,stars%ng3)
IF (datend == 0) THEN
IF (input%film) THEN
READ (iUnit) ((cdomvz(i,iVac),i=1,vacuum%nmz),iVac=1,vacuum%nvac)
READ (iUnit) (((cdomvxy(i,j-1,iVac),i=1,vacuum%nmzxy),j=2,oneD%odi%nq2), iVac=1,vacuum%nvac)
READ (iUnit) ((den%cdomvz(i,iVac),i=1,vacuum%nmz),iVac=1,vacuum%nvac)
READ (iUnit) (((den%cdomvxy(i,j-1,iVac),i=1,vacuum%nmzxy),j=2,oneD%odi%nq2), iVac=1,vacuum%nvac)
END IF
ELSE
! (datend < 0) => no off-diagonal magnetisation stored
......@@ -298,17 +292,17 @@ MODULE m_cdn_io
WRITE(*,*) 'datend = ', datend
CALL juDFT_error("density file has illegal state.",calledby ="readDensity")
END IF
cdom = CMPLX(0.0,0.0)
den%cdom = CMPLX(0.0,0.0)
IF (input%film) THEN
cdomvz = CMPLX(0.0,0.0)
cdomvxy = CMPLX(0.0,0.0)
den%cdomvz = CMPLX(0.0,0.0)
den%cdomvxy = CMPLX(0.0,0.0)
END IF
END IF
ELSE IF (archiveType.EQ.CDN_ARCHIVE_TYPE_NOCO_const) THEN
cdom = CMPLX(0.0,0.0)
den%cdom = CMPLX(0.0,0.0)
IF (input%film) THEN
cdomvz = CMPLX(0.0,0.0)
cdomvxy = CMPLX(0.0,0.0)
den%cdomvz = CMPLX(0.0,0.0)
den%cdomvxy = CMPLX(0.0,0.0)
END IF
END IF
CLOSE(iUnit)
......@@ -604,6 +598,13 @@ MODULE m_cdn_io
END IF
CLOSE(iUnit)
!write density matrix to n_mmp_mat file
IF((archiveType.EQ.CDN_ARCHIVE_TYPE_CDN1_const).AND.(relCdnIndex.EQ.1)) THEN
IF(atoms%n_u.GT.0) THEN
END IF
END IF
END IF
END SUBROUTINE writeDensity
......
......@@ -184,8 +184,7 @@ CONTAINS
ALLOCATE (inDen%mmpMat(-lmaxU_const:lmaxU_const,-lmaxU_const:lmaxU_const,MAX(1,atoms%n_u),input%jspins))
IF(mpi%irank.EQ.0) THEN
CALL readDensity(stars,vacuum,atoms,cell,sphhar,input,sym,oneD,archiveType,CDN_INPUT_DEN_const,&
0,fermiEnergyTemp,l_qfix,inDen%iter,inDen%mt,inDen%pw,inDen%vacz,inDen%vacxy,&
inDen%cdom,inDen%cdomvz,inDen%cdomvxy)
0,fermiEnergyTemp,l_qfix,inDen)
CALL timestart("Qfix")
CALL qfix(stars,atoms,sym,vacuum, sphhar,input,cell,oneD,inDen%pw,inDen%vacxy,inDen%mt,inDen%vacz,&
.FALSE.,.false.,fix)
......
......@@ -143,7 +143,7 @@ CONTAINS
IF (noco%l_noco) archiveType = CDN_ARCHIVE_TYPE_CDN_const
CALL readDensity(stars,vacuum,atoms,cell,sphhar,input,sym,oneD,archiveType,&
CDN_INPUT_DEN_const,0,fermiEnergyTemp,l_qfix,den%iter,den%mt,den%pw,den%vacz,den%vacxy,den%cdom,den%cdomvz,den%cdomvxy)
CDN_INPUT_DEN_const,0,fermiEnergyTemp,l_qfix,den)
! CLASSICAL HELLMAN-FEYNMAN FORCE
......
......@@ -663,8 +663,7 @@ CONTAINS
IF (noco%l_noco) THEN ! load workDen%pw,workDen%vacz,workDen%vacxyxy from 'cdn'-file
CALL readDensity(stars,vacuum,atoms,cell,sphhar,input,sym,oneD,CDN_ARCHIVE_TYPE_CDN_const,CDN_INPUT_DEN_const,&
0,fermiEnergyTemp,l_qfix,workDen%iter,workDen%mt,workDen%pw,workDen%vacz,workDen%vacxy,&
workDen%cdom,workDen%cdomvz,workDen%cdomvxy)
0,fermiEnergyTemp,l_qfix,workDen)
ENDIF
!
! CALCULATE THE INTEGRAL OF n1*Veff1 + n2*Veff2
......
......@@ -53,7 +53,7 @@ contains
den%mmpMat = CMPLX(0.0,0.0)
CALL readDensity(stars,vacuum,atoms,cell,sphhar,input,sym,oneD,archiveType,&
CDN_INPUT_DEN_const,0,fermiEnergyTemp,l_qfix,den%iter,den%mt,den%pw,den%vacz,den%vacxy,den%cdom,den%cdomvz,den%cdomvxy)
CDN_INPUT_DEN_const,0,fermiEnergyTemp,l_qfix,den)
IF ( typmag < atoms%ntype ) THEN
DO type= typmag+1,atoms%ntype
......
......@@ -63,8 +63,7 @@
input%jspins=1
CALL readCoreDensity(input,atoms,dimension,rhoc,tec,qintc)
CALL readDensity(stars,vacuum,atoms,cell,sphhar,input,sym,oneD,CDN_ARCHIVE_TYPE_CDN1_const,&
CDN_INPUT_DEN_const,0,fermiEnergyTemp,l_qfix,den%iter,den%mt,den%pw,den%vacz,&
den%vacxy,den%cdom,den%cdomvz,den%cdomvxy)
CDN_INPUT_DEN_const,0,fermiEnergyTemp,l_qfix,den)
input%jspins=2
qval = 0.
......
......@@ -64,8 +64,7 @@ SUBROUTINE flipcdn(atoms,input,vacuum,sphhar,&
! read the charge density
CALL readDensity(stars,vacuum,atoms,cell,sphhar,input,sym,oneD,archiveType,&
CDN_INPUT_DEN_const,0,fermiEnergyTemp,l_qfix,den%iter,den%mt,den%pw,&
den%vacz,den%vacxy,den%cdom,den%cdomvz,den%cdomvxy)
CDN_INPUT_DEN_const,0,fermiEnergyTemp,l_qfix,den)
! flip cdn for each atom with nflip=-1
na = 1
......
......@@ -140,12 +140,10 @@ SUBROUTINE plotdop(oneD,dimension,stars,vacuum,sphhar,atoms,&
den(i)%mmpMat = CMPLX(0.0,0.0)
IF(TRIM(ADJUSTL(cdnFilenames(i))).EQ.'cdn1') THEN
CALL readDensity(stars,vacuum,atoms,cell,sphhar,input,sym,oneD,CDN_ARCHIVE_TYPE_CDN1_const,&
CDN_INPUT_DEN_const,0,fermiEnergyTemp,l_qfix,den(i)%iter,den(i)%mt,den(i)%pw,&
den(i)%vacz,den(i)%vacxy,den(i)%cdom,den(i)%cdomvz,den(i)%cdomvxy)
CDN_INPUT_DEN_const,0,fermiEnergyTemp,l_qfix,den(i))
ELSE IF(TRIM(ADJUSTL(cdnFilenames(i))).EQ.'cdn') THEN
CALL readDensity(stars,vacuum,atoms,cell,sphhar,input,sym,oneD,CDN_ARCHIVE_TYPE_CDN_const,&
CDN_INPUT_DEN_const,0,fermiEnergyTemp,l_qfix,den(i)%iter,den(i)%mt,den(i)%pw,&
den(i)%vacz,den(i)%vacxy,den(i)%cdom,den(i)%cdomvz,den(i)%cdomvxy)
CDN_INPUT_DEN_const,0,fermiEnergyTemp,l_qfix,den(i))
ELSE
OPEN(20,file = cdnFilenames(i),form='unformatted',status='old')
CALL loddop(stars,vacuum,atoms,sphhar,input,sym,20,&
......
......@@ -117,7 +117,7 @@ CONTAINS
!---> reload the density matrix from file rhomat_inp
CALL readDensity(stars,vacuum,atoms,cell,sphhar,input,sym,oneD,CDN_ARCHIVE_TYPE_NOCO_const,CDN_INPUT_DEN_const,&
0,fermiEnergyTemp,l_qfix,den%iter,den%mt,den%pw,den%vacz,den%vacxy,den%cdom,den%cdomvz,den%cdomvxy)
0,fermiEnergyTemp,l_qfix,den)
CALL qfix(stars,atoms,sym,vacuum,sphhar,input,cell,oneD,&
den%pw,den%vacxy,den%mt,den%vacz,.FALSE.,.FALSE.,fix)
......
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