LCOV - code coverage report
Current view: top level - wannier - wann_wan90prep.F (source / functions) Hit Total Coverage
Test: combined.info Lines: 0 257 0.0 %
Date: 2019-09-08 04:53:50 Functions: 0 2 0.0 %

          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_wan90prep
       8             :       use m_juDFT
       9             :       USE m_types
      10             : c**********************************************************
      11             : c         prepares WF//spin12(jspin)//.win for 
      12             : c         input to wannier90 and creates bkpts file
      13             : c                FF, September 2006
      14             : c**********************************************************
      15             :       CONTAINS
      16           0 :       SUBROUTINE wann_wan90prep(input,kpts,
      17           0 :      >      jspins,amat,bmat,natd,taual_inp,zatom,ntype,
      18           0 :      >      ntypd,neq,l_bzsym,film,l_onedimens,l_ms,l_sgwf,l_socgwf,
      19             :      >      aux_latt_const,param_file,l_dim,wan90version)
      20             : 
      21             :       USE m_wann_postproc_setup
      22             :       USE m_wann_postproc_setup2
      23             :       USE m_wann_postproc_setup4
      24             :       USE m_wann_postproc_setup5
      25             :       use m_wann_get_mp
      26             :       use m_wann_get_kpts
      27             :       use m_wann_get_qpts
      28             :       use m_wann_gwf_tools, only : get_index_kq,get_dimension,get_shift
      29             :       use m_wann_gwf_auxbrav
      30             : 
      31             :       IMPLICIT NONE
      32             : 
      33             : 
      34             :       TYPE(t_input), INTENT(IN) :: input
      35             :       TYPE(t_kpts), INTENT(IN)  :: kpts
      36             :       integer,intent(in)  :: jspins
      37             :       integer,intent(in)  :: ntype
      38             :       integer,intent(in)  :: ntypd
      39             :       logical,intent(in)  :: l_bzsym
      40             :       logical,intent(in)  :: film
      41             :       real,intent(in)     :: amat(3,3),aux_latt_const
      42             :       real,intent(in)     :: bmat(3,3)
      43             :       integer,intent(in)  :: natd
      44             :       real,intent(in)     :: taual_inp(3,natd)
      45             :       real,intent(in)     :: zatom(ntype)
      46             :       integer,intent(in)  :: neq(ntypd)
      47             :       logical,intent(in)  :: l_onedimens
      48             :       integer,intent(in)  :: wan90version
      49             : 
      50             : 
      51             :       character(len=20),intent(in) :: param_file
      52             : 
      53             :       real             :: scale,scale_q
      54           0 :       real             :: taual(3,natd)
      55             :       real             :: amat_ang(3,3)
      56             :       real             :: bmat_ang(3,3)
      57             :       integer          :: at,j,n,bb
      58             :       integer          :: nkpts,iter,len,num_wann,num_bands,nn,i
      59             :       integer          :: num(3),dim,jspin,num_iter,nntot
      60             :       real             :: weight,maxi,mini,increm,compare
      61           0 :       real,allocatable :: kpoints(:,:)
      62             :       logical          :: l_file
      63             :       character(len=1) :: spin12(2)
      64             :       data spin12/'1','2'/
      65             :       integer          :: nkptd,ikpt_help,ikpt,iqpt
      66             :       character*2      :: namat(0:103)
      67             :       real,parameter   :: bohr=0.5291772108
      68             :       character(len=2) :: spin012(0:2)
      69             :       data spin012/'  ', '.1', '.2'/
      70             :       character(len=6) :: filename
      71             : 
      72             : 
      73           0 :       real,allocatable :: qpoints(:,:)
      74             :       real             :: amat_ang_q(3,3),bmat_ang_q(3,3)
      75             :       real             :: amat_q(3,3),bmat_q(3,3)
      76           0 :       real             :: taual_q(3,natd)
      77             :       integer          :: nqpts=1,nqptd=1
      78             :       integer          :: numq(3)
      79             :       logical, intent(in) :: l_ms,l_sgwf,l_socgwf
      80             :       logical, intent(in) :: l_dim(3)
      81             :       character(len=20) :: win_filename
      82             : 
      83           0 :       real,allocatable :: kqpoints(:,:)
      84             :       integer          :: nkqpts,ikqpt
      85           0 :       integer,allocatable :: numkq(:)
      86           0 :       real,allocatable :: amat_kq(:,:),bmat_kq(:,:)
      87           0 :       real,allocatable :: taual_kq(:,:)
      88             :       real             :: tpi,dummy_omtil
      89             :       integer :: arr_len,shift(3)
      90             : 
      91             :       DATA namat/'va',' h','he','li','be',' b',' c',' n',' o',' f','ne',
      92             :      +     'na','mg','al','si',' p',' s','cl','ar',' k','ca','sc','ti',
      93             :      +     ' v','cr','mn','fe','co','ni','cu','zn','ga','ge','as','se',
      94             :      +     'br','kr','rb','sr',' y','zr','nb','mo','tc','ru','rh','pd',
      95             :      +     'ag','cd','in','sn','sb','te',' j','xe','cs','ba','la','ce',
      96             :      +     'pr','nd','pm','sm','eu','gd','tb','dy','ho','er','tm','yb',
      97             :      +     'lu','hf','ta',' w','re','os','ir','pt','au','hg','tl','pb',
      98             :      +     'bi','po','at','rn','fr','ra','ac','th','pa',' u','np','pu',
      99             :      +     'am','cm','bk','cf','es','fm','md','no','lw'/
     100           0 :       num_iter=100
     101             : 
     102           0 :       call get_dimension(l_dim,arr_len)
     103           0 :       call get_shift(l_dim,shift)
     104             : 
     105             : c**********************************************************
     106             : c     Read in kpoints from kpts/w90kpts file.
     107             : c**********************************************************
     108             :       call wann_get_kpts(input,kpts,
     109             :      >         l_bzsym,film,l_onedimens,.false.,
     110           0 :      <         nkpts,kpoints)
     111           0 :       allocate(kpoints(3,nkpts))
     112             :       call wann_get_kpts(input,kpts,
     113             :      >         l_bzsym,film,l_onedimens,.true.,
     114           0 :      <         nkpts,kpoints)
     115             : 
     116             : 
     117             : c**********************************************************
     118             : c     Read in qpoints from qpts file.
     119             : c**********************************************************
     120           0 :       IF(l_sgwf.or.l_socgwf)THEN
     121             :       call wann_get_qpts(
     122             : !     >         l_bzsym,film,l_onedimens,.false.,
     123             :      >         .false.,.false.,.false.,.false.,
     124           0 :      <         nqpts,qpoints,param_file)
     125           0 :       allocate(qpoints(3,nqpts))
     126             :       call wann_get_qpts(
     127             : !     >         l_bzsym,film,l_onedimens,.true.,
     128             :      >         .false.,.false.,.false.,.true.,
     129           0 :      <         nqpts,qpoints,param_file)
     130             :       ELSE
     131           0 :          allocate(qpoints(3,1))
     132           0 :          qpoints=0.
     133             :       ENDIF
     134             : c*********************************************************
     135             : c     Find out the structure of k-point set.
     136             : c*********************************************************
     137             :       call wann_get_mp(
     138             :      >         nkpts,kpoints,
     139           0 :      <         num)
     140             : 
     141             : 
     142           0 :       taual=taual_inp
     143           0 :       if(film.and.l_onedimens)then
     144           0 :          do n=1,natd
     145           0 :            taual(1,n)=taual_inp(1,n)+0.5
     146           0 :            taual(2,n)=taual_inp(2,n)+0.5
     147             :          enddo
     148           0 :       elseif(film)then
     149           0 :          do n=1,natd
     150           0 :            taual(3,n)=taual_inp(3,n)+0.5
     151             :          enddo
     152             :       endif
     153             : 
     154             : c*********************************************************
     155             : c     Find out the structure of q-point set.              
     156             : c*********************************************************
     157           0 :       IF(l_sgwf.or.l_socgwf)THEN
     158             :       call wann_get_mp(
     159             :      >         nqpts,qpoints,
     160           0 :      <         numq)
     161             :       ELSE
     162           0 :          numq=1
     163             :       ENDIF
     164             : 
     165             : c*******************************************************
     166             : c     Write information to WF//spin12(jspin)//.win
     167             : c*******************************************************
     168           0 :       if(l_ms) nqptd = nqpts
     169             :          
     170           0 :       do jspin=1,jspins
     171             : c        proj file provides num_wann and num_bands
     172           0 :          l_file=.false.
     173           0 :          do j=jspin,0,-1
     174           0 :            inquire(file=trim('proj'//spin012(j)),exist=l_file)
     175           0 :            if(l_file)then
     176           0 :              filename='proj'//spin012(j)
     177           0 :              exit
     178             :            endif
     179             :          enddo
     180           0 :          if(l_file)then
     181           0 :             open(712,file=trim(filename),form='formatted',status='old')
     182           0 :             rewind(712)
     183             :          else
     184             :             CALL juDFT_error("no proj/proj.1/proj.2",calledby
     185           0 :      +           ="wann_wan90prep")
     186             :          endif
     187           0 :          read(712,*)num_wann,num_bands
     188           0 :          close(712)
     189             : 
     190           0 :          do iqpt=1,nqptd
     191           0 :             win_filename = 'WF'//spin12(jspin)      
     192           0 :             if(l_ms) then
     193           0 :               write(win_filename,'("WF",a1,"_",i4.4)')spin12(jspin),iqpt
     194             :             endif
     195             : 
     196             :             call wann_write_win(win_filename,film,num_wann,num_bands,
     197             :      >               num_iter,jspin,ntype,ntypd,natd,nkpts,neq,num,amat,
     198           0 :      >               kpoints,zatom,taual,namat,3)
     199             :          enddo
     200             :             
     201             :       enddo!jspin
     202             : 
     203             :       amat_ang=amat*bohr
     204             :       bmat_ang=bmat/bohr
     205             : 
     206             : c******************************************************
     207             : c     call wannier90 routines to get bkpts
     208             : c******************************************************
     209             : #ifdef CPP_WANN
     210             :       IF(wan90version.le.2)then !wanversion 1.1 and 1.2
     211             :         call wann_postproc_setup(
     212             :      >         natd,nkpts,kpoints,amat_ang,bmat_ang,
     213             :      >         num,num_bands,ntype,neq,
     214             :      >         zatom,taual,namat,win_filename,'bkpts')
     215             :           else !wanversion 2.0
     216             :         call wann_postproc_setup2(
     217             :      >         natd,nkpts,kpoints,amat_ang,bmat_ang,
     218             :      >         num,num_bands,ntype,neq,
     219             :      >         zatom,taual,namat,win_filename,'bkpts')
     220             :           endif
     221             : #else
     222           0 :       WRITE(*,*) 'The code is supposed to perform the Wannier setup'
     223           0 :       WRITE(*,*) 'but the Wannier90 library is not linked.'
     224             :       CALL juDFT_error("Wannier setup without Wannier90 library (1)",
     225           0 :      +                 calledby ="wann_wan90prep")
     226             : #endif
     227             : c******************************************************
     228             : c     call wannier90 routines to get bqpts
     229             : c******************************************************
     230           0 :       if(.not.(l_sgwf.or.l_socgwf)) goto 8765
     231             : 
     232             :       call wann_gwf_auxbrav(aux_latt_const,l_sgwf,l_socgwf,
     233           0 :      >                      amat_q,bmat_q,l_dim)
     234             :       amat_ang_q = amat_q*bohr
     235             :       bmat_ang_q = bmat_q/bohr
     236             : 
     237           0 :       if(l_sgwf.or.l_socgwf) then
     238           0 :          qpoints = qpoints/2.0
     239             :       endif
     240             : 
     241           0 :       taual_q=0.5
     242           0 :       if(l_dim(1))taual_q(1,:)=0.0
     243           0 :       if(l_dim(2))taual_q(2,:)=0.0
     244           0 :       if(l_dim(3))taual_q(3,:)=0.0
     245             : 
     246             :       call wann_write_win('WF1_q',film,num_wann,num_bands,
     247             :      >      num_iter,1,ntype,ntypd,natd,nqpts,neq,numq,amat_q,
     248           0 :      >      qpoints,zatom,taual_q,namat,3)
     249             : 
     250             : #ifdef CPP_WANN
     251             :       if(wan90version.le.2)then !wanversion 1.1 and 1.2
     252             :         call wann_postproc_setup(
     253             :      >         natd,nqpts,qpoints,amat_ang_q,bmat_ang_q,
     254             :      >         numq,num_bands,ntype,neq,
     255             :      >         zatom,taual_q,namat,'WF1_q','bqpts')
     256             :           else !wanversion 2.0
     257             :         call wann_postproc_setup2(
     258             :      >         natd,nqpts,qpoints,amat_ang_q,bmat_ang_q,
     259             :      >         numq,num_bands,ntype,neq,
     260             :      >         zatom,taual_q,namat,'WF1_q','bqpts')
     261             :           endif
     262             : #else
     263           0 :       WRITE(*,*) 'The code is supposed to perform the Wannier setup'
     264           0 :       WRITE(*,*) 'but the Wannier90 library is not linked.'
     265             :       CALL juDFT_error("Wannier setup without Wannier90 library (2)",
     266           0 :      +                 calledby ="wann_wan90prep")
     267             : #endif
     268             : 
     269             :       !bkqpts part below
     270           0 :       nkqpts = nqpts*nkpts
     271           0 :       allocate(kqpoints(arr_len,nkqpts))
     272           0 :       kqpoints = 0.
     273           0 :       do iqpt=1,nqpts
     274           0 :          do ikpt=1,nkpts 
     275           0 :             ikqpt = get_index_kq(ikpt,iqpt,nkpts)
     276           0 :             kqpoints(1,ikqpt) = kpoints(1,ikpt)
     277           0 :             kqpoints(2,ikqpt) = kpoints(2,ikpt)
     278           0 :             kqpoints(3,ikqpt) = kpoints(3,ikpt)
     279           0 :             if(l_dim(1)) kqpoints(4+shift(1),ikqpt)=qpoints(1,iqpt)
     280           0 :             if(l_dim(2)) kqpoints(4+shift(2),ikqpt)=qpoints(2,iqpt)
     281           0 :             if(l_dim(3)) kqpoints(4+shift(3),ikqpt)=qpoints(3,iqpt)
     282             :          enddo
     283             :       enddo
     284             : 
     285           0 :       allocate(numkq(arr_len))
     286           0 :       allocate(taual_kq(arr_len,natd))
     287           0 :       allocate(amat_kq(arr_len,arr_len))
     288           0 :       allocate(bmat_kq(arr_len,arr_len))
     289             : 
     290           0 :       numkq(1)=num(1); numkq(2)=num(2); numkq(3)=num(3)
     291           0 :       if(l_dim(1))numkq(4+shift(1))=numq(1)
     292           0 :       if(l_dim(2))numkq(4+shift(2))=numq(2)
     293           0 :       if(l_dim(3))numkq(4+shift(3))=numq(3)
     294             : 
     295           0 :       taual_kq(1,:) = taual(1,:); taual_kq(2,:) = taual(2,:)
     296           0 :       taual_kq(3,:) = taual(3,:); taual_kq(4:arr_len,:) = 0.0!0.0
     297             : 
     298             :       ! set up amat_kq
     299           0 :       amat_kq = 0.0
     300           0 :       bmat_kq = 0.0
     301           0 :       amat_kq(1:3,1:3) = amat(1:3,1:3)
     302           0 :       bmat_kq(1:3,1:3) = bmat(1:3,1:3)
     303           0 :       if(l_dim(1)) amat_kq(4+shift(1),4+shift(1)) = amat_q(1,1)
     304           0 :       if(l_dim(1)) bmat_kq(4+shift(1),4+shift(1)) = bmat_q(1,1)
     305           0 :       if(l_dim(2)) amat_kq(4+shift(2),4+shift(2)) = amat_q(2,2)
     306           0 :       if(l_dim(2)) bmat_kq(4+shift(2),4+shift(2)) = bmat_q(2,2)
     307           0 :       if(l_dim(3)) amat_kq(4+shift(3),4+shift(3)) = amat_q(3,3)
     308           0 :       if(l_dim(3)) bmat_kq(4+shift(3),4+shift(3)) = bmat_q(3,3)
     309             : 
     310             :       call wann_write_win('WF1_gwf',film,num_wann,num_bands,
     311             :      >      0,1,ntype,ntypd,natd,nkqpts,neq,numkq,amat_kq,
     312           0 :      >      kqpoints,zatom,taual_kq,namat,arr_len)
     313             : 
     314             : 
     315           0 :       if(arr_len.eq.4) then
     316             : #ifdef CPP_WANN4
     317             :          call wann_postproc_setup4(
     318             :      >         natd,nkqpts,kqpoints,amat_kq*bohr,bmat_kq/bohr,
     319             :      >         numkq,num_bands,ntype,neq,
     320             :      >         zatom,taual_kq,namat,'WF1_gwf','bkqpts')
     321             : #else
     322           0 :       WRITE(*,*) 'The code is supposed to perform the Wannier-4 setup'
     323           0 :       WRITE(*,*) 'but the modified Wannier90-4 library is not linked.'
     324             :       CALL juDFT_error("Wannier-4 setup without Wannier90-4 library",
     325           0 :      +                 calledby ="wann_wan90prep")
     326             : #endif
     327           0 :       elseif(arr_len.eq.5) then
     328             : #ifdef CPP_WANN5
     329             :          call wann_postproc_setup5(
     330             :      >         natd,nkqpts,kqpoints,amat_kq*bohr,bmat_kq/bohr,
     331             :      >         numkq,num_bands,ntype,neq,
     332             :      >         zatom,taual_kq,namat,'WF1_gwf','bkqpts')
     333             : #else
     334           0 :       WRITE(*,*) 'The code is supposed to perform the Wannier-5 setup'
     335           0 :       WRITE(*,*) 'but the modified Wannier90-5 library is not linked.'
     336             :       CALL juDFT_error("Wannier-5 setup without Wannier90-5 library",
     337           0 :      +                 calledby ="wann_wan90prep")
     338             : #endif
     339             : !         call juDFT_error("arr_len.eq.5 not yet implemented",
     340             : !     >                  calledby='wann_wan90prep')
     341           0 :       elseif(arr_len.eq.6) then
     342             :          call juDFT_error("arr_len.eq.6 not yet implemented",
     343           0 :      >                  calledby='wann_wan90prep')
     344             :       else
     345             :          call juDFT_error("Dimension arr_len not recognized",
     346           0 :      >                  calledby='wann_wan90prep')
     347             :       endif
     348             : 
     349           0 :       deallocate(kqpoints)
     350           0 :       deallocate(amat_kq,bmat_kq,numkq,taual_kq)
     351             : 
     352             : 8765  continue
     353             : 
     354           0 :       deallocate(kpoints)
     355           0 :       deallocate(qpoints)
     356             : 
     357           0 :       END SUBROUTINE wann_wan90prep
     358             : 
     359             : 
     360           0 :       subroutine wann_write_win(win_filename,film,num_wann,num_bands,
     361           0 :      >               num_iter,jspin,ntype,ntypd,natd,nkpts,neq,num,amat,
     362           0 :      >               kpoints,zatom,taual,namat,rdim)
     363             :       implicit none
     364             :       character(len=*),intent(in) ::win_filename
     365             :       logical,intent(in) :: film
     366             :       integer,intent(in) :: num_wann,num_iter,num_bands
     367             :       integer,intent(in) :: rdim
     368             :       integer,intent(in) :: jspin,ntype,natd,nkpts,ntypd
     369             :       integer,intent(in) :: neq(ntypd),num(rdim)
     370             :       real,intent(in) :: amat(rdim,rdim),kpoints(rdim,nkpts)
     371             :       real,intent(in) :: zatom(ntype),taual(rdim,natd)
     372             :       character*2,intent(in) :: namat(0:103)
     373             : 
     374             :       integer :: dim,nn,iter,at,i,search_shells
     375             :       logical :: l_exist
     376             : 
     377           0 :          open(911,file=trim(win_filename)//'.win')
     378           0 :          write(911,*)"length_unit=Bohr"
     379           0 :          write(911,*)"num_wann=",num_wann
     380           0 :          write(911,*)"num_iter=",num_iter
     381           0 :          write(911,*)"num_bands=",num_bands
     382           0 :          write(911,*)"          "
     383             : 
     384           0 :          if(rdim.gt.3) then
     385           0 :             search_shells=200
     386           0 :             inquire(file='searchshells_inp',exist=l_exist)
     387           0 :             if(l_exist) then
     388           0 :              open(777,file='searchshells_inp')
     389           0 :              read(777,*)search_shells
     390           0 :              close(777)
     391           0 :              write(*,*)'search_shells=',search_shells
     392             :             endif
     393           0 :             inquire(file=trim(win_filename)//'.kshell',exist=l_exist)
     394           0 :             if(l_exist) then
     395           0 :              write(*,*)'found .kshell file; set devel_flag'
     396           0 :              write(911,*)'devel_flag=kmesh_degen'
     397             :             endif
     398           0 :             write(911,*)"!iprint=",5
     399           0 :             write(911,*)"search_shells=",search_shells
     400             :          else
     401           0 :             write(911,*)"search_shells=",200
     402             :          endif
     403             : 
     404           0 :          write(911,*)"!optional parameters for wannierization"
     405           0 :          write(911,*)"!num_cg_steps="
     406           0 :          write(911,*)"!trial_step="
     407           0 :          write(911,*)"!fixed_step="
     408           0 :          write(911,*)"!restart=wannierise"
     409           0 :          write(911,*)"         "
     410             : 
     411           0 :          if(num_bands.ne.num_wann)then
     412           0 :             write(911,*)"! optional parameters for disentangling"
     413           0 :             write(911,*)"!dis_win_min="
     414           0 :             write(911,*)"!dis_win_max="
     415           0 :             write(911,*)"!dis_froz_min="
     416           0 :             write(911,*)"!dis_froz_max="
     417           0 :             write(911,*)"dis_num_iter=10000"
     418           0 :             write(911,*)"!dis_mix_ratio="
     419           0 :             write(911,*)"!dis_conv_tol="
     420           0 :             write(911,*)"!dis_conv_window="
     421           0 :             write(911,*)"            "
     422             :          endif
     423             : 
     424           0 :          write(911,*)"! optional parameters for plotting"
     425           0 :          if(jspin.eq.1)then
     426           0 :             write(911,*)"spin=up"
     427             :          else   
     428           0 :             write(911,*)"spin=down"
     429             :          endif   
     430           0 :          write(911,*)"!restart=plot"
     431           0 :          write(911,*)"!wannier_plot=true"
     432           0 :          write(911,*)"!wannier_plot_supercell=3"
     433           0 :          write(911,*)"!bands_plot=true"
     434             : 
     435             : 
     436           0 :          write(911,*)"!fermi_surface_plot=true"
     437           0 :          write(911,*)"            "
     438             : 
     439           0 :          write(911,*)"!options for Hamiltonian in Wannier basis"
     440           0 :          write(911,*)"!HR_PLOT=true"
     441           0 :          write(911,*)"!DIST_CUTOFF=3.0"
     442           0 :          write(911,*)"           "
     443             : 
     444           0 :          write(911,*)"!some more options"
     445           0 :          write(911,*)"!WRITE_R2MN=true"
     446           0 :          write(911,*)"!NUM_PRINT_CYCLES=10"
     447             : 
     448           0 :          write(911,*)"begin unit_cell_cart"
     449           0 :          write(911,*)"bohr"
     450           0 :          if(rdim.eq.3) then
     451           0 :             do dim=1,3
     452           0 :                write(911,*)amat(:,dim)
     453             :             enddo   
     454           0 :          elseif(rdim.eq.4)then
     455           0 :             do dim=1,4
     456           0 :                write(911,'(4f14.8)')amat(:,dim)
     457             :             enddo             
     458           0 :          elseif(rdim.eq.5)then
     459           0 :             do dim=1,5
     460           0 :                write(911,'(5f14.8)')amat(:,dim)
     461             :             enddo             
     462           0 :          elseif(rdim.eq.6)then
     463           0 :             do dim=1,6
     464           0 :                write(911,'(6f13.7)')amat(:,dim)
     465             :             enddo             
     466             :          endif
     467           0 :          write(911,*)"end unit_cell_cart"
     468           0 :          write(911,*)
     469             : 
     470           0 :          write(911,*)"begin atoms_frac"
     471           0 :          if(film)then
     472           0 :            write(911,*)!for reasons of plotting: shift the
     473           0 :            write(911,*)!coordinates in the 1d and 2d case
     474             :          endif
     475           0 :          nn=0
     476           0 :          do iter=1,ntype
     477           0 :             at=nint(zatom(iter))
     478           0 :             do i=1,neq(iter)
     479           0 :                nn=nn+1
     480           0 :              if(rdim.eq.3) write(911,*)namat(at),taual(:,nn)   
     481           0 :              if(rdim.eq.4) write(911,'(1x,a2,2x,4f12.6)')
     482           0 :      >                     namat(at),taual(:,nn)
     483           0 :              if(rdim.eq.5) write(911,'(1x,a2,2x,5f12.6)')
     484           0 :      >                     namat(at),taual(:,nn)
     485           0 :              if(rdim.eq.6) write(911,'(1x,a2,2x,6f12.6)')
     486           0 :      >                     namat(at),taual(:,nn)
     487             :             enddo   
     488             :          enddo   
     489           0 :          write(911,*)"end atoms_frac"
     490           0 :          write(911,*)
     491             : 
     492           0 :          if(rdim.eq.3) write(911,*)"mp_grid",(num(dim),dim=1,3)
     493           0 :          if(rdim.eq.4) write(911,'(1x,a7,2x,4(i4,1x))')
     494           0 :      >                 "mp_grid",(num(dim),dim=1,4)
     495           0 :          if(rdim.eq.5) write(911,'(1x,a7,2x,5(i4,1x))')
     496           0 :      >                 "mp_grid",(num(dim),dim=1,5)
     497           0 :          if(rdim.eq.6) write(911,'(1x,a7,2x,6(i4,1x))')
     498           0 :      >                 "mp_grid",(num(dim),dim=1,6)
     499           0 :          write(911,*)
     500             : 
     501           0 :          write(911,*)"begin kpoints"
     502           0 :          if(rdim.eq.3) then
     503           0 :             do iter=1,nkpts
     504           0 :                write(911,*)kpoints(:,iter)
     505             :             enddo
     506           0 :          elseif(rdim.eq.4)then
     507           0 :             do iter=1,nkpts
     508           0 :                write(911,'(4f19.15)')kpoints(:,iter)
     509             :             enddo
     510           0 :          elseif(rdim.eq.5)then
     511           0 :             do iter=1,nkpts
     512           0 :                write(911,'(5f15.11)')kpoints(:,iter)
     513             :             enddo
     514           0 :          elseif(rdim.eq.6)then
     515           0 :             do iter=1,nkpts
     516           0 :                write(911,'(6f13.9)')kpoints(:,iter)
     517             :             enddo
     518             :          endif
     519           0 :          write(911,*)"end kpoints"
     520           0 :          write(911,*)
     521             : 
     522           0 :          write(911,*)"!begin kpoint_path"
     523           0 :          if(rdim.eq.3) then
     524           0 :             write(911,*)"!X -0.5   0.0   0.0   G  0.0   0.0   0.0"
     525           0 :             write(911,*)"!G  0.0   0.0   0.0   X  0.5   0.0   0.0"
     526           0 :          elseif(rdim.eq.4) then
     527           0 :             write(911,*)"!X  0.0   0.0  -0.5   0.0    ",
     528           0 :      >                   "G  0.0   0.0   0.0   0.0"
     529           0 :             write(911,*)"!G  0.0   0.0   0.0   0.0    ",
     530           0 :      >                   "X  0.0   0.0   0.5   0.0"
     531           0 :          elseif(rdim.eq.5) then
     532           0 :             write(911,*)"!X  0.0  0.0 -0.5  0.0  0.0   ",
     533           0 :      >                   "G  0.0  0.0  0.0  0.0  0.0"
     534           0 :             write(911,*)"!G  0.0  0.0  0.0  0.0  0.0   ",
     535           0 :      >                   "X  0.0  0.0  0.5  0.0  0.0"
     536           0 :          elseif(rdim.eq.6) then
     537           0 :             write(911,*)"!X  0.0  0.0 -0.5  0.0  0.0  0.0   ",
     538           0 :      >                   "G  0.0  0.0  0.0  0.0  0.0  0.0"
     539           0 :             write(911,*)"!G  0.0  0.0  0.0  0.0  0.0  0.0   ",
     540           0 :      >                   "X  0.0  0.0  0.5  0.0  0.0  0.0"
     541             :          endif
     542           0 :          write(911,*)"!end kpoint_path"
     543           0 :          write(911,*)
     544             : 
     545           0 :          write(911,*)"wvfn_formatted=.true."
     546             :         
     547           0 :          close(911)
     548             : 
     549             : 
     550           0 :       end subroutine wann_write_win
     551             : 
     552             : 
     553             :       END MODULE m_wann_wan90prep

Generated by: LCOV version 1.13