Commit beff00ea authored by Gregor Michalicek's avatar Gregor Michalicek

Correct last commit + introduce noco type to t_potden%init

parent 85a71a67
......@@ -944,7 +944,7 @@ CONTAINS
END SUBROUTINE usdus_init
SUBROUTINE init_potden_types(pd,stars,atoms,sphhar,vacuum,oneD,jsp,l_noco,potden_type)
SUBROUTINE init_potden_types(pd,stars,atoms,sphhar,vacuum,noco,oneD,jsp,nocoExtraDim,potden_type)
USE m_judft
IMPLICIT NONE
CLASS(t_potden),INTENT(OUT):: pd
......@@ -952,18 +952,19 @@ CONTAINS
TYPE(t_stars),INTENT(IN) :: stars
TYPE(t_sphhar),INTENT(IN):: sphhar
TYPE(t_vacuum),INTENT(IN):: vacuum
TYPE(t_noco),INTENT(IN) :: noco
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,stars%ng2)
LOGICAL,INTENT(IN) :: nocoExtraDim
CALL init_potden_simple(pd,stars%ng3,atoms%jmtd,sphhar%nlhd,atoms%ntype,jsp,nocoExtraDim,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)
SUBROUTINE init_potden_simple(pd,ng3,jmtd,nlhd,ntype,jsp,nocoExtraDim,potden_type,nmzd,nmzxyd,n2d)
USE m_judft
IMPLICIT NONE
CLASS(t_potden),INTENT(OUT) :: pd
INTEGER,INTENT(IN) :: ng3,jmtd,nlhd,ntype,jsp,potden_type
LOGICAL,INTENT(IN) :: l_noco
LOGICAL,INTENT(IN) :: nocoExtraDim
INTEGER,INTENT(IN),OPTIONAL :: nmzd,nmzxyd,n2d
INTEGER:: err(4)
......@@ -982,7 +983,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(4,jsp,l_noco)),stat=err(3))
ALLOCATE(pd%vacz(nmzd,2,MERGE(4,jsp,nocoExtraDim)),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")
......
......@@ -535,11 +535,6 @@ MODULE m_cdn_io
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,&
......
......@@ -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,input%jspins,.FALSE.,POTDEN_TYPE_DEN)
CALL outDen%init(stars,atoms,sphhar,vacuum,noco,oneD,input%jspins,.FALSE.,POTDEN_TYPE_DEN)
IF (mpi%irank.EQ.0) THEN
INQUIRE(file='enpara',exist=l_enpara)
......
......@@ -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,input%jspins,.FALSE.,POTDEN_TYPE_DEN)
CALL inDen%init(stars,atoms,sphhar,vacuum,noco,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))
......@@ -196,10 +196,10 @@ CONTAINS
! Initialize and load inDen density (end)
! Initialize potentials (start)
CALL vTot%init(stars,atoms,sphhar,vacuum,oneD,DIMENSION%jspd,noco%l_noco,POTDEN_TYPE_POTTOT)
CALL vCoul%init(stars,atoms,sphhar,vacuum,oneD,DIMENSION%jspd,noco%l_noco,POTDEN_TYPE_POTCOUL)
CALL vTot%init(stars,atoms,sphhar,vacuum,noco,oneD,DIMENSION%jspd,noco%l_noco,POTDEN_TYPE_POTTOT)
CALL vCoul%init(stars,atoms,sphhar,vacuum,noco,oneD,DIMENSION%jspd,noco%l_noco,POTDEN_TYPE_POTCOUL)
CALL vx%init(stars%ng3,atoms%jmtd,sphhar%nlhd,atoms%ntype,DIMENSION%jspd,.FALSE.,POTDEN_TYPE_POTX)
CALL vTemp%init(stars,atoms,sphhar,vacuum,oneD,DIMENSION%jspd,noco%l_noco,POTDEN_TYPE_POTTOT)
CALL vTemp%init(stars,atoms,sphhar,vacuum,noco,oneD,DIMENSION%jspd,noco%l_noco,POTDEN_TYPE_POTTOT)
ALLOCATE(vTot%mmpMat(-lmaxU_const:lmaxU_const,-lmaxU_const:lmaxU_const,MAX(1,atoms%n_u),input%jspins))
ALLOCATE(vTemp%mmpMat(-lmaxU_const:lmaxU_const,-lmaxU_const:lmaxU_const,MAX(1,atoms%n_u),input%jspins))
! Initialize potentials (end)
......@@ -236,7 +236,7 @@ CONTAINS
IF (noco%l_noco) THEN
CALL timestart("gen. spin-up and -down density")
CALL rhodirgen(DIMENSION,sym,stars,atoms,sphhar,&
vacuum,22,cell,input,oneD)
vacuum,22,cell,input,noco,oneD)
CALL timestop("gen. spin-up and -down density")
ENDIF
!---> pk non-collinear
......
......@@ -49,6 +49,10 @@ SUBROUTINE mix(stars,atoms,sphhar,vacuum,input,sym,cell,noco,oneD,&
TYPE(t_potden),INTENT(INOUT) :: inDen
INTEGER, INTENT(IN) :: archiveType
!Local type instances
TYPE(t_potden) :: diffDen
!Local Scalars
REAL fix,intfac,vacfac
INTEGER i,imap,js,mit,irecl
......@@ -66,6 +70,16 @@ SUBROUTINE mix(stars,atoms,sphhar,vacuum,input,sym,cell,noco,oneD,&
REAL CPP_BLAS_sdot
EXTERNAL CPP_BLAS_sdot
CALL diffDen%init(stars,atoms,sphhar,vacuum,noco,oneD,input%jspins,.FALSE.,POTDEN_TYPE_DEN)
IF (noco%l_noco) THEN
ALLOCATE (diffDen%cdom(stars%ng3),diffDen%cdomvz(vacuum%nmzd,2))
ALLOCATE (diffDen%cdomvxy(vacuum%nmzxyd,oneD%odi%n2d-1,2))
ELSE
ALLOCATE (diffDen%cdom(1),diffDen%cdomvz(1,1),diffDen%cdomvxy(1,1,1))
END IF
ALLOCATE (diffDen%mmpMat(-lmaxU_const:lmaxU_const,-lmaxU_const:lmaxU_const,MAX(1,atoms%n_u),input%jspins))
diffDen%mmpMat = CMPLX(0.0,0.0)
! YM: I have exported 'vol' from outside, be aware
! IF (film) THEN
! vol = 2.0 * z1 * area
......@@ -78,19 +92,13 @@ SUBROUTINE mix(stars,atoms,sphhar,vacuum,input,sym,cell,noco,oneD,&
!In systems without inversions symmetry the interstitial star-
!coefficients are complex. Thus twice as many numbers have to be
!stored.
IF (sym%invs) THEN
intfac = 1.0
ELSE
intfac = 2.0
END IF
intfac = 2.0
IF (sym%invs) intfac = 1.0
!The corresponding is true for the coeff. of the warping vacuum
!density depending on the two dimensional inversion.
IF (sym%invs2) THEN
vacfac = 1.0
ELSE
vacfac = 2.0
END IF
vacfac = 2.0
IF (sym%invs2) vacfac = 1.0
mmaph = intfac*stars%ng3 + atoms%ntype*(sphhar%nlhd+1)*atoms%jmtd +&
vacfac*vacuum%nmzxyd*(oneD%odi%n2d-1)*vacuum%nvac + vacuum%nmzd*vacuum%nvac
......
......@@ -98,8 +98,7 @@ CONTAINS
10 IF (sliceplot%plpot) input%score = .FALSE.
IF (sliceplot%iplot) THEN
CALL timestart("Plotting")
IF (input%strho) CALL juDFT_error("strho = T and iplot=T",calledby&
& ="optional")
IF (input%strho) CALL juDFT_error("strho = T and iplot=T",calledby = "optional")
CALL plotdop(oneD,dimension,stars,vacuum,sphhar,atoms,&
input,sym,cell,sliceplot,noco)
CALL timestop("Plotting")
......@@ -126,14 +125,8 @@ CONTAINS
input%total = .FALSE.
!
CALL timestart("generation of start-density")
CALL stden(mpi,&
& sphhar,stars,atoms,sym,&
& DIMENSION,vacuum,&
& input,&
& cell,&
& xcpot,&
& obsolete,&
& oneD)
CALL stden(mpi,sphhar,stars,atoms,sym,DIMENSION,vacuum,&
input,cell,xcpot,obsolete,noco,oneD)
!
input%total=strho
CALL timestop("generation of start-density")
......@@ -144,9 +137,7 @@ CONTAINS
!
IF (input%swsp) THEN
CALL timestart("optional: spin polarized density")
CALL cdnsp(&
& atoms,input,vacuum,sphhar,&
& stars,sym,oneD,cell,dimension)
CALL cdnsp(atoms,input,vacuum,sphhar,stars,sym,noco,oneD,cell,dimension)
!
CALL timestop("optional: spin polarized density")
END IF
......@@ -156,9 +147,7 @@ CONTAINS
IF (input%lflip) THEN
CALL timestart('optional: flip magnetic moments')
CALL flipcdn(&
& atoms,input,vacuum,sphhar,&
& stars,sym,oneD,cell,noco%l_noco)
CALL flipcdn(atoms,input,vacuum,sphhar,stars,sym,noco,oneD,cell)
!
CALL timestop('optional: flip magnetic moments')
END IF
......@@ -166,9 +155,7 @@ CONTAINS
IF (obsolete%l_u2f) THEN
CALL timestart('optional: conversion to formatted')
CALL u2f(&
& stars,input,atoms,sphhar,vacuum,&
& cell,sym,noco%l_noco)
CALL u2f(stars,input,atoms,sphhar,vacuum,cell,sym,noco%l_noco)
!
CALL timestop('optional: conversion to formatted')
ENDIF
......@@ -176,17 +163,13 @@ CONTAINS
IF (obsolete%l_f2u) THEN
CALL timestart('optional: conversion to unformatted')
CALL f2u(&
& stars,input,atoms,sphhar,vacuum,&
& cell,sym,noco%l_noco)
CALL f2u(stars,input,atoms,sphhar,vacuum,cell,sym,noco%l_noco)
!
CALL timestop('optional: conversion to unformatted')
ENDIF
IF (input%l_bmt) THEN
CALL bmt(&
& stars,input,noco,atoms,sphhar,vacuum,&
& cell,sym,oneD)
CALL bmt(stars,input,noco,atoms,sphhar,vacuum,cell,sym,oneD)
ENDIF
ENDIF ! mpi%irank == 0
......
......@@ -81,7 +81,7 @@ CONTAINS
REAL dpj(atoms%jmtd)
CHARACTER(LEN=20) :: attributes(3)
CALL den%init(stars,atoms,sphhar,vacuum,oneD,input%jspins,.FALSE.,POTDEN_TYPE_DEN)
CALL den%init(stars,atoms,sphhar,vacuum,noco,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,input%jspins,.FALSE.,POTDEN_TYPE_DEN)
CALL workDen%init(stars,atoms,sphhar,vacuum,noco,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))
......
......@@ -40,7 +40,7 @@ contains
!atoms%jmtd = maxval(atoms%jri(:))
!sphhar%nlhd = maxval(sphhar%nlh(:))
CALL den%init(stars,atoms,sphhar,vacuum,oneD,input%jspins,.FALSE.,POTDEN_TYPE_DEN)
CALL den%init(stars,atoms,sphhar,vacuum,noco,oneD,input%jspins,.FALSE.,POTDEN_TYPE_DEN)
IF(noco%l_noco) THEN
ALLOCATE(den%cdom(stars%ng3))
ALLOCATE(den%cdomvz(vacuum%nmz,2),den%cdomvxy(vacuum%nmzxy,stars%ng2-1,2))
......
......@@ -15,7 +15,7 @@
CONTAINS
SUBROUTINE cdnsp(&
& atoms,input,vacuum,sphhar,&
& stars,sym,oneD,cell,DIMENSION)
& stars,sym,noco,oneD,cell,DIMENSION)
USE m_intgr, ONLY : intgr3
USE m_constants
......@@ -29,6 +29,7 @@
TYPE(t_sphhar),INTENT(IN) :: sphhar
TYPE(t_input),INTENT(INOUT) :: input
TYPE(t_sym),INTENT(IN) :: sym
TYPE(t_noco),INTENT(IN) :: noco
TYPE(t_oneD),INTENT(IN) :: oneD
TYPE(t_cell),INTENT(IN) :: cell
TYPE(t_dimension),INTENT(IN) :: DIMENSION
......@@ -55,7 +56,7 @@
& ("cdnsp: set jspins = 2 and remove fl7para!",calledby&
& ="cdnsp")
CALL den%init(stars,atoms,sphhar,vacuum,oneD,input%jspins,.FALSE.,POTDEN_TYPE_DEN)
CALL den%init(stars,atoms,sphhar,vacuum,noco,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)
......
......@@ -19,8 +19,7 @@ MODULE m_flipcdn
! *******************************************************
CONTAINS
SUBROUTINE flipcdn(atoms,input,vacuum,sphhar,&
stars,sym,oneD,cell,l_noco)
SUBROUTINE flipcdn(atoms,input,vacuum,sphhar,stars,sym,noco,oneD,cell)
USE m_constants
USE m_cdn_io
......@@ -34,9 +33,9 @@ SUBROUTINE flipcdn(atoms,input,vacuum,sphhar,&
TYPE(t_sphhar),INTENT(IN) :: sphhar
TYPE(t_input),INTENT(INOUT) :: input
TYPE(t_sym),INTENT(IN) :: sym
TYPE(t_noco),INTENT(IN) :: noco
TYPE(t_oneD),INTENT(IN) :: oneD
TYPE(t_cell),INTENT(IN) :: cell
LOGICAL,INTENT(IN) :: l_noco
! Local type instance
TYPE(t_potden) :: den
......@@ -50,8 +49,8 @@ SUBROUTINE flipcdn(atoms,input,vacuum,sphhar,&
! Local Arrays
CHARACTER(len=80), ALLOCATABLE :: clines(:)
CALL den%init(stars,atoms,sphhar,vacuum,oneD,input%jspins,.FALSE.,POTDEN_TYPE_DEN)
IF(l_noco) THEN
CALL den%init(stars,atoms,sphhar,vacuum,noco,oneD,input%jspins,.FALSE.,POTDEN_TYPE_DEN)
IF(noco%l_noco) THEN
ALLOCATE(den%cdom(stars%ng3))
ALLOCATE(den%cdomvz(vacuum%nmz,2),den%cdomvxy(vacuum%nmzxy,stars%ng2-1,2))
archiveType = CDN_ARCHIVE_TYPE_NOCO_const
......
......@@ -303,7 +303,7 @@ SUBROUTINE pldngen(sym,stars,atoms,sphhar,vacuum,&
inp=input
inp%jspins=1
CALL den%init(stars,atoms,sphhar,vacuum,oneD,inp%jspins,.FALSE.,POTDEN_TYPE_DEN)
CALL den%init(stars,atoms,sphhar,vacuum,noco,oneD,inp%jspins,.FALSE.,POTDEN_TYPE_DEN)
ALLOCATE (den%cdom(stars%ng3),den%cdomvz(vacuum%nmzd,2),den%cdomvxy(vacuum%nmzxyd,stars%ng2-1,2))
ALLOCATE (den%mmpMat(-lmaxU_const:lmaxU_const,-lmaxU_const:lmaxU_const,MAX(1,atoms%n_u),input%jspins))
den%iter = iter
......
......@@ -134,7 +134,7 @@ SUBROUTINE plotdop(oneD,dimension,stars,vacuum,sphhar,atoms,&
! Read in charge/potential
DO i = 1, numInFiles
CALL den(i)%init(stars,atoms,sphhar,vacuum,oneD,DIMENSION%jspd,.FALSE.,POTDEN_TYPE_DEN)
CALL den(i)%init(stars,atoms,sphhar,vacuum,noco,oneD,DIMENSION%jspd,.FALSE.,POTDEN_TYPE_DEN)
ALLOCATE (den(i)%cdom(1),den(i)%cdomvz(1,1),den(i)%cdomvxy(1,1,1))
ALLOCATE (den(i)%mmpMat(-lmaxU_const:lmaxU_const,-lmaxU_const:lmaxU_const,MAX(1,atoms%n_u),input%jspins))
den(i)%mmpMat = CMPLX(0.0,0.0)
......
......@@ -13,7 +13,7 @@ USE m_juDFT
CONTAINS
SUBROUTINE stden(mpi,sphhar,stars,atoms,sym,DIMENSION,vacuum,&
input,cell,xcpot,obsolete,oneD)
input,cell,xcpot,obsolete,noco,oneD)
USE m_sphpts
USE m_constants
......@@ -39,6 +39,7 @@ SUBROUTINE stden(mpi,sphhar,stars,atoms,sym,DIMENSION,vacuum,&
TYPE(t_obsolete),INTENT(IN) :: obsolete
TYPE(t_sym),INTENT(IN) :: sym
TYPE(t_stars),INTENT(IN) :: stars
TYPE(t_noco),INTENT(IN) :: noco
TYPE(t_oneD),INTENT(IN) :: oneD
TYPE(t_input),INTENT(IN) :: input
TYPE(t_vacuum),INTENT(IN) :: vacuum
......@@ -71,7 +72,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,input%jspins,.FALSE.,POTDEN_TYPE_DEN)
CALL den%init(stars,atoms,sphhar,vacuum,noco,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)
......
......@@ -26,7 +26,7 @@ MODULE m_rhodirgen
!**********************************************************************
CONTAINS
SUBROUTINE rhodirgen(DIMENSION,sym,stars,atoms,sphhar,vacuum,&
ndomfile,cell,input,oneD)
ndomfile,cell,input,noco,oneD)
!******** ABBREVIATIONS ***********************************************
! ifft3 : size of the 3d real space mesh
......@@ -50,6 +50,7 @@ CONTAINS
IMPLICIT NONE
TYPE(t_dimension),INTENT(IN) :: DIMENSION
TYPE(t_noco),INTENT(IN) :: noco
TYPE(t_oneD),INTENT(IN) :: oneD
TYPE(t_input),INTENT(IN) :: input
TYPE(t_vacuum),INTENT(IN) :: vacuum
......@@ -86,7 +87,7 @@ CONTAINS
zero = 0.0 ; czero = CMPLX(0.0,0.0)
eps = 1.0e-20
CALL den%init(stars,atoms,sphhar,vacuum,oneD,input%jspins,.FALSE.,POTDEN_TYPE_DEN)
CALL den%init(stars,atoms,sphhar,vacuum,noco,oneD,input%jspins,.FALSE.,POTDEN_TYPE_DEN)
ALLOCATE(den%cdom(stars%ng3),den%cdomvz(vacuum%nmz,2),den%cdomvxy(vacuum%nmzxy,stars%ng2-1,2))
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