Commit d16ed0d9 authored by Gregor Michalicek's avatar Gregor Michalicek

Introduce init subroutine for t_zMat type

parent dd4f73fb
......@@ -129,8 +129,8 @@ CONTAINS
nbands,noded,nodeu,noccbd,nslibd,na,&
ikpt,jsp_start,jsp_end,ispin
INTEGER skip_t,skip_tt
INTEGER n_size,i_rec,n_rank ,ncored,n_start,n_end,noccbd_l
LOGICAL l_fmpl,l_mcd,l_evp,l_orbcomprot
INTEGER n_size,i_rec,n_rank ,ncored,n_start,n_end,noccbd_l,nbasfcn
LOGICAL l_fmpl,l_mcd,l_evp,l_orbcomprot,l_real
! ...Local Arrays ..
INTEGER n_bands(0:dimension%neigd),ncore(atoms%ntype)
REAL e_mcd(atoms%ntype,input%jspins,dimension%nstd)
......@@ -170,6 +170,7 @@ CONTAINS
TYPE (t_zMat) :: zMat
INTEGER :: nkpt_extended
l_real = sym%invs.AND.(.NOT.noco%l_soc).AND.(.NOT.noco%l_noco)
zmat%l_real=sym%invs.AND.(.NOT.noco%l_soc).AND.(.NOT.noco%l_noco)
! ..
! ..
......@@ -415,21 +416,9 @@ CONTAINS
n_end = noccbd
END IF
END IF
zMat%nbasfcn=lapw%nv(1)+atoms%nlotot
IF (noco%l_noco) zMat%nbasfcn=zMat%nbasfcn+lapw%nv(2)+atoms%nlotot
IF (zmat%l_real) THEN
IF (.NOT.ALLOCATED(zMat%z_r)) THEN
ALLOCATE (zMat%z_r(zmat%nbasfcn,dimension%neigd))
zMat%nbands = dimension%neigd
END IF
zMat%z_r = 0
ELSE
IF (.NOT.ALLOCATED(zMat%z_c)) THEN
ALLOCATE (zMat%z_c(zmat%nbasfcn,dimension%neigd))
zMat%nbands = dimension%neigd
END IF
zMat%z_c = 0
endif
nbasfcn = MERGE(zMat%nbasfcn+lapw%nv(2),lapw%nv(1),noco%l_noco)+atoms%nlotot
CALL zMat%init(l_real,nbasfcn,dimension%neigd)
CALL cdn_read(eig_id,dimension%nvd,dimension%jspd,mpi%irank,mpi%isize,&
ikpt,jspin,zmat%nbasfcn,noco%l_ss,noco%l_noco,&
noccbd,n_start,n_end,nbands,eig,zMat)
......@@ -684,11 +673,6 @@ CONTAINS
END IF
!---> end of loop over PE's
IF (zmat%l_real) THEN
DEALLOCATE (zMat%z_r)
ELSE
DEALLOCATE (zMat%z_c)
END IF
ELSE !(ikpt < nkpt + 1)
#ifdef CPP_MPI
! Synchronizes the RMA operations
......
......@@ -5,12 +5,14 @@
!--------------------------------------------------------------------------------
MODULE m_types_misc
IMPLICIT NONE
!*************************************************************
! This module contains definitions for all kind of types
!*************************************************************
!
! Type for the HF total energy
!
TYPE t_energy_hf
REAL :: valence
REAL :: core
......@@ -19,6 +21,7 @@ MODULE m_types_misc
TYPE prodtype
INTEGER :: l1,l2,n1,n2
END TYPE prodtype
TYPE t_hybdat
INTEGER :: lmaxcd,maxindxc
REAL, ALLOCATABLE :: gridf(:,:) !alloc in util.F
......@@ -60,8 +63,6 @@ MODULE m_types_misc
REAL :: te_hfex_loc(2)
REAL, ALLOCATABLE :: w_iks(:,:,:)
END TYPE t_results
TYPE t_zMat
LOGICAL :: l_real
......@@ -69,6 +70,9 @@ MODULE m_types_misc
INTEGER :: nbands
REAL, ALLOCATABLE :: z_r(:,:) ! z_r(nbasfcn,nbands)
COMPLEX, ALLOCATABLE :: z_c(:,:) ! z_c(nbasfcn,nbands)
CONTAINS
PROCEDURE,PASS :: init => zMat_init
END TYPE t_zMat
TYPE t_hamOvlp
......@@ -77,6 +81,31 @@ MODULE m_types_misc
REAL, ALLOCATABLE :: a_r(:), b_r(:)
COMPLEX, ALLOCATABLE :: a_c(:), b_c(:)
END TYPE t_hamOvlp
CONTAINS
SUBROUTINE zMat_init(thisZMat,l_real,nbasfcn,nbands)
IMPLICIT NONE
CLASS(t_zMat), INTENT(INOUT) :: thisZMat
LOGICAL, INTENT(IN) :: l_real
INTEGER, INTENT(IN) :: nbasfcn,nbands
thisZMat%l_real = l_real
thisZMat%nbasfcn = nbasfcn
thisZMat%nbands = nbands
IF (ALLOCATED(thisZMat%z_r)) DEALLOCATE(thisZMat%z_r)
IF (ALLOCATED(thisZMat%z_c)) DEALLOCATE(thisZMat%z_c)
IF (l_real) THEN
ALLOCATE(thisZMat%z_r(nbasfcn,nbands))
thisZMat%z_r = 0.0
ELSE
ALLOCATE(thisZMat%z_c(nbasfcn,nbands))
thisZMat%z_c = CMPLX(0.0,0.0)
END IF
END SUBROUTINE zMat_init
END MODULE m_types_misc
  • At some point in the not so far future I would like to replace the t_zmat type with the general t_mat type with all the functionality needed.

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