fleur_init.F90 34.8 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.
!--------------------------------------------------------------------------------
6 7 8
      MODULE m_fleur_init
      IMPLICIT NONE
      CONTAINS
9
        SUBROUTINE fleur_init(mpi,&
10 11
             input,DIMENSION,atoms,sphhar,cell,stars,sym,noco,vacuum,&
             sliceplot,banddos,obsolete,enpara,xcpot,results,jij,kpts,hybrid,&
12
             oneD,coreSpecInput,wann,l_opti)
13
          USE m_judft
14
          USE m_juDFT_init
15
          USE m_types
16
          USE m_init_wannier_defaults
17
          USE m_rinpXML
Daniel Wortmann's avatar
Daniel Wortmann committed
18
          USE m_postprocessInput
19 20 21 22 23 24 25
          USE m_dimens
          USE m_inped
          USE m_setup
          USE m_gen_map
          USE m_dwigner
          USE m_gen_bz
          USE m_ylm
26
          USE m_InitParallelProcesses
27
          USE m_xmlOutput
Daniel Wortmann's avatar
Daniel Wortmann committed
28
          USE m_constants
29
          USE m_winpXML
30
          USE m_writeOutParameters
Daniel Wortmann's avatar
Daniel Wortmann committed
31
          USE m_setupMPI
32
          USE m_cdn_io
33
          USE m_fleur_info
34
          USE m_checks
35
          USE m_writeOutHeader
36 37
#ifdef CPP_MPI
          USE m_mpi_bc_all,  ONLY : mpi_bc_all
Daniel Wortmann's avatar
Daniel Wortmann committed
38 39 40
#endif
#ifdef CPP_HDF
          USE m_hdf_tools
41 42 43 44 45
#endif
          IMPLICIT NONE
          !     Types, these variables contain a lot of data!
          TYPE(t_mpi)    ,INTENT(INOUT):: mpi
          TYPE(t_input)    ,INTENT(OUT):: input
Daniel Wortmann's avatar
Daniel Wortmann committed
46
          TYPE(t_dimension),INTENT(OUT):: DIMENSION
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
          TYPE(t_atoms)    ,INTENT(OUT):: atoms
          TYPE(t_sphhar)   ,INTENT(OUT):: sphhar
          TYPE(t_cell)     ,INTENT(OUT):: cell
          TYPE(t_stars)    ,INTENT(OUT):: stars
          TYPE(t_sym)      ,INTENT(OUT):: sym
          TYPE(t_noco)     ,INTENT(OUT):: noco
          TYPE(t_vacuum)   ,INTENT(OUT):: vacuum
          TYPE(t_sliceplot),INTENT(OUT):: sliceplot
          TYPE(t_banddos)  ,INTENT(OUT):: banddos
          TYPE(t_obsolete) ,INTENT(OUT):: obsolete 
          TYPE(t_enpara)   ,INTENT(OUT):: enpara
          TYPE(t_xcpot)    ,INTENT(OUT):: xcpot
          TYPE(t_results)  ,INTENT(OUT):: results
          TYPE(t_jij)      ,INTENT(OUT):: jij
          TYPE(t_kpts)     ,INTENT(OUT):: kpts
          TYPE(t_hybrid)   ,INTENT(OUT):: hybrid
          TYPE(t_oneD)     ,INTENT(OUT):: oneD
64
          TYPE(t_coreSpecInput),INTENT(OUT) :: coreSpecInput
65
          TYPE(t_wann)     ,INTENT(OUT):: wann
66
          LOGICAL,          INTENT(OUT):: l_opti
67

68

69 70 71 72 73 74
          INTEGER, ALLOCATABLE          :: xmlElectronStates(:,:)
          INTEGER, ALLOCATABLE          :: atomTypeSpecies(:)
          INTEGER, ALLOCATABLE          :: speciesRepAtomType(:)
          REAL, ALLOCATABLE             :: xmlCoreOccs(:,:,:)
          LOGICAL, ALLOCATABLE          :: xmlPrintCoreStates(:,:)
          CHARACTER(len=3), ALLOCATABLE :: noel(:)
75
          !     .. Local Scalars ..
76
          INTEGER    :: i,n,l,m1,m2,isym,iisym,numSpecies,pc,iAtom,iType
77
          COMPLEX    :: cdum
78
          CHARACTER(len=4)              :: namex
79
          CHARACTER(len=12)             :: relcor, tempNumberString
80
          CHARACTER(LEN=20)             :: filename
81
          REAL                          :: a1(3),a2(3),a3(3)
82
          REAL                          :: scale, dtild, phi_add
83
          LOGICAL                       :: l_found, l_kpts, l_exist, l_krla
84

85 86 87 88 89 90 91 92
#ifdef CPP_MPI
          INCLUDE 'mpif.h'
          INTEGER ierr(3)
          CALL MPI_COMM_RANK (mpi%mpi_comm,mpi%irank,ierr)
          CALL MPI_COMM_SIZE (mpi%mpi_comm,mpi%isize,ierr)
#else
          mpi%irank=0 ; mpi%isize=1; mpi%mpi_comm=1
#endif
93 94 95 96 97 98 99 100 101 102 103 104 105 106
          !determine if we use an xml-input file
          INQUIRE (file='inp.xml',exist=input%l_inpXML)
          INQUIRE(file='inp',exist=l_found)
          IF (input%l_inpXML) THEN
             !xml found, we will use it, check if we also have a inp-file
             IF (l_found.AND..NOT.(juDFT_was_argument("-xmlInput").OR.juDFT_was_argument("-xml"))) &
                  CALL judft_warn("Both inp & inp.xml given.",calledby="fleur_init",hint="Please delete one of the input files or specify -xml to use inp.xml")
          ELSE
             IF(juDFT_was_argument("-xmlInput").OR.juDFT_was_argument("-xml")) &
                  CALL judft_error("inp.xml not found",calledby="fleur_init",hint="You gave the -xml option but provided no inp.xml file")
             IF (.NOT.l_found) CALL judft_error("No input file found",calledby='fleur_init',hint="To use FLEUR, you have to provide either an 'inp' or an 'inp.xml' file in the working directory")
          END IF


107

108
          CALL check_command_line()
Daniel Wortmann's avatar
Daniel Wortmann committed
109
#ifdef CPP_HDF
110
          CALL hdf_init()
Daniel Wortmann's avatar
Daniel Wortmann committed
111
#endif
112 113 114 115 116 117 118 119 120 121 122 123
          results%seigscv         = 0.0
          results%te_vcoul        = 0.0
          results%te_veff         = 0.0
          results%te_exc          = 0.0
          results%te_hfex%valence = 0.0
          results%te_hfex%core    = 0.0
          results%e_ldau          = 0.0
          results%ts              = 0.0
          input%gw                = -1
          input%gw_neigd          =  0
          !-t3e
          IF (mpi%irank.EQ.0) THEN
124
             CALL startXMLOutput()
Daniel Wortmann's avatar
Daniel Wortmann committed
125
             IF (judft_was_argument("-info")) THEN
126
                  CLOSE(6)
Daniel Wortmann's avatar
Daniel Wortmann committed
127 128
                  OPEN (6,status='SCRATCH')
             ELSE
129
                  IF (.not.judft_was_argument("-no_out")) &
Daniel Wortmann's avatar
Daniel Wortmann committed
130 131
                  OPEN (6,file='out',form='formatted',status='unknown')
             ENDIF
132
             CALL writeOutHeader()
Daniel Wortmann's avatar
Daniel Wortmann committed
133 134 135 136 137
             IF (judft_was_argument("-info")) THEN
                OPEN (16,status='SCRATCH')
             ELSE
                OPEN (16,file='inf',form='formatted',status='unknown')
             ENDIF
138 139
          ENDIF

140 141
          CALL initWannierDefaults(wann)

142
          input%minDistance = 0.0
143 144
          input%ldauLinMix = .FALSE.
          input%ldauMixParam = 0.05
145
          input%ldauSpinf = 1.0
146 147
          input%pallst = .FALSE.

148
          kpts%ntet = 1
149
          kpts%numSpecialPoints = 1
150 151 152 153 154 155 156

          sliceplot%iplot=.FALSE.
          sliceplot%kk = 0
          sliceplot%e1s = 0.0
          sliceplot%e2s = 0.0
          sliceplot%nnne = 0

157
          IF (input%l_inpXML) THEN
Daniel Wortmann's avatar
Daniel Wortmann committed
158
             ALLOCATE(noel(1))
159
             IF (mpi%irank.EQ.0) THEN
160
                WRITE (6,*) 'XML code path used: Calculation parameters are stored in out.xml'
161
                ALLOCATE(kpts%specialPoints(3,kpts%numSpecialPoints))
Daniel Wortmann's avatar
Daniel Wortmann committed
162
                ALLOCATE(atomTypeSpecies(1),speciesRepAtomType(1))
163 164 165 166 167 168 169 170
                ALLOCATE(xmlElectronStates(1,1),xmlPrintCoreStates(1,1))
                ALLOCATE(xmlCoreOccs(1,1,1))
                namex = '    '
                relcor = '            '
                a1 = 0.0
                a2 = 0.0
                a3 = 0.0
                scale = 1.0
171
                CALL r_inpXML(&
172
                     atoms,obsolete,vacuum,input,stars,sliceplot,banddos,DIMENSION,&
173
                     cell,sym,xcpot,noco,Jij,oneD,hybrid,kpts,enpara,coreSpecInput,wann,&
174
                     noel,namex,relcor,a1,a2,a3,scale,dtild,xmlElectronStates,&
Daniel Wortmann's avatar
Daniel Wortmann committed
175
                     xmlPrintCoreStates,xmlCoreOccs,atomTypeSpecies,speciesRepAtomType,&
176
                     l_kpts)
177

Daniel Wortmann's avatar
Daniel Wortmann committed
178
                ALLOCATE (results%force(3,atoms%ntype,DIMENSION%jspd))
179 180
                ALLOCATE (results%force_old(3,atoms%ntype))
                results%force(:,:,:) = 0.0
181
             END IF
182

183 184
             CALL postprocessInput(mpi,input,sym,stars,atoms,vacuum,obsolete,kpts,&
                                   oneD,hybrid,jij,cell,banddos,sliceplot,xcpot,&
185
                                   noco,dimension,enpara,sphhar,l_opti,noel,l_kpts)
186

187
             IF (mpi%irank.EQ.0) THEN
188
                filename = ''
189 190
                numSpecies = SIZE(speciesRepAtomType)
                CALL w_inpXML(&
Daniel Wortmann's avatar
Daniel Wortmann committed
191
                              atoms,obsolete,vacuum,input,stars,sliceplot,banddos,&
Daniel Wortmann's avatar
Daniel Wortmann committed
192
                              cell,sym,xcpot,noco,jij,oneD,hybrid,kpts,kpts%nkpt3,kpts%l_gamma,&
Daniel Wortmann's avatar
Daniel Wortmann committed
193 194 195 196
                              noel,namex,relcor,a1,a2,a3,scale,dtild,input%comment,&
                              xmlElectronStates,xmlPrintCoreStates,xmlCoreOccs,&
                              atomTypeSpecies,speciesRepAtomType,.TRUE.,filename,&
                             .TRUE.,numSpecies,enpara)
Daniel Wortmann's avatar
Daniel Wortmann committed
197 198

                DEALLOCATE(atomTypeSpecies,speciesRepAtomType)
199
                DEALLOCATE(xmlElectronStates,xmlPrintCoreStates,xmlCoreOccs)
200
             END IF
201

Daniel Wortmann's avatar
Daniel Wortmann committed
202 203
             DEALLOCATE(noel)

204 205
#ifdef CPP_MPI
             CALL initParallelProcesses(atoms,vacuum,input,stars,sliceplot,banddos,&
206 207
                  DIMENSION,cell,sym,xcpot,noco,jij,oneD,hybrid,&
                  kpts,enpara,sphhar,mpi,results,obsolete)
208 209
#endif

210 211
          ELSE ! else branch of "IF (input%l_inpXML) THEN"

Daniel Wortmann's avatar
Daniel Wortmann committed
212 213 214 215 216 217 218 219 220 221 222
             namex = '    '
             relcor = '            '

             !--- J< 
             jij%l_wr=.TRUE.
             jij%nqptd=1
             jij%nmagn=1
             jij%mtypes=1
             jij%phnd=1
             !--- J>

223 224 225 226 227 228 229
             CALL dimens(&
                  &            mpi,input,&
                  &            sym,stars,&
                  &            atoms,sphhar,&
                  &            DIMENSION,vacuum,&
                  &            obsolete,kpts,&
                  &            oneD,hybrid,Jij)
230 231


232 233 234 235 236 237
             DIMENSION%nn2d= (2*stars%mx1+1)* (2*stars%mx2+1)
             DIMENSION%nn3d= (2*stars%mx1+1)* (2*stars%mx2+1)* (2*stars%mx3+1)
             !-odim
             IF (oneD%odd%d1) THEN
                oneD%odd%k3 = stars%mx3
                oneD%odd%nn2d = (2*(oneD%odd%k3) + 1)*(2*(oneD%odd%M) + 1)
238
             ELSE
239
                oneD%odd%k3 = 0 ; oneD%odd%M =0 ; oneD%odd%nn2d = 1
240
                oneD%odd%mb = 0
241 242
             ENDIF
             !-odim
243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295
             ALLOCATE ( atoms%nz(atoms%ntype),atoms%relax(3,atoms%ntype),atoms%nlhtyp(atoms%ntype))
             ALLOCATE ( sphhar%clnu(sphhar%memd,0:sphhar%nlhd,sphhar%ntypsd),stars%ustep(stars%ng3) )
             ALLOCATE ( stars%ig(-stars%mx1:stars%mx1,-stars%mx2:stars%mx2,-stars%mx3:stars%mx3),stars%ig2(stars%ng3) )
             ALLOCATE ( atoms%jri(atoms%ntype),stars%kv2(2,stars%ng2),stars%kv3(3,stars%ng3),sphhar%llh(0:sphhar%nlhd,sphhar%ntypsd) )
             ALLOCATE (sym%mrot(3,3,sym%nop),sym%tau(3,sym%nop))
             ALLOCATE ( atoms%lmax(atoms%ntype),sphhar%mlh(sphhar%memd,0:sphhar%nlhd,sphhar%ntypsd))!,sym%mrot(3,3,sym%nop) )
             ALLOCATE ( atoms%ncv(atoms%ntype),atoms%neq(atoms%ntype),atoms%ngopr(atoms%nat) )
             ALLOCATE ( sphhar%nlh(sphhar%ntypsd),sphhar%nmem(0:sphhar%nlhd,sphhar%ntypsd) )
             ALLOCATE ( stars%nstr2(stars%ng2),atoms%ntypsy(atoms%nat),stars%nstr(stars%ng3) )
             ALLOCATE ( stars%igfft(0:DIMENSION%nn3d-1,2),stars%igfft2(0:DIMENSION%nn2d-1,2),atoms%nflip(atoms%ntype) )
             ALLOCATE ( atoms%ncst(atoms%ntype) )
             ALLOCATE ( vacuum%izlay(vacuum%layerd,2) )
             ALLOCATE ( sym%invarop(atoms%nat,sym%nop),sym%invarind(atoms%nat) )
             ALLOCATE ( sym%multab(sym%nop,sym%nop),sym%invtab(sym%nop) )
             ALLOCATE ( atoms%invsat(atoms%nat),sym%invsatnr(atoms%nat) )
             ALLOCATE ( atoms%lnonsph(atoms%ntype) )
             ALLOCATE ( atoms%dx(atoms%ntype),atoms%pos(3,atoms%nat))!,sym%tau(3,sym%nop) )
             ALLOCATE ( atoms%rmsh(atoms%jmtd,atoms%ntype),atoms%rmt(atoms%ntype),stars%sk2(stars%ng2),stars%sk3(stars%ng3) )
             ALLOCATE ( stars%phi2(stars%ng2) )
             ALLOCATE ( atoms%taual(3,atoms%nat),atoms%volmts(atoms%ntype),atoms%zatom(atoms%ntype) )
             ALLOCATE ( enpara%el0(0:atoms%lmaxd,atoms%ntype,DIMENSION%jspd) )
             ALLOCATE ( enpara%evac0(2,DIMENSION%jspd),stars%rgphs(-stars%mx1:stars%mx1,-stars%mx2:stars%mx2,-stars%mx3:stars%mx3)  )
             ALLOCATE ( results%force(3,atoms%ntype,DIMENSION%jspd) )
             ALLOCATE ( results%force_old(3,atoms%ntype) )
             ALLOCATE ( kpts%bk(3,kpts%nkpt),kpts%wtkpt(kpts%nkpt) )
             ALLOCATE ( stars%pgfft(0:DIMENSION%nn3d-1),stars%pgfft2(0:DIMENSION%nn2d-1) )
             ALLOCATE ( stars%ufft(0:27*stars%mx1*stars%mx2*stars%mx3-1) )
             ALLOCATE ( atoms%bmu(atoms%ntype),atoms%vr0(atoms%ntype) )
             ALLOCATE ( enpara%lchange(0:atoms%lmaxd,atoms%ntype,DIMENSION%jspd) )
             ALLOCATE ( enpara%lchg_v(2,DIMENSION%jspd),atoms%l_geo(atoms%ntype) )
             ALLOCATE ( atoms%nlo(atoms%ntype),atoms%llo(atoms%nlod,atoms%ntype),enpara%skiplo(atoms%ntype,DIMENSION%jspd) )
             ALLOCATE ( enpara%ello0(atoms%nlod,atoms%ntype,DIMENSION%jspd),enpara%llochg(atoms%nlod,atoms%ntype,DIMENSION%jspd) )
             ALLOCATE ( atoms%lo1l(0:atoms%llod,atoms%ntype),atoms%nlol(0:atoms%llod,atoms%ntype),atoms%lapw_l(atoms%ntype) )
             ALLOCATE ( noco%alphInit(atoms%ntype),noco%alph(atoms%ntype),noco%beta(atoms%ntype),noco%l_relax(atoms%ntype) )
             ALLOCATE ( jij%alph1(atoms%ntype),jij%l_magn(atoms%ntype),jij%M(atoms%ntype) )
             ALLOCATE ( jij%magtype(atoms%ntype),jij%nmagtype(atoms%ntype) )
             ALLOCATE ( noco%b_con(2,atoms%ntype),atoms%lda_u(atoms%ntype),atoms%l_dulo(atoms%nlod,atoms%ntype) )
             ALLOCATE ( enpara%enmix(DIMENSION%jspd),sym%d_wgn(-3:3,-3:3,3,sym%nop) )
             ALLOCATE ( atoms%ulo_der(atoms%nlod,atoms%ntype) )
             ALLOCATE ( noco%soc_opt(atoms%ntype+2) )
             ALLOCATE ( atoms%numStatesProvided(atoms%ntype))
             ALLOCATE ( kpts%ntetra(4,kpts%ntet), kpts%voltet(kpts%ntet))
             !+odim
             ALLOCATE ( oneD%ig1(-oneD%odd%k3:oneD%odd%k3,-oneD%odd%M:oneD%odd%M) )
             ALLOCATE ( oneD%kv1(2,oneD%odd%n2d),oneD%nstr1(oneD%odd%n2d) )
             ALLOCATE ( oneD%ngopr1(atoms%nat),oneD%mrot1(3,3,oneD%odd%nop),oneD%tau1(3,oneD%odd%nop) )
             ALLOCATE ( oneD%invtab1(oneD%odd%nop),oneD%multab1(oneD%odd%nop,oneD%odd%nop) )
             ALLOCATE ( oneD%igfft1(0:oneD%odd%nn2d-1,2),oneD%pgfft1(0:oneD%odd%nn2d-1) )
             stars%sk2(:) = 0.0 ; stars%phi2(:) = 0.0
             !-odim

             ! HF/hybrid functionals/EXX
             ALLOCATE ( hybrid%nindx(0:atoms%lmaxd,atoms%ntype) )
296
           
297
             kpts%specificationType = 0
298
             atoms%numStatesProvided(:) = 0
299
             input%l_coreSpec = .FALSE.
300 301 302

             jij%M(:)             = 0.0
             jij%l_magn(:)        =.FALSE.
Daniel Wortmann's avatar
Daniel Wortmann committed
303 304

             atoms%vr0(:)         = 0.0
305 306 307
             results%force(:,:,:) = 0.0

             CALL timestart("preparation:stars,lattice harmonics,+etc")
Daniel Wortmann's avatar
Daniel Wortmann committed
308

309
             !+t3e
310 311
             IF (mpi%irank.EQ.0) THEN
                !-t3e
312 313 314 315
                CALL inped(atoms,obsolete,vacuum,&
                           input,banddos,xcpot,sym,&
                           cell,sliceplot,noco,&
                           stars,oneD,jij,hybrid,kpts,scale,a1,a2,a3,namex,relcor)
316
                !
317
                IF (xcpot%is_gga()) THEN
318 319
                   ALLOCATE (stars%ft2_gfx(0:DIMENSION%nn2d-1),stars%ft2_gfy(0:DIMENSION%nn2d-1))
                   ALLOCATE (oneD%pgft1x(0:oneD%odd%nn2d-1),oneD%pgft1xx(0:oneD%odd%nn2d-1),&
320 321
                             oneD%pgft1xy(0:oneD%odd%nn2d-1),&
                             oneD%pgft1y(0:oneD%odd%nn2d-1),oneD%pgft1yy(0:oneD%odd%nn2d-1))
322 323 324
                ELSE
                   ALLOCATE (stars%ft2_gfx(0:1),stars%ft2_gfy(0:1))
                   ALLOCATE (oneD%pgft1x(0:1),oneD%pgft1xx(0:1),oneD%pgft1xy(0:1),&
325
                             oneD%pgft1y(0:1),oneD%pgft1yy(0:1))
326 327
                ENDIF
                oneD%odd%nq2 = oneD%odd%n2d
328
                oneD%odi%nq2 = oneD%odd%nq2
329 330 331 332 333 334 335 336
                !-odim
                !+t3e
                INQUIRE(file="cdn1",exist=l_opti)
                IF (noco%l_noco) INQUIRE(file="rhomat_inp",exist=l_opti)
                l_opti=.NOT.l_opti
                IF ((sliceplot%iplot).OR.(input%strho).OR.(input%swsp).OR.&
                     &    (input%lflip).OR.(obsolete%l_f2u).OR.(obsolete%l_u2f).OR.(input%l_bmt)) l_opti = .TRUE.
                !
337 338 339

                namex=xcpot%get_name()
                l_krla = xcpot%krla.EQ.1
Daniel Wortmann's avatar
Daniel Wortmann committed
340
             END IF ! mpi%irank.eq.0
341 342 343 344 345 346 347 348 349 350 351 352 353 354

#ifdef CPP_MPI
             CALL MPI_BCAST(namex,4,MPI_CHARACTER,0,mpi%mpi_comm,ierr)
             CALL MPI_BCAST(l_krla,1,MPI_LOGICAL,0,mpi%mpi_comm,ierr)
#endif
             IF (mpi%irank.NE.0) THEN
                CALL xcpot%init(namex,l_krla)
             END IF

             CALL setup(mpi,atoms,kpts,DIMENSION,sphhar,&
                        obsolete,sym,stars,oneD,input,noco,&
                        vacuum,cell,xcpot,&
                        sliceplot,enpara,l_opti)

Daniel Wortmann's avatar
Daniel Wortmann committed
355
             IF (mpi%irank.EQ.0) THEN
356 357 358
                !
                stars%ng3=stars%ng3 ; stars%ng2=stars%ng2 
                !+t3e
Daniel Wortmann's avatar
Daniel Wortmann committed
359 360
                banddos%l_orb = .FALSE.
                banddos%orbCompAtom = 0
Daniel Wortmann's avatar
Daniel Wortmann committed
361

362
                ALLOCATE(xcpot%lda_atom(atoms%ntype))
363
                ALLOCATE(noco%socscale(atoms%ntype))
364
                xcpot%lda_atom(:) = .FALSE.
365
                noco%socscale(:) = 1.0
366

Daniel Wortmann's avatar
Daniel Wortmann committed
367 368 369 370 371 372 373 374 375 376 377 378
                IF(juDFT_was_argument("-toXML")) THEN
                   WRITE(*,*) ''
                   WRITE(*,*) 'Please note:'
                   WRITE(*,*) 'The inp to xml input conversion is experimental and'
                   WRITE(*,*) 'only made for basic inp files without sophisticated'
                   WRITE(*,*) 'parametrizations. You might have to adjust the generated'
                   WRITE(*,*) 'file by hand to really obtain an adequate input file.'
                   WRITE(*,*) 'Also the generated XML input file is not meant to be'
                   WRITE(*,*) 'beautiful.'
                   WRITE(*,*) ''
                   ALLOCATE(noel(atoms%ntype),atomTypeSpecies(atoms%ntype),speciesRepAtomType(atoms%ntype))
                   ALLOCATE(xmlElectronStates(29,atoms%ntype),xmlPrintCoreStates(29,atoms%ntype))
379
                   ALLOCATE(xmlCoreOccs(1,1,1),atoms%label(atoms%nat))
Daniel Wortmann's avatar
Daniel Wortmann committed
380 381 382
                   filename = 'inpConverted.xml'
                   xmlElectronStates = noState_const
                   xmlPrintCoreStates = .FALSE.
383
                   DO i = 1, atoms%nat
384
                      WRITE(atoms%label(i),'(i0)') i
385
                   END DO
Daniel Wortmann's avatar
Daniel Wortmann committed
386 387 388 389 390 391
                   DO i = 1, atoms%ntype
                      noel(i) = namat_const(atoms%nz(i))
                      atomTypeSpecies(i) = i
                      speciesRepAtomType(i) = i
                   END DO
                   numSpecies = SIZE(speciesRepAtomType)
392 393 394 395 396 397 398
                   ALLOCATE(atoms%speciesName(numSpecies))
                   atoms%speciesName = ''
                   DO i = 1, numSpecies
                      tempNumberString = ''
                      WRITE(tempNumberString,'(i0)') i
                      atoms%speciesName(i) = TRIM(ADJUSTL(noel(speciesRepAtomType(i)))) // '-' // TRIM(ADJUSTL(tempNumberString))
                   END DO
Daniel Wortmann's avatar
Daniel Wortmann committed
399 400 401
                   a1(:) = a1(:) / scale
                   a2(:) = a2(:) / scale
                   a3(:) = a3(:) / scale
Daniel Wortmann's avatar
Daniel Wortmann committed
402 403
                   kpts%specificationType = 3
                   sym%symSpecType = 3
Daniel Wortmann's avatar
Daniel Wortmann committed
404 405
                   CALL w_inpXML(&
                                 atoms,obsolete,vacuum,input,stars,sliceplot,banddos,&
Daniel Wortmann's avatar
Daniel Wortmann committed
406
                                 cell,sym,xcpot,noco,jij,oneD,hybrid,kpts,kpts%nkpt3,kpts%l_gamma,&
Daniel Wortmann's avatar
Daniel Wortmann committed
407 408 409 410
                                 noel,namex,relcor,a1,a2,a3,scale,dtild,input%comment,&
                                 xmlElectronStates,xmlPrintCoreStates,xmlCoreOccs,&
                                 atomTypeSpecies,speciesRepAtomType,.FALSE.,filename,&
                                 .TRUE.,numSpecies,enpara)
411
                   DEALLOCATE(atoms%speciesName, atoms%label)
Daniel Wortmann's avatar
Daniel Wortmann committed
412 413 414 415 416
                   DEALLOCATE(noel,atomTypeSpecies,speciesRepAtomType)
                   DEALLOCATE(xmlElectronStates,xmlPrintCoreStates,xmlCoreOccs)
                   CALL juDFT_end("Fleur inp to XML input conversion completed.")
                END IF
             END IF ! mpi%irank.eq.0
417
             CALL timestop("preparation:stars,lattice harmonics,+etc")
418 419

          END IF ! end of else branch of "IF (input%l_inpXML) THEN"
420 421 422 423
          !
          !-odim
          oneD%odd%nq2 = oneD%odd%n2d
          oneD%odd%kimax2 = oneD%odd%nq2 - 1
Daniel Wortmann's avatar
Daniel Wortmann committed
424
          oneD%odd%nat = atoms%nat
425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444

          oneD%odi%d1 = oneD%odd%d1 ; oneD%odi%mb = oneD%odd%mb ; oneD%odi%M = oneD%odd%M
          oneD%odi%k3 = oneD%odd%k3 ; oneD%odi%chi = oneD%odd%chi ; oneD%odi%rot = oneD%odd%rot
          oneD%odi%invs = oneD%odd%invs ; oneD%odi%zrfs = oneD%odd%zrfs
          oneD%odi%n2d = oneD%odd%n2d ; oneD%odi%nq2 = oneD%odd%nq2 ; oneD%odi%nn2d = oneD%odd%nn2d
          oneD%odi%kimax2 = oneD%odd%kimax2 ; oneD%odi%m_cyl = oneD%odd%m_cyl
          oneD%odi%ig => oneD%ig1 ; oneD%odi%kv => oneD%kv1 ; oneD%odi%nst2 => oneD%nstr1

          oneD%ods%nop = oneD%odd%nop ; oneD%ods%nat = oneD%odd%nat
          oneD%ods%mrot => oneD%mrot1 ; oneD%ods%tau => oneD%tau1 ; oneD%ods%ngopr => oneD%ngopr1
          oneD%ods%invtab => oneD%invtab1 ; oneD%ods%multab => oneD%multab1

          oneD%odl%nn2d = oneD%odd%nn2d
          oneD%odl%igf => oneD%igfft1 ; oneD%odl%pgf => oneD%pgfft1

          oneD%odg%nn2d = oneD%odd%nn2d
          oneD%odg%pgfx => oneD%pgft1x ; oneD%odg%pgfy => oneD%pgft1y
          oneD%odg%pgfxx => oneD%pgft1xx ; oneD%odg%pgfyy => oneD%pgft1yy ; oneD%odg%pgfxy => oneD%pgft1xy
          !+odim
          !
445

446 447 448 449 450 451 452 453 454 455 456 457 458
#ifdef CPP_MPI
          CALL MPI_BCAST(l_opti,1,MPI_LOGICAL,0,mpi%mpi_comm,ierr)
          CALL MPI_BCAST(noco%l_noco,1,MPI_LOGICAL,0,mpi%mpi_comm,ierr)
          CALL MPI_BCAST(noco%l_soc,1,MPI_LOGICAL,0,mpi%mpi_comm,ierr)
          CALL MPI_BCAST(input%strho ,1,MPI_LOGICAL,0,mpi%mpi_comm,ierr)
          CALL MPI_BCAST(input%jspins,1,MPI_INTEGER,0,mpi%mpi_comm,ierr)
          CALL MPI_BCAST(atoms%n_u,1,MPI_INTEGER,0,mpi%mpi_comm,ierr)
          CALL MPI_BCAST(atoms%lmaxd,1,MPI_INTEGER,0,mpi%mpi_comm,ierr)
#endif
          CALL ylmnorm_init(atoms%lmaxd)
          !
          !--> determine more dimensions
          !
Daniel Wortmann's avatar
Daniel Wortmann committed
459
          DIMENSION%nbasfcn = DIMENSION%nvd + atoms%nat*atoms%nlod*(2*atoms%llod+1)
Daniel Wortmann's avatar
Daniel Wortmann committed
460 461
          DIMENSION%lmd     = atoms%lmaxd* (atoms%lmaxd+2)
          DIMENSION%lmplmd  = (DIMENSION%lmd* (DIMENSION%lmd+3))/2
462

463

464
          IF (mpi%irank.EQ.0) THEN
465

466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502
             !--- J< 
             jij%l_jenerg = .FALSE.
             IF (jij%l_J) THEN
                OPEN (113,file='qpts',status='old')
                INQUIRE(file='jenerg',exist=jij%l_jenerg)
                OPEN (114,file='jenerg',status='unknown')
                READ (113,*) jij%nqptd
             ENDIF
          ENDIF!(mpi%irank.EQ.0)

#ifdef CPP_MPI
          CALL MPI_BCAST(jij%nqptd,1,MPI_INTEGER,0,mpi%mpi_comm,ierr)
          CALL MPI_BCAST(jij%l_jenerg,1,MPI_LOGICAL,0,mpi%mpi_comm,ierr)
#endif
          ALLOCATE ( jij%qj(3,jij%nqptd) )
          jij%nqpt=jij%nqptd
          !+t3e
          IF (mpi%irank.EQ.0) THEN
             !-t3e
             IF (jij%l_J) THEN
                IF(jij%l_disp)THEN
                   WRITE(6,*) 'q points for the magnon spectrum calculation:'
                ELSE
                   WRITE(6,*) 'q points for the J-constants calculation:'
                ENDIF
                WRITE(6,*)'      q1       ','      q2       ','      q3'
                DO i=1,jij%nqpt
                   READ (113,3333) jij%qj(1:3,i)
                   WRITE(6,3333) jij%qj(1:3,i)
                ENDDO
3333            FORMAT(3(f14.10,1x))
             ENDIF !(jij%l_J)
             !+t3e
          ENDIF
          !-t3e
          !--- J>

Daniel Wortmann's avatar
Daniel Wortmann committed
503 504 505 506 507 508 509 510 511 512 513 514 515
          !Now check for additional input files
          IF (mpi%irank.EQ.0) THEN
             IF(.NOT.banddos%l_orb) THEN
                INQUIRE(file='orbcomp',exist=banddos%l_orb)
                IF (banddos%l_orb) THEN
                   OPEN (111,file='orbcomp',form='formatted')
                   READ (111,*) banddos%orbCompAtom
                   CLOSE (111)
                END IF
             END IF
             INQUIRE(file='mcd_inp',exist=banddos%l_mcd)
          END IF

516 517 518 519

#ifdef CPP_MPI
          CALL mpi_bc_all(&
               &           mpi,stars,sphhar,atoms,obsolete,&
Daniel Wortmann's avatar
Daniel Wortmann committed
520
               &           sym,kpts,jij,DIMENSION,input,&
521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537
               &           banddos,sliceplot,vacuum,cell,enpara,&
               &           noco,oneD,xcpot,hybrid)
          ! initialize record length of the eig file

#endif 
          atoms%nlotot = 0
          DO n = 1, atoms%ntype
             DO l = 1,atoms%nlo(n)
                atoms%nlotot = atoms%nlotot + atoms%neq(n) * ( 2*atoms%llo(l,n) + 1 )
             ENDDO
          ENDDO

          jij%qn = 0.0
          !-t3e
          !-odim
          oneD%odd%nq2 = oneD%odd%n2d
          oneD%odd%kimax2 = oneD%odd%nq2 - 1
Daniel Wortmann's avatar
Daniel Wortmann committed
538
          oneD%odd%nat = atoms%nat
539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557

          oneD%odi%d1 = oneD%odd%d1 ; oneD%odi%mb = oneD%odd%mb ; oneD%odi%M = oneD%odd%M
          oneD%odi%k3 = oneD%odd%k3 ; oneD%odi%chi = oneD%odd%chi ; oneD%odi%rot = oneD%odd%rot
          oneD%odi%invs = oneD%odd%invs ; oneD%odi%zrfs = oneD%odd%zrfs
          oneD%odi%n2d = oneD%odd%n2d ; oneD%odi%nq2 = oneD%odd%nq2 ; oneD%odi%nn2d = oneD%odd%nn2d
          oneD%odi%kimax2 = oneD%odd%kimax2 ; oneD%odi%m_cyl = oneD%odd%m_cyl
          oneD%odi%ig => oneD%ig1 ; oneD%odi%kv => oneD%kv1 ; oneD%odi%nst2 => oneD%nstr1

          oneD%ods%nop = oneD%odd%nop ; oneD%ods%nat = oneD%odd%nat
          oneD%ods%mrot => oneD%mrot1 ; oneD%ods%tau => oneD%tau1 ; oneD%ods%ngopr => oneD%ngopr1
          oneD%ods%invtab => oneD%invtab1 ; oneD%ods%multab => oneD%multab1

          oneD%odl%nn2d = oneD%odd%nn2d
          oneD%odl%igf => oneD%igfft1 ; oneD%odl%pgf => oneD%pgfft1

          oneD%odg%nn2d = oneD%odd%nn2d
          oneD%odg%pgfx => oneD%pgft1x ; oneD%odg%pgfy => oneD%pgft1y
          oneD%odg%pgfxx => oneD%pgft1xx ; oneD%odg%pgfyy => oneD%pgft1yy ; oneD%odg%pgfxy => oneD%pgft1xy
          !+odim
Daniel Wortmann's avatar
Daniel Wortmann committed
558
          IF (noco%l_noco) DIMENSION%nbasfcn = 2*DIMENSION%nbasfcn
559 560 561 562 563
          !
          !--- J<
          IF (jij%l_J) THEN
             input%itmax = 1
             jij%phnd=2
Daniel Wortmann's avatar
Daniel Wortmann committed
564
             jij%nkpt_l = CEILING(REAL(kpts%nkpt)/mpi%isize)
Daniel Wortmann's avatar
Daniel Wortmann committed
565
             ALLOCATE ( jij%eig_l(DIMENSION%neigd+5,jij%nkpt_l) )
566 567
          ELSE
             jij%nkpt_l = 1
Daniel Wortmann's avatar
Daniel Wortmann committed
568
             ALLOCATE ( jij%eig_l(DIMENSION%neigd+5,1) )
569 570 571 572 573 574 575 576 577 578 579
          ENDIF
          !--- J>

          IF( sym%invs .OR. noco%l_soc ) THEN
             sym%nsym = sym%nop
          ELSE
             ! combine time reversal symmetry with the spatial symmetry opera
             ! thus the symmetry operations are doubled
             sym%nsym = 2*sym%nop
          END IF

580 581 582 583 584 585 586 587 588 589 590
          ! Initializations for Wannier functions (start)
          wann%l_ms=.false.
          wann%l_sgwf=.false.
          wann%l_socgwf=.false.
          wann%l_gwf=.false.
          wann%l_bs_comf=.false. !.true.
          wann%scale_param = 1.0
          wann%aux_latt_const = 8.0!5.5!5.45886450 !5.98136400 !8.0725882513951497 !5.4170 !1.0
          wann%param_file='qpts'
          wann%l_dim=.false.
          IF (mpi%irank.EQ.0) THEN
591
#ifdef CPP_WANN             
592 593 594
             INQUIRE(FILE='plotbscomf',EXIST=wann%l_bs_comf)
             WRITE(*,*)'l_bs_comf=',wann%l_bs_comf
             WRITE(*,*) 'Logical variables for wannier functions to be read in!!'
595 596
#endif
             wann%l_gwf = wann%l_ms.OR.wann%l_sgwf.OR.wann%l_socgwf
597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686

             if(wann%l_gwf) then
                WRITE(*,*)'running HDWF-extension of FLEUR code'
                WRITE(*,*)'with l_sgwf =',wann%l_sgwf,' and l_socgwf =',wann%l_socgwf

                IF(wann%l_socgwf.AND. .NOT.noco%l_soc) THEN
                  CALL juDFT_error("set l_soc=T if l_socgwf=T",calledby="fleur_init")
                END IF

                IF((wann%l_ms.or.wann%l_sgwf).AND..NOT.(noco%l_noco.AND.noco%l_ss)) THEN
                   CALL juDFT_error("set l_noco=l_ss=T for l_sgwf.or.l_ms",calledby="fleur_init")
                END IF

                IF((wann%l_ms.or.wann%l_sgwf).and.wann%l_socgwf) THEN
                   CALL juDFT_error("(l_ms.or.l_sgwf).and.l_socgwf",calledby="fleur_init")
                END IF

                INQUIRE(FILE=wann%param_file,EXIST=l_exist)
                IF(.NOT.l_exist) THEN
                   CALL juDFT_error("where is param_file"//trim(wann%param_file)//"?",calledby="fleur_init")
                END IF
                OPEN (113,file=wann%param_file,status='old')
                READ (113,*) wann%nparampts,wann%scale_param
                CLOSE(113)
             ELSE
                wann%nparampts=1
                wann%scale_param=1.0
             END IF
          END IF

#ifdef CPP_MPI
          CALL MPI_BCAST(wann%l_bs_comf,1,MPI_LOGICAL,0,mpi%mpi_comm,ierr)
          CALL MPI_BCAST(wann%l_gwf,1,MPI_LOGICAL,0,mpi%mpi_comm,ierr)
          CALL MPI_BCAST(wann%nparampts,1,MPI_INTEGER,0,mpi%mpi_comm,ierr)
          CALL MPI_BCAST(wann%scale_param,1,MPI_DOUBLE_PRECISION,0,mpi%mpi_comm,ierr)

          CALL MPI_BCAST(wann%l_sgwf,1,MPI_LOGICAL,0,MPI_COMM_WORLD,ierr)
          CALL MPI_BCAST(wann%l_socgwf,1,MPI_LOGICAL,0,MPI_COMM_WORLD,ierr)
          CALL MPI_BCAST(wann%l_ms,1,MPI_LOGICAL,0,MPI_COMM_WORLD,ierr)
#endif

          ALLOCATE (wann%param_vec(3,wann%nparampts))
          ALLOCATE (wann%param_alpha(atoms%ntype,wann%nparampts))

          IF(mpi%irank.EQ.0) THEN
             IF(wann%l_gwf) THEN
                OPEN(113,file=wann%param_file,status='old')
                READ(113,*)!header
                write(6,*) 'parameter points for HDWFs generation:'
                IF(wann%l_sgwf.or.wann%l_ms) THEN
                   WRITE(6,*)'      q1       ','      q2       ','      q3'
                ELSE IF(wann%l_socgwf) THEN
                   WRITE(6,*)'      --       ','     phi       ','    theta'
                END IF

                DO pc = 1, wann%nparampts
                   READ(113,'(3(f14.10,1x))') wann%param_vec(1,pc), wann%param_vec(2,pc), wann%param_vec(3,pc)
                   wann%param_vec(:,pc) = wann%param_vec(:,pc) / wann%scale_param
                   WRITE(6,'(3(f14.10,1x))') wann%param_vec(1,pc), wann%param_vec(2,pc), wann%param_vec(3,pc)
                   IF(wann%l_sgwf.or.wann%l_ms) THEN
                      iAtom = 1
                      DO iType = 1, atoms%ntype
                         phi_add = tpi_const*(wann%param_vec(1,pc)*atoms%taual(1,iAtom) +&
                                              wann%param_vec(2,pc)*atoms%taual(2,iAtom) +&
                                              wann%param_vec(3,pc)*atoms%taual(3,iAtom))
                         wann%param_alpha(iType,pc) = noco%alph(iType) + phi_add
                         iAtom = iAtom + atoms%neq(iType)
                      END DO  
                   END IF
                END DO

                IF(ANY(wann%param_vec(1,:).NE.wann%param_vec(1,1))) wann%l_dim(1)=.true.
                IF(ANY(wann%param_vec(2,:).NE.wann%param_vec(2,1))) wann%l_dim(2)=.true.
                IF(ANY(wann%param_vec(3,:).NE.wann%param_vec(3,1))) wann%l_dim(3)=.true.

                CLOSE(113)

                IF(wann%l_dim(1).and.wann%l_socgwf) THEN
                   CALL juDFT_error("do not specify 1st component if l_socgwf",calledby="fleur_init")
                END IF
             END IF!(wann%l_gwf)
          END IF!(mpi%irank.EQ.0)

#ifdef CPP_MPI
          CALL MPI_BCAST(wann%param_vec,3*wann%nparampts,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ierr)
          CALL MPI_BCAST(wann%param_alpha,atoms%ntype*wann%nparampts,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ierr)
          CALL MPI_BCAST(wann%l_dim,3,MPI_LOGICAL,0,MPI_COMM_WORLD,ierr)
#endif

          ! Initializations for Wannier functions (end)
687

688
          IF (    xcpot%is_hybrid() ) THEN
689 690 691 692 693
             IF (input%film .OR. oneD%odi%d1)&
                  &    CALL juDFT_error("2D film and 1D calculations not implemented"&
                  &                 //"for HF/EXX/PBE0/HSE", calledby ="fleur",&
                  &                 hint="Use a supercell or a different functional")

Daniel Wortmann's avatar
Daniel Wortmann committed
694 695 696
!             IF( ANY( atoms%l_geo  ) )&
!                  &     CALL juDFT_error("Forces not implemented for HF/PBE0/HSE ",&
!                  &                    calledby ="fleur")
697

Daniel Wortmann's avatar
Daniel Wortmann committed
698
!             IF (.NOT. obsolete%pot8) STOP 'Choose pot8=T'
699
             !calculate whole Brilloun zone
Daniel Wortmann's avatar
Daniel Wortmann committed
700
             !CALL gen_bz(kpts,sym)
701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724
             CALL gen_map(&
                  &          atoms,sym,oneD,hybrid)
             !
             ! calculate d_wgn
             !
             ALLOCATE (hybrid%d_wgn2(-atoms%lmaxd:atoms%lmaxd,-atoms%lmaxd:atoms%lmaxd,0:atoms%lmaxd,sym%nsym))
             CALL d_wigner(sym%nop,sym%mrot,cell%bmat,atoms%lmaxd,hybrid%d_wgn2(:,:,1:,:sym%nop))
             hybrid%d_wgn2(:,:,0,:) = 1

             DO isym = sym%nop+1,sym%nsym
                iisym = isym - sym%nop
                DO l = 0,atoms%lmaxd
                   DO m2 = -l,l
                      DO m1 = -l,-1
                         cdum                  = hybrid%d_wgn2( m1,m2,l,iisym)
                         hybrid%d_wgn2( m1,m2,l,isym) = hybrid%d_wgn2(-m1,m2,l,iisym)*(-1)**m1
                         hybrid%d_wgn2(-m1,m2,l,isym) = cdum                  *(-1)**m1
                      END DO
                      hybrid%d_wgn2(0,m2,l,isym) = hybrid%d_wgn2(0,m2,l,iisym)
                   END DO
                END DO
             END DO
          ELSE
             IF ( banddos%dos .AND. banddos%ndir == -3 ) THEN
Daniel Wortmann's avatar
Daniel Wortmann committed
725
                WRITE(*,*) 'Recalculating k point grid to cover the full BZ.'
726
                CALL gen_bz(kpts,sym)
Daniel Wortmann's avatar
Daniel Wortmann committed
727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744
                kpts%nkpt = kpts%nkptf
                DEALLOCATE(kpts%bk,kpts%wtkpt)
                ALLOCATE(kpts%bk(3,kpts%nkptf),kpts%wtkpt(kpts%nkptf))
                kpts%bk(:,:) = kpts%bkf(:,:)
                IF (kpts%nkpt3(1)*kpts%nkpt3(2)*kpts%nkpt3(3).NE.kpts%nkptf) THEN
                   IF(kpts%l_gamma) THEN
                      kpts%wtkpt = 1.0 / (kpts%nkptf-1)
                      DO i = 1, kpts%nkptf
                         IF(ALL(kpts%bk(:,i).EQ.0.0)) THEN
                            kpts%wtkpt(i) = 0.0
                         END IF
                      END DO
                   ELSE
                      CALL juDFT_error("nkptf does not match product of nkpt3(i).",calledby="fleur_init")
                   END IF
                ELSE
                   kpts%wtkpt = 1.0 / kpts%nkptf
                END IF
745 746 747 748
             END IF
             ALLOCATE(hybrid%map(0,0),hybrid%tvec(0,0,0),hybrid%d_wgn2(0,0,0,0))
             hybrid%l_calhf   = .FALSE.
          END IF
Daniel Wortmann's avatar
Daniel Wortmann committed
749
 
750
          IF (mpi%irank.EQ.0) THEN
751 752 753
             CALL writeOutParameters(mpi,input,sym,stars,atoms,vacuum,obsolete,kpts,&
                                     oneD,hybrid,jij,cell,banddos,sliceplot,xcpot,&
                                     noco,dimension,enpara,sphhar)
754
             CALL fleur_info(kpts)
755
             CALL deleteDensities()
756 757
          END IF

Daniel Wortmann's avatar
Daniel Wortmann committed
758 759 760
          !Finalize the MPI setup
          CALL setupMPI(kpts%nkpt,mpi)

761 762 763 764
          IF (mpi%irank.EQ.0) THEN
             CALL setStartingDensity(noco%l_noco)
          END IF

Daniel Wortmann's avatar
Daniel Wortmann committed
765 766 767
          !new check mode will only run the init-part of FLEUR
          IF (judft_was_argument("-check")) CALL judft_end("Check-mode done",mpi%irank)

768
          !check for broken feature
769
          IF ((mpi%n_size>1).and.(ANY(atoms%nlo(:)>0)).and.(noco%l_noco)) call judft_warn("Eigenvector parallelization is broken for noco&LOs")
770

771
        END SUBROUTINE fleur_init
772
      END MODULE m_fleur_init