LCOV - code coverage report
Current view: top level - init/old_inp - fleur_init_old.F90 (source / functions) Hit Total Coverage
Test: combined.info Lines: 105 155 67.7 %
Date: 2019-09-08 04:53:50 Functions: 1 1 100.0 %

          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_fleur_init_old
       7             :   IMPLICIT NONE
       8             : CONTAINS
       9             :   !> Collection of code for old-style inp-file treatment
      10          56 :   SUBROUTINE fleur_init_old(mpi,&
      11             :        input,DIMENSION,atoms,sphhar,cell,stars,sym,noco,vacuum,forcetheo,&
      12             :        sliceplot,banddos,obsolete,enpara,xcpot,kpts,hybrid,&
      13             :        oneD,coreSpecInput,l_opti)
      14             :     USE m_types
      15             :     USE m_judft
      16             :     USE m_dimens
      17             :     USE m_inped
      18             :     USE m_setup
      19             :     USE m_constants
      20             :     USE m_winpXML
      21             : #ifdef CPP_MPI
      22             : #ifndef CPP_OLDINTEL
      23             :     USE m_mpi_dist_forcetheorem
      24             : #endif
      25             : #endif
      26             : 
      27             :     IMPLICIT NONE
      28             :     !     Types, these variables contain a lot of data!
      29             :     TYPE(t_mpi)    ,INTENT(INOUT)  :: mpi
      30             :     TYPE(t_input)    ,INTENT(INOUT):: input
      31             :     TYPE(t_dimension),INTENT(OUT)  :: DIMENSION
      32             :     TYPE(t_atoms)    ,INTENT(OUT)  :: atoms
      33             :     TYPE(t_sphhar)   ,INTENT(OUT)  :: sphhar
      34             :     TYPE(t_cell)     ,INTENT(OUT)  :: cell
      35             :     TYPE(t_stars)    ,INTENT(OUT)  :: stars
      36             :     TYPE(t_sym)      ,INTENT(OUT)  :: sym
      37             :     TYPE(t_noco)     ,INTENT(OUT)  :: noco
      38             :     TYPE(t_vacuum)   ,INTENT(OUT)  :: vacuum
      39             :     TYPE(t_sliceplot),INTENT(INOUT):: sliceplot
      40             :     TYPE(t_banddos)  ,INTENT(OUT)  :: banddos
      41             :     TYPE(t_obsolete) ,INTENT(OUT)  :: obsolete 
      42             :     TYPE(t_enpara)   ,INTENT(OUT)  :: enpara
      43             :     CLASS(t_xcpot),INTENT(OUT),ALLOCATABLE  :: xcpot
      44             :     TYPE(t_kpts)     ,INTENT(INOUT):: kpts
      45             :     TYPE(t_hybrid)   ,INTENT(OUT)  :: hybrid
      46             :     TYPE(t_oneD)     ,INTENT(OUT)  :: oneD
      47             :     TYPE(t_coreSpecInput),INTENT(OUT) :: coreSpecInput
      48             :     CLASS(t_forcetheo),ALLOCATABLE,INTENT(OUT)::forcetheo
      49             :     LOGICAL,          INTENT(OUT):: l_opti
      50             : 
      51             : 
      52          28 :     INTEGER, ALLOCATABLE          :: xmlElectronStates(:,:)
      53          28 :     INTEGER, ALLOCATABLE          :: atomTypeSpecies(:)
      54          28 :     INTEGER, ALLOCATABLE          :: speciesRepAtomType(:)
      55          28 :     REAL, ALLOCATABLE             :: xmlCoreOccs(:,:,:)
      56          28 :     LOGICAL, ALLOCATABLE          :: xmlPrintCoreStates(:,:)
      57          28 :     CHARACTER(len=3), ALLOCATABLE :: noel(:)
      58             :     !     .. Local Scalars ..
      59             :     INTEGER    :: i,n,l,m1,m2,isym,iisym,numSpecies,pc,iAtom,iType
      60             :     COMPLEX    :: cdum
      61             :     CHARACTER(len=4)              :: namex
      62             :     CHARACTER(len=12)             :: relcor, tempNumberString
      63             :     CHARACTER(LEN=20)             :: filename
      64             :     REAL                          :: a1(3),a2(3),a3(3)
      65             :     REAL                          :: dtild, phi_add
      66             :     LOGICAL                       :: l_found, l_kpts, l_exist, l_krla
      67             : #ifdef CPP_MPI
      68             :     INTEGER:: ierr
      69             :     INCLUDE 'mpif.h'
      70             : #endif
      71             : 
      72          28 :     ALLOCATE(t_forcetheo::forcetheo) !default no forcetheorem type
      73          28 :     ALLOCATE(t_xcpot_inbuild::xcpot)
      74             : 
      75             :     SELECT TYPE(xcpot)
      76             :     TYPE IS (t_xcpot_inbuild)
      77          28 :     namex = '    '
      78          28 :     relcor = '            '
      79             : 
      80             :     CALL dimens(mpi,input,sym,stars,atoms,sphhar,DIMENSION,vacuum,&
      81          28 :          obsolete,kpts,oneD,hybrid)
      82          28 :     stars%kimax2= (2*stars%mx1+1)* (2*stars%mx2+1)-1
      83          28 :     stars%kimax = (2*stars%mx1+1)* (2*stars%mx2+1)* (2*stars%mx3+1)-1
      84             :     !-odim
      85          28 :     IF (oneD%odd%d1) THEN
      86           0 :        oneD%odd%k3 = stars%mx3
      87           0 :        oneD%odd%nn2d = (2*(oneD%odd%k3) + 1)*(2*(oneD%odd%M) + 1)
      88             :     ELSE
      89          28 :        oneD%odd%k3 = 0 ; oneD%odd%M =0 ; oneD%odd%nn2d = 1
      90          28 :        oneD%odd%mb = 0
      91             :     ENDIF
      92             :     !-odim
      93          28 :     ALLOCATE ( atoms%nz(atoms%ntype),atoms%relax(3,atoms%ntype),atoms%nlhtyp(atoms%ntype))
      94          28 :     ALLOCATE (atoms%corestateoccs(1,2,atoms%ntype));atoms%corestateoccs=0.0
      95          28 :     ALLOCATE ( sphhar%clnu(sphhar%memd,0:sphhar%nlhd,sphhar%ntypsd),stars%ustep(stars%ng3) )
      96          28 :     ALLOCATE ( stars%ig(-stars%mx1:stars%mx1,-stars%mx2:stars%mx2,-stars%mx3:stars%mx3),stars%ig2(stars%ng3) )
      97          28 :     ALLOCATE ( atoms%jri(atoms%ntype),stars%kv2(2,stars%ng2),stars%kv3(3,stars%ng3),sphhar%llh(0:sphhar%nlhd,sphhar%ntypsd) )
      98          28 :     ALLOCATE (sym%mrot(3,3,sym%nop),sym%tau(3,sym%nop))
      99          28 :     ALLOCATE ( atoms%lmax(atoms%ntype),sphhar%mlh(sphhar%memd,0:sphhar%nlhd,sphhar%ntypsd))!,sym%mrot(3,3,sym%nop) )
     100          28 :     ALLOCATE ( atoms%ncv(atoms%ntype),atoms%neq(atoms%ntype),atoms%ngopr(atoms%nat) )
     101          28 :     ALLOCATE ( sphhar%nlh(sphhar%ntypsd),sphhar%nmem(0:sphhar%nlhd,sphhar%ntypsd) )
     102          28 :     ALLOCATE ( stars%nstr2(stars%ng2),atoms%ntypsy(atoms%nat),stars%nstr(stars%ng3) )
     103          28 :     ALLOCATE ( stars%igfft(0:stars%kimax,2),stars%igfft2(0:stars%kimax2,2),atoms%nflip(atoms%ntype) )
     104          28 :     ALLOCATE ( atoms%ncst(atoms%ntype) )
     105          28 :     ALLOCATE ( vacuum%izlay(vacuum%layerd,2) )
     106          28 :     ALLOCATE ( sym%invarop(atoms%nat,sym%nop),sym%invarind(atoms%nat) )
     107          28 :     ALLOCATE ( sym%multab(sym%nop,sym%nop),sym%invtab(sym%nop) )
     108          28 :     ALLOCATE ( atoms%invsat(atoms%nat),sym%invsatnr(atoms%nat) )
     109          28 :     ALLOCATE ( atoms%lnonsph(atoms%ntype) )
     110          28 :     ALLOCATE ( atoms%dx(atoms%ntype),atoms%pos(3,atoms%nat))!,sym%tau(3,sym%nop) )
     111          28 :     ALLOCATE ( atoms%rmsh(atoms%jmtd,atoms%ntype),atoms%rmt(atoms%ntype),stars%sk2(stars%ng2),stars%sk3(stars%ng3) )
     112          28 :     ALLOCATE ( stars%phi2(stars%ng2) )
     113          28 :     ALLOCATE ( atoms%taual(3,atoms%nat),atoms%volmts(atoms%ntype),atoms%zatom(atoms%ntype) )
     114          28 :     ALLOCATE ( stars%rgphs(-stars%mx1:stars%mx1,-stars%mx2:stars%mx2,-stars%mx3:stars%mx3)  )
     115          28 :     ALLOCATE ( kpts%bk(3,kpts%nkpt),kpts%wtkpt(kpts%nkpt) )
     116          28 :     ALLOCATE ( stars%pgfft(0:stars%kimax),stars%pgfft2(0:stars%kimax2) )
     117          28 :     ALLOCATE ( stars%ufft(0:27*stars%mx1*stars%mx2*stars%mx3-1) )
     118          28 :     ALLOCATE ( atoms%bmu(atoms%ntype) )
     119          28 :     ALLOCATE ( atoms%l_geo(atoms%ntype) )
     120          28 :     ALLOCATE ( atoms%nlo(atoms%ntype),atoms%llo(atoms%nlod,atoms%ntype) )
     121          28 :     ALLOCATE ( atoms%lo1l(0:atoms%llod,atoms%ntype),atoms%nlol(0:atoms%llod,atoms%ntype),atoms%lapw_l(atoms%ntype) )
     122          28 :     ALLOCATE ( noco%alphInit(atoms%ntype),noco%alph(atoms%ntype),noco%beta(atoms%ntype),noco%l_relax(atoms%ntype) )
     123          28 :     ALLOCATE ( noco%b_con(2,atoms%ntype),atoms%lda_u(atoms%ntype),atoms%l_dulo(atoms%nlod,atoms%ntype) )
     124          28 :     ALLOCATE ( sym%d_wgn(-3:3,-3:3,3,sym%nop) )
     125          28 :     ALLOCATE ( atoms%ulo_der(atoms%nlod,atoms%ntype) )
     126          28 :     ALLOCATE ( atoms%numStatesProvided(atoms%ntype))
     127          28 :     ALLOCATE ( kpts%ntetra(4,kpts%ntet), kpts%voltet(kpts%ntet))
     128             :     !+odim
     129          28 :     ALLOCATE ( oneD%ig1(-oneD%odd%k3:oneD%odd%k3,-oneD%odd%M:oneD%odd%M) )
     130          28 :     ALLOCATE ( oneD%kv1(2,oneD%odd%n2d),oneD%nstr1(oneD%odd%n2d) )
     131          28 :     ALLOCATE ( oneD%ngopr1(atoms%nat),oneD%mrot1(3,3,oneD%odd%nop),oneD%tau1(3,oneD%odd%nop) )
     132          28 :     ALLOCATE ( oneD%invtab1(oneD%odd%nop),oneD%multab1(oneD%odd%nop,oneD%odd%nop) )
     133          28 :     ALLOCATE ( oneD%igfft1(0:oneD%odd%nn2d-1,2),oneD%pgfft1(0:oneD%odd%nn2d-1) )
     134        5096 :     stars%sk2(:) = 0.0 ; stars%phi2(:) = 0.0
     135             :     !-odim
     136             : 
     137          92 :     atoms%nlo(:) = 0
     138          92 :     atoms%llo(:,:) = -1
     139             : 
     140             :     ! HF/hybrid functionals/EXX
     141          28 :     ALLOCATE ( hybrid%nindx(0:atoms%lmaxd,atoms%ntype) )
     142             : 
     143          28 :     kpts%specificationType = 0
     144          92 :     atoms%numStatesProvided(:) = 0
     145          28 :     input%l_coreSpec = .FALSE.
     146             : 
     147             : 
     148             : 
     149             : 
     150          28 :     IF(.NOT.juDFT_was_argument("-toXML")) THEN
     151          28 :        PRINT *,"--------------WARNING----------------------"
     152          28 :        PRINT *,"You are using the old-style FLEUR inp file."
     153          28 :        PRINT *,"Please be warned that not all features are"
     154          28 :        PRINT *,"implemented/tested in this mode. Please "
     155          28 :        PRINT *,"consider switching to xml input. You might"
     156          28 :        PRINT *,"find the -toXML command line option useful."
     157          28 :        PRINT *,"--------------WARNING----------------------"
     158             :     ELSE
     159           0 :        IF (mpi%isize>1) CALL judft_error("Do not call -toXML with more than a single PE")
     160             :     ENDIF
     161          28 :     CALL timestart("preparation:stars,lattice harmonics,+etc")
     162             : 
     163             :     !+t3e
     164          28 :     IF (mpi%irank.EQ.0) THEN
     165             :        !-t3e
     166             :        CALL inped(atoms,obsolete,vacuum,input,banddos,xcpot,sym,&
     167             :             cell,sliceplot,noco,&
     168          14 :             stars,oneD,hybrid,kpts,a1,a2,a3,namex,relcor)
     169             :        !
     170          14 :        IF (xcpot%needs_grad()) THEN
     171           8 :           ALLOCATE (stars%ft2_gfx(0:stars%kimax2),stars%ft2_gfy(0:stars%kimax2))
     172             :           ALLOCATE (oneD%pgft1x(0:oneD%odd%nn2d-1),oneD%pgft1xx(0:oneD%odd%nn2d-1),&
     173             :                oneD%pgft1xy(0:oneD%odd%nn2d-1),&
     174           8 :                oneD%pgft1y(0:oneD%odd%nn2d-1),oneD%pgft1yy(0:oneD%odd%nn2d-1))
     175             :        ELSE
     176           6 :           ALLOCATE (stars%ft2_gfx(0:1),stars%ft2_gfy(0:1))
     177             :           ALLOCATE (oneD%pgft1x(0:1),oneD%pgft1xx(0:1),oneD%pgft1xy(0:1),&
     178           6 :                oneD%pgft1y(0:1),oneD%pgft1yy(0:1))
     179             :        ENDIF
     180          14 :        oneD%odd%nq2 = stars%ng2!oneD%odd%n2d
     181          14 :        oneD%odi%nq2 = oneD%odd%nq2
     182             :        !-odim
     183             :        !+t3e
     184          14 :        INQUIRE(file="cdn1",exist=l_opti)
     185          14 :        IF (noco%l_noco) INQUIRE(file="rhomat_inp",exist=l_opti)
     186          14 :        l_opti=.NOT.l_opti
     187             :        IF ((sliceplot%iplot).OR.(input%strho).OR.(input%swsp).OR.&
     188          14 :             &    (input%lflip).OR.(input%l_bmt)) l_opti = .TRUE.
     189             :        !
     190             : 
     191          14 :        namex=xcpot%get_name()
     192          14 :        l_krla = xcpot%data%krla.EQ.1
     193             :     END IF ! mpi%irank.eq.0
     194             : 
     195             : #ifdef CPP_MPI
     196          28 :     CALL MPI_BCAST(namex,4,MPI_CHARACTER,0,mpi%mpi_comm,ierr)
     197          28 :     CALL MPI_BCAST(l_krla,1,MPI_LOGICAL,0,mpi%mpi_comm,ierr)
     198          28 :     CALL MPI_BCAST(atoms%ntype,1,MPI_INTEGER,0,mpi%mpi_comm,ierr)
     199             : #ifndef CPP_OLDINTEL
     200          28 :     CALL mpi_dist_forcetheorem(mpi,forcetheo)
     201             : #endif
     202             : #endif
     203          28 :     IF (mpi%irank.NE.0) THEN
     204          14 :        CALL xcpot%init(namex,l_krla,atoms%ntype)
     205             :     END IF
     206             : 
     207             :     CALL setup(mpi,atoms,kpts,DIMENSION,sphhar,&
     208             :          obsolete,sym,stars,oneD,input,noco,&
     209             :          vacuum,cell,xcpot,&
     210          28 :          sliceplot,enpara,l_opti)
     211             : 
     212          28 :     IF (mpi%irank.EQ.0) THEN
     213          14 :        banddos%l_orb = .FALSE.
     214          14 :        banddos%orbCompAtom = 0
     215             : 
     216          14 :        ALLOCATE(noco%socscale(atoms%ntype))
     217          14 :        xcpot%lda_atom(:) = .FALSE.
     218          46 :        noco%socscale(:) = 1.0
     219             : 
     220          14 :        IF(juDFT_was_argument("-toXML")) THEN
     221           0 :           WRITE(*,*) ''
     222           0 :           WRITE(*,*) 'Please note:'
     223           0 :           WRITE(*,*) 'The inp to xml input conversion is experimental and'
     224           0 :           WRITE(*,*) 'only made for basic inp files without sophisticated'
     225           0 :           WRITE(*,*) 'parametrizations. You might have to adjust the generated'
     226           0 :           WRITE(*,*) 'file by hand to really obtain an adequate input file.'
     227           0 :           WRITE(*,*) 'Also the generated XML input file is not meant to be'
     228           0 :           WRITE(*,*) 'beautiful.'
     229           0 :           WRITE(*,*) ''
     230           0 :           ALLOCATE(noel(atoms%ntype),atomTypeSpecies(atoms%ntype),speciesRepAtomType(atoms%ntype))
     231           0 :           ALLOCATE(xmlElectronStates(29,atoms%ntype),xmlPrintCoreStates(29,atoms%ntype))
     232           0 :           ALLOCATE(xmlCoreOccs(1,1,1),atoms%label(atoms%nat))
     233           0 :           ALLOCATE(hybrid%lcutm1(atoms%ntype),hybrid%lcutwf(atoms%ntype),hybrid%select1(4,atoms%ntype))
     234           0 :           filename = 'inpConverted.xml'
     235           0 :           xmlElectronStates = noState_const
     236           0 :           xmlPrintCoreStates = .FALSE.
     237           0 :           DO i = 1, atoms%nat
     238           0 :              WRITE(atoms%label(i),'(i0)') i
     239             :           END DO
     240           0 :           DO iType = 1, atoms%ntype
     241           0 :              noel(iType) = namat_const(atoms%nz(iType))
     242           0 :              atomTypeSpecies(iType) = iType
     243           0 :              speciesRepAtomType(iType) = iType
     244             : 
     245           0 :              hybrid%lcutm1(iType) = 4
     246           0 :              hybrid%lcutwf(iType) = atoms%lmax(iType) - atoms%lmax(iType) / 10
     247           0 :              hybrid%select1(:,iType) = (/4, 0, 4, 2 /)
     248             :           END DO
     249           0 :           hybrid%gcutm1 = input%rkmax - 0.5
     250           0 :           hybrid%tolerance1 = 1.0e-4
     251           0 :           hybrid%ewaldlambda = 3
     252           0 :           hybrid%lexp = 16
     253           0 :           hybrid%bands1 = max( nint(input%zelec)*10, 60 )
     254             : 
     255           0 :           numSpecies = SIZE(speciesRepAtomType)
     256           0 :           ALLOCATE(atoms%speciesName(numSpecies))
     257           0 :           atoms%speciesName = ''
     258           0 :           DO i = 1, numSpecies
     259           0 :              tempNumberString = ''
     260           0 :              WRITE(tempNumberString,'(i0)') i
     261           0 :              atoms%speciesName(i) = TRIM(ADJUSTL(noel(speciesRepAtomType(i)))) // '-' // TRIM(ADJUSTL(tempNumberString))
     262             :           END DO
     263           0 :           a1(:) = a1(:) / input%scaleCell
     264           0 :           a2(:) = a2(:) / input%scaleCell
     265           0 :           a3(:) = a3(:) / input%scaleCell
     266           0 :           kpts%specificationType = 3
     267           0 :           sym%symSpecType = 3
     268             :           CALL w_inpXML(&
     269             :                atoms,obsolete,vacuum,input,stars,sliceplot,forcetheo,banddos,&
     270             :                cell,sym,xcpot,noco,oneD,hybrid,kpts,kpts%nkpt3,kpts%l_gamma,&
     271             :                noel,namex,relcor,a1,a2,a3,cell%amat(3,3),input%comment,&
     272             :                xmlElectronStates,xmlPrintCoreStates,xmlCoreOccs,&
     273             :                atomTypeSpecies,speciesRepAtomType,.FALSE.,filename,&
     274           0 :                .TRUE.,numSpecies,enpara)
     275           0 :           DEALLOCATE(atoms%speciesName, atoms%label)
     276           0 :           DEALLOCATE(noel,atomTypeSpecies,speciesRepAtomType)
     277           0 :           DEALLOCATE(xmlElectronStates,xmlPrintCoreStates,xmlCoreOccs)
     278           0 :           CALL juDFT_end("Fleur inp to XML input conversion completed.")
     279             :        END IF
     280             :     END IF ! mpi%irank.eq.0
     281          56 :     CALL timestop("preparation:stars,lattice harmonics,+etc")
     282             :     END SELECT
     283          28 :   END SUBROUTINE fleur_init_old
     284          56 : END MODULE m_fleur_init_old

Generated by: LCOV version 1.13