wann_postproc.F90 21.7 KB
Newer Older
1 2 3 4 5 6 7
!--------------------------------------------------------------------------------
! 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.
!--------------------------------------------------------------------------------

MODULE m_wann_postproc
8
CONTAINS
9
  SUBROUTINE wann_postproc(&
10
       stars,vacuum,atoms,sphhar,input,kpts,sym,mpi,&
11
       lapw,oneD,noco,nococonv,cell,vTot,enpara,sliceplot,eig_id,l_real,&
12 13 14 15 16 17 18 19 20
       wann, fullnkpts, l_proj,ef,l_sgwf,fullnqpts)
    !     <          fermi_weights)

    !***********************************************
    !     Collection of those subroutines which may
    !     be called after the Wannier functions have
    !     been computed.
    !     Frank Freimuth
    !***********************************************
21

22
    USE m_types
23
    USE m_constants
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
    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
    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
Frank Freimuth's avatar
Frank Freimuth committed
42
    use m_wann_socmatvec_rs
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
    USE m_wann_nocoplot
#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

58

59 60 61 62 63 64 65 66 67 68 69
    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
    TYPE(t_kpts),INTENT(IN)      :: kpts
    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
70
    TYPE(t_nococonv),INTENT(IN)  :: nococonv
71 72 73 74 75 76 77 78 79 80 81 82
    TYPE(t_cell),INTENT(IN)      :: cell
    TYPE(t_potden),INTENT(IN)    :: vTot
    TYPE(t_enpara),INTENT(IN)    :: enpara
    type(t_sliceplot),INTENT(IN) :: sliceplot

    TYPE(t_wann), INTENT(in) :: wann
    LOGICAL,      INTENT(in) :: l_real
    INTEGER,      INTENT(in) :: eig_id
    INTEGER,      INTENT(in) :: fullnkpts,fullnqpts
    LOGICAL,      INTENT(in) :: l_proj
    REAL,    INTENT (in) :: ef
    LOGICAL, INTENT (in) :: l_sgwf
83
    !      real,intent(inout)   :: fermi_weights(:,:,:) !(input%neig,nkptd,jspd)
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106

    CHARACTER(len=12) :: fending
    INTEGER :: i,nkpts,ikpt,nkqpts,iqpt
    REAL    :: 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,ALLOCATABLE    :: kpoints(:,:)!(3,fullnkpts)
    INTEGER             :: r1,r2,r3,spinspin,num_angl
    LOGICAL             :: l_nocosoc

    ALLOCATE(kpoints(3,fullnkpts))
    l_nocosoc=.FALSE.
    IF(noco%l_soc)l_nocosoc=.TRUE.
    IF(noco%l_noco)l_nocosoc=.TRUE.

    !***************************************************
    !     Read in the kpoints from w90kpts or kpts.
107
    !***************************************************
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
    CALL wann_get_kpts(input,kpts,&
         wann%l_bzsym,input%film,oneD%odi%d1,.FALSE.,&
         nkpts,kpoints)
    IF (nkpts /= fullnkpts)&
         CALL juDFT_error ('mismatch in number of kpoints',&
         calledby="wann_postproc")

    CALL wann_get_kpts(input,kpts,&
         wann%l_bzsym,input%film,oneD%odi%d1,.TRUE.,&
         nkpts,kpoints)
    !*********************************************************
    !     Find out the structure of k-point set.
    !*********************************************************
    CALL wann_get_mp(&
         fullnkpts,kpoints,&
         num)

Frank Freimuth's avatar
Frank Freimuth committed
125
    IF(wann%l_wannierize)THEN
126 127 128 129 130 131 132
#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
       CALL wann_wannierize(&
Frank Freimuth's avatar
Frank Freimuth committed
133
            input%film,wann,mpi,kpoints,fullnkpts,input%jspins,&
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167
            atoms%nat,atoms%pos,cell%amat,cell%bmat,atoms%ntype,atoms%neq,atoms%zatom)
#endif
    ENDIF

    IF(wann%l_dipole2.AND.mpi%irank==0)THEN
       CALL wann_dipole2(&
            input%jspins,atoms%pos,cell%omtil,atoms%nat,&
            (noco%l_soc.OR.noco%l_noco))
    ENDIF

    IF(wann%l_dipole.AND.mpi%irank==0)THEN
       CALL wann_dipole(&
            input%jspins,cell%omtil,atoms%nat,atoms%pos,cell%amat,&
            atoms%ntype,atoms%neq,atoms%zatom)
    ENDIF

#ifdef CPP_TOPO
    IF(wann%l_nedrho.AND.mpi%irank==0)THEN
       CALL wann_nedrho(&
            fullnkpts,cell%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
       CALL juDFT_error("not in this version",&
            calledby ="wann_postproc")

       !         call wann_plotw90(i,wann%band_min,wann%band_max,numbands,nwfs,
       !     >   atoms%l_dulo,noco%l_noco,noco%l_ss,atoms%lmaxd,atoms%ntype,
168
       !     >      input%neig,atoms%nat,sym%nop,lapw%dim_nvd(),jspd,lapw%dim_nbasfcn(),atoms%llod,atoms%nlod,atoms%ntype,
169
       !     >      nwdd,cell%omtil,atoms%nlo,atoms%llo,atoms%lapw_l,sym%invtab,sym%mrot,sym%ngopr,atoms%neq,atoms%lmax,
170 171
       !     >      sym%invsat,sym%invsatnr,kpts%nkpt,atoms%taual,atoms%rmt,cell%amat,cell%bmat,cell%bbmat,nococonv%alph,
       !     >      nococonv%beta,nococonv%qss,stars%sk2,stars%phi2,oneD%odi,oneD%ods,mpi%irank,mpi%isize,stars%ng3,vacuum%nmzxyd,vacuum%nmzd,
172
       !     >      size(atoms%rmsh,1),sphhar%nlhd,stars%ng3,vacuum%nvac,sym%invs,sym%invs2,input%film,sphhar%nlh,atoms%jri,sphhar%ntypsd,
173
       !     >      sym%ntypsy,input%jspins,kpts%nkpt,atoms%dx,stars%ng2,atoms%rmsh,sliceplot%e1s,sliceplot%e2s,atoms%ulo_der,
174
       !     >      stars%ustep,stars%ig,stars%mx1,stars%mx2,stars%mx3,stars%rgphs,sliceplot%slice,sliceplot%kk,sliceplot%nnne,
175
       !     >      cell%z1,lapw%dim_nv2d(),vacuum%nmzxy,vacuum%nmz,vacuum%delz,stars%ig2,cell%area,sym%tau,atoms%zatom,stars%ng2,sym%nop2,
176 177 178 179 180 181 182 183
       !     >      cell%volint,sym%symor,atoms%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.&
Frank Freimuth's avatar
Frank Freimuth committed
184
         wann%l_socmatvecrs.OR.&
185 186 187 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 215 216 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
         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.mpi%irank==0)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.oneD%odi%d1.AND.input%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',&
                        calledby="wann_postproc")

                   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,cell%amat,0,&
               rvecnum,rvec,ndegen)
          ALLOCATE(rvec(3,rvecnum))
          ALLOCATE(ndegen(rvecnum))
          CALL wann_wigner_seitz(&
               .FALSE.,num,cell%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.mpi%irank==0) THEN
       CALL wann_hopping(&
            rvecnum,rvec,kpoints,&
            input%jspins,fullnkpts,wann%l_bzsym,input%film,oneD%odi%d1,&
            l_nocosoc,wann%band_min,wann%band_max,&
251
            input%neig,wann%l_socmmn0,wann%l_ndegen,ndegen,&
252 253 254 255 256 257 258 259
            wann%wan90version,wann%l_unformatted)
    ENDIF

    IF(wann%l_nablars.AND.mpi%irank==0) THEN
       CALL wann_nabla_rs(&
            rvecnum,rvec,kpoints,&
            input%jspins,fullnkpts,wann%l_bzsym,input%film,oneD%odi%d1,&
            noco%l_soc,wann%band_min,wann%band_max,&
260
            input%neig,.FALSE.,&
261 262 263 264 265 266 267 268 269 270 271 272
            wann%wan90version)
    ENDIF

    IF(wann%l_orbcomprs.AND.mpi%irank==0)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,input%film,&
273
            noco%l_soc,wann%band_min,wann%band_max,input%neig,&
274 275 276 277 278 279 280 281 282 283
            wann%wan90version)
       IF( input%jspins.EQ.2 )THEN
          spinspin=2
          IF(noco%l_soc.OR.noco%l_noco)spinspin=1
          CALL wann_fft5(&
               .FALSE.,&
               num_angl,wann%oc_num_orbs,&
               'WF2.orbcomp','orbcomp.2',&
               rvecnum,rvec,kpoints,&
               spinspin,fullnkpts,input%film,&
284
               noco%l_soc,wann%band_min,wann%band_max,input%neig,&
285 286 287 288 289 290 291 292 293 294
               wann%wan90version)
       ENDIF
    ENDIF

    IF(wann%l_rmat)THEN
       CALL wann_rmat(&
            cell%bmat,cell%amat,&
            rvecnum,rvec,kpoints,&
            input%jspins,fullnkpts,wann%l_bzsym,input%film,oneD%odi%d1,&
            l_nocosoc,wann%band_min,wann%band_max,&
295
            input%neig,.FALSE.,wann%wan90version)
296 297 298 299 300 301 302 303 304
    ENDIF


    IF(wann%l_anglmomrs.AND.mpi%irank==0)THEN
       CALL wann_fft4(&
            'WF1.anglmom',&
            'anglmomrs.1',.FALSE.,&
            rvecnum,rvec,kpoints,&
            input%jspins,fullnkpts,wann%l_bzsym,input%film,oneD%odi%d1,&
305
            noco%l_soc,wann%band_min,wann%band_max,input%neig,&
306 307 308 309 310 311 312 313
            .FALSE.,wann%wan90version)
    ENDIF

#ifdef CPP_TOPO
    IF(wann%l_offdiposoprs.AND.mpi%irank==0)THEN
       CALL wann_offdiposop_rs(&
            rvecnum,rvec,kpoints,&
            input%jspins,fullnkpts,wann%l_bzsym,input%film,oneD%odi%d1,&
314
            noco%l_soc,wann%band_min,wann%band_max,input%neig,&
315 316 317 318 319 320 321
            .FALSE.)
    ENDIF

    IF(wann%l_spindisprs.AND.mpi%irank==0)THEN
       CALL wann_fft5(&
            rvecnum,rvec,kpoints,&
            input%jspins,fullnkpts,wann%l_bzsym,input%film,oneD%odi%d1,&
322
            noco%l_soc,wann%band_min,wann%band_max,input%neig,&
323 324 325 326 327 328 329 330
            .FALSE.)
    ENDIF

    IF(wann%l_perturbrs.AND.mpi%irank==0)THEN
       CALL wann_fft3(&
            'WF1.perturb'  ,'perturbrs.1'  ,.FALSE.,&
            rvecnum,rvec,kpoints,&
            input%jspins,fullnkpts,wann%l_bzsym,input%film,oneD%odi%d1,&
331
            noco%l_soc,wann%band_min,wann%band_max,input%neig,&
332 333 334 335 336 337 338 339 340
            .FALSE.)
    ENDIF

    IF(wann%l_socspicomrs.AND.mpi%irank==0)THEN
       IF(noco%l_soc)THEN
          CALL wann_fft4(&
               'WF1.socspicom','socspicomrs.1',.TRUE.,&
               rvecnum,rvec,kpoints,&
               input%jspins,fullnkpts,wann%l_bzsym,input%film,oneD%odi%d1,&
341
               noco%l_soc,wann%band_min,wann%band_max,input%neig,&
342 343 344 345 346
               .FALSE.)
       ELSE
          CALL wann_fft6(&
               rvecnum,rvec,kpoints,&
               input%jspins,fullnkpts,wann%l_bzsym,input%film,oneD%odi%d1,&
347
               noco%l_soc,wann%band_min,wann%band_max,input%neig,&
348 349 350 351 352 353 354 355 356 357 358
               .FALSE.)
       ENDIF
    ENDIF



    IF(wann%l_torquers.AND.mpi%irank==0) THEN
       CALL wann_torque_rs(&
            atoms%ntype,atoms%neq,rvecnum,rvec,kpoints,&
            input%jspins,fullnkpts,wann%l_bzsym,input%film,oneD%odi%d1,&
            noco%l_soc,wann%band_min,wann%band_max,&
359
            input%neig,.FALSE.)
360 361 362 363 364 365 366
    ENDIF
#endif
    IF (wann%l_nablapaulirs.AND.mpi%irank==0)THEN
       CALL wann_nabla_pauli_rs(&
            rvecnum,rvec,kpoints,&
            input%jspins,fullnkpts,wann%l_bzsym,input%film,oneD%odi%d1,&
            noco%l_soc,wann%band_min,wann%band_max,&
367
            input%neig,.FALSE.,wann%wan90version)
368 369 370 371 372 373 374
    ENDIF

    IF (wann%l_pauli.AND.mpi%irank==0)THEN
       CALL wann_pauli_rs(&
            rvecnum,rvec,kpoints,&
            input%jspins,fullnkpts,wann%l_bzsym,input%film,oneD%odi%d1,&
            l_nocosoc,wann%band_min,wann%band_max,&
375
            input%neig,.FALSE.,wann%l_ndegen,ndegen,&
376 377 378 379 380 381 382 383
            wann%wan90version,wann%l_unformatted)
    ENDIF

    IF (wann%l_perpmagrs.AND.mpi%irank==0)THEN
       CALL wann_perpmag_rs(&
            rvecnum,rvec,kpoints,&
            input%jspins,fullnkpts,wann%l_bzsym,input%film,oneD%odi%d1,&
            noco%l_soc,wann%band_min,wann%band_max,&
384
            input%neig,.FALSE.,wann%l_ndegen,ndegen,wann%wan90version,&
385 386 387 388 389 390 391 392
            wann%l_unformatted)
    ENDIF

    IF (wann%l_socmatrs.AND.mpi%irank==0)THEN
       CALL wann_socmat_rs(&
            rvecnum,rvec,kpoints,&
            input%jspins,fullnkpts,wann%l_bzsym,input%film,oneD%odi%d1,&
            noco%l_soc,wann%band_min,wann%band_max,&
393
            input%neig,.FALSE.,wann%wan90version)
394 395
    ENDIF

Frank Freimuth's avatar
Frank Freimuth committed
396 397 398 399 400 401 402 403 404 405
      if (wann%l_socmatvecrs.and.mpi%irank==0)then
         call wann_socmatvec_rs( &
            rvecnum,rvec,kpoints, &
            input%jspins,fullnkpts,wann%l_bzsym,input%film,oneD%odi%d1, &
            noco%l_soc,wann%band_min,wann%band_max, &
            input%neig,.false.,wann%l_ndegen,ndegen,&
            wann%wan90version,wann%l_unformatted)
      endif


406 407
    IF(wann%l_plot_umdat)THEN
       CALL wann_plot_um_dat(&
Frank Freimuth's avatar
Frank Freimuth committed
408
            kpts,stars,vacuum,atoms,sphhar,input,sym,mpi,&
Frank Freimuth's avatar
Frank Freimuth committed
409
            oneD,noco,nococonv,cell,vTot,enpara,eig_id,l_real,&
410 411
            mpi%mpi_comm,i,wann%band_min,wann%band_max,noco%l_soc,&
            atoms%l_dulo,noco%l_noco,noco%l_ss,atoms%lmaxd,atoms%ntype,&
Frank Freimuth's avatar
Frank Freimuth committed
412
            input%neig,atoms%nat,sym%nop,lapw%dim_nvd(),input%jspins,atoms%llod,atoms%nlod,atoms%ntype,&
413
            cell%omtil,atoms%nlo,atoms%llo,atoms%lapw_l,sym%invtab,sym%mrot,sym%ngopr,atoms%neq,atoms%lmax,&
414 415
            sym%invsat,sym%invsatnr,kpts%nkpt,atoms%taual,atoms%rmt,cell%amat,cell%bmat,cell%bbmat,nococonv%alph,&
            nococonv%beta,nococonv%qss,stars%sk2,stars%phi2,oneD%odi,oneD%ods,mpi%irank,mpi%isize,stars%ng3,vacuum%nmzxyd,vacuum%nmzd,&
416
            SIZE(atoms%rmsh,1),sphhar%nlhd,stars%ng3,vacuum%nvac,sym%invs,sym%invs2,input%film,sphhar%nlh,atoms%jri,sphhar%ntypsd,&
417
            sym%ntypsy,input%jspins,kpts%nkpt,atoms%dx,stars%ng2,atoms%rmsh,sliceplot%e1s,sliceplot%e2s,atoms%ulo_der,&
418
            stars%ustep,stars%ig,stars%mx1,stars%mx2,stars%mx3,stars%rgphs,sliceplot%slice,sliceplot%kk,sliceplot%nnne,&
419
            cell%z1,lapw%dim_nv2d(),vacuum%nmzxy,vacuum%nmz,vacuum%delz,stars%ig2,cell%area,sym%tau,atoms%zatom,stars%ng2,sym%nop2,&
420 421 422 423 424 425 426 427 428
            cell%volint,sym%symor,atoms%pos,ef,wann%l_bzsym,wann%l_proj_plot,&
            wann%wan90version)
    ENDIF


    CALL CPU_TIME(delta2)
    IF(wann%l_lapw.AND.mpi%irank==0)THEN
       CALL wannier_to_lapw(&
            mpi%mpi_comm,eig_id,l_real,&
429
            input,lapw,oneD,noco,nococonv,sym,cell,atoms,stars,vacuum,sphhar,&
430 431 432
            vTot,&
            noco%l_soc,wann%unigrid,i,wann%band_min,wann%band_max,&
            atoms%l_dulo,noco%l_noco,noco%l_ss,atoms%lmaxd,atoms%ntype,&
433
            input%neig,atoms%nat,sym%nop,lapw%dim_nvd(),input%jspins,lapw%dim_nbasfcn(),atoms%llod,atoms%nlod,atoms%ntype,&
434
            cell%omtil,atoms%nlo,atoms%llo,atoms%lapw_l,sym%invtab,sym%mrot,sym%ngopr,atoms%neq,atoms%lmax,&
435 436
            sym%invsat,sym%invsatnr,kpts%nkpt,atoms%taual,atoms%rmt,cell%amat,cell%bmat,cell%bbmat,nococonv%alph,&
            nococonv%beta,nococonv%qss,stars%sk2,stars%phi2,oneD%odi,oneD%ods,mpi%irank,mpi%isize,stars%ng3,vacuum%nmzxyd,vacuum%nmzd,&
437
            SIZE(atoms%rmsh,1),sphhar%nlhd,stars%ng3,vacuum%nvac,sym%invs,sym%invs2,input%film,sphhar%nlh,atoms%jri,sphhar%ntypsd,&
438
            sym%ntypsy,input%jspins,kpts%nkpt,atoms%dx,stars%ng2,atoms%rmsh,sliceplot%e1s,sliceplot%e2s,atoms%ulo_der,&
439
            stars%ustep,stars%ig,stars%mx1,stars%mx2,stars%mx3,stars%rgphs,sliceplot%slice,sliceplot%kk,sliceplot%nnne,&
440
            cell%z1,lapw%dim_nv2d(),vacuum%nmzxy,vacuum%nmz,vacuum%delz,stars%ig2,cell%area,sym%tau,atoms%zatom,stars%ng2,sym%nop2,&
441 442 443 444 445 446 447 448 449
            cell%volint,sym%symor,atoms%pos,ef,wann%l_bzsym,wann%l_proj_plot,&
            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,&
            atoms%l_dulo,noco%l_noco,noco%l_ss,atoms%lmaxd,atoms%ntype,&
450
            input%neig,atoms%nat,sym%nop,lapw%dim_nvd(),input%jspins,lapw%dim_nbasfcn(),atoms%llod,atoms%nlod,atoms%ntype,&
451
            nwdd,cell%omtil,atoms%nlo,atoms%llo,atoms%lapw_l,sym%invtab,sym%mrot,sym%ngopr,atoms%neq,atoms%lmax,&
452 453
            sym%invsat,sym%invsatnr,kpts%nkpt,atoms%taual,atoms%rmt,cell%amat,cell%bmat,cell%bbmat,nococonv%alph,&
            nococonv%beta,nococonv%qss,stars%sk2,stars%phi2,oneD%odi,oneD%ods,mpi%irank,mpi%isize,stars%ng3,vacuum%nmzxyd,vacuum%nmzd,&
454
            SIZE(atoms%rmsh,1),sphhar%nlhd,stars%ng3,vacuum%nvac,sym%invs,sym%invs2,input%film,sphhar%nlh,atoms%jri,sphhar%ntypsd,&
455
            sym%ntypsy,input%jspins,kpts%nkpt,atoms%dx,stars%ng2,atoms%rmsh,sliceplot%e1s,sliceplot%e2s,atoms%ulo_der,&
456
            stars%ustep,stars%ig,stars%mx1,stars%mx2,stars%mx3,stars%rgphs,sliceplot%slice,sliceplot%kk,sliceplot%nnne,&
457
            cell%z1,lapw%dim_nv2d(),vacuum%nmzxy,vacuum%nmz,vacuum%delz,stars%ig2,cell%area,sym%tau,atoms%zatom,stars%ng2,sym%nop2,&
458 459 460 461 462 463 464 465 466 467 468
            cell%volint,sym%symor,atoms%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,&
            atoms%l_dulo,noco%l_noco,noco%l_ss,atoms%lmaxd,atoms%ntype,&
469
            input%neig,atoms%nat,sym%nop,lapw%dim_nvd(),input%jspins,lapw%dim_nbasfcn(),atoms%llod,atoms%nlod,atoms%ntype,&
470
            nwdd,cell%omtil,atoms%nlo,atoms%llo,atoms%lapw_l,sym%invtab,sym%mrot,sym%ngopr,atoms%neq,atoms%lmax,&
471 472
            sym%invsat,sym%invsatnr,kpts%nkpt,atoms%taual,atoms%rmt,cell%amat,cell%bmat,cell%bbmat,nococonv%alph,&
            nococonv%beta,nococonv%qss,stars%sk2,stars%phi2,oneD%odi,oneD%ods,mpi%irank,mpi%isize,stars%ng3,vacuum%nmzxyd,vacuum%nmzd,&
473
            SIZE(atoms%rmsh,1),sphhar%nlhd,stars%ng3,vacuum%nvac,sym%invs,sym%invs2,input%film,sphhar%nlh,atoms%jri,sphhar%ntypsd,&
474
            sym%ntypsy,input%jspins,kpts%nkpt,atoms%dx,stars%ng2,atoms%rmsh,sliceplot%e1s,sliceplot%e2s,atoms%ulo_der,&
475
            stars%ustep,stars%ig,stars%mx1,stars%mx2,stars%mx3,stars%rgphs,sliceplot%slice,sliceplot%kk,sliceplot%nnne,&
476
            cell%z1,lapw%dim_nv2d(),vacuum%nmzxy,vacuum%nmz,vacuum%delz,stars%ig2,cell%area,sym%tau,atoms%zatom,stars%ng2,sym%nop2,&
477 478 479 480 481 482 483 484 485 486 487 488 489 490 491
            cell%volint,sym%symor,atoms%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.mpi%irank==0)THEN
       CALL juDFT_error("not yet tested in this release",calledby&
            ="wann_postproc")
       !         call wann_plot_from_lapw(
492
       !     >     lapw%dim_nv2d(),input%jspins,oneD%odi,oneD%ods,stars%ng3,vacuum%nmzxyd,stars%ng2,
493 494 495
       !     >     sphhar%ntypsd,
       !     >     atoms%ntype,atoms%lmaxd,size(atoms%rmsh,1),atoms%nat,vacuum%nmzd,atoms%neq,stars%ng3,vacuum%nvac,
       !     >     vacuum%nmz,vacuum%nmzxy,stars%ng2,sym%nop,sym%nop2,cell%volint,input%film,sliceplot%slice,sym%symor,
496
       !     >     sym%invs,sym%invs2,cell%z1,vacuum%delz,sym%ngopr,sym%ntypsy,atoms%jri,atoms%pos,atoms%zatom,
497 498 499 500 501 502
       !     >     atoms%lmax,sym%mrot,sym%tau,atoms%rmsh,sym%invtab,cell%amat,cell%bmat,cell%bbmat,sliceplot%nnne,sliceplot%kk,
       !     >     atoms%nlod,atoms%llod,lmd,cell%omtil,atoms%nlo,atoms%llo)
    ENDIF
    CALL CPU_TIME(delta3)
    time_lapw_plot=delta3-delta2

503 504
    WRITE(oUnit,*)"time_lapw_expand=",time_lapw_expand
    WRITE(oUnit,*)"time_lapw_plot=",time_lapw_plot
505 506 507

    IF(wann%l_finishnocoplot.AND.mpi%irank==0) THEN
       !         write(*,*)'doing the UNK mixing'
508 509
       !         write(*,*)'nococonv%alph',nococonv%alph
       !         write(*,*)'nococonv%beta',nococonv%beta
510
       !         nkqpts=fullnkpts
511
       !         if(l_sgwf) nkqpts=fullnkpts*fullnqpts
512 513 514
       CALL wann_nocoplot(atoms,sliceplot%slice,sliceplot%nnne,&!nslibd&
            cell%amat,cell%bmat,fullnkpts,oneD%odi,input%film,&
            atoms%nat,atoms%ntype,SIZE(atoms%rmsh,1),atoms%ntype,atoms%neq,atoms%pos,&
515
            atoms%jri,atoms%rmsh,nococonv%alph,nococonv%beta,fullnqpts,nococonv%qss,&
516 517 518 519 520
            cell%z1,atoms%zatom)
    ENDIF

  END SUBROUTINE wann_postproc
END MODULE m_wann_postproc