make_kpoints.f90 2.4 KB
Newer Older
1 2 3 4 5
!--------------------------------------------------------------------------------
! 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.
!--------------------------------------------------------------------------------
Daniel Wortmann's avatar
Daniel Wortmann committed
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
MODULE m_make_kpoints
  USE m_juDFT
  IMPLICIT NONE
CONTAINS
  SUBROUTINE make_kpoints(kpts,cell,sym,film,l_socorss,str)
    USE m_types_kpts
    USE m_types_cell
    USE m_types_sym
    TYPE(t_kpts),INTENT(out)::kpts
    TYPE(t_cell),INTENT(in) ::cell
    TYPE(t_sym),INTENT(in)  ::sym
    LOGICAL,INTENT(in)::l_socorss,film
    CHARACTER(len=*),INTENT(inout)::str

    LOGICAL:: tria,l_gamma,l_soc_or_ss
    REAL   :: den
    INTEGER:: nk,grid(3)
    character(len=20)::name=""
24 25
    l_soc_or_ss=l_socorss

Daniel Wortmann's avatar
Daniel Wortmann committed
26 27
    IF (judft_was_argument("-k")) THEN
       IF (LEN_TRIM(str)>1) CALL judft_error("Do not specify k-points in file and on command line")
28
       str=judft_string_for_argument("-k")
Daniel Wortmann's avatar
Daniel Wortmann committed
29 30 31 32 33 34 35
    END IF

    !set name
    IF (INDEX(str,"#")>0) THEN
       name=trim(adjustl(str(INDEX(str,"#")+1:)))
       str=str(:INDEX(str,"#")-1)
    END IF
36

Daniel Wortmann's avatar
Daniel Wortmann committed
37 38 39 40
    str=ADJUSTL(str)
    DO WHILE(INDEX(str,'@')>0)
       IF (INDEX(str,'tria@')==1) THEN
          tria=.TRUE.
41
          str=str(6:)
Daniel Wortmann's avatar
Daniel Wortmann committed
42 43 44
       ENDIF
       IF (INDEX(str,'gamma@')==1) THEN
          l_gamma=.TRUE.
45
          str=str(7:)
Daniel Wortmann's avatar
Daniel Wortmann committed
46 47 48
       ENDIF
       IF (INDEX(str,'soc@')==1) THEN
          l_soc_or_ss=.TRUE.
49
          str=str(5:)
Daniel Wortmann's avatar
Daniel Wortmann committed
50 51 52
       ENDIF
    END DO
    IF (INDEX(str,'den=')==1) THEN
53
       str=str(5:)
Daniel Wortmann's avatar
Daniel Wortmann committed
54 55 56
       READ(str,*) den
       CALL kpts%init_by_density(den,cell,sym,film,tria,l_soc_or_ss,l_gamma)
    ELSEIF(INDEX(str,'nk=')==1) THEN
57
       str=str(4:)
Daniel Wortmann's avatar
Daniel Wortmann committed
58 59 60
       READ(str,*) nk
       CALL kpts%init_by_number(nk,cell,sym,film,tria,l_soc_or_ss,l_gamma)
    ELSEIF(INDEX(str,'grid=')==1) THEN
61
       str=str(6:)
Daniel Wortmann's avatar
Daniel Wortmann committed
62 63 64 65 66 67 68 69 70 71 72 73 74
       READ(str,*) grid
       CALL kpts%init_by_grid(grid,cell,sym,film,tria,l_soc_or_ss,l_gamma)
    ELSEIF(INDEX(str,'file')==1) THEN
       CALL kpts%init_by_kptsfile(film)
    ELSEIF(LEN_TRIM(str)<1.OR.INDEX(ADJUSTL(str),'#')==1) THEN
       CALL kpts%init_defaults(cell,sym,film,tria,l_soc_or_ss,l_gamma)
    ELSE
       CALL judft_error(("Could not process -k argument:"//str))
    ENDIF
    
    if (len_trim(name)>0) kpts%name=name
  END SUBROUTINE make_kpoints
END MODULE m_make_kpoints