LCOV - code coverage report
Current view: top level - wannier - wann_kpointgen.f (source / functions) Hit Total Coverage
Test: FLEUR test coverage Lines: 0 75 0.0 %
Date: 2024-04-26 04:44:34 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_kpointgen
       8             :       use m_juDFT
       9             :       private
      10             :       public::wann_kpointgen
      11             :       contains
      12           0 :       subroutine wann_kpointgen()
      13             : c***********************************************************
      14             : c     Generate the k-point file 'kpts' 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     use the program w90kpointgen instead.
      18             : c     Frank Freimuth, June 2007
      19             : c***********************************************************
      20             :       implicit none
      21             :       integer num,dim
      22             :       integer c1,c2,c3
      23             :       real i1,i2,i3
      24             :       logical l_shift
      25             :       integer Nx,Ny,Nz
      26             :       integer nnx,nny,nnz
      27             :       real ilen1,ilen2,ilen3
      28             :       integer limit1, limit2, limit3
      29             :       real scale,shift1,shift2,shift3
      30             : 
      31           0 :       call timestart("wann_kpointgen")
      32             :       
      33           0 :       print*,"specify dimension"
      34           0 :       read(*,*)dim
      35           0 :       print*,"symmetric to origin?"
      36           0 :       read(*,*)l_shift
      37           0 :       Nx=1;Ny=1;Nz=1
      38           0 :       if(dim==3)then
      39           0 :          print*,"Creates three dimensional k-point set."
      40           0 :       elseif(dim==2)then
      41           0 :          print*,"Create two-dimensional k-point set."
      42           0 :       elseif(dim==1)then
      43           0 :          print*,"Create one-dimensional k-point set."
      44             :       else
      45           0 :          CALL juDFT_error("unknown dimension",calledby="wann_kpointgen")
      46             :       endif
      47           0 :       print*,"Specify the number of k-point steps"
      48           0 :       print*,"for each direction."
      49           0 :       if(.not.dim==2)then
      50           0 :          print*,"Nz="
      51           0 :          read(*,*)Nz
      52             :       endif
      53           0 :       if(.not.dim==1)then
      54           0 :          print*,"Ny="
      55           0 :          read(*,*)Ny
      56           0 :          print*,"Nx="
      57           0 :          read(*,*)Nx
      58             :       endif   
      59           0 :       num=Nx*Ny*Nz
      60           0 :       print*,"Number of k-points: ",num
      61           0 :       call findkgt(Nx,nnx)
      62           0 :       call findkgt(ny,nny)
      63           0 :       call findkgt(nz,nnz)
      64           0 :       scale=nnx
      65           0 :       if(nny.ne.nnx)scale=scale*nny
      66           0 :       if(nnz.ne.nny .and. nnz.ne.nnx)
      67           0 :      &      scale=scale*nnz
      68           0 :       print*,"scale=",scale
      69           0 :       ilen1=1.0/nx; ilen2=1.0/ny; ilen3=1.0/nz
      70           0 :       limit1=nx-1; limit2=ny-1; limit3=nz-1   
      71           0 :       if(l_shift)then
      72           0 :          shift1=limit1*ilen1/2.0
      73           0 :          shift2=limit2*ilen2/2.0
      74           0 :          shift3=limit3*ilen3/2.0
      75             :       endif
      76           0 :       open(100,file='kpts',form='formatted',status='unknown')
      77           0 :       if(dim.ne.2)then !not the film-format of kpts
      78           0 :        write(100,'(i5,f20.10)')num,scale
      79           0 :        do c1=0,limit1
      80           0 :          do c2=0,limit2
      81           0 :             do c3=0,limit3
      82           0 :                i1=(ilen1*c1-shift1)*scale
      83           0 :                i2=(ilen2*c2-shift2)*scale
      84           0 :                i3=(ilen3*c3-shift3)*scale
      85           0 :                write(100,'(4f10.5)')i1,i2,i3,1.0
      86             :             enddo
      87             :          enddo
      88             :        enddo
      89             :       else !film-format
      90           0 :          write(100,'(i5,f20.10,3x,l1)')num,scale,.false.
      91           0 :          do c1=0,limit1
      92           0 :            do c2=0,limit2
      93           0 :                i1=(ilen1*c1-shift1)*scale
      94           0 :                i2=(ilen2*c2-shift2)*scale
      95           0 :                i3=(ilen3*c3-shift3)*scale
      96           0 :                write(100,'(3f10.5)')i1,i2,1.0
      97             :            enddo
      98             :          enddo
      99             :       endif
     100           0 :       close(100)
     101             : 
     102           0 :       call timestop("wann_kpointgen")
     103           0 :       end subroutine wann_kpointgen
     104             : 
     105           0 :       subroutine findkgt(nu,sc)
     106             :       implicit none
     107             :       integer,intent(out)::sc
     108             :       integer,intent(in)::nu
     109             :       integer k,nnu
     110             : 
     111           0 :       call timestart("findkgt")
     112           0 :       nnu=nu
     113           0 :       IF(nnu==0)  CALL juDFT_error("nnu.eq.0",calledby="wann_kpointgen")
     114           0 :       do k=1,3
     115           0 :          if(nnu.eq.1)exit
     116           0 :          if(mod(nnu,5).ne.0)exit
     117           0 :          nnu=nnu/5
     118             :       enddo
     119           0 :       do k=1,3
     120           0 :          if(nnu.eq.1)exit
     121           0 :          if(mod(nnu,2).ne.0)exit
     122           0 :          nnu=nnu/2
     123             :       enddo
     124           0 :       sc=nnu
     125           0 :       call timestop("findkgt")
     126           0 :       end subroutine findkgt
     127             : 
     128             :       end module m_wann_kpointgen

Generated by: LCOV version 1.14