Line data Source code
1 : !--------------------------------------------------------------------------------
2 : ! Copyright (c) 2016 Peter Grünberg Institut, Forschungszentrum Jülich, Germany
3 : ! This file is part of FLEUR and available as free software under the conditions
4 : ! of the MIT license as expressed in the LICENSE file in more detail.
5 : !--------------------------------------------------------------------------------
6 :
7 : module m_wann_w90kpointgen
8 : use m_juDFT
9 : private
10 : public :: wann_w90kpointgen
11 : contains
12 0 : subroutine wann_w90kpointgen()
13 : c***********************************************************
14 : c Generate the k-point file 'w90kpts' appropriate for the
15 : c calculation of Wannier Functions with the Fleur-code.
16 : c In order to use the symmetry of the Brillouin zone
17 : c the w90kpts file is needed. The 'kpts' file is then
18 : c generated from the 'w90kpts' using the symmetries.
19 : c This is done by the subroutine wann_kptsreduc inside the
20 : c Fleur-code.
21 : c Frank Freimuth, June 2007
22 : c***********************************************************
23 : implicit none
24 : integer num,dim
25 : integer c1,c2,c3
26 : real i1,i2,i3
27 : logical l_shift
28 : integer Nx,Ny,Nz
29 : integer nnx,nny,nnz
30 : real ilen1,ilen2,ilen3
31 : integer limit1, limit2, limit3
32 : real scale,shift1,shift2,shift3
33 :
34 0 : call timestart("wann_w90kpointgen")
35 :
36 0 : print*,"specify dimension"
37 0 : read(*,*)dim
38 0 : print*,"symmetric to origin?"
39 0 : read(*,*)l_shift
40 0 : Nx=1;Ny=1;Nz=1
41 0 : if(dim==3)then
42 0 : print*,"Creates three dimensional k-point set."
43 0 : elseif(dim==2)then
44 0 : print*,"Create two-dimensional k-point set."
45 0 : elseif(dim==1)then
46 0 : print*,"Create one-dimensional k-point set."
47 : else
48 : CALL juDFT_error("unknown dimension",calledby
49 0 : + ="wann_w90kpointgen")
50 : endif
51 0 : print*,"Specify the number of k-point steps"
52 0 : print*,"for each direction."
53 0 : if(.not.dim==2)then
54 0 : print*,"Nz="
55 0 : read(*,*)Nz
56 : endif
57 0 : if(.not.dim==1)then
58 0 : print*,"Ny="
59 0 : read(*,*)Ny
60 0 : print*,"Nx="
61 0 : read(*,*)Nx
62 : endif
63 0 : num=Nx*Ny*Nz
64 0 : print*,"Number of k-points: ",num
65 0 : call findkgt(Nx,nnx)
66 0 : call findkgt(ny,nny)
67 0 : call findkgt(nz,nnz)
68 0 : scale=nnx
69 0 : if(nny.ne.nnx)scale=scale*nny
70 0 : if(nnz.ne.nny .and. nnz.ne.nnx)
71 0 : & scale=scale*nnz
72 0 : print*,"scale=",scale
73 0 : ilen1=1.0/nx; ilen2=1.0/ny; ilen3=1.0/nz
74 0 : limit1=nx-1; limit2=ny-1; limit3=nz-1
75 0 : if(l_shift)then
76 0 : shift1=limit1*ilen1/2.0
77 0 : shift2=limit2*ilen2/2.0
78 0 : shift3=limit3*ilen3/2.0
79 : endif
80 : open(100,file='w90kpts',form='formatted',
81 0 : & status='unknown',recl=1000)
82 0 : write(100,*)num,scale
83 0 : do c1=0,limit1
84 0 : do c2=0,limit2
85 0 : do c3=0,limit3
86 0 : i1=(ilen1*c1-shift1)*scale
87 0 : i2=(ilen2*c2-shift2)*scale
88 0 : i3=(ilen3*c3-shift3)*scale
89 0 : write(100,*)i1,i2,i3,1.0
90 : enddo
91 : enddo
92 : enddo
93 0 : close(100)
94 :
95 0 : call timestop("wann_w90kpointgen")
96 0 : end subroutine wann_w90kpointgen
97 :
98 0 : subroutine findkgt(nu,sc)
99 : implicit none
100 : integer,intent(out)::sc
101 : integer,intent(in)::nu
102 : integer k,nnu
103 :
104 0 : call timestart("findkgt")
105 0 : nnu=nu
106 0 : IF(nnu==0) CALL juDFT_error("nnu.eq.0",calledby
107 0 : + ="wann_w90kpointgen")
108 0 : do k=1,3
109 0 : if(nnu.eq.1)exit
110 0 : if(mod(nnu,5).ne.0)exit
111 0 : nnu=nnu/5
112 : enddo
113 0 : do k=1,3
114 0 : if(nnu.eq.1)exit
115 0 : if(mod(nnu,2).ne.0)exit
116 0 : nnu=nnu/2
117 : enddo
118 0 : sc=nnu
119 :
120 0 : call timestop("findkgt")
121 0 : end subroutine findkgt
122 :
123 :
124 : end module m_wann_w90kpointgen
|