Commit 0f500c29 authored by Gregor Michalicek's avatar Gregor Michalicek

Some more adaptions of the Wannier code to the new fleur

parent 6865931e
...@@ -20,7 +20,8 @@ c**************************************** ...@@ -20,7 +20,8 @@ c****************************************
> nv,shiftkpt, > nv,shiftkpt,
> tau, > tau,
x bkpt,k1,k2,k3, x bkpt,k1,k2,k3,
x z,nsfactor) x zMat,nsfactor)
USE m_types
use m_inv3 use m_inv3
use m_constants,only:pimach use m_constants,only:pimach
implicit none implicit none
...@@ -46,11 +47,9 @@ c**************************************** ...@@ -46,11 +47,9 @@ c****************************************
real,intent(in) :: tau(3,nop) real,intent(in) :: tau(3,nop)
real,intent(inout) :: bkpt(3) real,intent(inout) :: bkpt(3)
integer,intent(inout) :: k1(:,:),k2(:,:),k3(:,:) !nvd,jspd integer,intent(inout) :: k1(:,:),k2(:,:),k3(:,:) !nvd,jspd
#if ( !defined(CPP_INVERSION) || defined(CPP_SOC) )
complex,intent(inout) :: z(:,:) TYPE(t_zmat), INTENT (INOUT) :: zMat !z(nbasfcn,noccbd) !can be real/complex
#else
real,intent(inout) :: z(:,:)
#endif
complex,intent(out) :: nsfactor !phase of non-symmorphic ops complex,intent(out) :: nsfactor !phase of non-symmorphic ops
real :: bkrot(3),tpi,arg real :: bkrot(3),tpi,arg
...@@ -75,13 +74,12 @@ c print*,testmat ...@@ -75,13 +74,12 @@ c print*,testmat
c testmat=matmul(rotmat,mrot(:,:,absoper)) c testmat=matmul(rotmat,mrot(:,:,absoper))
c print*,testmat c print*,testmat
IF(.NOT.zMat%l_real) THEN
#if ( !defined(CPP_INVERSION) || defined(CPP_SOC) ) if(oper.lt.0)then
if(oper.lt.0)then zMat%z_c = CONJG(zMat%z_c)
z=conjg(z) ! time-inversion symmetry shiftnonsymm=-1.0*shiftnonsymm
shiftnonsymm=-1.0*shiftnonsymm endif
endif END IF
#endif
if(l_noco) then if(l_noco) then
jsp_start=1 jsp_start=1
...@@ -135,7 +133,11 @@ c print*,testmat ...@@ -135,7 +133,11 @@ c print*,testmat
+ + k3(j,jspin) * shiftnonsymm(3) + + k3(j,jspin) * shiftnonsymm(3)
phase = tpi*phase phase = tpi*phase
phase = cos(phase) phase = cos(phase)
z(j+jj,:) = phase * z(j+jj,:) IF(zMat%l_real) THEN
zMat%z_r(j+jj,:) = phase * zMat%z_r(j+jj,:)
ELSE
zMat%z_c(j+jj,:) = phase * zMat%z_c(j+jj,:)
END IF
enddo enddo
jj=jj+nv(jspin) jj=jj+nv(jspin)
do ilo=1,nlotot do ilo=1,nlotot
...@@ -145,7 +147,11 @@ c print*,testmat ...@@ -145,7 +147,11 @@ c print*,testmat
+ + k3(j,jspin) * shiftnonsymm(3) + + k3(j,jspin) * shiftnonsymm(3)
phase = tpi*phase phase = tpi*phase
phase = cos(phase) phase = cos(phase)
z(jj+ilo,:) = phase * z(jj+ilo,:) IF(zMat%l_real) THEN
zMat%z_r(jj+ilo,:) = phase * zMat%z_r(jj+ilo,:)
ELSE
zMat%z_c(jj+ilo,:) = phase * zMat%z_c(jj+ilo,:)
END IF
enddo enddo
enddo enddo
......
This diff is collapsed.
...@@ -15,30 +15,25 @@ c Frank Freimuth, October 2006 ...@@ -15,30 +15,25 @@ c Frank Freimuth, October 2006
c**************************************************************** c****************************************************************
CONTAINS CONTAINS
SUBROUTINE wann_write_eig( SUBROUTINE wann_write_eig(
> ntapwf, > eig_id,
> lmaxd,ntypd,nlod,neigd,nvd,jspd, > lmaxd,ntypd,nlod,neigd,nvd,jspd,
> isize,jspin,nbasfcn,nlotot, > isize,jspin,nbasfcn,nlotot,
> l_ss,l_noco,nrec,fullnkpts,irecl, > l_ss,l_noco,nrec,fullnkpts,
> l_bzsym,l_byindex,l_bynumber,l_byenergy, > l_bzsym,l_byindex,l_bynumber,l_byenergy,
> irreduc,odi,band_min,band_max,numbands, > irreduc,odi,band_min,band_max,numbands,
> e1s,e2s,ef,l_paulimag,nkpt, > e1s,e2s,ef,l_paulimag,nkpt,
< nbnd,kpoints,l_gwf,iqpt) < nbnd,kpoints,l_gwf,iqpt)
use m_cdnread, only:cdn_read use m_cdnread, only:cdn_read
use m_types,only:od_inp use m_types
IMPLICIT NONE IMPLICIT NONE
integer,intent(in) :: ntapwf integer,intent(in) :: eig_id
integer,intent(in) :: lmaxd,ntypd,nlod,neigd,nvd,jspd integer,intent(in) :: lmaxd,ntypd,nlod,neigd,nvd,jspd
integer,intent(in) :: isize,jspin,nbasfcn,nlotot integer,intent(in) :: isize,jspin,nbasfcn,nlotot
logical,intent(in) :: l_ss,l_noco logical,intent(in) :: l_ss,l_noco
integer,intent(in) :: nrec,fullnkpts integer,intent(in) :: nrec,fullnkpts
#ifndef CPP_MPI
integer(8), intent (in) :: irecl
#else
include 'mpif.h'
INTEGER(KIND=MPI_OFFSET_KIND),intent(in) :: irecl
#endif
logical,intent(in) :: l_byindex,l_bynumber,l_byenergy logical,intent(in) :: l_byindex,l_bynumber,l_byenergy
integer,intent(in) :: irreduc(fullnkpts) integer,intent(in) :: irreduc(fullnkpts)
type (od_inp),intent(in) :: odi type (od_inp),intent(in) :: odi
...@@ -75,11 +70,8 @@ c**************************************************************** ...@@ -75,11 +70,8 @@ c****************************************************************
! END QPOINTS ! END QPOINTS
real,parameter :: hartree=27.21138505 real,parameter :: hartree=27.21138505
#if ( !defined(CPP_INVERSION) || defined(CPP_SOC) ) TYPE(t_zmat) :: zmat !z(nbasfcn,noccbd) !can be real/complex
COMPLEX :: z(nbasfcn,neigd)
#else
REAL :: z(nbasfcn,neigd)
#endif
! WRITE(*,*)'min',band_min,'max',band_max,'num',numbands ! WRITE(*,*)'min',band_min,'max',band_max,'num',numbands
! WRITE(*,*)'wann_rw_eig: neigd',neigd ! WRITE(*,*)'wann_rw_eig: neigd',neigd
n_start=1 n_start=1
...@@ -133,12 +125,12 @@ c**************************************************************** ...@@ -133,12 +125,12 @@ c****************************************************************
kptibz=ikpt kptibz=ikpt
if(l_bzsym) kptibz=irreduc(ikpt) if(l_bzsym) kptibz=irreduc(ikpt)
call wann_read_eig( call wann_read_eig(
> ntapwf, > eig_id,
> lmaxd,ntypd,nlod,neigd,nvd,jspd, > lmaxd,ntypd,nlod,neigd,nvd,jspd,
> 0,isize,kptibz,jspin,nbasfcn,nlotot, > 0,isize,kptibz,jspin,nbasfcn,nlotot,
> l_ss,l_noco,nrec,irecl, > l_ss,l_noco,nrec,
< nmat,nv,ello,evdu,epar,kveclo, < nmat,nv,ello,evdu,epar,kveclo,
< k1,k2,k3,bkpt,wk,nbands,eig,z,cp_time,66, < k1,k2,k3,bkpt,wk,nbands,eig,zMat,
> l_gwf,iqpt) > l_gwf,iqpt)
...@@ -181,12 +173,12 @@ c**************************************************************** ...@@ -181,12 +173,12 @@ c****************************************************************
kptibz=ikpt kptibz=ikpt
if(l_bzsym)kptibz=irreduc(ikpt) if(l_bzsym)kptibz=irreduc(ikpt)
call wann_read_eig( call wann_read_eig(
> ntapwf, > eig_id,
> lmaxd,ntypd,nlod,neigd,nvd,jspd, > lmaxd,ntypd,nlod,neigd,nvd,jspd,
> 0,isize,kptibz,jspin,nbasfcn,nlotot, > 0,isize,kptibz,jspin,nbasfcn,nlotot,
> l_ss,l_noco,nrec,irecl, > l_ss,l_noco,nrec,
< nmat,nv,ello,evdu,epar,kveclo, < nmat,nv,ello,evdu,epar,kveclo,
< k1,k2,k3,bkpt,wk,nbands,eig,z,cp_time,66, < k1,k2,k3,bkpt,wk,nbands,eig,zMat,
> l_gwf,iqpt) > l_gwf,iqpt)
...@@ -202,178 +194,50 @@ c**************************************************************** ...@@ -202,178 +194,50 @@ c****************************************************************
endif endif
close (306) close (306)
end subroutine wann_write_eig end subroutine wann_write_eig
c*********************************************************************
c each process writes its own eig file if hdf is not used for mpi c*****************************************************************
c this routine finds the appropriate eig file for a given kpoint c read in eig file
c Frank Freimuth, October 2006 c*****************************************************************
c********************************************************************* subroutine wann_read_eig(
subroutine wann_mpi_read_eig( > eig_id,
> lmaxd,ntypd,nlod,neigd,nvd,jspd, > lmaxd,ntypd,nlod,neigd,nvd,jspd,
> irank,isize,kptibz,jspin,nbasfcn,nlotot, > irank,isize,kptibz,jspin,nbasfcn,nlotot,
> l_ss,l_noco,nrec,irecl, > l_ss,l_noco,nrec,
< nmat,nv,ello,evdu,epar,kveclo, < nmat,nv,ello,evdu,epar,kveclo,
< k1,k2,k3,bkpt,wk,nbands,eig,z,cp_time,funit,zMat, < k1,k2,k3,bkpt,wk,nbands,eig,zMat,
> l_gwf,iqpt) > l_gwf,iqpt)
use m_cdnread, only:cdn_read
USE m_types USE m_types
use m_cdnread, only:cdn_read
implicit none implicit none
integer, intent (in) :: eig_id
INTEGER, INTENT (IN) :: irank,isize,kptibz,nbasfcn,neigd,nlotot INTEGER, INTENT (IN) :: irank,isize,kptibz,nbasfcn,neigd,nlotot
INTEGER, INTENT (IN) :: nrec,nvd,jspd,jspin INTEGER, INTENT (IN) :: nrec,nvd,jspd,jspin
INTEGER, INTENT (IN) :: lmaxd,ntypd,nlod,iqpt INTEGER, INTENT (IN) :: lmaxd,ntypd,nlod,iqpt
LOGICAL, INTENT (IN) :: l_ss,l_noco,l_gwf LOGICAL, INTENT (IN) :: l_ss,l_noco,l_gwf
#ifndef CPP_MPI
integer(8), intent (in) :: irecl
#else
include 'mpif.h'
INTEGER(KIND=MPI_OFFSET_KIND),intent(in) :: irecl
#endif
INTEGER, INTENT (OUT) :: nbands,nmat INTEGER, INTENT (OUT) :: nbands,nmat
REAL, INTENT (OUT) :: wk REAL, INTENT (OUT) :: wk
INTEGER, INTENT (OUT) :: k1(nvd,jspd),k2(nvd,jspd),k3(nvd,jspd) INTEGER, INTENT (OUT) :: k1(nvd,jspd),k2(nvd,jspd),k3(nvd,jspd)
INTEGER, INTENT (OUT) :: nv(jspd),kveclo(nlotot) INTEGER, INTENT (OUT) :: nv(jspd),kveclo(nlotot)
REAL, INTENT (OUT) :: bkpt(3),eig(neigd) REAL, INTENT (OUT) :: bkpt(3),eig(neigd)
REAL, INTENT (INOUT) :: cp_time(9)
REAL, INTENT (OUT) :: ello(nlod,ntypd,jspd),evdu(2,jspd) REAL, INTENT (OUT) :: ello(nlod,ntypd,jspd),evdu(2,jspd)
REAL, INTENT (OUT) :: epar(0:lmaxd,ntypd,jspd) REAL, INTENT (OUT) :: epar(0:lmaxd,ntypd,jspd)
TYPE(t_zmat), INTENT (INOUT) :: zmat !z(nbasfcn,noccbd) !can be real/complex TYPE(t_zmat), INTENT (INOUT) :: zmat !z(nbasfcn,noccbd) !can be real/complex
#if ( !defined(CPP_INVERSION) || defined(CPP_SOC) )
COMPLEX, INTENT (OUT) :: z(nbasfcn,neigd)
#else
REAL, INTENT (OUT) :: z(nbasfcn,neigd)
#endif
INTEGER, INTENT(IN) :: funit
character(len=12) :: fname,fend
integer :: aoff,d1,d10
integer :: cpu_index
logical :: l_eig
integer :: n_start,n_end integer :: n_start,n_end
n_start=1 n_start=1
n_end=neigd n_end=neigd
fend='' CALL cdn_read(
if(l_gwf) write(fend,'("_",i4.4)')iqpt
do cpu_index=0,isize-1
if (mod(kptibz-1,isize).eq.cpu_index) then
if(cpu_index.eq.irank)then
call cdn_read(
> eig_id, > eig_id,
> nvd,jspd,irank,isize,kptibz,jspin,nbasfcn, > nvd,jspd,irank,isize,kptibz,jspin,nbasfcn,
> l_ss,l_noco,neigd,n_start,n_end, > l_ss,l_noco,neigd,n_start,n_end,
< nmat,nv,ello,evdu,epar,kveclo, < nmat,nv,ello,evdu,epar,kveclo,
< k1,k2,k3,bkpt,wk,nbands,eig,zMat) < k1,k2,k3,bkpt,wk,nbands,eig,zMat)
else !eigenvalues are stored in the file of another process
d10=int((cpu_index+0.5)/10)
d1=mod(cpu_index,10)
aoff=iachar('1')-1
if(d10.ge.10)aoff=iachar('7')
fname='eig'//achar(d10+aoff)//achar(d1+iachar('1')-1)
fname=trim(fname)//trim(fend)
l_eig=.false.
!write(*,*)fname
c if(irank.eq.0) write(*,*) 'opening file=',fname
inquire(file=fname,exist=l_eig)
IF(.NOT.l_eig) CALL juDFT_error("one of eig files not found"
+ ,calledby ="wann_rw_eig")
OPEN(666,file=fname,access='direct',form='unformatted',
& recl=irecl,status='old')
call cdn_read(
> lmaxd,ntypd,nlod,neigd,nvd,jspd,
> cpu_index,isize,kptibz,jspin,nbasfcn,nlotot,
> l_ss,l_noco,nrec,kptibz,666,neigd,
> n_start,n_end,
< nmat,nv,ello,evdu,epar,kveclo,
< k1,k2,k3,bkpt,wk,nbands,eig,z,cp_time)
close(666)
endif !cpu_index==irank
endif !find process
enddo !cpu_index
end subroutine wann_mpi_read_eig
c*****************************************************************
c read in eig file
c*****************************************************************
subroutine wann_read_eig(
> ntapwf,
> lmaxd,ntypd,nlod,neigd,nvd,jspd,
> irank,isize,kptibz,jspin,nbasfcn,nlotot,
> l_ss,l_noco,nrec,irecl,
< nmat,nv,ello,evdu,epar,kveclo,
< k1,k2,k3,bkpt,wk,nbands,eig,z,cp_time,funit,
> l_gwf,iqpt)
use m_cdnread, only:cdn_read
implicit none
integer, intent (in) :: ntapwf
INTEGER, INTENT (IN) :: irank,isize,kptibz,nbasfcn,neigd,nlotot
INTEGER, INTENT (IN) :: nrec,nvd,jspd,jspin
INTEGER, INTENT (IN) :: lmaxd,ntypd,nlod,iqpt
LOGICAL, INTENT (IN) :: l_ss,l_noco,l_gwf
#ifndef CPP_MPI
integer(8), intent (in) :: irecl
#else
include 'mpif.h'
INTEGER(KIND=MPI_OFFSET_KIND),intent(in) :: irecl
#endif
INTEGER, INTENT (OUT) :: nbands,nmat
REAL, INTENT (OUT) :: wk
INTEGER, INTENT (OUT) :: k1(nvd,jspd),k2(nvd,jspd),k3(nvd,jspd)
INTEGER, INTENT (OUT) :: nv(jspd),kveclo(nlotot)
REAL, INTENT (OUT) :: bkpt(3),eig(neigd)
REAL, INTENT (INOUT) :: cp_time(9)
REAL, INTENT (OUT) :: ello(nlod,ntypd,jspd),evdu(2,jspd)
REAL, INTENT (OUT) :: epar(0:lmaxd,ntypd,jspd)
#if ( !defined(CPP_INVERSION) || defined(CPP_SOC) )
COMPLEX, INTENT (OUT) :: z(nbasfcn,neigd)
#else
REAL, INTENT (OUT) :: z(nbasfcn,neigd)
#endif
INTEGER, INTENT(IN) :: funit !QPOINTS
integer :: n_start,n_end
n_start=1
n_end=neigd
#if( defined(CPP_MPI) && !defined(CPP_HDF) )
! MPI without HDF
call wann_mpi_read_eig(
> lmaxd,ntypd,nlod,neigd,nvd,jspd,
> irank,isize,kptibz,jspin,nbasfcn,nlotot,
> l_ss,l_noco,nrec,irecl,
< nmat,nv,ello,evdu,epar,kveclo,
< k1,k2,k3,bkpt,wk,nbands,eig,z,cp_time,funit,
> l_gwf,iqpt)
#else
!MPI with HDF or no MPI
call cdn_read(
> lmaxd,ntypd,nlod,neigd,nvd,jspd,
> 0,isize,kptibz,jspin,nbasfcn,nlotot,
> l_ss,l_noco,nrec,kptibz,funit,
> neigd,n_start,n_end,
< nmat,nv,ello,evdu,epar,kveclo,
< k1,k2,k3,bkpt,wk,nbands,eig,z,cp_time)
#endif
END SUBROUTINE wann_read_eig END SUBROUTINE wann_read_eig
END MODULE m_wann_rw_eig END MODULE m_wann_rw_eig
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