LCOV - code coverage report
Current view: top level - init - checks.F90 (source / functions) Hit Total Coverage
Test: FLEUR test coverage Lines: 32 51 62.7 %
Date: 2024-04-16 04:21:52 Functions: 2 2 100.0 %

          Line data    Source code
       1             : !--------------------------------------------------------------------------------
       2             : ! Copyright (c) 2016 Peter Gruenberg Institut, Forschungszentrum Juelich, 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             : 
       7             : MODULE m_checks
       8             :   USE m_juDFT
       9             :   USE m_types
      10             :   IMPLICIT NONE
      11             :   private
      12             :   public :: check_command_line,check_input_switches
      13             :   CONTAINS
      14         160 :     SUBROUTINE check_command_line(fmpi)
      15             :       !Here we check is command line arguments are OK
      16             : #ifdef CPP_MPI
      17             :       USE mpi
      18             :       INTEGER:: isize,ierr,irank
      19             : #endif
      20             :       TYPE(t_mpi), INTENT(INOUT):: fmpi
      21         160 :       IF (TRIM(juDFT_string_for_argument("-eig"))=="hdf") THEN
      22             : #ifndef CPP_HDF
      23             :          CALL judft_error("HDF5 cannot be used for Eigenvector IO",&
      24             :               hint="You compiled without support for HDF5. Please use another mode")
      25             : #endif
      26             : #ifdef CPP_MPI
      27             : #ifndef CPP_HDFMPI
      28             :          IF (fmpi%irank.GT.1) THEN
      29             :             CALL judft_error("HDF5 cannot be used in parallel mode for Eigenvector IO",&
      30             :                  hint="Your HDF5 library does not support parallel IO" )
      31             :          END IF
      32             : #endif
      33             : #endif
      34             :       ENDIF
      35             :       !Check for IO options not available in parallel
      36             : #ifdef CPP_MPI
      37         160 :       CALL MPI_COMM_RANK(MPI_COMM_WORLD,irank,ierr)
      38         160 :       CALL MPI_COMM_SIZE(MPI_COMM_WORLD,isize,ierr)
      39             : 
      40         160 :       IF (irank.EQ.0) THEN
      41          80 :          IF (isize>1) THEN
      42          80 :             IF (TRIM(juDFT_string_for_argument("-eig"))=="-mem") CALL judft_error(&
      43          80 :                 "-eig mem cannot be used in parallel mode for Eigenvector IO",hint="Use -eig mpi or -eig hdf instead")
      44          80 :             IF (TRIM(juDFT_string_for_argument("-eig"))=="-da") CALL judft_error(&
      45          80 :                 "-eig da cannot be used in parallel mode for Eigenvector IO",hint="Use -eig mpi or -eig hdf instead")
      46             :          END IF
      47             :       END IF
      48             : #endif
      49         160 :     END SUBROUTINE check_command_line
      50             : 
      51          80 :     SUBROUTINE check_input_switches(banddos,vacuum,noco,atoms,input,sym,kpts,hybinp)
      52             :       USE m_nocoInputCheck
      53             :       USE m_types_fleurinput
      54             :       USE m_constants
      55             :       type(t_banddos),INTENT(IN)::banddos
      56             :       type(t_vacuum),INTENT(IN) ::vacuum
      57             :       type(t_noco),INTENT(IN)   ::noco
      58             :       type(t_atoms),INTENT(IN)  ::atoms
      59             :       type(t_input),INTENT(IN)  ::input
      60             :       type(t_sym),INTENT(IN)    :: sym
      61             :       type(t_kpts),INTENT(IN)   :: kpts
      62             :       type(t_hybinp),intent(in) :: hybinp
      63             : 
      64             :       integer :: i,n,na
      65             :       real :: maxpos,minpos
      66             : 
      67             :      ! Check DOS related stuff (from inped)
      68          80 :      IF(banddos%l_jDOS.AND..NOT.noco%l_noco) THEN
      69             :         CALL juDFT_error("jDOS+collinear is not implemented at the moment.",&
      70           0 :                          hint="If you need this feature please create an issue on the fleur git")
      71             :      ENDIF
      72             : 
      73          80 :       IF(atoms%n_opc>0.AND..NOT.noco%l_soc) THEN
      74             :          CALL juDFT_error("Orbital polarization corrections without spin-orbit coupling have no effect",&
      75           0 :                           calledby="check_input_switches")
      76             :       ENDIF
      77             : 
      78          80 :      IF (banddos%vacdos) THEN
      79           0 :         IF (.NOT.banddos%dos) THEN
      80           0 :            CALL juDFT_error("STOP DOS: only set vacdos = .true. if dos = .true.",calledby ="check_input_switches")
      81             :         END IF
      82           0 :         IF (.NOT.banddos%starcoeff.AND.(banddos%nstars.NE.1))THEN
      83           0 :            CALL juDFT_error("STOP banddos: if stars = f set vacuum=1",calledby ="check_input_switches")
      84             :         END IF
      85           0 :         IF (banddos%layers.LT.1) THEN
      86           0 :            CALL juDFT_error("STOP DOS: specify layers if vacdos = true",calledby ="check_input_switches")
      87             :         END IF
      88           0 :         DO i=1,banddos%layers
      89           0 :            IF (banddos%izlay(i,1).LT.1) THEN
      90           0 :               CALL juDFT_error("STOP DOS: all layers must be at z>0",calledby ="check_input_switches")
      91             :            END IF
      92             :         END DO
      93             :      END IF
      94             : 
      95          80 :      IF((input%gw.EQ.2).AND.(kpts%kptsKind.NE.KPTS_KIND_SPEX_MESH)) THEN
      96           0 :         CALL juDFT_warn('Chosen k-point set is not compatible to this GW step.', calledby='check_input_switches')
      97             :      END IF
      98             : 
      99          80 :      IF (noco%l_noco) CALL nocoInputCheck(atoms,input,sym,vacuum,noco)
     100             : 
     101             :      !In film case check centering of film
     102          80 :      if ( input%film ) then
     103          11 :         IF ((input%f_level.GT.0.).AND.input%l_f) THEN
     104           0 :            call judft_warn("Enhanced forces are not implemented for film calculations.",hint="Set the f_level tag to 0.")
     105             :         END IF
     106          11 :         if (.not.sym%symor) call judft_warn("Non-symorphic films probably do not work correctly. Either proceed with caution or use a symorphic setup (symor=T in inpgen)")
     107          11 :        maxpos=0.0;minpos=0.0
     108          32 :        DO n=1,atoms%ntype
     109          21 :          na=atoms%firstAtom(n) - 1
     110          53 :          maxpos=max(maxpos,maxval(atoms%pos(3,na+1:na+atoms%neq(n)))+atoms%rmt(n))
     111          64 :          minpos=max(minpos,maxval(-1.*atoms%pos(3,na+1:na+atoms%neq(n)))+atoms%rmt(n))
     112             :        ENDDO
     113          11 :        if (abs(maxpos-minpos)>2.0) call judft_warn("Your film setup is not centered around zero",hint="Using a non-centred setup can lead to numerical problems. Please check your setup an try to ensure that the center of your film is at z=0")
     114             :      endif
     115             : 
     116          80 :      IF(banddos%unfoldBand.AND.noco%l_soc.AND..NOT.noco%l_noco) THEN
     117           0 :         IF(banddos%unfoldUseOlap) THEN
     118           0 :            CALL juDFT_error("Band unfolding for 2nd variation SOC is only implemented without incorporating the overlap matrix.", hint="You have to set the optional /output/unfoldingBand/@useOlap switch to F.", calledby ="check_input_switches")
     119             :         END IF
     120             :      END IF
     121             :      
     122          80 :      IF ((atoms%n_v.GT.0).AND.(sym%nop.GT.1)) THEN
     123           0 :         CALL juDFT_error("LDA+V is incompatible to the usage of symmetries beyond the identity, but you have such symmetries.", hint="Please recreate your FLEUR input by using inpgen with the '-nosym' command line option.", calledby ="check_input_switches")
     124             :      END IF
     125             : 
     126             :      ! Disable functionalities that are known to have bugs:
     127             : 
     128          97 :      IF (ANY(atoms%lda_u(1:atoms%n_u)%l_amf)) THEN
     129           0 :         CALL juDFT_warn("Around Mean Field limit in LDA+U calculations is disabled at the moment.")
     130             :      END IF
     131             :      
     132          80 :      IF(banddos%l_mcd) THEN
     133           0 :         CALL juDFT_warn("Magnetic Circular Dichroism calculations are disbled at the moment.")
     134             :      END IF
     135             :      
     136         217 :      IF (ANY(atoms%lapw_l(:).GE.0)) THEN
     137           0 :         CALL juDFT_warn("APW+lo calculations are disabled at the moment.")
     138             :      END IF
     139             : 
     140             : #ifndef CPP_HDF
     141             :      if (hybinp%l_hybrid) call juDFT_warn("Hybrid calculations should always use HDF5")
     142             : #endif     
     143             : 
     144          80 :    END SUBROUTINE check_input_switches
     145             : 
     146             :   END MODULE m_checks

Generated by: LCOV version 1.14