LCOV - code coverage report
Current view: top level - inpgen - set_inp.f90 (source / functions) Hit Total Coverage
Test: combined.info Lines: 232 290 80.0 %
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_setinp
       8             :       use m_juDFT
       9             : !---------------------------------------------------------------------
      10             : !  Check muffin tin radii and determine a reasonable choice for MTRs.
      11             : !  Derive also other parameters for the input file, to provide some
      12             : !  help in the out-file.                                        gb`02
      13             : !---------------------------------------------------------------------
      14             :       CONTAINS
      15           3 :       SUBROUTINE set_inp(&
      16           3 :      &                   infh,nline,xl_buffer,bfh,buffer,l_hyb,&
      17           3 :      &                   atoms,sym,cell,title,idlist,&
      18             :      &                   input,vacuum,noco,&
      19           3 :      &                   atomTypeSpecies,speciesRepAtomType,numSpecies,&
      20             :      &                   a1,a2,a3)
      21             : 
      22             :       USE m_types
      23             :       USE iso_c_binding
      24             :       USE m_chkmt
      25             :       USE m_constants
      26             :       USE m_atominput
      27             :       USE m_lapwinput
      28             :       USE m_rwinp
      29             :       USE m_winpXML
      30             :       USE m_juDFT_init
      31             :       USE m_kpoints
      32             :       USE m_inv3
      33             :       USE m_types_xcpot_inbuild
      34             : 
      35             :       IMPLICIT NONE
      36             :       TYPE(t_input),INTENT(INOUT)    :: input
      37             :       TYPE(t_vacuum),INTENT(INOUT)   :: vacuum
      38             :       TYPE(t_noco),INTENT(INOUT)     :: noco
      39             :       TYPE(t_sym),INTENT(INOUT)      :: sym
      40             :       TYPE(t_cell),INTENT(INOUT)     :: cell
      41             :       TYPE(t_atoms),INTENT(INOUT)    :: atoms
      42             : 
      43             :       INTEGER, INTENT (IN) :: infh,xl_buffer,bfh,numSpecies
      44             :       INTEGER, INTENT (INOUT) :: nline
      45             :       INTEGER, INTENT (IN) :: atomTypeSpecies(atoms%ntype)
      46             :       INTEGER, INTENT (IN) :: speciesRepAtomType(atoms%nat)
      47             :       CHARACTER(len=xl_buffer) :: buffer
      48             :       LOGICAL, INTENT (IN) :: l_hyb  
      49             :       REAL,    INTENT (IN) :: idlist(:)
      50             :       REAL,    INTENT (INOUT) :: a1(3),a2(3),a3(3)
      51             :       CHARACTER(len=80), INTENT (IN) :: title
      52             :  
      53             :       INTEGER nel,i,j, nkptOld
      54             :       REAL    kmax,dtild,n1,n2,gam,kmax0,dtild0,dvac0,sumWeight
      55             :       REAL    recVecLength, kPointDen(3)
      56             :       LOGICAL l_test,l_gga,l_exists, l_explicit, l_kpts
      57          12 :       REAL     dx0(atoms%ntype), rmtTemp(atoms%ntype)
      58             :       REAL     a1Temp(3),a2Temp(3),a3Temp(3) 
      59             :       INTEGER  div(3)
      60          12 :       INTEGER jri0(atoms%ntype),lmax0(atoms%ntype)
      61             :       CHARACTER(len=1)  :: ch_rw
      62             :       CHARACTER(len=4)  :: namex
      63           6 :       CHARACTER(len=3)  :: noel(atoms%ntype)
      64             :       CHARACTER(len=12) :: relcor
      65             :       CHARACTER(len=3)  :: latnamTemp
      66             :       CHARACTER(LEN=20) :: filename
      67             :       INTEGER  nu,iofile
      68             :       INTEGER  n, errorStatus
      69             :       REAL     scpos ,zc
      70             : 
      71             :       TYPE(t_banddos)::banddos
      72             :       TYPE(t_obsolete)::obsolete
      73             :       TYPE(t_sliceplot)::sliceplot
      74             :       TYPE(t_oneD)::oneD
      75           3 :       TYPE(t_stars)::stars
      76           3 :       TYPE(t_hybrid)::hybrid
      77           3 :       TYPE(t_xcpot_inbuild)::xcpot
      78           3 :       TYPE(t_kpts)::kpts
      79           3 :       TYPE(t_enpara)::enpara
      80             :       TYPE(t_forcetheo)::forcetheo
      81             : 
      82             :     !-odim
      83             : !+odim
      84             : !      REAL, PARAMETER :: eps=0.00000001
      85             : !     ..
      86             : !HF   added for HF and hybrid functionals
      87           6 :       REAL     ::  taual_hyb(3,atoms%nat)
      88             :       INTEGER  ::  bands
      89             :       LOGICAL  ::  l_gamma
      90             : !HF
      91             : 
      92           6 :       INTEGER :: xmlElectronStates(29,atoms%ntype)
      93           6 :       LOGICAL :: xmlPrintCoreStates(29,atoms%ntype)
      94           6 :       REAL    :: xmlCoreOccs(2,29,atoms%ntype)
      95             :       REAL    :: xmlCoreRefOccs(29)
      96             : 
      97             :       interface
      98             :          function dropInputSchema() bind(C, name="dropInputSchema")
      99             :             use iso_c_binding
     100             :             INTEGER(c_int) dropInputSchema
     101             :          end function dropInputSchema
     102             :       end interface
     103             : 
     104             :       DATA xmlCoreRefOccs /2,2,2,4,2,2,4,2,4,6,2,4,2,4,6,2,4,2,6,8,4,&
     105             :      &                     6,2,4,2,6,8,4,6/
     106           6 :       xmlElectronStates = noState_const
     107           6 :       xmlPrintCoreStates = .FALSE.
     108           6 :       xmlCoreOccs = 0.0
     109             : 
     110           3 :       l_test = .false.
     111           3 :       l_gga  = .true.
     112           3 :       atoms%nlod=9
     113           3 :       ALLOCATE(atoms%nz(atoms%ntype))
     114           3 :       ALLOCATE(atoms%jri(atoms%ntype))
     115           3 :       ALLOCATE(atoms%dx(atoms%ntype))
     116           3 :       ALLOCATE(atoms%lmax(atoms%ntype))
     117           3 :       ALLOCATE(atoms%nlo(atoms%ntype))
     118           3 :       ALLOCATE(atoms%llo(atoms%nlod,atoms%ntype))
     119           3 :       ALLOCATE(atoms%ncst(atoms%ntype))
     120           3 :       ALLOCATE(atoms%lnonsph(atoms%ntype))
     121           3 :       ALLOCATE(atoms%nflip(atoms%ntype))
     122           3 :       ALLOCATE(atoms%l_geo(atoms%ntype))
     123           3 :       ALLOCATE(atoms%lda_u(atoms%ntype))
     124           3 :       ALLOCATE(atoms%bmu(atoms%ntype))
     125           3 :       ALLOCATE(atoms%relax(3,atoms%ntype))
     126           3 :       ALLOCATE(atoms%ulo_der(atoms%nlod,atoms%ntype))
     127             :       
     128           3 :       atoms%nz(:) = NINT(atoms%zatom(:))
     129           9 :       DO i = 1, atoms%ntype
     130           6 :        noel(i) = namat_const(atoms%nz(i))
     131             :       ENDDO
     132           3 :       atoms%rmt(:) = 999.9
     133           3 :       atoms%pos(:,:) = matmul( cell%amat , atoms%taual(:,:) )
     134           3 :       atoms%ulo_der = 0
     135           3 :       ch_rw = 'w'
     136           3 :       sym%namgrp= 'any ' 
     137           3 :       banddos%dos   = .false. ; banddos%l_mcd = .false. ; input%secvar = .false.
     138           3 :       input%vchk = .false. ; input%cdinf = .false. 
     139           3 :       input%l_bmt= .false. ; input%eonly  = .false.
     140           3 :       input%gauss= .false. ; input%tria  = .false. 
     141           3 :       sliceplot%slice= .false. ;  input%swsp  = .false.
     142           3 :       input%lflip= .false. ; banddos%vacdos= .false. ; input%integ = .false.
     143           3 :       sliceplot%iplot= .false. ; input%score = .false. ; sliceplot%plpot = .false.
     144           3 :       input%pallst = .false. ; obsolete%lwb = .false. ; vacuum%starcoeff = .false.
     145           3 :       input%strho  = .false.  ; input%l_f = .false. ; atoms%l_geo(:) = .true.
     146           3 :       noco%l_noco = noco%l_ss ;   input%jspins = 1
     147           3 :       input%itmax = 15 ; input%maxiter = 99 ; input%imix = 7 ; input%alpha = 0.05
     148           3 :       input%preconditioning_param = 0.0 ; input%minDistance = 1.0e-5
     149           3 :       input%spinf = 2.0 ; obsolete%lepr = 0 ; input%coretail_lmax = 0
     150           3 :       sliceplot%kk = 0 ; sliceplot%nnne = 0  ; vacuum%nstars = 0 ; vacuum%nstm = 0 
     151           3 :       nu = 5 ; vacuum%layerd = 1 ; iofile = 6
     152           3 :       ALLOCATE(vacuum%izlay(vacuum%layerd,2))
     153           3 :       banddos%ndir = 0 ; vacuum%layers = 0 ; atoms%nflip(:) = 1 ; vacuum%izlay(:,:) = 0
     154           3 :       banddos%e_mcd_lo = -10.0 ; banddos%e_mcd_up = 0.0
     155           3 :       atoms%lda_u%l = -1 ; atoms%relax(1:2,:) = 1 ; atoms%relax(:,:) = 1
     156           3 :       input%epsdisp = 0.00001 ; input%epsforce = 0.00001 ; input%forcealpha = 1.0 ; input%forcemix = 2 ! BFGS is default.
     157           3 :       sliceplot%e1s = 0.0 ; sliceplot%e2s = 0.0 ; banddos%e1_dos = 0.5 ; banddos%e2_dos = -0.5 ; input%tkb = 0.001
     158           3 :       banddos%sig_dos = 0.015 ; vacuum%tworkf = 0.0 ; input%scaleCell = 1.0 ; scpos = 1.0
     159           3 :       input%scaleA1 = 1.0 ; input%scaleA2 = 1.0 ; input%scaleC = 1.0
     160           3 :       zc = 0.0 ; vacuum%locx(:) = 0.0 ;  vacuum%locy(:) = 0.0
     161           3 :       kpts%numSpecialPoints = 0
     162           3 :       input%ldauLinMix = .FALSE. ; input%ldauMixParam = 0.05 ; input%ldauSpinf = 1.0
     163           3 :       input%l_wann = .FALSE.
     164           3 :       input%numBandsKPoints = 240
     165           3 :       banddos%unfoldband = .FALSE. ; banddos%s_cell_x = 1 ; banddos%s_cell_y = 1 ; banddos%s_cell_z = 1
     166             : 
     167             : !+odim
     168           3 :       oneD%odd%mb = 0 ; oneD%odd%M = 0 ; oneD%odd%m_cyl = 0 ; oneD%odd%chi = 0 ; oneD%odd%rot = 0
     169           3 :       oneD%odd%k3 = 0 ; oneD%odd%n2d= 0 ; oneD%odd%nq2 = 0 ; oneD%odd%nn2d = 0 
     170           3 :       oneD%odd%nop = 0 ; oneD%odd%kimax2 = 0 ; oneD%odd%nat = 0
     171           3 :       oneD%odd%invs = .false. ; oneD%odd%zrfs = .false. ; oneD%odd%d1 = .false.
     172             : !-odim
     173             : ! check for magnetism
     174           3 :       atoms%bmu(:) = 0.0
     175           6 :       DO n = 1, atoms%ntype
     176           3 :         IF (atoms%nz(n).EQ.24) atoms%bmu(n) = 1.0  ! Cr - Ni
     177           3 :         IF (atoms%nz(n).EQ.25) atoms%bmu(n) = 3.5
     178           3 :         IF (atoms%nz(n).EQ.26) atoms%bmu(n) = 2.2
     179           3 :         IF (atoms%nz(n).EQ.27) atoms%bmu(n) = 1.6
     180           3 :         IF (atoms%nz(n).EQ.28) atoms%bmu(n) = 1.1
     181           3 :         IF (atoms%nz(n).EQ.59) atoms%bmu(n) = 2.1  ! Pr - Tm
     182           3 :         IF (atoms%nz(n).EQ.60) atoms%bmu(n) = 3.1
     183           3 :         IF (atoms%nz(n).EQ.61) atoms%bmu(n) = 4.1
     184           3 :         IF (atoms%nz(n).EQ.62) atoms%bmu(n) = 5.1
     185           3 :         IF (atoms%nz(n).EQ.63) atoms%bmu(n) = 7.1
     186           3 :         IF (atoms%nz(n).EQ.64) atoms%bmu(n) = 7.1 
     187           3 :         IF (atoms%nz(n).EQ.65) atoms%bmu(n) = 6.1
     188           3 :         IF (atoms%nz(n).EQ.66) atoms%bmu(n) = 5.1
     189           3 :         IF (atoms%nz(n).EQ.67) atoms%bmu(n) = 4.1
     190           3 :         IF (atoms%nz(n).EQ.68) atoms%bmu(n) = 3.1
     191           6 :         IF (atoms%nz(n).EQ.69) atoms%bmu(n) = 2.1
     192             :       ENDDO
     193             : 
     194           3 :       input%delgau = input%tkb ; atoms%ntype = atoms%ntype ; atoms%nat = atoms%nat
     195          33 :       DO i = 1, 10
     196          30 :         j = (i-1) * 8 + 1
     197          33 :         input%comment(i) = title(j:j+7)
     198             :       ENDDO 
     199           3 :       IF (noco%l_noco) input%jspins = 2
     200             :        
     201          12 :       a1(:) = cell%amat(:,1) ; a2(:) = cell%amat(:,2) ; a3(:) = cell%amat(:,3) 
     202             : 
     203             :       CALL chkmt(&
     204             :      &           atoms,input,vacuum,cell,oneD,l_test,&
     205             :      &           l_gga,noel,&
     206           3 :      &           kmax,dtild,vacuum%dvac,atoms%lmax,atoms%jri,atoms%rmt,atoms%dx)
     207             : 
     208             : ! --> read in (possibly) atomic info
     209             : 
     210           3 :       stars%gmax = 3.0 * kmax ; xcpot%gmaxxc = 2.5 * kmax ; input%rkmax = kmax
     211           3 :       atoms%lnonsph(:) = min( max( (atoms%lmax(:)-2),3 ), 8 )
     212             : 
     213             :       CALL atom_input(&
     214             :      &                infh,xl_buffer,bfh,buffer,&
     215             :      &                input,idlist,xmlCoreRefOccs,&
     216             :      &                nline,&
     217             :      &                xmlElectronStates,xmlPrintCoreStates,xmlCoreOccs,&
     218             :      &                atomTypeSpecies,numSpecies,&
     219           3 :      &                nel,atoms,enpara)
     220             : 
     221           6 :       DO n = 1, atoms%ntype
     222           6 :          IF (atoms%lnonsph(n).GT.atoms%lmax(n)) THEN
     223             :             WRITE(*,'(a20,i5,a25,i3,a4,i3,a1)')& 
     224           0 :                'NOTE: For atom type ', n,' lnonsph is reduced from ',& 
     225           0 :                atoms%lnonsph(n),' to ', atoms%lmax(n), '.'
     226             :             WRITE(6,'(a20,i5,a25,i3,a4,i3,a1)')&
     227           0 :                'NOTE: For atom type ', n, ' lnonsph is reduced from ',& 
     228           0 :                atoms%lnonsph(n),' to ', atoms%lmax(n), '.'
     229           0 :             atoms%lnonsph(n) = atoms%lmax(n)
     230             :          END IF
     231             :       END DO
     232             : 
     233           3 :       input%zelec = nel
     234             : 
     235             : ! --> check once more
     236           6 :       rmtTemp = 999.0
     237           3 :       l_test = .true.
     238             :       CALL chkmt(&
     239             :      &           atoms,input,vacuum,cell,oneD,l_test,&
     240             :      &           l_gga,noel,&
     241           3 :      &           kmax0,dtild0,dvac0,lmax0,jri0,rmtTemp,dx0)
     242             : 
     243           3 :       IF ( ANY(atoms%nlo(:).NE.0) ) THEN
     244           0 :         input%ellow = -1.8
     245             :       ELSE
     246           3 :         input%ellow = -0.8  
     247             :       ENDIF
     248           3 :       IF (input%film) THEN
     249           0 :          input%elup = 0.5
     250             :       ELSE
     251           3 :          input%elup = 1.0
     252             :       ENDIF 
     253             : 
     254           3 :       IF (.not.input%film) THEN
     255           3 :          vacuum%dvac = a3(3) ; dtild = vacuum%dvac
     256             :       ENDIF
     257             :       IF ( (abs(a1(3)).GT.eps).OR.(abs(a2(3)).GT.eps).OR.&
     258           3 :      &     (abs(a3(1)).GT.eps).OR.(abs(a3(2)).GT.eps) ) THEN          
     259           3 :         cell%latnam = 'any'
     260             :       ELSE
     261           0 :         IF ( (abs(a1(2)).LT.eps).AND.(abs(a2(1)).LT.eps) ) THEN
     262           0 :           IF (abs(a1(1)-a2(2)).LT.eps) THEN
     263           0 :             cell%latnam = 'squ'
     264             :           ELSE
     265           0 :             cell%latnam = 'p-r'
     266             :           ENDIF
     267             :         ELSE
     268           0 :           n1 = sqrt(a1(1)**2 + a1(2)**2); n2 = sqrt(a2(1)**2 + a2(2)**2)
     269           0 :           IF (abs(n1-n2).LT.eps) THEN
     270           0 :             gam = ( a1(1)*a2(1) + a1(2)*a2(2) ) / (n1 * n2)
     271           0 :             gam = 57.295779512*acos(gam)
     272           0 :             IF (abs(gam-60.).LT.eps) THEN
     273           0 :                cell%latnam = 'hex'
     274           0 :                a1(2) = n1 * 0.5
     275           0 :                a1(1) = a1(2) * sqrt(3.0)
     276           0 :             ELSEIF (abs(gam-120.).LT.eps) THEN
     277           0 :                cell%latnam = 'hx3'
     278           0 :                a1(1) = n1 * 0.5
     279           0 :                a1(2) = a1(1) * sqrt(3.0)
     280             :             ELSE
     281           0 :                cell%latnam = 'c-r'
     282           0 :                gam = 0.5 * gam / 57.295779512
     283           0 :                a1(1) =  n1 * cos(gam)
     284           0 :                a1(2) = -n1 * sin(gam)
     285             :             ENDIF
     286           0 :             a2(1) =   a1(1)
     287           0 :             a2(2) = - a1(2)
     288             :           ELSE
     289           0 :             cell%latnam = 'obl'
     290             :           ENDIF
     291             :         ENDIF
     292             :       ENDIF
     293             : 
     294             : !HF   added for HF and hybrid functionals
     295           3 :       hybrid%gcutm1       = input%rkmax - 0.5
     296           3 :       hybrid%tolerance1   = 1e-4
     297           3 :       taual_hyb   = atoms%taual
     298           3 :       ALLOCATE(hybrid%lcutwf(atoms%ntype))
     299           3 :       ALLOCATE(hybrid%lcutm1(atoms%ntype))
     300           3 :       ALLOCATE(hybrid%select1(4,atoms%ntype))
     301           3 :       hybrid%lcutwf      = atoms%lmax - atoms%lmax / 10
     302           3 :       hybrid%ewaldlambda = 3
     303           3 :       hybrid%lexp        = 16
     304           6 :       hybrid%lcutm1 = 4
     305           6 :       hybrid%select1(1,:) = 4
     306           6 :       hybrid%select1(2,:) = 0
     307           6 :       hybrid%select1(3,:) = 4
     308           6 :       hybrid%select1(4,:) = 2
     309           3 :       bands       = max( nint(input%zelec)*10, 60 )
     310           3 :       l_gamma     = .false.
     311           3 :       hybrid%l_hybrid = l_hyb
     312           3 :       IF (l_hyb) THEN
     313           0 :          input%ellow = input%ellow -  2.0
     314           0 :          input%elup  = input%elup  + 10.0
     315           0 :          input%gw_neigd = bands
     316           0 :          hybrid%bands1 = ceiling(0.75*bands)
     317           0 :          l_gamma = .true.
     318           0 :          input%minDistance = 1.0e-5
     319             :       ELSE
     320           3 :         input%gw_neigd = 0
     321             :       END IF
     322             : !HF
     323             : 
     324             : ! rounding
     325           3 :       atoms%rmt(:)  = real(NINT(atoms%rmt(:)  * 100 ) / 100.)
     326           3 :       atoms%dx(:)   = real(NINT(atoms%dx(:)   * 1000) / 1000.)
     327           3 :       stars%gmax    = real(NINT(stars%gmax    * 10  ) / 10.)
     328           3 :       input%rkmax   = real(NINT(input%rkmax   * 10  ) / 10.)
     329           3 :       xcpot%gmaxxc  = real(NINT(xcpot%gmaxxc  * 10  ) / 10.)
     330           3 :       hybrid%gcutm1 = real(NINT(hybrid%gcutm1 * 10  ) / 10.)
     331           3 :       IF (input%film) THEN
     332           0 :        vacuum%dvac = real(NINT(vacuum%dvac*100)/100.)
     333           0 :        dtild = real(NINT(dtild*100)/100.)
     334             :       ENDIF
     335             : !
     336             : ! read some lapw input
     337             : !
     338             :       CALL lapw_input(&
     339             :      &                infh,nline,xl_buffer,bfh,buffer,&
     340             :      &                input%jspins,input%kcrel,obsolete%ndvgrd,kpts%nkpt,div,kpts%kPointDensity,&
     341             :      &                input%frcor,input%ctail,obsolete%chng,input%tria,input%rkmax,stars%gmax,xcpot%gmaxxc,&
     342           3 :      &                vacuum%dvac,dtild,input%tkb,namex,relcor)
     343             : 
     344           3 :       stars%gmaxInit = stars%gmax
     345             : !
     346           3 :       IF (input%film) atoms%taual(3,:) = atoms%taual(3,:) * a3(3) / dtild
     347             : 
     348           3 :       INQUIRE(file="inp",exist=l_exists)
     349           3 :       IF (l_exists) THEN
     350           0 :          CALL juDFT_error("inp-file exists. Cannot write another input file in this directory.",calledby="set_inp")
     351             :       ENDIF
     352           3 :       INQUIRE(file="inp.xml",exist=l_exists)
     353           3 :       IF (l_exists) THEN
     354           0 :          CALL juDFT_error("inp.xml-file exists. Cannot write another input file in this directory.",calledby="set_inp")
     355             :       ENDIF
     356             : 
     357           3 :       nu = 8 
     358           3 :       input%gw = 0
     359           3 :       IF(juDFT_was_argument("-gw")) input%gw = 1
     360             : 
     361           3 :       IF (kpts%nkpt == 0) THEN     ! set some defaults for the k-points
     362           3 :         IF (input%film) THEN
     363           0 :           cell%area = ABS(cell%amat(1,1)*cell%amat(2,2)-cell%amat(1,2)*cell%amat(2,1))
     364           0 :           kpts%nkpt = MAX(nint((3600/cell%area)/sym%nop2),1)
     365             :         ELSE
     366           3 :           kpts%nkpt = MAX(nint((216000/cell%omtil)/sym%nop),1)
     367             :         ENDIF
     368             :       ENDIF
     369             : 
     370           3 :       kpts%specificationType = 0
     371           9 :       IF((ANY(div(:).NE.0)).AND.(ANY(kpts%kPointDensity(:).NE.0.0))) THEN
     372           0 :          CALL juDFT_error('Double specification of k point set', calledby = 'set_inp')
     373             :       END IF
     374           9 :       IF (ANY(div(:).NE.0)) THEN
     375           1 :          kpts%specificationType = 2
     376           8 :       ELSE IF (ANY(kpts%kPointDensity(:).NE.0.0)) THEN
     377           0 :          kpts%specificationType = 4
     378             :       ELSE
     379           2 :          kpts%specificationType = 1
     380             :       END IF
     381           3 :       l_kpts = .FALSE.
     382             : 
     383           3 :       IF(TRIM(ADJUSTL(sym%namgrp)).EQ.'any') THEN
     384           3 :          sym%symSpecType = 1
     385             :       ELSE
     386           0 :          sym%symSpecType = 2
     387             :       END IF
     388             : 
     389             :       ! set vacuum%nvac
     390           3 :       vacuum%nvac = 2
     391           3 :       IF (sym%zrfs.OR.sym%invs) vacuum%nvac = 1
     392           3 :       IF (oneD%odd%d1) vacuum%nvac = 1
     393             :       
     394             :       ! Set defaults for noco  types
     395           3 :       ALLOCATE(noco%l_relax(atoms%ntype),noco%b_con(2,atoms%ntype))
     396           3 :       ALLOCATE(noco%alphInit(atoms%ntype),noco%alph(atoms%ntype),noco%beta(atoms%ntype))
     397             :    
     398           3 :       IF (noco%l_ss) input%ctail = .FALSE.
     399           3 :       noco%l_mperp = .FALSE.
     400           3 :       noco%l_constr = .FALSE.
     401           3 :       noco%mix_b = 0.0
     402          12 :       noco%qss = 0.0
     403             : 
     404           6 :       noco%l_relax(:) = .FALSE.
     405           6 :       noco%alphInit(:) = 0.0
     406           6 :       noco%alph(:) = 0.0
     407           6 :       noco%beta(:) = 0.0
     408           6 :       noco%b_con(:,:) = 0.0
     409             : 
     410             :      
     411           3 :       CALL inv3(cell%amat,cell%bmat,cell%omtil)
     412          12 :       cell%bmat=tpi_const*cell%bmat
     413          12 :       kpts%nkpt3(:) = div(:)
     414             : 
     415           3 :       IF (kpts%specificationType.EQ.4) THEN
     416           0 :          DO i = 1, 3
     417           0 :             IF (kpts%kPointDensity(i).LE.0.0) THEN
     418           0 :                CALL juDFT_error('Error: Nonpositive kpointDensity provided', calledby = 'set_inp')
     419             :             END IF
     420           0 :             recVecLength = SQRT(cell%bmat(i,1)**2 + cell%bmat(i,2)**2 + cell%bmat(i,3)**2)
     421           0 :             kpts%nkpt3(i) = CEILING(kpts%kPointDensity(i) * recVecLength)
     422             :          END DO
     423           0 :          kpts%nkpt = kpts%nkpt3(1) * kpts%nkpt3(2) * kpts%nkpt3(3)
     424             :       END IF
     425             : 
     426           3 :       IF (l_hyb) THEN
     427             :          ! Changes for hybrid functionals
     428           0 :          namex = 'pbe0'
     429           0 :          input%ctail = .false. ; atoms%l_geo = .false.! ; input%frcor = .true.
     430           0 :          input%itmax = 15 ; input%maxiter = 25!; input%imix  = 17
     431           0 :          IF (ANY(kpts%nkpt3(:).EQ.0)) kpts%nkpt3(:) = 4
     432           0 :          div(:) = kpts%nkpt3(:)
     433           0 :          kpts%specificationType = 2
     434             :       END IF
     435             : 
     436           3 :          nkptOld = kpts%nkpt
     437           3 :          latnamTemp = cell%latnam
     438             : 
     439           3 :          l_explicit = juDFT_was_argument("-explicit")
     440             : 
     441           3 :          a1Temp(:) = a1(:)
     442           3 :          a2Temp(:) = a2(:)
     443           3 :          a3Temp(:) = a3(:)
     444             : 
     445           3 :          IF(l_explicit) THEN
     446             :             ! kpts generation
     447           2 :             kpts%l_gamma = l_gamma
     448             : 
     449           2 :             CALL kpoints(oneD,sym,cell,input,noco,banddos,kpts,l_kpts)
     450             : 
     451           2 :             kpts%specificationType = 3
     452           2 :             IF (l_hyb) kpts%specificationType = 2
     453             :          END IF
     454             : 
     455           3 :          IF(l_explicit) THEN
     456           2 :             sym%symSpecType = 3
     457             :             !set latnam to any
     458           2 :             cell%latnam = 'any'
     459             : 
     460           8 :             a1Temp(:) = cell%amat(:,1)
     461           8 :             a2Temp(:) = cell%amat(:,2)
     462           8 :             a3Temp(:) = cell%amat(:,3)
     463             :          END IF
     464             : 
     465           3 :          errorStatus = 0
     466           3 :          errorStatus = dropInputSchema()
     467           3 :          IF(errorStatus.NE.0) THEN
     468           0 :             STOP 'Error: Cannot print out FleurInputSchema.xsd'
     469             :          END IF
     470           3 :          filename = 'inp.xml'
     471             : 
     472             :          CALL w_inpXML(&
     473             :      &                 atoms,obsolete,vacuum,input,stars,sliceplot,forcetheo,banddos,&
     474             :      &                 cell,sym,xcpot,noco,oneD,hybrid,kpts,div,l_gamma,&
     475             :      &                 noel,namex,relcor,a1Temp,a2Temp,a3Temp,dtild,input%comment,&
     476             :      &                 xmlElectronStates,xmlPrintCoreStates,xmlCoreOccs,&
     477             :      &                 atomTypeSpecies,speciesRepAtomType,.FALSE.,filename,&
     478           3 :      &                 l_explicit,numSpecies,enpara)
     479             : 
     480           3 :          IF(juDFT_was_argument("-explicit")) THEN
     481           2 :             sumWeight = 0.0
     482           2 :             WRITE(6,*) ''
     483           2 :             WRITE(6,'(a,(a3,i10))') 'k-point count:','', kpts%nkpt
     484         227 :             DO i = 1, kpts%nkpt
     485           2 :                sumWeight = sumWeight + kpts%wtkpt(i)
     486             :             END DO
     487         452 :             DO i = 1, kpts%nkpt
     488         225 :                kpts%wtkpt(i) = kpts%wtkpt(i) / sumWeight
     489           2 :                kpts%wtkpt(i) = kpts%wtkpt(i)
     490             :             END DO
     491             :          END IF
     492             : 
     493           3 :          kpts%nkpt = nkptOld
     494           3 :          cell%latnam = latnamTemp
     495             :  
     496           3 :       DEALLOCATE (noco%l_relax,noco%b_con,noco%alphInit,noco%alph,noco%beta)
     497           3 :       DEALLOCATE (atoms%ulo_der)
     498             : 
     499           6 :       IF (ANY(kpts%nkpt3(:).NE.0)) THEN
     500          14 :          DO i = 1, 3
     501           6 :             recVecLength = SQRT(cell%bmat(i,1)**2 + cell%bmat(i,2)**2 + cell%bmat(i,3)**2)
     502           8 :             kPointDen(i) = kpts%nkpt3(i) / recVecLength
     503             :          END DO
     504           2 :          WRITE(6,*) ''
     505           2 :          WRITE(6,'(a,3(a4,i10))')   'k-point mesh:'   , '', kpts%nkpt3(1),'', kpts%nkpt3(2),'', kpts%nkpt3(3)
     506           2 :          WRITE(6,'(a,3(a4,f10.6))') 'k-point density:', '', kPointDen(1),'', kPointDen(2),'', kPointDen(3)
     507           2 :          WRITE(6,*) ''
     508             :       END IF
     509             : 
     510           3 :       CLOSE (6)
     511             : 
     512             : 
     513          15 :       END SUBROUTINE set_inp
     514             :       END MODULE m_setinp

Generated by: LCOV version 1.13