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_postproc_setup
8 : use m_juDFT
9 : #ifdef CPP_WANN
10 : CONTAINS
11 0 : SUBROUTINE wann_postproc_setup(
12 0 : > natd,nkpts,kpoints,amat,bmat,
13 0 : > num,num_bands,ntype,neq,
14 0 : > zatom,taual,namat,seed,bkpts_filename)
15 : c******************************************************
16 : c Call the Wannier90 setup routine.
17 : c Purpose: get the file of nearest-neighbor kpoints
18 : c Frank Freimuth
19 : c******************************************************
20 : IMPLICIT NONE
21 :
22 : integer, intent(in) :: natd
23 : integer, intent(in) :: nkpts
24 : real, intent(in) :: kpoints(3,nkpts)
25 : real, intent(in) :: amat(3,3)
26 : real, intent(in) :: bmat(3,3)
27 : integer, intent(in) :: num(3)
28 : integer, intent(in) :: num_bands
29 : integer, intent(in) :: ntype
30 : integer, intent(in) :: neq(ntype)
31 : real, intent(in) :: zatom(ntype)
32 : real, intent(in) :: taual(:,:)
33 : character(len=2),intent(in) :: namat(0:103)
34 : character(len=*),intent(in) :: seed ! QPOINTS
35 : character(len=*),intent(in) :: bkpts_filename ! QPOINTS
36 :
37 : integer :: i,j,at
38 : character(len=50) :: seedname
39 : integer :: num_atoms
40 0 : character(len=2) :: atom_symbols(natd)
41 : logical :: gamma_only
42 : logical :: spinors
43 : integer,parameter :: num_nnmax=12
44 : integer :: nntot
45 0 : integer :: nnlist(nkpts,num_nnmax)
46 0 : integer :: nncell(3,nkpts,num_nnmax)
47 : integer :: num_bands2
48 : integer :: num_wann2
49 0 : real :: proj_site(3,num_bands)
50 0 : integer :: proj_l(num_bands)
51 0 : integer :: proj_m(num_bands)
52 0 : integer :: proj_radial(num_bands)
53 0 : real :: proj_z(3,num_bands)
54 0 : real :: proj_x(3,num_bands)
55 0 : real :: proj_zona(num_bands)
56 0 : integer :: exclude_bands(num_bands)
57 : integer :: nn,ikpt
58 0 : real :: pos(3,natd)
59 :
60 : ! Taken from wannier90-1.2/src/wannier_lib.F90
61 : interface
62 : subroutine wannier_setup(seed__name, mp_grid_loc, num_kpts_loc,
63 : + real_lattice_loc, recip_lattice_loc, kpt_latt_loc,
64 : + num_bands_tot, num_atoms_loc, atom_symbols_loc,
65 : + atoms_cart_loc, gamma_only_loc, spinors_loc, nntot_loc,
66 : + nnlist_loc, nncell_loc, num_bands_loc, num_wann_loc,
67 : + proj_site_loc, proj_l_loc, proj_m_loc, proj_radial_loc,
68 : + proj_z_loc, proj_x_loc, proj_zona_loc, exclude_bands_loc
69 : + ,proj_s_loc,proj_s_qaxis_loc)
70 :
71 : implicit none
72 : integer, parameter :: dp = selected_real_kind(15,300)
73 : integer, parameter :: num_nnmax=12
74 : character(len=*), intent(in) :: seed__name
75 : integer, dimension(3), intent(in) :: mp_grid_loc
76 : integer, intent(in) :: num_kpts_loc
77 : real(kind=dp), dimension(3,3), intent(in) :: real_lattice_loc
78 : real(kind=dp), dimension(3,3), intent(in) :: recip_lattice_loc
79 : real(kind=dp), dimension(3,num_kpts_loc), intent(in) ::
80 : + kpt_latt_loc
81 : integer, intent(in) :: num_bands_tot
82 : integer, intent(in) :: num_atoms_loc
83 : character(len=*), dimension(num_atoms_loc), intent(in) ::
84 : + atom_symbols_loc
85 : real(kind=dp), dimension(3,num_atoms_loc), intent(in) ::
86 : + atoms_cart_loc
87 : logical, intent(in) :: gamma_only_loc
88 : logical, intent(in) :: spinors_loc
89 :
90 : integer, intent(out) :: nntot_loc
91 : integer, dimension(num_kpts_loc,num_nnmax), intent(out) ::
92 : + nnlist_loc
93 : integer,dimension(3,num_kpts_loc,num_nnmax), intent(out) ::
94 : + nncell_loc
95 : integer, intent(out) :: num_bands_loc
96 : integer, intent(out) :: num_wann_loc
97 : real(kind=dp), dimension(3,num_bands_tot), intent(out) ::
98 : + proj_site_loc
99 : integer, dimension(num_bands_tot), intent(out) :: proj_l_loc
100 : integer, dimension(num_bands_tot), intent(out) :: proj_m_loc
101 : integer, dimension(num_bands_tot), intent(out) ::
102 : + proj_radial_loc
103 : real(kind=dp), dimension(3,num_bands_tot), intent(out) ::
104 : + proj_z_loc
105 : real(kind=dp), dimension(3,num_bands_tot), intent(out) ::
106 : + proj_x_loc
107 : real(kind=dp), dimension(num_bands_tot), intent(out) ::
108 : + proj_zona_loc
109 : integer, dimension(num_bands_tot), intent(out) ::
110 : + exclude_bands_loc
111 : integer, dimension(num_bands_tot), optional, intent(out) ::
112 : + proj_s_loc
113 : real(kind=dp),dimension(3,num_bands_tot),optional,intent(out)::
114 : + proj_s_qaxis_loc
115 : end subroutine wannier_setup
116 : end interface
117 :
118 0 : call timestart("wann_postproc_setup")
119 0 : do j=1,natd
120 0 : pos(:,j)=matmul(amat(:,:),taual(:,j))
121 : enddo
122 :
123 : !seedname='WF1'
124 0 : seedname=seed
125 0 : gamma_only=.false.
126 0 : spinors=.false.
127 :
128 0 : num_atoms=0
129 0 : do i=1,ntype
130 0 : at=nint(zatom(i))
131 0 : do j=1,neq(i)
132 0 : num_atoms=num_atoms+1
133 0 : atom_symbols(num_atoms)=namat(at)
134 : enddo !j
135 : enddo !i
136 :
137 : c**********************************************************
138 : c Call Wannier90 routine for preparation.
139 : c**********************************************************
140 : call wannier_setup(
141 : > seed,num,
142 : > nkpts,
143 : > transpose(amat),bmat,
144 : > kpoints,num_bands,
145 : > num_atoms,atom_symbols,pos,
146 : > gamma_only,spinors,
147 : > nntot,nnlist,nncell,num_bands2,
148 : > num_wann2,
149 : > proj_site,proj_l,proj_m,
150 : > proj_radial,proj_z,
151 0 : > proj_x,proj_zona,exclude_bands)
152 :
153 : c******************************************************
154 : c write bkpts
155 : c******************************************************
156 0 : open(202,file=bkpts_filename,form='formatted')
157 0 : write (202,'(i4)') nntot
158 0 : do ikpt=1,nkpts
159 0 : do nn=1,nntot
160 : write (202,'(2i6,3x,3i4)')
161 : c & ikpt,bpt(nn,ikpt),(gb(i,nn,ikpt),i=1,3)
162 0 : & ikpt,nnlist(ikpt,nn),(nncell(i,ikpt,nn),i=1,3)
163 : enddo
164 : enddo
165 0 : close(202)
166 :
167 0 : call timestop("wann_postproc_setup")
168 0 : END SUBROUTINE wann_postproc_setup
169 : #endif
170 : END MODULE m_wann_postproc_setup
|