optional.f90 7.5 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
!--------------------------------------------------------------------------------
! 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.
!--------------------------------------------------------------------------------
MODULE m_optional
  USE m_juDFT
CONTAINS
  SUBROUTINE OPTIONAL(mpi, atoms,sphhar,vacuum,DIMENSION,&
       stars,input,sym, cell, sliceplot,obsolete, xcpot, noco, oneD)
    !
    !----------------------------------------
    ! this routine is called by: fleur.F90
    !
    ! optional --+-- plot -+- loddop
    !            |         +- outcdn -+- cotra0
    !            |                    +- cotra1
    !            |                    +- starf2 -- spgrot
    !            |                    +- starf3
    !            |                    +- ylm3
    !            +-- stden -+- atom2 -+- setcor
    !            |          |         +- stpot1
    !            |          |         +- differ -+- inwint
    !            |          |         |          +- outint
    !            |          |         +- vxcall (-> see vgen.F) or:
    !            |          |         +- potl0 -+- grdchlh
    !            |          |         |         +- mkgl0
    !            |          |         |         +- vxcallg (-> see vgen.F)
    !            |          |         +- intgr1
    !            |          +- cdnovlp -+- spgrot
    !            |          |           +- rcerf --wofz
    !            |          |           +- diflgr
    !            |          |           +- qpw_to_nmt -+- phasy1 -+- spgrot
    !            |          |                          |          +- ylm3
    !            |          |                          +- sphbes
    !            |          +- qfix -- cdntot -+- intgr3
    !            |          |                  +- qsf
    !            |          |                  +- pwint -- spgrot
    !            |          +- wrtdop
    !            |          +- points -- qranf
    !            |          +- sphpts -- qranf
    !            |          +- checkdop -+- starf3
    !            |                       +- cotra0
    !            |                       +- starf2 -- spgrot
    !            |                       +- fitchk
    !            |                       +- cotra1
    !            |                       +- ylm3
    !            +-- cdnsp -+- loddop
    !            |          +- wrtdop
    !            |          +- intgr3
    !            +-- flipcdn -+- loddop
    !            |            +- wrtdop
    !            +-- f2u -- wrtdop
    !            +-- u2f -- loddop
    !            +-- bmt -+- loddop
    !                     +- wrtdop
    !----------------------------------------
    USE m_bmt
    USE m_plotdop
    USE m_stden
    USE m_cdnsp
    USE m_flipcdn
    USE m_f2u
    USE m_u2f
    USE m_types
    IMPLICIT NONE
    !     ..
    !     .. Scalar Arguments ..
69

70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
    TYPE(t_mpi),INTENT(IN)      :: mpi
    TYPE(t_atoms),INTENT(IN)    :: atoms
    TYPE(t_dimension),INTENT(IN):: DIMENSION
    TYPE(t_sphhar),INTENT(IN)   :: sphhar
    TYPE(t_obsolete),INTENT(IN) :: obsolete
    TYPE(t_sym),INTENT(IN)      :: sym
    TYPE(t_stars),INTENT(IN)    :: stars
    TYPE(t_oneD),INTENT(IN)     :: oneD
    TYPE(t_input),INTENT(INOUT) :: input
    TYPE(t_noco),INTENT(IN)     :: noco
    TYPE(t_vacuum),INTENT(IN)   :: vacuum
    TYPE(t_cell),INTENT(IN)     :: cell
    TYPE(t_xcpot),INTENT(IN)    :: xcpot
    TYPE(t_sliceplot),INTENT(IN):: sliceplot
    !     ..
    !     .. Local Scalars ..
    INTEGER :: it
    CHARACTER*10 :: cdnfname
    !     ..
    it = 1
90

91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167
    IF (mpi%irank == 0) THEN
10     IF (sliceplot%plpot) input%score = .FALSE.
       IF (sliceplot%iplot) THEN
          CALL timestart("Plotting")
          IF (input%strho)  CALL juDFT_error("strho = T and iplot=T",calledby&
               &        ="optional")
          IF (noco%l_noco) THEN
             cdnfname = 'cdn'
             CALL plotdop(&
                  &           oneD,stars,vacuum,sphhar,atoms,&
                  &           input,sym,cell,sliceplot,&
                  &           noco%l_noco,cdnfname)
             cdnfname = 'mdnx'
             CALL plotdop(&
                  &           oneD,stars,vacuum,sphhar,atoms,&
                  &           input,sym,cell,sliceplot,&
                  &           noco%l_noco,cdnfname)
             cdnfname = 'mdny'
             CALL plotdop(&
                  &           oneD,stars,vacuum,sphhar,atoms,&
                  &           input,sym,cell,sliceplot,&
                  &           noco%l_noco,cdnfname)
             cdnfname = 'mdnz'
             CALL plotdop(&
                  &           oneD,stars,vacuum,sphhar,atoms,&
                  &           input,sym,cell,sliceplot,&
                  &           noco%l_noco,cdnfname)
          ELSE
             IF (sliceplot%slice) THEN
                cdnfname = 'cdn_slice'
             ELSE
                cdnfname = 'cdn1'
             ENDIF
             CALL plotdop(&
                  &           oneD,stars,vacuum,sphhar,atoms,&
                  &           input,sym,cell,sliceplot,&
                  &           noco%l_noco,cdnfname)
          ENDIF
          CALL timestop("Plotting")
       END IF
    ENDIF ! mpi%irank == 0
    !
    !     --->generate starting charge density
    !
    IF (input%strho) THEN
       input%total = .FALSE.
       !
       CALL timestart("generation of start-density")
       CALL stden(mpi,&
            &              sphhar,stars,atoms,sym,&
            &              DIMENSION,vacuum,&
            &              input,&
            &              cell,&
            &              xcpot,&
            &              obsolete,&
            &              oneD)
       !
       CALL timestart("generation of start-density")
    END IF
    IF (mpi%irank == 0) THEN
       !
       !     --->generate spin polarized charge density
       !
       CALL timestart("optional: spin polarized density")
       IF (input%swsp) THEN
          CALL cdnsp(&
               &              atoms,input,vacuum,sphhar,&
               &              stars,&
               &              sym,&
               &              cell,DIMENSION)
          !
          CALL timestop("optional: spin polarized density")
       END IF
       !
       !     --->flip magnetic moments
       !
       IF (input%lflip) THEN
168

169 170 171 172 173 174 175
          CALL timestart('optional: flip magnetic moments')
          CALL flipcdn(&
               &                atoms,input,vacuum,sphhar,&
               &                stars,sym,cell,noco%l_noco)
          !
          CALL timestop('optional: flip magnetic moments')
       END IF
176

177
       IF (obsolete%l_u2f) THEN
178

179 180 181 182 183 184 185
          CALL timestart('optional: conversion to formatted')
          CALL u2f(&
               &           stars,input,atoms,sphhar,vacuum,&
               &           cell,sym,noco%l_noco)
          !
          CALL timestop('optional: conversion to formatted')
       ENDIF
186

187
       IF (obsolete%l_f2u) THEN
188

189 190 191 192 193 194 195
          CALL timestart('optional: conversion to unformatted')
          CALL f2u(&
               &           stars,input,atoms,sphhar,vacuum,&
               &           cell,sym,noco%l_noco)
          !
          CALL timestop('optional: conversion to unformatted')
       ENDIF
196

197 198 199 200 201
       IF (input%l_bmt) THEN
          CALL bmt(&
               &           stars,input,noco,atoms,sphhar,vacuum,&
               &           cell,sym)
       ENDIF
202

203
    ENDIF ! mpi%irank == 0
204

205 206
  END SUBROUTINE OPTIONAL
END MODULE m_optional