wann_postproc.F 20.3 KB
Newer Older
1 2 3 4 5 6
!--------------------------------------------------------------------------------
! Copyright (c) 2016 Peter Grünberg Institut, Forschungszentrum Jülich, Germany
! This file is part of FLEUR and available as free software under the conditions
! of the MIT license as expressed in the LICENSE file in more detail.
!--------------------------------------------------------------------------------

7 8 9
      module m_wann_postproc
      contains 
      subroutine wann_postproc(
10
     >          DIMENSION,stars,vacuum,atoms,sphhar,input,kpts,sym,mpi,
11
     >          lapw,oneD,noco,cell,vTot,eig_id,l_real,
12 13 14 15 16
     >          mpi_comm,wann,l_p0,film,jspins,n2d,
     >          natd,pos,amat,bmat,ntype,neq,zatom,
     >          omtil,l_soc,l_noco,neigd,fullnkpts,
     >          odi,l_proj,
     >          l_dulo,l_ss,lmaxd,ntypd,nop,nvd,jspd,nbasfcn,
17
     >          llod,nlod,nlo,llo,lapw_l,invtab,mrot,ngopr,
18 19 20 21 22 23
     >          lmax,invsat,invsatnr,nkpt,taual,rmt,bbmat,alph,
     >          beta,qss,sk2,phi2,ods,
     >          irank,isize,n3d,nmzxyd,nmzd,jmtd,nlhd,nq3,nvac,
     >          invs,invs2,nlh,jri,ntypsy,ntypsd,nkptd,
     >          dx,rmsh,
     >          e1s,e2s,ulo_der,ustep,k1d,k2d,k3d,nop2,
24
     >          ig,rgphs,slice,kk,nnne,nv2d,nmzxy,nmz,nq2,
25
     >          delz,area,z1,volint,ig2,tau,symor,ef,l_sgwf,fullnqpts)
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
c     <          fermi_weights)

c***********************************************
c     Collection of those subroutines which may
c     be called after the Wannier functions have
c     been computed.
c     Frank Freimuth
c***********************************************
      use m_types
      use m_wann_dipole
      use m_wann_dipole2
      use m_wann_wannierize
      use m_wann_hopping
      use m_wann_plot_um_dat
      use m_wannier_to_lapw
      use m_wann_plot_from_lapw
      use m_wann_nabla_rs
      use m_wann_pauli_rs
      use m_wann_nabla_pauli_rs
      use m_wann_socmat_rs
      use m_wann_perpmag_rs
47
      use m_types
48 49 50 51 52 53
      use m_wann_wigner_seitz
      use m_wann_get_mp
      use m_wann_get_kpts
      use m_wann_fft4
      use m_wann_fft5
      use m_wann_rmat
54
      use m_wann_nocoplot
55 56 57 58 59 60 61 62 63 64 65 66 67
#ifdef CPP_TOPO
      use m_wann_torque_rs
      use m_wann_offdiposop_rs
      use m_wann_fft6
      use m_wann_fft3
      use m_wann_nedrho
#endif

#ifdef DCPP_WANN_EXT
      use m_wannier_to_lapw_kpts
      use m_wannier_lapw_gfleur
#endif
      implicit none
68 69 70 71 72 73 74

      TYPE(t_dimension),INTENT(IN) :: DIMENSION
      TYPE(t_stars),INTENT(IN)     :: stars
      TYPE(t_vacuum),INTENT(IN)    :: vacuum
      TYPE(t_atoms),INTENT(IN)     :: atoms
      TYPE(t_sphhar),INTENT(IN)    :: sphhar
      TYPE(t_input),INTENT(IN)     :: input
75
      TYPE(t_kpts),INTENT(IN)      :: kpts
76 77 78 79 80 81
      TYPE(t_sym),INTENT(IN)       :: sym
      TYPE(t_mpi),INTENT(IN)       :: mpi
      TYPE(t_lapw),INTENT(IN)      :: lapw
      TYPE(t_oneD),INTENT(IN)      :: oneD
      TYPE(t_noco),INTENT(IN)      :: noco
      TYPE(t_cell),INTENT(IN)      :: cell
82
      TYPE(t_potden),INTENT(IN)    :: vTot
83

84 85
      type(t_wann), intent(in) :: wann
      logical,      intent(in) :: l_p0
86
      logical,      intent(in) :: film, l_real
87
      integer,      intent(in) :: jspins,n2d,mpi_comm, eig_id
88 89 90 91 92 93 94 95 96
      integer,      intent(in) :: natd
      real,         intent(in) :: pos(3,natd)
      real,         intent(in) :: amat(3,3),bmat(3,3)
      integer,      intent(in) :: ntype
      integer,      intent(in) :: neq(ntype)
      real,         intent(in) :: zatom(ntype)
      real,         intent(in) :: omtil
      logical,      intent(in) :: l_soc,l_noco
      integer,      intent(in) :: neigd
97
      integer,      intent(in) :: fullnkpts,fullnqpts
98 99 100
      type(od_inp), intent(in) :: odi
      logical,      intent(in) :: l_proj
      integer, intent (in)     :: lmaxd,ntypd,nop,nvd,jspd
101
      integer, intent (in)     :: nbasfcn,llod,nlod
102 103 104 105 106
      integer, intent (in)     :: nlo(ntypd),llo(nlod,ntypd)
      integer, intent (in)     :: lapw_l(ntypd)
      logical, intent (in)     :: l_dulo(nlod,ntypd),l_ss
      integer, intent (in)     :: invtab(nop),mrot(3,3,nop),ngopr(natd)
      integer, intent (in)     :: lmax(ntypd)
107
      integer, intent (in)     :: invsat(natd),invsatnr(natd),nkpt
108 109
      real,    intent (in)     :: taual(3,natd),rmt(ntypd)
      real,    intent (in)     :: bbmat(3,3)
110 111
      real,    intent (in)     :: alph(ntypd),beta(ntypd)
      real,    intent (in)     :: qss(3,fullnqpts)
112 113 114 115 116 117 118 119 120 121 122 123 124 125
      real,    intent (in)     :: sk2(n2d),phi2(n2d)
      type (od_sym),intent(in) :: ods
      integer, intent (in)     :: irank,isize,n3d
      integer, intent (in) :: nmzxyd,nmzd,jmtd,nlhd,nq3,nvac
      logical, intent (in) :: invs,invs2
      integer, intent (in) :: ntypsd,nkptd
      integer, intent (in) :: nlh(ntypsd),jri(ntypd),ntypsy(natd)
      real,    intent (in) :: dx(ntypd)
      real,    intent (in) :: rmsh(jmtd,ntypd)
      real,    intent (in) :: e1s,e2s
      integer, intent (in) :: ulo_der(nlod,ntypd)
      complex, intent (in) :: ustep(n3d)
      integer, intent (in) :: k1d,k2d,k3d,nop2
      integer, intent (in) :: ig(-k1d:k1d,-k2d:k2d,-k3d:k3d)
126
      complex, intent (in) :: rgphs(-k1d:k1d,-k2d:k2d,-k3d:k3d)
127
      logical, intent (in) :: slice
128
      integer, intent (in) :: kk,nnne
129 130 131 132 133 134
      integer, intent (in) :: nv2d,nmzxy,nmz,nq2
      real,    intent (in) :: delz,area,z1,volint
      integer, intent (in) :: ig2(n3d)
      real,    intent (in) :: tau(3,nop)
      logical, intent (in) :: symor
      real,    intent (in) :: ef
135
      logical, intent (in) :: l_sgwf
136 137
c      real,intent(inout)   :: fermi_weights(:,:,:) !(neigd,nkptd,jspd)

138
      character(len=12) :: fending
139
      integer :: i,nkpts,ikpt,nkqpts,iqpt
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159
      real(4) :: delta3,time_lapw_expand,delta2,time_lapw_plot
      logical :: l_need_fft,l_file
      integer :: hopmin_z,hopmax_z
      integer :: hopmin_y,hopmax_y
      integer :: hopmin_x,hopmax_x
      integer             :: ii
      integer             :: rvecnum,rvecind,num(3),int_dummy
      integer,allocatable :: rvec(:,:),ndegen(:)
      real                :: scale
      real                :: kpoints(3,fullnkpts)
      integer             :: r1,r2,r3,spinspin,num_angl
      logical             :: l_nocosoc

      l_nocosoc=.false.
      if(l_soc)l_nocosoc=.true.
      if(l_noco)l_nocosoc=.true.

c***************************************************
c     Read in the kpoints from w90kpts or kpts.
c***************************************************      
160
      call wann_get_kpts(input,kpts,
161
     >         wann%l_bzsym,film,odi%d1,.false.,
162 163
     <         nkpts,kpoints)
      if (nkpts /= fullnkpts)
164
     +  CALL juDFT_error ('mismatch in number of kpoints',
165
     +                  calledby="wann_postproc")
166

167
      call wann_get_kpts(input,kpts,
168
     >         wann%l_bzsym,film,odi%d1,.true.,
169
     <         nkpts,kpoints)
170 171 172 173 174 175 176 177
c*********************************************************
c     Find out the structure of k-point set.
c*********************************************************
      call wann_get_mp(
     >         fullnkpts,kpoints,
     <         num)

      if(wann%l_wannierize.and.l_p0)then
178 179 180 181 182 183
#ifndef CPP_WANN
         WRITE(*,*) 'At this point a wannierization has to be performed'
         WRITE(*,*) 'but the Wannier90 library is not linked!'
         CALL juDFT_error ('Wannierization without Wannier90 library',
     +                     calledby="wann_postproc")
#else
184 185 186
         call wann_wannierize(
     >            film,wann%l_bzsym,jspins,
     >            natd,pos,amat,bmat,ntype,neq,zatom)
187
#endif
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214
      endif

      if(wann%l_dipole2.and.l_p0)then
         call wann_dipole2(
     >            jspins,pos,omtil,natd,
     >            (l_soc.or.l_noco))
      endif   

      if(wann%l_dipole.and.l_p0)then
         call wann_dipole(
     >            jspins,omtil,natd,pos,amat,
     >            ntype,neq,zatom)
      endif

#ifdef CPP_TOPO
      if(wann%l_nedrho.and.l_p0)then
         call wann_nedrho(
     >       fullnkpts,area,ef,
     <       fermi_weights)
      endif
#endif

      if(wann%l_byenergy) i=3
      if(wann%l_bynumber) i=2
      if(wann%l_byindex)  i=1

      if(wann%l_plotw90)then
215 216
         CALL juDFT_error("not in this version",
     +                    calledby ="wann_postproc")
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267

c         call wann_plotw90(i,wann%band_min,wann%band_max,numbands,nwfs,
c     >   l_dulo,l_noco,l_ss,lmaxd,ntypd,
c     >      neigd,natd,nop,nvd,jspd,nbasfcn,llod,nlod,ntype,
c     >      nwdd,omtil,nlo,llo,lapw_l,invtab,mrot,ngopr,neq,lmax,
c     >      invsat,invsatnr,nkpt,taual,rmt,amat,bmat,bbmat,alph,
c     >      beta,qss,sk2,phi2,odi,ods,irank,isize,n3d,nmzxyd,nmzd,
c     >      jmtd,nlhd,nq3,nvac,invs,invs2,film,nlh,jri,ntypsd,
c     >      ntypsy,jspins,nkptd,dx,n2d,rmsh,e1s,e2s,ulo_der,
c     >      ustep,ig,k1d,k2d,k3d,rgphs,slice,kk,nnne,
c     >      z1,nv2d,nmzxy,nmz,delz,ig2,area,tau,zatom,nq2,nop2,
c     >      volint,symor,pos,ef,wann%l_bzsym,irecl)

      endif

      l_need_fft=.false.
      if(wann%l_hopping.or.wann%l_nablars.or.
     &   wann%l_nablapaulirs.or.wann%l_pauli.or.
     &   wann%l_perpmagrs.or.wann%l_socmatrs.or.
     &   wann%l_torquers.or.wann%l_offdiposoprs.or.
     &   wann%l_socspicomrs.or.wann%l_spindisprs.or.
     &   wann%l_anglmomrs .or.wann%l_perturbrs.or.
     &   wann%l_orbcomprs.or.wann%l_rmat)l_need_fft=.true.

      if(l_need_fft.and.l_p0)then

       if(.false.)then !specify r-mesh by its boundaries
         hopmin_z=-5;hopmax_z=5
         hopmin_x=0;hopmax_x=0
         hopmin_y=0;hopmax_y=0
         rvecnum=(hopmax_z-hopmin_z+1)
         if(.not.odi%d1.and.film)then
           hopmin_x=-5;hopmax_x=5
           hopmin_y=-5;hopmax_y=5
           hopmin_z=0;     hopmax_z=0
         else
           hopmin_x=-5;hopmax_x=5
           hopmin_y=-5;hopmax_y=5
         endif
         rvecnum=        (hopmax_z-hopmin_z+1)
         rvecnum=rvecnum*(hopmax_y-hopmin_y+1)
         rvecnum=rvecnum*(hopmax_x-hopmin_x+1)

         allocate(rvec(3,rvecnum))
         rvecind=0
         do r3=hopmin_z,hopmax_z
          do r2=hopmin_y,hopmax_y
           do r1=hopmin_x,hopmax_x
            rvecind=rvecind+1
            if (rvecind > rvecnum)
     +        CALL juDFT_error ('mismatch in number of kpoints',
268
     +                         calledby="wann_postproc")
269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348

            rvec(1,rvecind)=r1
            rvec(2,rvecind)=r2
            rvec(3,rvecind)=r3
           enddo !r1
          enddo !r2
         enddo !r3
       else !determine optimal r-mesh
         call wann_wigner_seitz(
     >       .true.,num,amat,0,
     <       rvecnum,rvec,ndegen)
         allocate(rvec(3,rvecnum))
         allocate(ndegen(rvecnum))
         call wann_wigner_seitz(
     >       .false.,num,amat,rvecnum,
     <       int_dummy,rvec,ndegen)

         open(333,file='wig_vectors',recl=1000)
         do ii=1,rvecnum
            write(333,*)ii,rvec(1,ii),rvec(2,ii),rvec(3,ii),
     &             ndegen(ii)
         enddo
         close(333)

       endif

      endif

      if(wann%l_hopping.and.l_p0) then
         call wann_hopping(
     >       rvecnum,rvec,kpoints,
     >       jspins,fullnkpts,wann%l_bzsym,film,odi%d1,
     >       l_nocosoc,wann%band_min,wann%band_max,
     >       neigd,wann%l_socmmn0,wann%l_ndegen,ndegen,
     >       wann%wan90version,wann%l_unformatted)
      endif

      if(wann%l_nablars.and.l_p0) then
         call wann_nabla_rs(
     >       rvecnum,rvec,kpoints,
     >       jspins,fullnkpts,wann%l_bzsym,film,odi%d1,
     >       l_soc,wann%band_min,wann%band_max,
     >       neigd,.false.,
     >       wann%wan90version)
      endif  

      if(wann%l_orbcomprs.and.l_p0)then
         num_angl=9
         if(wann%l_oc_f)num_angl=16
         call wann_fft5(
     >          .false.,
     >          num_angl,wann%oc_num_orbs,
     >          'WF1.orbcomp','orbcomp.1',
     >          rvecnum,rvec,kpoints,
     >          1,fullnkpts,film,
     >          l_soc,wann%band_min,wann%band_max,neigd,
     >          wann%wan90version)
         if( jspins.eq.2 )then
            spinspin=2
            if(l_soc.or.l_noco)spinspin=1
            call wann_fft5(
     >             .false.,
     >             num_angl,wann%oc_num_orbs,
     >             'WF2.orbcomp','orbcomp.2',
     >             rvecnum,rvec,kpoints,
     >             spinspin,fullnkpts,film,
     >             l_soc,wann%band_min,wann%band_max,neigd,
     >             wann%wan90version)
         endif   
      endif
 
      if(wann%l_rmat)then
        call wann_rmat(
     >      bmat,amat,
     >      rvecnum,rvec,kpoints,
     >      jspins,fullnkpts,wann%l_bzsym,film,odi%d1,
     >      l_nocosoc,wann%band_min,wann%band_max,
     >      neigd,.false.,wann%wan90version)
      endif

349 350

       if(wann%l_anglmomrs.and.l_p0)then
351
        call wann_fft4(
352 353
     >       'WF1.anglmom',
     >       'anglmomrs.1',.false.,
354 355 356 357
     >       rvecnum,rvec,kpoints,
     >       jspins,fullnkpts,wann%l_bzsym,film,odi%d1,
     >       l_soc,wann%band_min,wann%band_max,neigd,
     >       .false.,wann%wan90version)
358 359
       endif
 
360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448
#ifdef CPP_TOPO
      if(wann%l_offdiposoprs.and.l_p0)then
         call wann_offdiposop_rs(
     >       rvecnum,rvec,kpoints,
     >       jspins,fullnkpts,wann%l_bzsym,film,odi%d1,
     >       l_soc,wann%band_min,wann%band_max,neigd,
     >       .false.)
      endif

      if(wann%l_spindisprs.and.l_p0)then
          call wann_fft5(
     >       rvecnum,rvec,kpoints,
     >       jspins,fullnkpts,wann%l_bzsym,film,odi%d1,
     >       l_soc,wann%band_min,wann%band_max,neigd,
     >       .false.)
      endif   

      if(wann%l_perturbrs.and.l_p0)then
          call wann_fft3(
     >       'WF1.perturb'  ,'perturbrs.1'  ,.false.,
     >       rvecnum,rvec,kpoints,
     >       jspins,fullnkpts,wann%l_bzsym,film,odi%d1,
     >       l_soc,wann%band_min,wann%band_max,neigd,
     >       .false.)
      endif

      if(wann%l_socspicomrs.and.l_p0)then
        if(l_soc)then
          call wann_fft4(
     >       'WF1.socspicom','socspicomrs.1',.true.,
     >       rvecnum,rvec,kpoints,
     >       jspins,fullnkpts,wann%l_bzsym,film,odi%d1,
     >       l_soc,wann%band_min,wann%band_max,neigd,
     >       .false.)
        else
          call wann_fft6(
     >       rvecnum,rvec,kpoints,
     >       jspins,fullnkpts,wann%l_bzsym,film,odi%d1,
     >       l_soc,wann%band_min,wann%band_max,neigd,
     >       .false.)
        endif  
      endif



      if(wann%l_torquers.and.l_p0) then
         call wann_torque_rs(
     >       ntype,neq,rvecnum,rvec,kpoints,
     >       jspins,fullnkpts,wann%l_bzsym,film,odi%d1,
     >       l_soc,wann%band_min,wann%band_max,
     >       neigd,.false.)
      endif  
#endif
      if (wann%l_nablapaulirs.and.l_p0)then
         call wann_nabla_pauli_rs(
     >       rvecnum,rvec,kpoints,
     >       jspins,fullnkpts,wann%l_bzsym,film,odi%d1,
     >       l_soc,wann%band_min,wann%band_max,
     >       neigd,.false.,wann%wan90version)
      endif   

      if (wann%l_pauli.and.l_p0)then
         call wann_pauli_rs(
     >       rvecnum,rvec,kpoints,
     >       jspins,fullnkpts,wann%l_bzsym,film,odi%d1,
     >       l_nocosoc,wann%band_min,wann%band_max,
     >       neigd,.false.,wann%l_ndegen,ndegen,
     >       wann%wan90version,wann%l_unformatted)
      endif

      if (wann%l_perpmagrs.and.l_p0)then
         call wann_perpmag_rs(
     >       rvecnum,rvec,kpoints,
     >       jspins,fullnkpts,wann%l_bzsym,film,odi%d1,
     >       l_soc,wann%band_min,wann%band_max,
     >       neigd,.false.,wann%l_ndegen,ndegen,wann%wan90version,
     >       wann%l_unformatted)
      endif

      if (wann%l_socmatrs.and.l_p0)then
         call wann_socmat_rs(
     >       rvecnum,rvec,kpoints,
     >       jspins,fullnkpts,wann%l_bzsym,film,odi%d1,
     >       l_soc,wann%band_min,wann%band_max,
     >       neigd,.false.,wann%wan90version)
      endif

      if(wann%l_plot_umdat)then
         call wann_plot_um_dat(
449
     >      DIMENSION,stars,vacuum,atoms,sphhar,input,sym,mpi,
450
     >      lapw,oneD,noco,cell,vTot,eig_id,l_real,
451 452 453
     >      mpi_comm,i,wann%band_min,wann%band_max,l_soc,
     >      l_dulo,l_noco,l_ss,lmaxd,ntypd,
     >      neigd,natd,nop,nvd,jspd,nbasfcn,llod,nlod,ntype,
454
     >      omtil,nlo,llo,lapw_l,invtab,mrot,ngopr,neq,lmax,
455
     >      invsat,invsatnr,nkpt,taual,rmt,amat,bmat,bbmat,alph,
456
     >      beta,qss(:,1),sk2,phi2,odi,ods,irank,isize,n3d,nmzxyd,nmzd,
457 458 459 460
     >      jmtd,nlhd,nq3,nvac,invs,invs2,film,nlh,jri,ntypsd,
     >      ntypsy,jspins,nkptd,dx,n2d,rmsh,e1s,e2s,ulo_der,
     >      ustep,ig,k1d,k2d,k3d,rgphs,slice,kk,nnne,
     >      z1,nv2d,nmzxy,nmz,delz,ig2,area,tau,zatom,nq2,nop2,
461
     >      volint,symor,pos,ef,wann%l_bzsym,wann%l_proj_plot,
462 463 464 465 466 467 468
     >      wann%wan90version)
      endif


      call cpu_time(delta2)
      if(wann%l_lapw.and.l_p0)then
         call wannier_to_lapw(
469
     >      mpi_comm,eig_id,l_real,
470
     >      input,lapw,oneD,noco,sym,cell,atoms,stars,vacuum,sphhar,
471
     >      vTot,
472
     >      l_soc,wann%unigrid,i,wann%band_min,wann%band_max,
473 474
     >      l_dulo,l_noco,l_ss,lmaxd,ntypd,
     >      neigd,natd,nop,nvd,jspd,nbasfcn,llod,nlod,ntype,
475
     >      omtil,nlo,llo,lapw_l,invtab,mrot,ngopr,neq,lmax,
476
     >      invsat,invsatnr,nkpt,taual,rmt,amat,bmat,bbmat,alph,
477
     >      beta,qss(:,1),sk2,phi2,odi,ods,irank,isize,n3d,nmzxyd,nmzd,
478 479 480 481
     >      jmtd,nlhd,nq3,nvac,invs,invs2,film,nlh,jri,ntypsd,
     >      ntypsy,jspins,nkptd,dx,n2d,rmsh,e1s,e2s,ulo_der,
     >      ustep,ig,k1d,k2d,k3d,rgphs,slice,kk,nnne,
     >      z1,nv2d,nmzxy,nmz,delz,ig2,area,tau,zatom,nq2,nop2,
482
     >      volint,symor,pos,ef,wann%l_bzsym,wann%l_proj_plot,
483 484 485 486 487 488 489 490 491 492 493
     >      wann%wan90version)
      endif

      if(wann%l_lapw_kpts)then
#ifdef DCPP_WANN_EXT
         call wannier_to_lapw_kpts(
     >      unigrid,i,wann%band_min,wann%band_max,
     >      l_dulo,l_noco,l_ss,lmaxd,ntypd,
     >      neigd,natd,nop,nvd,jspd,nbasfcn,llod,nlod,ntype,
     >      nwdd,omtil,nlo,llo,lapw_l,invtab,mrot,ngopr,neq,lmax,
     >      invsat,invsatnr,nkpt,taual,rmt,amat,bmat,bbmat,alph,
494
     >      beta,qss(:,1),sk2,phi2,odi,ods,irank,isize,n3d,nmzxyd,nmzd,
495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512
     >      jmtd,nlhd,nq3,nvac,invs,invs2,film,nlh,jri,ntypsd,
     >      ntypsy,jspins,nkptd,dx,n2d,rmsh,e1s,e2s,ulo_der,
     >      ustep,ig,k1d,k2d,k3d,rgphs,slice,kk,nnne,
     >      z1,nv2d,nmzxy,nmz,delz,ig2,area,tau,zatom,nq2,nop2,
     >      volint,symor,pos,ef,wann%l_bzsym,wann%l_proj_plot,irecl)
#else
         CALL juDFT_error("not yet tested in this release",calledby
     +        ="wann_postproc")
#endif
      endif
      if(wann%l_lapw_gfleur)then
#ifdef DCPP_WANN_EXT
         call wannier_lapw_gfleur(
     >      gfthick,gfcut,i,wann%band_min,wann%band_max,
     >      l_dulo,l_noco,l_ss,lmaxd,ntypd,
     >      neigd,natd,nop,nvd,jspd,nbasfcn,llod,nlod,ntype,
     >      nwdd,omtil,nlo,llo,lapw_l,invtab,mrot,ngopr,neq,lmax,
     >      invsat,invsatnr,nkpt,taual,rmt,amat,bmat,bbmat,alph,
513
     >      beta,qss(:,1),sk2,phi2,odi,ods,irank,isize,n3d,nmzxyd,nmzd,
514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546
     >      jmtd,nlhd,nq3,nvac,invs,invs2,film,nlh,jri,ntypsd,
     >      ntypsy,jspins,nkptd,dx,n2d,rmsh,e1s,e2s,ulo_der,
     >      ustep,ig,k1d,k2d,k3d,rgphs,slice,kk,nnne,
     >      z1,nv2d,nmzxy,nmz,delz,ig2,area,tau,zatom,nq2,nop2,
     >      volint,symor,pos,ef,wann%l_bzsym,wann%l_proj_plot,irecl)
#else
         CALL juDFT_error("not yet tested in this release",calledby
     +        ="wann_postproc")
#endif
      endif

      call cpu_time(delta3)
      time_lapw_expand=delta3-delta2

      call cpu_time(delta2)
      if(wann%l_plot_lapw.and.l_p0)then
         CALL juDFT_error("not yet tested in this release",calledby
     +        ="wann_postproc")
c         call wann_plot_from_lapw(
c     >     nv2d,jspins,odi,ods,n3d,nmzxyd,n2d,
c     >     ntypsd,
c     >     ntype,lmaxd,jmtd,natd,nmzd,neq,nq3,nvac,
c     >     nmz,nmzxy,nq2,nop,nop2,volint,film,slice,symor,
c     >     invs,invs2,z1,delz,ngopr,ntypsy,jri,pos,zatom,
c     >     lmax,mrot,tau,rmsh,invtab,amat,bmat,bbmat,nnne,kk,
c     >     nlod,llod,lmd,omtil,nlo,llo)
      endif
      call cpu_time(delta3)
      time_lapw_plot=delta3-delta2

      write(6,*)"time_lapw_expand=",time_lapw_expand
      write(6,*)"time_lapw_plot=",time_lapw_plot

547 548 549 550 551 552
      if(wann%l_finishnocoplot.and.l_p0) then
c         write(*,*)'doing the UNK mixing'
c         write(*,*)'alph',alph
c         write(*,*)'beta',beta
c         nkqpts=fullnkpts
c         if(l_sgwf) nkqpts=fullnkpts*fullnqpts 
553
         call wann_nocoplot(atoms,slice,nnne,!nslibd
554 555 556 557 558 559
     >                      amat,bmat,fullnkpts,odi,film,
     >                      natd,ntypd,jmtd,ntype,neq,pos,
     >                      jri,rmsh,alph,beta,fullnqpts,qss,
     >                      z1,zatom)
      endif

560 561
      end subroutine wann_postproc
      end module m_wann_postproc