LCOV - code coverage report
Current view: top level - init/old_inp - apws_dim.f90 (source / functions) Hit Total Coverage
Test: combined.info Lines: 41 52 78.8 %
Date: 2019-09-08 04:53:50 Functions: 1 1 100.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_apwsdim
       8             :       CONTAINS
       9         104 :       SUBROUTINE apws_dim(&
      10             :      &                    bkpt,cell,input,noco,oneD,&
      11             :      &                    nv,nv2,kq1d,kq2d,kq3d)
      12             : !
      13             : !*********************************************************************
      14             : !     determines dimensions of the lapw basis set with |k+G|<rkmax.
      15             : !     bkpt is the k-point given in internal units
      16             : !
      17             : !     dimensions kq(i)d for charge density FFT added.
      18             : !        s. bluegel, JRCAT, Feb. 97
      19             : !*********************************************************************
      20             :       USE m_boxdim
      21             :       USE m_ifft,     ONLY : ifft235
      22             :       USE m_types
      23             : 
      24             :       IMPLICIT NONE
      25             :       REAL,INTENT(IN)              :: bkpt(3)
      26             :       TYPE(t_cell),INTENT(IN)      :: cell
      27             :       TYPE(t_input),INTENT(IN)     :: input
      28             :       TYPE(t_noco),INTENT(IN)      :: noco
      29             :       TYPE(t_oneD),INTENT(IN)      :: oneD
      30             :       INTEGER,INTENT(OUT) :: nv,nv2,kq1d,kq2d,kq3d   
      31             :       
      32             : 
      33             :       INTEGER j1,j2,j3,mk1,mk2,mk3,iofile,ksfft
      34             :       INTEGER ispin,nvh(2),nv2h(2)
      35             :       
      36             :       REAL arltv1,arltv2,arltv3,rkm,rk2,r2,s(3),gmaxp
      37             : ! ..
      38             : !
      39             : !------->          ABBREVIATIONS
      40             : !
      41             : 
      42             : !   iofile      : device number for in and output
      43             : !   gmax        : cut-off wavevector for charge density
      44             : !   rkmax       : cut-off for |g+k|
      45             : !   gmaxp       : gmaxp = gmax/rkmax, ideal: gmaxp=2
      46             : !   arltv(i)    : length of reciprical lattice vector along
      47             : !                 direction (i)
      48             : !
      49             : !---> Determine rkmax box of size mk1, mk2, mk3,
      50             : !     for which |G(mk1,mk2,mk3) + (k1,k2,k3)| < rkmax
      51             : !
      52         104 :       CALL boxdim(cell%bmat,arltv1,arltv2,arltv3)
      53             : 
      54             : !     (add 1+1 due to integer rounding, strange k_vector in BZ)
      55         104 :       mk1 = int(input%rkmax/arltv1) + 2
      56         104 :       mk2 = int(input%rkmax/arltv2) + 2
      57         104 :       mk3 = int(input%rkmax/arltv3) + 2
      58             : 
      59         104 :       rkm = input%rkmax
      60         104 :       rk2 = rkm*rkm
      61             : !---> obtain vectors
      62             : !---> in a spin-spiral calculation different basis sets are used for
      63             : !---> the two spin directions, because the cutoff radius is defined
      64             : !---> by |G + k +/- qss/2| < rkmax.
      65         312 :       DO ispin = 1,2
      66         208 :          nv = 0
      67         208 :          nv2 = 0
      68        2156 :          DO j1 = -mk1,mk1
      69        1948 :             s(1) = bkpt(1) + j1 + (2*ispin - 3)/2.0*noco%qss(1)
      70       20764 :             DO j2 = -mk2,mk2
      71       18608 :                s(2) = bkpt(2) + j2 + (2*ispin - 3)/2.0*noco%qss(2)
      72             : !--->          nv2 for films
      73       18608 :                s(3) = 0.0
      74             :                !r2 = dotirp(s,s,cell%bbmat)
      75       18608 :                r2 = dot_product(matmul(s,cell%bbmat),s)
      76       18608 :                IF (r2.LE.rk2) nv2 = nv2 + 1
      77      238116 :                DO j3 = -mk3,mk3
      78      217560 :                   s(3) = bkpt(3) + j3 + (2*ispin - 3)/2.0*noco%qss(3)
      79             :                   !r2 = dotirp(s,s,cell%bbmat)
      80      217560 :                   r2 = dot_product(matmul(s,cell%bbmat),s)
      81      236168 :                   IF (r2.LE.rk2) THEN
      82       29544 :                      nv = nv + 1
      83             :                   END IF
      84             :                END DO
      85             :             END DO
      86             :          END DO
      87             : !-odim
      88         208 :          IF (oneD%odd%d1) THEN
      89           0 :            nv2 = 0
      90           0 :            s(1) = 0.0
      91           0 :            s(2) = 0.0
      92           0 :            DO j3 = -mk3,mk3
      93           0 :               s(3) = bkpt(3) + j3 + (2*ispin - 3)/2.0*noco%qss(3)
      94             :               !r2 = dotirp(s,s,cell%bbmat)
      95           0 :               r2 = dot_product(matmul(s,cell%bbmat),s)
      96             :                
      97           0 :               IF (r2.LE.rk2) THEN
      98           0 :                  nv2 = nv2 + 1
      99             :               END IF
     100             :            END DO
     101             :          END IF
     102             : !+odim
     103         208 :          nvh(ispin)  = nv
     104         312 :          nv2h(ispin) = nv2
     105             :       END DO
     106         104 :       nv  = max(nvh(1),nvh(2))
     107         104 :       nv2 = max(nv2h(1),nv2h(2))
     108             : 
     109             : !---> Determine the dimensions kq1d, kq2d, kq3d
     110             : !     of the dimension of the charge density fft-box
     111             : !     needed for the fast calculation of pw density
     112             : !     (add 1 due to integer rounding,
     113             : !      factor 2 due to positive domain)
     114             : !
     115         104 :       gmaxp = 2.0
     116         104 :       CALL boxdim(cell%bmat,arltv1,arltv2,arltv3)
     117             : !
     118         104 :       mk1 = int(gmaxp*input%rkmax/arltv1) + 1
     119         104 :       mk2 = int(gmaxp*input%rkmax/arltv2) + 1
     120         104 :       mk3 = int(gmaxp*input%rkmax/arltv3) + 1
     121             : 
     122             : !---> add + 1 in spin spiral calculation, to make sure that all G's are 
     123             : !---> still within the FFT-box after being shifted by the spin spiral
     124             : !---> q-vector.
     125         104 :       IF (noco%l_ss) THEN
     126           0 :          mk1 = mk1 + 1
     127           0 :          mk2 = mk2 + 1
     128           0 :          mk3 = mk3 + 1
     129             :       ENDIF         
     130             : !
     131         104 :       kq1d = 2*mk1
     132         104 :       kq2d = 2*mk2
     133         104 :       kq3d = 2*mk3
     134             : !
     135             : !---> fft's are usually fastest for low primes
     136             : !     (restrict kqid to: kqid=  (2**P) * (3**Q) * (5**R)
     137             : !
     138         104 :       ksfft = 1
     139             : !     ksfft=(0,1) : KEY OF SELECTING FFT-PRDOGRAM AND RADIX-TYPE
     140             : !                      0  PROGRAM, RADIX-2 ONLY
     141             : !                      1  PROGRAM, RADIX-2, RADIX-3,RADIX-5
     142             : 
     143         104 :       kq1d = ifft235(6,ksfft,kq1d,gmaxp)
     144         104 :       kq2d = ifft235(6,ksfft,kq2d,gmaxp)
     145         104 :       kq3d = ifft235(6,ksfft,kq3d,gmaxp)
     146             : 
     147         104 :       RETURN
     148             :       END SUBROUTINE
     149             :       END

Generated by: LCOV version 1.13