optional.F90 6.76 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
!--------------------------------------------------------------------------------
! 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
48 49
    !            +-- cdnsp -+- readDensity
    !            |          +- writeDensity
50
    !            |          +- intgr3
51 52
    !            +-- flipcdn -+- readDensity
    !            |            +- writeDensity
53 54
    !            +-- f2u -- wrtdop
    !            +-- u2f -- loddop
55
    !            +-- bmt -+- readDensity
56 57 58 59 60 61 62
    !                     +- wrtdop
    !----------------------------------------
    USE m_bmt
    USE m_plotdop
    USE m_stden
    USE m_cdnsp
    USE m_flipcdn
63
    USE m_cdn_io
64
    USE m_types
65 66
    USE m_pldngen
   
67 68 69
    IMPLICIT NONE
    !     ..
    !     .. Scalar Arguments ..
70

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

98 99
    IF (sliceplot%iplot .AND. (mpi%irank==0) ) THEN
       IF (noco%l_noco) THEN
100
          CALL pldngen(mpi,sym,stars,atoms,sphhar,vacuum,&
101
               cell,input,noco,oneD,sliceplot,cden,mxden,myden,mzden)
102 103 104 105
       ENDIF
    ENDIF

       
106
    IF (mpi%irank == 0) THEN
107
       IF (sliceplot%plpot) input%score = .FALSE.
108 109
       IF (sliceplot%iplot) THEN
          CALL timestart("Plotting")
110
          IF (input%strho) CALL juDFT_error("strho = T and iplot=T",calledby = "optional")
111 112 113 114 115 116 117
          IF (noco%l_noco) THEN
             CALL plotdop(oneD,dimension,stars,vacuum,sphhar,atoms,&
                          input,sym,cell,sliceplot,noco,cden,mxden,myden,mzden)
          ELSE
             CALL plotdop(oneD,dimension,stars,vacuum,sphhar,atoms,&
                          input,sym,cell,sliceplot,noco,cden)
          END IF
118 119 120 121 122 123
          CALL timestop("Plotting")
       END IF
    ENDIF ! mpi%irank == 0
    !
    !     --->generate starting charge density
    !
124
    strho=input%strho
125
    IF (.NOT.(strho.OR.sliceplot%iplot)) THEN
126
       archiveType = CDN_ARCHIVE_TYPE_CDN1_const
127
       IF (noco%l_noco) THEN
128
          archiveType = CDN_ARCHIVE_TYPE_NOCO_const
129
       END IF
130 131 132 133 134 135
       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
136 137
    ENDIF
    IF (strho) THEN
138
       strho=input%total 
139 140 141
       input%total = .FALSE.
       !
       CALL timestart("generation of start-density")
142 143
       CALL stden(mpi,sphhar,stars,atoms,sym,DIMENSION,vacuum,&
                  input,cell,xcpot,obsolete,noco,oneD)
144
       !
145
       input%total=strho
146
       CALL timestop("generation of start-density")
147 148 149 150 151 152
    END IF
    IF (mpi%irank == 0) THEN
       !
       !     --->generate spin polarized charge density
       !
       IF (input%swsp) THEN
153
          CALL timestart("optional: spin polarized density")
154
          CALL cdnsp(atoms,input,vacuum,sphhar,stars,sym,noco,oneD,cell,dimension)
155 156 157 158 159 160 161
          !
          CALL timestop("optional: spin polarized density")
       END IF
       !
       !     --->flip magnetic moments
       !
       IF (input%lflip) THEN
162

163
          CALL timestart('optional: flip magnetic moments')
164
          CALL flipcdn(atoms,input,vacuum,sphhar,stars,sym,noco,oneD,cell)
165 166 167
          !
          CALL timestop('optional: flip magnetic moments')
       END IF
168

169 170
 
 
171
       IF (input%l_bmt) THEN
172
          CALL bmt(stars,input,noco,atoms,sphhar,vacuum,cell,sym,oneD)
173
       ENDIF
174

175
    ENDIF ! mpi%irank == 0
176 177 178 179 180 181 182

    IF (sliceplot%iplot)      CALL juDFT_end("density plot o.k.",mpi%irank)
    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)
    
183 184
  END SUBROUTINE OPTIONAL
END MODULE m_optional