Commit 62689124 authored by Daniel Wortmann's avatar Daniel Wortmann

First attempt for bugfix for noco. Still not working correctly.

parent 510cc289
......@@ -229,7 +229,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,noco,oneD)
vacuum,cell,input,noco,oneD,inDen)
CALL timestop("gen. spin-up and -down density")
ENDIF
!---> pk non-collinear
......@@ -307,7 +307,7 @@ CONTAINS
!---> and down potentials and direction of the magnetic field
IF (noco%l_noco) THEN
CALL timestart("generation of potential-matrix")
CALL vmatgen(stars, atoms,sphhar,vacuum,sym,input,oneD,8,22,26)
CALL vmatgen(stars, atoms,sphhar,vacuum,sym,input,oneD,inDen,vTot)
CALL timestop("generation of potential-matrix")
ENDIF
!---> end pk non-collinear
......
......@@ -659,8 +659,9 @@ CONTAINS
IF (input%total) THEN
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)
PRINT *,"TODO: check that read is not needed in vgen"
! CALL readDensity(stars,vacuum,atoms,cell,sphhar,input,sym,oneD,CDN_ARCHIVE_TYPE_CDN_const,CDN_INPUT_DEN_const,&
! 0,fermiEnergyTemp,l_qfix,workDen)
ENDIF
!
! CALCULATE THE INTEGRAL OF n1*Veff1 + n2*Veff2
......
......@@ -9,4 +9,5 @@ types/types_lapw.F90
types/types_tlmplm.F90
types/types_misc.F90
types/types_mpimat.F90
types/types_potden.f90
)
......@@ -11,4 +11,5 @@ MODULE m_types
USE m_types_mpi
USE m_types_tlmplm
USE m_types_misc
USE m_types_potden
END MODULE m_types
......@@ -863,30 +863,7 @@ MODULE m_types_misc
END TYPE t_wann
TYPE t_potden
INTEGER :: iter
INTEGER :: potdenType
COMPLEX,ALLOCATABLE :: pw(:,:)
REAL,ALLOCATABLE :: mt(:,:,:,:)
REAL,ALLOCATABLE :: vacz(:,:,:)
COMPLEX,ALLOCATABLE :: vacxy(:,:,:,:)
! For density only (noco case)
COMPLEX, ALLOCATABLE :: cdom(:)
COMPLEX, ALLOCATABLE :: cdomvz(:,:)
COMPLEX, ALLOCATABLE :: cdomvxy(:,:,:)
! For density matrix and associated potential matrix
COMPLEX, ALLOCATABLE :: mmpMat(:,:,:,:)
!this type contains two init routines that should be used to allocate
!memory. You can either specify the datatypes or give the dimensions as integers
!See implementation below!
CONTAINS
PROCEDURE :: init_potden_types
PROCEDURE :: init_potden_simple
PROCEDURE :: resetpotden
GENERIC :: init=>init_potden_types,init_potden_simple
END TYPE t_potden
CONTAINS
SUBROUTINE usdus_init(ud,atoms,jsp)
USE m_judft
......@@ -910,86 +887,6 @@ CONTAINS
IF (ANY(err>0)) CALL judft_error("Not enough memory allocating usdus datatype")
END SUBROUTINE usdus_init
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
TYPE(t_atoms),INTENT(IN) :: atoms
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) :: nocoExtraDim
CALL init_potden_simple(pd,stars%ng3,atoms%jmtd,sphhar%nlhd,atoms%ntype,&
atoms%n_u,noco%l_noco,jsp,nocoExtraDim,potden_type,&
vacuum%nmzd,vacuum%nmzxyd,stars%ng2)
END SUBROUTINE init_potden_types
SUBROUTINE init_potden_simple(pd,ng3,jmtd,nlhd,ntype,n_u,l_noco,jsp,nocoExtraDim,potden_type,nmzd,nmzxyd,n2d)
USE m_constants
USE m_judft
IMPLICIT NONE
CLASS(t_potden),INTENT(OUT) :: pd
INTEGER,INTENT(IN) :: ng3,jmtd,nlhd,ntype,n_u,jsp,potden_type
LOGICAL,INTENT(IN) :: l_noco,nocoExtraDim
INTEGER,INTENT(IN) :: nmzd,nmzxyd,n2d
INTEGER:: err(4)
err=0
pd%iter=0
pd%potdenType=potden_type
IF(ALLOCATED(pd%pw)) DEALLOCATE (pd%pw)
IF(ALLOCATED(pd%mt)) DEALLOCATE (pd%mt)
IF(ALLOCATED(pd%vacz)) DEALLOCATE (pd%vacz)
IF(ALLOCATED(pd%vacxy)) DEALLOCATE (pd%vacxy)
IF(ALLOCATED(pd%cdom)) DEALLOCATE (pd%cdom)
IF(ALLOCATED(pd%cdomvz)) DEALLOCATE (pd%cdomvz)
IF(ALLOCATED(pd%cdomvxy)) DEALLOCATE (pd%cdomvxy)
IF(ALLOCATED(pd%mmpMat)) DEALLOCATE (pd%mmpMat)
ALLOCATE (pd%pw(ng3,jsp),stat=err(1))
ALLOCATE (pd%mt(jmtd,0:nlhd,ntype,jsp),stat=err(2))
ALLOCATE (pd%vacz(nmzd,2,MERGE(4,jsp,nocoExtraDim)),stat=err(3))
ALLOCATE (pd%vacxy(nmzxyd,n2d-1,2,jsp),stat=err(4))
IF (l_noco) THEN
ALLOCATE (pd%cdom(ng3))
ALLOCATE (pd%cdomvz(nmzd,2))
ALLOCATE (pd%cdomvxy(nmzxyd,n2d-1,2))
ELSE
ALLOCATE (pd%cdom(1))
ALLOCATE (pd%cdomvz(1,1),pd%cdomvxy(1,1,1))
END IF
ALLOCATE (pd%mmpMat(-lmaxU_const:lmaxU_const,-lmaxU_const:lmaxU_const,MAX(1,n_u),jsp))
IF (ANY(err>0)) CALL judft_error("Not enough memory allocating potential or density")
pd%pw=CMPLX(0.0,0.0)
pd%mt=0.0
pd%vacz=0.0
pd%vacxy=CMPLX(0.0,0.0)
pd%cdom = CMPLX(0.0,0.0)
pd%cdomvz = CMPLX(0.0,0.0)
pd%cdomvxy = CMPLX(0.0,0.0)
pd%mmpMat = CMPLX(0.0,0.0)
END SUBROUTINE init_potden_simple
SUBROUTINE resetPotDen(pd)
IMPLICIT NONE
CLASS(t_potden),INTENT(INOUT) :: pd
pd%pw=CMPLX(0.0,0.0)
pd%mt=0.0
pd%vacz=0.0
pd%vacxy=CMPLX(0.0,0.0)
pd%cdom = CMPLX(0.0,0.0)
pd%cdomvz = CMPLX(0.0,0.0)
pd%cdomvxy = CMPLX(0.0,0.0)
pd%mmpMat = CMPLX(0.0,0.0)
END SUBROUTINE resetPotDen
END MODULE m_types_misc
This diff is collapsed.
This diff is collapsed.
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