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 : MODULE m_optional
7 : USE m_juDFT
8 : #ifdef CPP_MPI
9 : use mpi
10 : #endif
11 : CONTAINS
12 160 : SUBROUTINE OPTIONAL(fmpi, atoms,sphhar,vacuum,&
13 : stars,input,sym, cell, sliceplot, xcpot, noco)
14 : !
15 : !----------------------------------------
16 : ! this routine is called by: fleur.F90
17 : !
18 : ! optional stden -+- atom2 -+- setcor
19 : ! | | +- stpot1
20 : ! | | +- differ -+- inwint
21 : ! | | | +- outint
22 : ! | | +- vxcall (-> see vgen.F) or:
23 : ! | | +- potl0 -+- grdchlh
24 : ! | | | +- mkgl0
25 : ! | | | +- vxcallg (-> see vgen.F)
26 : ! | | +- intgr1
27 : ! | +- cdnovlp -+- spgrot
28 : ! | | +- rcerf --wofz
29 : ! | | +- diflgr
30 : ! | | +- qpw_to_nmt -+- phasy1 -+- spgrot
31 : ! | | | +- ylm3
32 : ! | | +- sphbes
33 : ! | +- qfix -- cdntot -+- intgr3
34 : ! | | +- qsf
35 : ! | | +- pwint -- spgrot
36 : ! | +- wrtdop
37 : ! | +- points -- qranf
38 : ! | +- sphpts -- qranf
39 : ! | +- checkdop -+- starf3
40 : ! | +- starf2 -- spgrot
41 : ! | +- fitchk
42 : ! | +- ylm3
43 : ! +-- cdnsp -+- readDensity
44 : ! | +- writeDensity
45 : ! | +- intgr3
46 : ! +-- flipcdn -+- readDensity
47 : ! | +- writeDensity
48 : ! +-- f2u -- wrtdop
49 : ! +-- u2f -- loddop
50 : !----------------------------------------
51 : USE m_stden
52 : USE m_cdnsp
53 : USE m_flipcdn
54 : USE m_cdn_io
55 : USE m_types
56 :
57 :
58 : IMPLICIT NONE
59 : ! ..
60 : ! .. Scalar Arguments ..
61 :
62 : TYPE(t_mpi),INTENT(IN) :: fmpi
63 : TYPE(t_atoms),INTENT(IN) :: atoms
64 :
65 : TYPE(t_sphhar),INTENT(IN) :: sphhar
66 : TYPE(t_sym),INTENT(IN) :: sym
67 : TYPE(t_stars),INTENT(IN) :: stars
68 :
69 : TYPE(t_input),INTENT(IN) :: input
70 : TYPE(t_noco),INTENT(IN) :: noco
71 : TYPE(t_vacuum),INTENT(IN) :: vacuum
72 : TYPE(t_cell),INTENT(IN) :: cell
73 : CLASS(t_xcpot),INTENT(IN) :: xcpot
74 : TYPE(t_sliceplot),INTENT(IN):: sliceplot
75 : ! ..
76 : ! .. Local Scalars ..
77 : INTEGER :: it, archiveType, atomsCounter
78 : CHARACTER*10 :: cdnfname
79 : LOGICAL :: strho
80 : LOGICAL :: stateCheck=.TRUE.
81 : #ifdef CPP_MPI
82 : INTEGER :: ierr
83 : #endif
84 : ! ..
85 160 : it = 1
86 :
87 :
88 : !
89 : ! --->generate starting charge density
90 : !
91 160 : strho=input%strho
92 160 : IF (.NOT.(strho.OR.(sliceplot%iplot.NE.0))) THEN
93 160 : archiveType = CDN_ARCHIVE_TYPE_CDN1_const
94 408 : IF (any(noco%l_unrestrictMT)) THEN
95 18 : archiveType = CDN_ARCHIVE_TYPE_FFN_const
96 142 : ELSE IF (noco%l_noco) THEN
97 34 : archiveType = CDN_ARCHIVE_TYPE_NOCO_const
98 : END IF
99 160 : IF (fmpi%irank == 0) THEN
100 80 : strho = .NOT.isDensityFilePresent(archiveType)
101 : END IF
102 : #ifdef CPP_MPI
103 160 : CALL MPI_BCAST(strho,1,MPI_LOGICAL,0,fmpi%mpi_comm,ierr)
104 : #endif
105 : ENDIF
106 160 : IF (strho) THEN
107 : !strho=input%total
108 : !input%total = .FALSE.
109 : !
110 136 : CALL timestart("generation of start-density")
111 136 : IF (input%jspins.EQ.2) THEN
112 250 : DO atomsCounter=1, atoms%ntype
113 1918 : IF(.NOT.MAXVAL(ABS(atoms%econf(atomsCounter)%Occupation(:,1)-atoms%econf(atomsCounter)%Occupation(:,2))).EQ.0)stateCheck=.FALSE.
114 : END DO
115 : END IF
116 136 : IF (stateCheck.AND.(input%jspins.EQ.2)) CALL juDFT_warn("You're setting up a spin-polarized calculation (jspins=2) without any actual polarization given in the systems occupation. You're sure you want that?", calledby = "optional")
117 : CALL stden(fmpi,sphhar,stars,atoms,sym,vacuum,&
118 136 : input,cell,xcpot,noco )
119 : !
120 : !input%total=strho
121 136 : CALL timestop("generation of start-density")
122 : END IF
123 160 : IF (fmpi%irank == 0) THEN
124 : !
125 : ! --->generate spin polarized charge density
126 : !
127 80 : IF (input%swsp) THEN
128 1 : CALL timestart("optional: spin polarized density")
129 1 : CALL cdnsp(atoms,input,vacuum,sphhar,stars,sym,noco ,cell)
130 : !
131 1 : CALL timestop("optional: spin polarized density")
132 : END IF
133 : !
134 : ! --->flip magnetic moments
135 : !
136 80 : IF (input%lflip) THEN
137 :
138 2 : CALL timestart('optional: flip magnetic moments')
139 2 : CALL flipcdn(atoms,input,vacuum,sphhar,stars,sym,noco ,cell,toGlobal=.true.)
140 2 : print *,"TODO,toGlobal in optional should be removed"
141 2 : CALL timestop('optional: flip magnetic moments')
142 : END IF
143 :
144 :
145 :
146 :
147 : ENDIF ! fmpi%irank == 0
148 :
149 160 : IF (input%strho) CALL juDFT_end("starting density generated",fmpi%irank)
150 160 : IF (input%swsp) CALL juDFT_end("spin polarised density generated",fmpi%irank)
151 158 : IF (input%lflip) CALL juDFT_end("magnetic moments flipped",fmpi%irank)
152 :
153 154 : END SUBROUTINE OPTIONAL
154 : END MODULE m_optional
|