LCOV - code coverage report
Current view: top level - wannier - wann_optional.f90 (source / functions) Coverage Total Hit
Test: FLEUR test coverage Lines: 56.1 % 41 23
Test Date: 2025-06-14 04:34:23 Functions: 100.0 % 1 1

            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              : 
       7              : MODULE m_wann_optional
       8              :   USE m_juDFT
       9              : CONTAINS
      10            2 :   SUBROUTINE wann_optional(fmpi,input,kpts,atoms,sym,cell ,noco,wann)
      11              :     !**************************************************
      12              :     !     Make preparations for the calculation of
      13              :     !     Wannier functions.
      14              :     !     Frank Freimuth
      15              :     !**************************************************
      16              :     USE m_types
      17              : !    USE m_wann_read_inp   !Call wann_read_inp now in fleur-init
      18              :     USE m_wann_projgen
      19              :     USE m_wann_kpointgen
      20              :     USE m_wann_w90kpointgen
      21              :     USE m_wann_kptsreduc
      22              :     USE m_wann_kptsreduc2
      23              :     USE m_wann_wan90prep
      24              :     USE m_wann_dipole3
      25              :     USE m_wann_dipole2
      26              :     USE m_wann_dipole
      27              :     USE m_wann_convert_fleur_w90
      28              : 
      29              :     IMPLICIT NONE
      30              :     TYPE(t_mpi),       INTENT(IN)    :: fmpi
      31              :     TYPE(t_input),     INTENT(IN)    :: input
      32              :     TYPE(t_kpts),      INTENT(IN)    :: kpts
      33              :     TYPE(t_atoms),     INTENT(IN)    :: atoms
      34              :     TYPE(t_sym),       INTENT(IN)    :: sym
      35              :     TYPE(t_cell),      INTENT(IN)    :: cell
      36              :      
      37              :     TYPE(t_noco),      INTENT(IN)    :: noco
      38              :     TYPE(t_wann),      INTENT(IN)    :: wann
      39              : 
      40              :     INTEGER       :: num_wann(2)
      41              :     LOGICAL       :: l_nocosoc,l_stopopt,l_file
      42              : 
      43            2 :     call timestart("wann_optional")
      44            2 :     l_nocosoc=noco%l_noco.OR.noco%l_soc
      45            2 :     l_stopopt=wann%l_stopopt
      46              :     !-----read the input file to determine what to do
      47              : !    CALL wann_read_inp(input,.TRUE.,wann) !call wann_read_inp now in fleur_init
      48              : 
      49              :     !-----generate projection-definition-file
      50            2 :     IF(wann%l_projgen) THEN
      51            1 :        inquire(file='projgen_inp',exist=l_file)
      52            1 :        if(.not.l_file)CALL juDFT_error ("projgen_inp", calledby="wann_optional")
      53            1 :        if(fmpi%irank==0)then
      54            1 :         CALL wann_projgen(atoms%ntype,atoms%neq,atoms%nat,atoms%zatom,l_nocosoc,wann)
      55              :        endif
      56              : !       l_stopopt=.TRUE.
      57              :     ENDIF
      58              : 
      59              :     !-----generate k-point-files
      60            2 :     IF(wann%l_kpointgen) THEN
      61            0 :           if(fmpi%irank==0)then
      62            0 :        CALL wann_kpointgen()
      63              :               endif
      64              :        l_stopopt=.TRUE.
      65              :     ENDIF
      66            2 :     IF(wann%l_w90kpointgen) THEN
      67            0 :           if(fmpi%irank==0)then
      68            0 :        CALL wann_w90kpointgen()
      69              :               endif
      70              :        l_stopopt=.TRUE.
      71              :     ENDIF
      72              : 
      73              :     !-----find Wannier-irreducible part of BZ
      74            2 :     IF(wann%l_kptsreduc)THEN
      75            0 :           if(fmpi%irank==0)then
      76            0 :        CALL wann_kptsreduc(sym%nop,sym%mrot,cell%bmat,sym%tau,input%film, l_nocosoc)
      77              :               endif
      78              :        l_stopopt=.TRUE.
      79              :     ENDIF
      80              : 
      81              :     !-----find Wannier-irreducible part of BZ
      82            2 :     IF(wann%l_kptsreduc2)THEN
      83            0 :           if(fmpi%irank==0)then
      84            0 :        CALL wann_kptsreduc2(wann%mhp, sym%nop,sym%mrot,cell%bmat,sym%tau,input%film, l_nocosoc)
      85              :               endif
      86              :        l_stopopt=.TRUE.
      87              :     ENDIF
      88              : 
      89              :     !-----generate WF1.win and bkpts
      90            2 :     IF(wann%l_prepwan90)THEN
      91            1 :           if(fmpi%irank==0)then
      92              :        CALL wann_wan90prep(input,kpts, input%jspins,cell%amat,cell%bmat, atoms%nat,atoms%taual,&
      93              :             atoms%zatom,atoms%ntype, atoms%ntype,atoms%neq,wann%l_bzsym,input%film,&
      94              :             wann%l_ms,wann%l_sgwf,wann%l_socgwf, wann%aux_latt_const,wann%param_file,wann%l_dim, &
      95            1 :             wann%wan90version)
      96              :                    endif
      97              :     ENDIF
      98              : 
      99              :     !-----calculate polarization, if not wannierize
     100              :     !-----if wannierize, then calculate polarization later (after wannierize)
     101            2 :     IF(wann%l_dipole3.AND..NOT.wann%l_wannierize)THEN
     102            0 :        num_wann(1)=wann%band_max(1)-wann%band_min(1)+1
     103            0 :        num_wann(2)=wann%band_max(2)-wann%band_min(2)+1
     104            0 :              if(fmpi%irank==0)then
     105              :        CALL wann_dipole3(input%jspins,cell%omtil,atoms%nat,atoms%pos, cell%amat,cell%bmat,atoms%taual,&
     106            0 :             num_wann, atoms%ntype,atoms%neq,atoms%zatom,l_nocosoc)
     107              :                    endif
     108              : !       l_stopopt=.TRUE.
     109              :     ENDIF
     110              : 
     111            2 :     IF(wann%l_dipole2.AND..NOT.wann%l_wannierize)THEN
     112            0 :       if(fmpi%irank==0)then
     113            0 :        CALL wann_dipole2(input%jspins,atoms%pos,cell%omtil,atoms%nat,l_nocosoc)
     114              :       endif
     115              : !       l_stopopt=.TRUE.
     116              :     ENDIF!-----calculate polarization, if not wannierize
     117              : 
     118              :     !-----calculate polarization, if not wannierize
     119              :     !-----if wannierize, then calculate polarization later (after wannierize)
     120            2 :     IF(wann%l_dipole.AND..NOT.wann%l_wannierize)THEN
     121            0 :           if(fmpi%irank==0)then
     122              :        CALL wann_dipole(input%jspins,cell%omtil,atoms%nat,atoms%pos, cell%amat,atoms%ntype,&
     123            0 :             atoms%neq,atoms%zatom)
     124              :                    endif
     125              : !       l_stopopt=.TRUE.
     126              :     ENDIF
     127              : 
     128              : 
     129              :     !---- convert files from fleur-format to wannier90 format
     130              :       IF(wann%l_mmn0_unf_to_spn_unf.or. &
     131              :        wann%l_mmn0_to_spn_unf.or. &
     132              :        wann%l_mmn0_to_spn.or. &
     133              :        wann%l_mmn0_to_spn2.or. &
     134              :        wann%l_mmn0_unf_to_spn.or. &
     135              : 
     136              :        wann%l_perpmag_unf_to_tor_unf.or. &
     137              :        wann%l_perpmag_to_tor_unf.or. &
     138              :        wann%l_perpmag_to_tor.or. &
     139              :        wann%l_perpmag_unf_to_tor.or. &
     140              : 
     141              :       wann%l_hsomtx_unf_to_hsoc_unf.or. &
     142              :       wann%l_hsomtx_to_hsoc_unf.or. &
     143              :       wann%l_hsomtx_to_hsoc.or. &
     144              :       wann%l_hsomtx_unf_to_hsoc .or.&
     145              : 
     146              :       wann%l_hsomtxvec_unf_to_lmpzsoc_unf.or. &
     147              :       wann%l_hsomtxvec_to_lmpzsoc_unf.or. &
     148            2 :       wann%l_hsomtxvec_to_lmpzsoc.or. &
     149              :       wann%l_hsomtxvec_unf_to_lmpzsoc)then
     150            0 :       if(fmpi%irank==0)then
     151            0 :          call wann_convert_fleur_w90(input%jspins,l_nocosoc,wann)
     152              :        endif
     153              :          l_stopopt=.true.
     154              :     ENDIF
     155              : 
     156              : 
     157            2 :     IF(l_stopopt)  CALL juDFT_end("wann_optional done",fmpi%irank) 
     158              : 
     159            2 :     call timestop("wann_optional")
     160            2 :   END SUBROUTINE wann_optional
     161              : END MODULE m_wann_optional
        

Generated by: LCOV version 2.0-1