Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
1. fixed one bug about writing files under the gfortran compiler envi…
…ronment

2. Added SlabBandWaveFunc_calc subroutine to calculate the density distribution of slab system.
  • Loading branch information
quanshengwu committed Dec 11, 2018
1 parent effa1a1 commit e7bc7e7
Show file tree
Hide file tree
Showing 13 changed files with 299 additions and 110 deletions.
18 changes: 14 additions & 4 deletions examples/Bi2Se3/.wt.in.travis
Expand Up @@ -40,6 +40,7 @@ BulkFS_calc = T
BulkGap_cube_calc = T
BulkGap_plane_calc = T
SlabBand_calc = T
SlabBandWaveFunc_calc = T
SlabBand_plane_calc = T
WireBand_calc = T
SlabSS_calc = T
Expand All @@ -64,12 +65,12 @@ surf_onsite= 0.0 ! surf_onsite
&PARAMETERS
Eta_Arc = 0.001 ! infinite small value, like brodening
E_arc = 0.0 ! energy for calculate Fermi Arc
OmegaNum = 40 ! omega number
OmegaNum = 10 ! omega number
OmegaMin = -0.6 ! energy interval
OmegaMax = 0.5 ! energy interval
Nk1 = 6 ! number k points odd number would be better
Nk2 = 6 ! number k points odd number would be better
Nk3 = 6 ! number k points odd number would be better
Nk1 = 4 ! number k points odd number would be better
Nk2 = 4 ! number k points odd number would be better
Nk3 = 4 ! number k points odd number would be better
NP = 2 ! number of principle layers
Gap_threshold = 0.01 ! threshold for GapCube output
/
Expand Down Expand Up @@ -116,6 +117,15 @@ Direct
0.5 0.0 0.0
0.0 0.5 0.0
0.0 0.0 0.5

SELECTED_BANDS
4
180 181 182 183

SINGLEKPOINT_2D
Direct
0 0 0




Expand Down
50 changes: 30 additions & 20 deletions examples/Bi2Se3/wt.in
Expand Up @@ -33,22 +33,23 @@ SURFACE ! Specify surface with two vectors, see doc

!> bulk band structure calculation flag
&CONTROL
BulkBand_calc = T
BulkBand_points_calc = F
DOS_calc = T
BulkFS_calc = F
BulkGap_cube_calc = F
BulkGap_plane_calc = F
SlabBand_calc = T
SlabBand_plane_calc = T
WireBand_calc = F
SlabSS_calc = T
SlabArc_calc = T
SlabQPI_calc = F
ArcQPI_calc = T
Z2_3D_calc = T
SlabSpintexture_calc = T
Wanniercenter_calc = F
BulkBand_calc = T
BulkBand_points_calc = T
DOS_calc = T
BulkFS_calc = F
BulkGap_cube_calc = F
BulkGap_plane_calc = F
SlabBand_calc = T
SlabBandWaveFunc_calc = T
SlabBand_plane_calc = T
WireBand_calc = T
SlabSS_calc = T
SlabArc_calc = T
SlabQPI_calc = T
ArcQPI_calc = T
Z2_3D_calc = T
SlabSpintexture_calc = T
Wanniercenter_calc = T
/

&SYSTEM
Expand All @@ -67,11 +68,11 @@ E_arc = 0.0 ! energy for calculate Fermi Arc
OmegaNum = 400 ! omega number
OmegaMin = -0.6 ! energy interval
OmegaMax = 0.5 ! energy interval
Nk1 = 101 ! number k points odd number would be better
Nk2 = 101 ! number k points odd number would be better
Nk3 = 61 ! number k points odd number would be better
Nk1 = 40 ! number k points odd number would be better
Nk2 = 40 ! number k points odd number would be better
Nk3 = 20 ! number k points odd number would be better
NP = 2 ! number of principle layers
Gap_threshold = 0.01 ! threshold for GapCube output
Gap_threshold = 0.01 ! threshold for FindNodes_calc output
/

KPATH_BULK ! k point path
Expand Down Expand Up @@ -116,6 +117,15 @@ Direct
0.5 0.0 0.0
0.0 0.5 0.0
0.0 0.0 0.5

SELECTED_BANDS
4
180 181 182 183

SINGLEKPOINT_2D
Direct
0 0 0




Expand Down
5 changes: 5 additions & 0 deletions soc/Makefile.gfortran
Expand Up @@ -18,6 +18,11 @@ flag = -O3 #-g -Wall -Wextra -Warray-temporaries -Wconversion -fimplicit-none -f
# blas and lapack libraries
libs = -L/usr/lib/ -llapack -lblas

# Intel MKL also supports with gfortran comipler
# dynamic linking
# libs = -L/${MKLROOT}/lib/intel64 -lmkl_core -lmkl_sequential -lmkl_intel_lp64 -lpthread


main : $(obj)
$(f90) $(obj) -o wt.x $(libs)
cp -f wt.x ../bin
Expand Down
9 changes: 7 additions & 2 deletions soc/Makefile.gfortran-mpi
Expand Up @@ -9,11 +9,11 @@ OBJ = module.o aux.o symmetry.o readHmnR.o inverse.o proteus.o \
effective_mass.o findnodes.o sigma_AHC.o \
main.o

# compiler
# compiler, here mpif90 should be comipled with gfortran
F90 = mpif90 -cpp -DMPI

INCLUDE =
WFLAG = -Wall -Wextra -Warray-temporaries -Wconversion -fimplicit-none \
WFLAG = #-Wall -Wextra -Warray-temporaries -Wconversion -fimplicit-none \
-fbacktrace -ffree-line-length-0 -fcheck=all -finit-real=nan \
-ffpe-trap=zero,overflow,underflow
OFLAG = -g
Expand All @@ -24,6 +24,11 @@ LFLAG = $(OFLAG)
# blas and lapack libraries
LIBS = /opt/local/lib/libopenblas.a

# Intel MKL also supports with gfortran comipler
# dynamic linking
# LIBS = -L/${MKLROOT}/lib/intel64 -lmkl_core -lmkl_sequential -lmkl_intel_lp64 -lpthread


main : $(OBJ)
$(F90) $(LFLAG) $(OBJ) -o wt.x $(LIBS)
cp -f wt.x ../bin
Expand Down
2 changes: 1 addition & 1 deletion soc/Makefile.gfortran_travis
Expand Up @@ -13,7 +13,7 @@ obj = module.o aux.o symmetry.o readHmnR.o inverse.o proteus.o \
# compiler
f90 = gfortran -cpp -fprofile-arcs -ftest-coverage

flag = -O0
flag = -O2

# blas and lapack libraries
libs = -llapack -lblas
Expand Down
2 changes: 1 addition & 1 deletion soc/Makefile.intel-mpi
Expand Up @@ -13,7 +13,7 @@ OBJ = module.o aux.o symmetry.o readHmnR.o inverse.o proteus.o \
F90 = mpiifort -fpp -DMPI

INCLUDE = -I${MKLROOT}/include
WFLAG = -warn all -nogen-interface
WFLAG = -nogen-interface
OFLAG = -O3 -g -traceback -static-intel
FFLAG = $(OFLAG) $(WFLAG)
LFLAG = $(OFLAG)
Expand Down
107 changes: 93 additions & 14 deletions soc/eigen.f90
@@ -1,6 +1,7 @@
! complex version
! a subroutine to calculate eigenvector and eigenvalue
subroutine eigensystem_c(JOBZ,UPLO,N,A,W)
! A pack of Lapack subroutine zheev, which is
! a subroutine to calculate eigenvector and eigenvalue for a
! complex hermite matrix

use para, only : Dp, stdout
implicit none
Expand Down Expand Up @@ -40,27 +41,30 @@ subroutine eigensystem_c(JOBZ,UPLO,N,A,W)
real(Dp), intent(inout) :: W(N)

integer :: info
integer :: lwork

real(Dp),allocatable :: rwork(:)

complex(Dp),allocatable :: work(:)

allocate(rwork(16*N))
allocate( work(16*N))
lwork=16*N
allocate(rwork(lwork))
allocate( work(lwork))
rwork= 0d0
work= 0d0
work= (0d0, 0d0)

info=0
W=0.0d0

!> if N==1, you don't have to do the diagonalization
if (N==1) then
W=A(1, 1)
A(1, 1)= 1d0
return
endif

call zheev( JOBZ, UPLO, N, A, N, &
W, work, 16*N, rwork, info )
W, work, lwork, rwork, info )

if (info.ne.0) then
write(stdout, *) 'ERROR : something wrong with zheev'
Expand All @@ -71,9 +75,10 @@ subroutine eigensystem_c(JOBZ,UPLO,N,A,W)
return
end subroutine eigensystem_c

! real version
! a subroutine to calculate eigenvector and eigenvalue
subroutine eigensystem_r (JOBZ,UPLO,N,A,W)
! A pack of Lapack subroutine dsyev, which is
! a subroutine to calculate eigenvector and eigenvalue for a
! real symmetric matrix

use para, only : Dp, stdout
implicit none
Expand Down Expand Up @@ -139,8 +144,9 @@ subroutine eigensystem_r (JOBZ,UPLO,N,A,W)
return
end subroutine eigensystem_r

! a subroutine to calculate eigenvector and eigenvalue
subroutine zgeev_pack(N, A, W)
! a pack of Lapack subroutine zgeev, which is a subroutine to
! calculate eigenvector and eigenvalue of a complex hermite matrix

use para, only : Dp
implicit none
Expand Down Expand Up @@ -203,18 +209,18 @@ subroutine zgeev_pack(N, A, W)
ldvl=N
ldvr=N
lwork= 16*N

allocate(VL(N, N))
allocate(VR(N, N))

allocate(rwork(16*N))
allocate( work(lwork))
VL= 0d0
VR= 0d0
VL= (0d0, 0d0)
VR= (0d0, 0d0)
rwork= 0d0
work= 0d0
work= (0d0, 0d0)

info=0
W=0.0d0
W=(0d0, 0d0)

if (N==1) then
W=A(1, 1)
Expand All @@ -229,6 +235,79 @@ subroutine zgeev_pack(N, A, W)
stop ">>> Error : something wrong happens in zgeev_pack"
endif

deallocate(VL)
deallocate(VR)
deallocate(rwork)
deallocate( work)

return
end subroutine zgeev_pack


!> the IL-th through IU-th eigenvalues will be found.
subroutine zheevx_pack(JOBZ, UPLO, N, il, iu, A, eigval, eigvec)
use para, only : dp
implicit none

!> inout variables
character(1), intent(in) :: JOBZ ! 'V' compute eigenvectors and eigenvalues; 'N' only eigenvalues
character(1), intent(in) :: UPLO
integer, intent(in) :: N !> dimension of matrix A
integer, intent(in) :: il !> lowest band to be calculated
integer, intent(in) :: iu !> highest band to be calculated
real(dp), intent(inout) :: eigval(iu-il+1) !> eigenvalues
complex(dp), intent(inout) :: A(N, N) !> the input hermite complex matrix
complex(dp), intent(inout) :: eigvec(N, iu-il+1) !> eigenvectors

!> local variables
real(dp), allocatable :: eigenvalues(:)
integer , allocatable :: iwork(:)
integer , allocatable :: ifail(:)
real(dp), allocatable :: rwork(:)
complex(dp), allocatable :: work(:)

integer :: mdim
integer :: lwork
integer :: info
real(dp) :: vl !> not referenced in this subroutine
real(dp) :: vu !> not referenced in this subroutine

real(dp), parameter :: abstol= 1D-10

!real(dp), external :: DLAMCH
!abstol= 2*DLAMCH('S')

mdim= iu-il+1
lwork= 64*N

allocate(ifail(N))
allocate(iwork(5*N))
allocate(rwork(7*N))
allocate(work(lwork))
allocate(eigenvalues(N))
ifail = 0
iwork = 0
rwork = 0d0
work = 0d0

eigenvalues= 0d0
eigvec= 0d0
vl=0d0; vu=0d0

call zheevx(JOBZ,'I',UPLO,N,A,N,vl,vu,il,iu,abstol,&
mdim,eigenvalues,eigvec,N,work,lwork,rwork,iwork,ifail,info)

if (info/=0) then
print *, ' Error info in zheevx: ', info
stop ' Error happens in zheev_pack'
endif

eigval(1:mdim)= eigenvalues(1:mdim)

deallocate(eigenvalues, work, iwork, ifail, rwork)

return
end subroutine zheevx_pack



2 changes: 1 addition & 1 deletion soc/fermiarc.f90
Expand Up @@ -837,9 +837,9 @@ subroutine SurfaceDOSkk
close(outfileindex)
endif

outfileindex= outfileindex+ 1
if (cpuid.eq.0.and.SOC>0 .and. (SlabSpintexture_calc.or.ArcQPI_calc))then
!> generate gnuplot scripts for plotting the spin texture
outfileindex= outfileindex+ 1
if (cpuid.eq.0) then
open(outfileindex,file='spintext_r.gnu')
write(outfileindex, '(a)')"set encoding iso_8859_1"
Expand Down
12 changes: 12 additions & 0 deletions soc/main.f90
Expand Up @@ -298,6 +298,18 @@ program main
if(cpuid.eq.0)write(stdout, *)'<< End of calculating the slab band structure in k plane mode'
endif

!> slab band
if (SlabBandWaveFunc_calc)then
if(cpuid.eq.0)write(stdout, *)' '
if(cpuid.eq.0)write(stdout, *)'>> Start of calculating the slab band wave function'
call now(time_start)
call psik_slab
call now(time_end)
call print_time_cost(time_start, time_end, 'SlabBandWaveFunc_calc')
if(cpuid.eq.0)write(stdout, *)'<< End of calculating the slab band wave function'
endif



!> slab band
if (SlabBand_calc)then
Expand Down

0 comments on commit e7bc7e7

Please sign in to comment.