Commit cfc39301 authored by Gregor Michalicek's avatar Gregor Michalicek

Implemented old-style storage of old densities with new density wrappers

The numbering scheme of the old densities changed. It now represents the
last two digits of the overall iteration. Not just of the iteration
of the current run.
parent a8abe8cf
......@@ -163,7 +163,7 @@ MODULE m_cdn_io
END SUBROUTINE readDensity
SUBROUTINE writeDensity(stars,vacuum,atoms,sphhar,input,sym,oneD,archiveType,inOrOutCDN,&
iter,fr,fpw,fz,fzxy,cdom,cdomvz,cdomvxy)
relCdnIndex,iter,fr,fpw,fz,fzxy,cdom,cdomvz,cdomvxy)
TYPE(t_stars),INTENT(IN) :: stars
TYPE(t_vacuum),INTENT(IN) :: vacuum
......@@ -174,7 +174,7 @@ MODULE m_cdn_io
TYPE(t_oneD),INTENT(IN) :: oneD
INTEGER, INTENT (IN) :: inOrOutCDN
INTEGER, INTENT (IN) :: iter
INTEGER, INTENT (IN) :: relCdnIndex, iter
INTEGER, INTENT (IN) :: archiveType
! ..
! .. Array Arguments ..
......@@ -193,7 +193,9 @@ MODULE m_cdn_io
REAL, ALLOCATABLE :: frTemp(:,:,:,:), fzTemp(:,:,:)
INTEGER :: mode, iterTemp, k, i, iVac, j, iUnit
INTEGER :: d1, d10, asciioffset, iUnitTemp
CHARACTER(len=30) :: filename
CHARACTER(len=5) :: cdnfile
CALL getMode(mode)
......@@ -216,6 +218,69 @@ MODULE m_cdn_io
iUnit = 93
OPEN (iUnit,file=TRIM(ADJUSTL(filename)),FORM='unformatted',STATUS='unknown')
IF ((relCdnIndex.EQ.1).AND.(archiveType.EQ.CDN_ARCHIVE_TYPE_CDN1_const)) THEN
starsTemp%n3d = stars%n3d
inputTemp%jspins = input%jspins
vacuumTemp%nmzxyd = vacuum%nmzxyd
starsTemp%n2d = stars%n2d
atomsTemp%jmtd = atoms%jmtd
sphharTemp%nlhd = sphhar%nlhd
vacuumTemp%nmzd = vacuum%nmzd
atomsTemp%ntype = atoms%ntype
ALLOCATE (sphharTemp%nlh(SIZE(sphhar%nlh)))
sphharTemp%nlh(:) = sphhar%nlh(:)
ALLOCATE (atomsTemp%ntypsy(SIZE(atoms%ntypsy)))
atomsTemp%ntypsy(:) = atoms%ntypsy(:)
ALLOCATE (atomsTemp%jri(SIZE(atoms%jri)))
atomsTemp%jri(:) = atoms%jri(:)
ALLOCATE (atomsTemp%neq(SIZE(atoms%neq)))
atomsTemp%neq(:) = atoms%neq(:)
ALLOCATE (atomsTemp%zatom(SIZE(atoms%zatom)))
atomsTemp%zatom(:) = atoms%zatom(:)
ALLOCATE (atomsTemp%rmt(SIZE(atoms%rmt)))
atomsTemp%rmt(:) = atoms%rmt(:)
ALLOCATE (atomsTemp%dx(SIZE(atoms%dx)))
atomsTemp%dx(:) = atoms%dx(:)
starsTemp%ng3 = stars%ng3
symTemp%invs = sym%invs
inputTemp%film = input%film
vacuumTemp%nvac = vacuum%nvac
starsTemp%ng2 = stars%ng2
symTemp%invs2 = sym%invs2
ALLOCATE (fpwTemp(stars%n3d,input%jspins))
ALLOCATE (fzxyTemp(vacuum%nmzxyd,stars%n2d-1,2,input%jspins))
ALLOCATE (frTemp(atoms%jmtd,0:sphhar%nlhd,atoms%ntype,input%jspins))
ALLOCATE (fzTemp(vacuum%nmzd,2,input%jspins))
!---> generate name of file to hold the results of this iteration
d1 = MOD(iter,10)
d10 = MOD(INT((iter+0.5)/10),10)
asciioffset = IACHAR('1')-1
IF ( d10.GE.10 ) asciioffset = IACHAR('7')
cdnfile = 'cdn'//ACHAR(d10+asciioffset)//ACHAR(d1+IACHAR('1')-1)
iUnitTemp = 72
OPEN (iUnitTemp,file=cdnfile,form='unformatted',status='unknown')
REWIND iUnitTemp
CALL loddop(starsTemp,vacuumTemp,atomsTemp,sphharTemp,inputTemp,symTemp,&
iUnit,iterTemp,frTemp,fpwTemp,fzTemp,fzxyTemp)
CALL wrtdop(starsTemp,vacuumTemp,atomsTemp,sphharTemp,inputTemp,symTemp,&
iUnitTemp,iterTemp,frTemp,fpwTemp,fzTemp,fzxyTemp)
CALL loddop(starsTemp,vacuumTemp,atomsTemp,sphharTemp,inputTemp,symTemp,&
iUnit,iterTemp,frTemp,fpwTemp,fzTemp,fzxyTemp)
CALL wrtdop(starsTemp,vacuumTemp,atomsTemp,sphharTemp,inputTemp,symTemp,&
iUnitTemp,iterTemp,frTemp,fpwTemp,fzTemp,fzxyTemp)
CLOSE(iUnitTemp)
REWIND iUnit
DEALLOCATE (fzTemp, frTemp, fzxyTemp, fpwTemp)
DEALLOCATE (atomsTemp%neq, atomsTemp%jri, atomsTemp%zatom, atomsTemp%ntypsy, sphharTemp%nlh)
DEALLOCATE (atomsTemp%rmt, atomsTemp%dx)
END IF
IF ((inOrOutCDN.EQ.CDN_OUTPUT_DEN_const).AND.(archiveType.NE.CDN_ARCHIVE_TYPE_NOCO_const)) THEN
! Generate data in temp arrays and variables to be able to perform loddop call.
......@@ -256,7 +321,7 @@ MODULE m_cdn_io
! Write the density
CALL wrtdop(stars,vacuum,atoms,sphhar, input,sym,&
iUnit,iter,fr,fpw,fz,fzxy)
iUnit,iter+relCdnIndex,fr,fpw,fz,fzxy)
! Write additional data if l_noco
IF (archiveType.EQ.CDN_ARCHIVE_TYPE_NOCO_const) THEN
......
......@@ -475,7 +475,7 @@ enddo
END IF
CALL writeDensity(stars,vacuum,atoms,sphhar,input,sym,oneD,archiveType,&
CDN_OUTPUT_DEN_const,iter,rho,qpw,rht,rhtxy,cdom,cdomvz,cdomvxy)
CDN_OUTPUT_DEN_const,0,iter,rho,qpw,rht,rhtxy,cdom,cdomvz,cdomvxy)
ENDIF
DEALLOCATE (cdom,cdomvz,cdomvxy,qa21)
......
......@@ -17,7 +17,6 @@ CONTAINS
!
#include"cpp_double.h"
USE m_cdn_io
USE m_wrtdop
USE m_brysh1
USE m_stmix
USE m_broyden
......@@ -47,13 +46,11 @@ CONTAINS
! ..
! .. Local Scalars ..
REAL fix,intfac,vacfac
INTEGER i,iter,imap,js,mit,nt,nt1,irecl
INTEGER i,iter,imap,js,mit,nt,irecl
INTEGER mmap,mmaph,nmaph,nmap,mapmt,mapvac,mapvac2
INTEGER iq2,iq3,ivac,imz ,iofl, archiveType
INTEGER n_u_keep
LOGICAL lexist,l_ldaU
INTEGER d1,d10,asciioffset
CHARACTER (len=5) cdnfile
! ..
! .. Local Arrays ..
......@@ -183,34 +180,10 @@ CONTAINS
WRITE(6,'(''WARNING : for QUASI-NEWTON METHODS SPINF=1'')')
END IF
!---> generate name of file to hold the results of this iteration
!gs+ changed cdn filename gen. to cdn//tens//digits
!gs fixed cdn filehandle to 71, otherwise conflict after it>=18
!gs plus: you don't want to have open so many fh's
!gs construct 2char rep of iter --> '01'-->'Z9'
d1 = MOD(it,10)
d10 = INT( (it + 0.5)/10 )
asciioffset = IACHAR('1')-1
IF ( d10.GE.10 ) asciioffset = IACHAR('7')
cdnfile = 'cdn'//ACHAR(d10+asciioffset)//ACHAR(d1+IACHAR('1')-1)
! WRITE (*,*) d1,d10,'>',cdnfile,'<' !gsdbg
IF (.NOT.noco%l_noco) THEN
nt1 = 72
OPEN (nt1,file=cdnfile,form='unformatted',status='unknown')
REWIND nt1
ENDIF
!gs-
!---> reload densities of current iteration
CALL readDensity(stars,vacuum,atoms,sphhar,input,sym,oneD,archiveType,&
CDN_INPUT_DEN_const,0,iter,rho,qpw,rht,rhtxy,cdom,cdomvz,cdomvxy)
IF (.NOT.noco%l_noco) THEN
!---> write density to file for storage
CALL wrtdop(stars,vacuum,atoms,sphhar, input,sym,&
nt1, iter,rho,qpw,rht,rhtxy)
END IF
!
!---> put input charge density into arrays sm
! in the spin polarized case the arrays consist of
......@@ -223,12 +196,6 @@ CONTAINS
CALL readDensity(stars,vacuum,atoms,sphhar,input,sym,oneD,archiveType,&
CDN_OUTPUT_DEN_const,0,iter,rho,qpw,rht,rhtxy,cdom,cdomvz,cdomvxy)
IF (.NOT.noco%l_noco) THEN
!---> write density to file for storage
CALL wrtdop(stars,vacuum,atoms,sphhar, input,sym,&
nt1, iter,rho,qpw,rht,rhtxy)
END IF
!
!---> put output charge density into arrays fsm
!
......@@ -334,10 +301,8 @@ CONTAINS
CALL qfix(stars,atoms,sym,vacuum, sphhar,input,cell,oneD,&
qpw,rhtxy,rho,rht,.FALSE., fix)
iter = iter + 1
CALL writeDensity(stars,vacuum,atoms,sphhar,input,sym,oneD,archiveType,CDN_INPUT_DEN_const,&
iter,rho,qpw,rht,rhtxy,cdom,cdomvz,cdomvxy)
1,iter,rho,qpw,rht,rhtxy,cdom,cdomvz,cdomvxy)
DEALLOCATE ( cdom,cdomvz,cdomvxy )
IF ( atoms%n_u > 0 ) THEN
......
......@@ -164,7 +164,7 @@ CONTAINS
IF (input%total.OR.reap) THEN
CALL writeDensity(stars,vacuum,atoms,sphhar,input,sym,oneD,archiveType,CDN_INPUT_DEN_const,&
iter,rho,qpw,rht,rhtxy,cdom,cdomvz,cdomvxy)
0,iter,rho,qpw,rht,rhtxy,cdom,cdomvz,cdomvxy)
END IF
WRITE (6,FMT=8000)
......
......@@ -115,7 +115,7 @@
ENDIF
! ----> write the spin-polarized density
CALL writeDensity(stars,vacuum,atoms,sphhar,input,sym,oneD,CDN_ARCHIVE_TYPE_CDN1_const,&
CDN_INPUT_DEN_const,iter,rho,qpw,rht,rhtxy,cdom,cdomvz,cdomvxy)
CDN_INPUT_DEN_const,0,iter,rho,qpw,rht,rhtxy,cdom,cdomvz,cdomvxy)
!
! -----> This part is only used for testing th e magnetic moment in
! -----> each sphere
......
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