optional.F90 5.62 KB
Newer Older
1 2 3 4 5 6 7 8
!--------------------------------------------------------------------------------
! 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
9
  SUBROUTINE OPTIONAL(mpi, atoms,sphhar,vacuum,&
10
       stars,input,sym, cell, sliceplot, xcpot, noco, oneD)
11 12 13 14 15
    !
    !----------------------------------------
    ! this routine is called by: fleur.F90
    !
    ! optional --+-- plot -+- loddop
16
    !            |         +- outcdn -+- starf2 -- spgrot
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
    !            |                    +- 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
    !            |                       +- starf2 -- spgrot
    !            |                       +- fitchk
    !            |                       +- ylm3
44 45
    !            +-- cdnsp -+- readDensity
    !            |          +- writeDensity
46
    !            |          +- intgr3
47 48
    !            +-- flipcdn -+- readDensity
    !            |            +- writeDensity
49 50
    !            +-- f2u -- wrtdop
    !            +-- u2f -- loddop
51
    !            +-- bmt -+- readDensity
52 53 54 55 56 57
    !                     +- wrtdop
    !----------------------------------------
    USE m_bmt
    USE m_stden
    USE m_cdnsp
    USE m_flipcdn
58
    USE m_cdn_io
59
    USE m_types
60

61

62 63 64
    IMPLICIT NONE
    !     ..
    !     .. Scalar Arguments ..
65

66 67
    TYPE(t_mpi),INTENT(IN)      :: mpi
    TYPE(t_atoms),INTENT(IN)    :: atoms
68

69 70 71 72 73 74 75 76
    TYPE(t_sphhar),INTENT(IN)   :: sphhar
    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
77
    CLASS(t_xcpot),INTENT(IN)   :: xcpot
78 79 80
    TYPE(t_sliceplot),INTENT(IN):: sliceplot
    !     ..
    !     .. Local Scalars ..
81
    INTEGER :: it, archiveType
82
    CHARACTER*10 :: cdnfname
83
    LOGICAL :: strho
84 85 86 87
#ifdef CPP_MPI
    include 'mpif.h'
    INTEGER :: ierr(2)
#endif
88 89
    !     ..
    it = 1
90

91 92 93 94 95 96
 !   IF ((sliceplot%iplot.NE.0 ).AND. (mpi%irank==0) ) THEN
 !      IF (noco%l_noco) THEN
 !         CALL pldngen(mpi,sym,stars,atoms,sphhar,vacuum,&
 !              cell,input,noco,oneD,sliceplot)
 !      ENDIF
 !   ENDIF
97

98

99 100 101
    !
    !     --->generate starting charge density
    !
102
    strho=input%strho
103
    IF (.NOT.(strho.OR.(sliceplot%iplot.NE.0))) THEN
104
       archiveType = CDN_ARCHIVE_TYPE_CDN1_const
105
       IF (noco%l_noco) THEN
106
          archiveType = CDN_ARCHIVE_TYPE_NOCO_const
107
       END IF
108 109 110 111 112 113
       IF (mpi%irank == 0) THEN
          strho = .NOT.isDensityFilePresent(archiveType)
       END IF
#ifdef CPP_MPI
       CALL MPI_BCAST(strho,1,MPI_LOGICAL,0,mpi%mpi_comm,ierr)
#endif
114 115
    ENDIF
    IF (strho) THEN
116
       strho=input%total
117 118 119
       input%total = .FALSE.
       !
       CALL timestart("generation of start-density")
120
       CALL stden(mpi,sphhar,stars,atoms,sym,vacuum,&
121
                  input,cell,xcpot,noco,oneD)
122
       !
123
       input%total=strho
124
       CALL timestop("generation of start-density")
125 126 127 128 129 130
    END IF
    IF (mpi%irank == 0) THEN
       !
       !     --->generate spin polarized charge density
       !
       IF (input%swsp) THEN
131
          CALL timestart("optional: spin polarized density")
132
          CALL cdnsp(atoms,input,vacuum,sphhar,stars,sym,noco,oneD,cell)
133 134 135 136 137 138 139
          !
          CALL timestop("optional: spin polarized density")
       END IF
       !
       !     --->flip magnetic moments
       !
       IF (input%lflip) THEN
140

141
          CALL timestart('optional: flip magnetic moments')
142
          CALL flipcdn(atoms,input,vacuum,sphhar,stars,sym,noco,oneD,cell)
143 144 145
          !
          CALL timestop('optional: flip magnetic moments')
       END IF
146

147 148


149
       IF (input%l_bmt) THEN
150
          CALL bmt(stars,input,noco,atoms,sphhar,vacuum,cell,sym,oneD)
151
       ENDIF
152

153
    ENDIF ! mpi%irank == 0
154 155 156 157 158

    IF (input%strho)          CALL juDFT_end("starting density generated",mpi%irank)
    IF (input%swsp)           CALL juDFT_end("spin polarised density generated",mpi%irank)
    IF (input%lflip)          CALL juDFT_end("magnetic moments flipped",mpi%irank)
    IF (input%l_bmt)          CALL juDFT_end('"cdnbmt" written',mpi%irank)
159

160 161
  END SUBROUTINE OPTIONAL
END MODULE m_optional