LCOV - code coverage report
Current view: top level - wannier - wann_read_inp.F90 (source / functions) Hit Total Coverage
Test: FLEUR test coverage Lines: 0 642 0.0 %
Date: 2024-04-28 04:28:00 Functions: 0 1 0.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             : 
       7             : module m_wann_read_inp
       8             : #ifdef CPP_MPI 
       9             :    use mpi 
      10             : #endif
      11             : contains
      12           0 : subroutine wann_read_inp(input,noco,fmpi,wann)
      13             : !********************************************
      14             : !     Read the Wannier input file 'wann_inp'.
      15             : !     Frank Freimuth
      16             : !********************************************
      17             :    use m_judft
      18             :    use m_types
      19             :    USE m_constants
      20             : 
      21             :    implicit none
      22             : 
      23             : 
      24             :    TYPE(t_input),intent(inout) :: input
      25             :    TYPE(t_noco),      INTENT(INOUT) :: noco
      26             :    TYPE(t_wann), intent(inout) :: wann
      27             :    TYPE(t_mpi),intent(in)          :: fmpi
      28             : 
      29             :    logical           :: l_file,l_orbcompinp,l_p0
      30             :    integer           :: i,ios,n,neigd_min,joblistlen
      31             :    character(len=30) :: task
      32             :    real              :: version_real
      33             : #ifdef CPP_MPI
      34             :           integer :: ierr
      35             : #endif
      36             : 
      37           0 :    l_p0=(fmpi%irank==0)
      38             : !-----some defaults
      39           0 :    wann%l_perpmagatlres=.false.
      40           0 :    wann%l_atomlist=.false.
      41           0 :    wann%l_ndegen=.false.
      42           0 :    wann%l_orbitalmom=.false.
      43           0 :    wann%l_orbcomp=.false.
      44           0 :    wann%l_orbcomprs=.false.
      45           0 :    wann%l_perturbrs=.false.
      46           0 :    wann%l_denmat=.false.
      47           0 :    wann%l_perturb=.false.
      48           0 :    wann%l_nedrho=.false.
      49           0 :    wann%l_anglmomrs=.false.
      50           0 :    wann%l_anglmom=.false.
      51           0 :    wann%l_socspicom=.false.
      52           0 :    wann%l_socspicomrs=.false.
      53           0 :    wann%l_offdiposoprs=.false.
      54           0 :    wann%l_offdiposop=.false.
      55           0 :    wann%l_spindisp=.false.
      56           0 :    wann%l_spindisprs=.false.
      57           0 :    wann%l_torque=.false.
      58           0 :    wann%l_torquers=.false.
      59           0 :    wann%l_berry=.false.
      60           0 :    wann%l_perpmag=.false.
      61           0 :    wann%l_perpmagrs=.false.
      62           0 :    wann%l_perpmagat=.false.
      63           0 :    wann%l_perpmagatrs=.false.
      64           0 :    wann%l_socmatrs=.false.
      65           0 :    wann%l_socmat=.false.
      66           0 :    wann%l_socmatvec=.false.
      67           0 :    wann%l_soctomom=.false.
      68           0 :    wann%l_kptsreduc2=.false.
      69           0 :    wann%l_nablars=.false.
      70           0 :    wann%l_nablapaulirs=.false.
      71           0 :    wann%l_surfcurr=.false.
      72           0 :    wann%l_updown=.false.
      73           0 :    wann%l_ahe=.false.
      74           0 :    wann%l_she=.false.
      75           0 :    wann%l_rmat=.false.
      76           0 :    wann%l_nabla=.false.
      77           0 :    wann%l_socodi=.false.
      78           0 :    wann%l_pauli=.false.
      79           0 :    wann%l_pauliat=.false.
      80           0 :    wann%l_potmat=.false.
      81           0 :    wann%l_projgen=.false.
      82           0 :    wann%l_stopopt=.false.
      83           0 :    wann%l_kpointgen=.false.
      84           0 :    wann%l_w90kpointgen=.false.
      85           0 :    wann%l_plot_symm=.false.
      86           0 :    wann%l_socmmn0=.false.
      87           0 :    wann%l_bzsym=.false.
      88           0 :    wann%l_hopping=.false.
      89           0 :    wann%l_kptsreduc=.false.
      90           0 :    wann%l_prepwan90=.false.
      91           0 :    wann%l_plot_umdat=.false.
      92           0 :    wann%l_wann_plot=.false.
      93           0 :    wann%l_bynumber=.false.
      94           0 :    wann%l_matrixmmn=.false.
      95           0 :    wann%l_matrixamn=.false.
      96           0 :    wann%l_projmethod=.false.
      97           0 :    wann%l_wannierize=.false.
      98           0 :    wann%l_plotw90=.false.
      99           0 :    wann%l_byenergy=.false.
     100           0 :    wann%l_proj_plot=.false.
     101           0 :    wann%l_bestproj=.false.
     102           0 :    wann%l_ikptstart=.false.
     103           0 :    wann%l_lapw=.false.
     104           0 :    wann%l_plot_lapw=.false.
     105           0 :    wann%l_fermi=.false.
     106           0 :    wann%l_dipole=.false.
     107           0 :    wann%l_dipole2=.false.
     108           0 :    wann%l_dipole3=.false.
     109           0 :    wann%l_mmn0=.false.
     110           0 :    wann%l_mmn0at=.false.
     111           0 :    wann%l_manyfiles=.false.
     112           0 :    wann%l_collectmanyfiles=.false.
     113           0 :    wann%l_ldauwan=.false.
     114           0 :    wann%l_lapw_kpts=.false.
     115           0 :    wann%l_lapw_gfleur=.false.
     116           0 :    wann%l_unformatted=.false.
     117           0 :    wann%l_finishnocoplot=.false.
     118           0 :    wann%l_finishgwf=.false.
     119           0 :    wann%l_skipkov=.false.
     120           0 :    wann%l_matrixuHu=.false.
     121           0 :    wann%l_matrixuHu_dmi=.false.
     122           0 :    wann%ikptstart=1
     123           0 :    wann%wan90version=2 ! Set the standard to Wannier90-1.2
     124           0 :    wann%l_mmn0_unf_to_spn_unf=.false.
     125           0 :    wann%l_mmn0_to_spn_unf=.false.
     126           0 :    wann%l_mmn0_to_spn=.false.
     127           0 :    wann%l_mmn0_to_spn2=.false.
     128           0 :    wann%l_mmn0_unf_to_spn=.false.
     129           0 :    wann%l_perpmag_unf_to_tor_unf=.false.
     130           0 :    wann%l_perpmag_to_tor_unf=.false.
     131           0 :    wann%l_perpmag_to_tor=.false.
     132           0 :    wann%l_perpmag_unf_to_tor=.false.
     133           0 :    wann%l_hsomtxvec_unf_to_lmpzsoc_unf=.false.
     134           0 :    wann%l_hsomtxvec_to_lmpzsoc_unf=.false.
     135           0 :    wann%l_hsomtxvec_to_lmpzsoc=.false.
     136           0 :    wann%l_hsomtxvec_unf_to_lmpzsoc=.false.
     137           0 :    wann%l_hsomtx_unf_to_hsoc_unf=.false.
     138           0 :    wann%l_hsomtx_to_hsoc_unf=.false.
     139           0 :    wann%l_hsomtx_to_hsoc=.false.
     140           0 :    wann%l_hsomtx_unf_to_hsoc=.false.
     141           0 :    input%l_kpts_fullbz=.true.
     142             : 
     143             : !-----read the input file 'wann_inp'
     144           0 :    l_file=.false.
     145           0 :    inquire(file='wann_inp',exist=l_file)
     146           0 :    IF ((.not.l_file)) THEN
     147           0 :       CALL juDFT_error ("wann_inp not found", calledby="wann_read_inp")
     148             :    END IF
     149           0 :    IF (l_file) THEN
     150           0 :       wann%band_min(1:2)=-1
     151           0 :       wann%band_max(1:2)=-1
     152           0 :       wann%l_byindex=.false.
     153           0 :       open(916,file='wann_inp',form='formatted')
     154           0 :       i=0
     155             :       do
     156           0 :          i=i+1
     157           0 :          read(916,'(a)',iostat=ios)task
     158           0 :          if(ios.ne.0)exit
     159           0 :          if(l_p0) write(oUnit,*)"line ",i,":",task
     160           0 :          if(task(1:1).eq.'!')cycle
     161           0 :          if(index(task,'=F').ne.0.or.index(task,'=f').ne.0)cycle
     162           0 :          read(task,*,iostat=ios)task
     163           0 :          if(index(task,'=').ne.0)then
     164           0 :             task=task(1:(index(task,'=')-1))
     165             :          endif
     166           0 :          if(l_p0) write(oUnit,*)"==>key: ",task
     167           0 :          if(trim(task).eq.'endjobs')then
     168             :             exit
     169           0 :          elseif(trim(task).eq.'nabla')then
     170           0 :             wann%l_nabla=.true.
     171           0 :          elseif(trim(task).eq.'kptsreduc2')then
     172           0 :             wann%l_kptsreduc2=.true.
     173           0 :             backspace(916)
     174           0 :             read(916,*,iostat=ios)task,wann%mhp(1),wann%mhp(2),wann%mhp(3)
     175           0 :             if (ios /= 0) CALL juDFT_error ("error reading mhp", calledby="wann_read_inp")
     176           0 :             if(l_p0)write(oUnit,*)"mhp=",wann%mhp(1),wann%mhp(2),wann%mhp(3)
     177           0 :          elseif(trim(task).eq.'nablars')then
     178           0 :             wann%l_nablars=.true.
     179           0 :          elseif(trim(task).eq.'nablapaulirs')then
     180           0 :             wann%l_nablapaulirs=.true.
     181           0 :          elseif(trim(task).eq.'socspicom')then
     182           0 :             wann%l_socspicom=.true.
     183           0 :          elseif(trim(task).eq.'orbitalmom')then
     184           0 :             wann%l_orbitalmom=.true.
     185           0 :          elseif(trim(task).eq.'anglmom')then
     186           0 :             wann%l_anglmom=.true.
     187           0 :          elseif(trim(task).eq.'ndegen')then
     188           0 :             wann%l_ndegen=.true.
     189           0 :          elseif(trim(task).eq.'unformatted')then
     190           0 :             wann%l_unformatted=.true.
     191           0 :          elseif(trim(task).eq.'eig66')then
     192           0 :            call judft_error("eig66 not supported in wannier")
     193           0 :          elseif(trim(task).eq.'orbcomp')then
     194           0 :             wann%l_orbcomp=.true.
     195           0 :          elseif(trim(task).eq.'orbcomprs')then
     196           0 :             wann%l_orbcomprs=.true.
     197           0 :          elseif(trim(task).eq.'denmat')then
     198           0 :             wann%l_denmat=.true.
     199           0 :          elseif(trim(task).eq.'nedrho')then
     200           0 :             wann%l_nedrho=.true.
     201           0 :          elseif(trim(task).eq.'perturb')then
     202           0 :             wann%l_perturb=.true.
     203           0 :          elseif(trim(task).eq.'perturbrs')then
     204           0 :             wann%l_perturbrs=.true.
     205           0 :          elseif(trim(task).eq.'rmat')then
     206           0 :             wann%l_rmat=.true.
     207           0 :          elseif(trim(task).eq.'anglmomrs')then
     208           0 :             wann%l_anglmomrs=.true.
     209           0 :          elseif(trim(task).eq.'socspicomrs')then
     210           0 :             wann%l_socspicomrs=.true.
     211           0 :          elseif(trim(task).eq.'she')then
     212           0 :             wann%l_she=.true.
     213           0 :          elseif(trim(task).eq.'berry')then
     214           0 :             wann%l_berry=.true.
     215           0 :          elseif(trim(task).eq.'offdiposop')then
     216           0 :             wann%l_offdiposop=.true.
     217           0 :          elseif(trim(task).eq.'offdiposoprs')then
     218           0 :             wann%l_offdiposoprs=.true.
     219           0 :          elseif(trim(task).eq.'spindisp')then
     220           0 :             wann%l_spindisp=.true.
     221           0 :          elseif(trim(task).eq.'spindisprs')then
     222           0 :             wann%l_spindisprs=.true.
     223           0 :          elseif(trim(task).eq.'torque')then
     224           0 :             wann%l_torque=.true.
     225           0 :          elseif(trim(task).eq.'torquers')then
     226           0 :             wann%l_torquers=.true.
     227           0 :          elseif(trim(task).eq.'perpmag')then
     228           0 :             wann%l_perpmag=.true.
     229           0 :          elseif(trim(task).eq.'perpmagrs')then
     230           0 :             wann%l_perpmagrs=.true.
     231           0 :          elseif(trim(task).eq.'perpmagat')then
     232           0 :             wann%l_perpmagat=.true.
     233           0 :          elseif(trim(task).eq.'perpmagatrs')then
     234           0 :             wann%l_perpmagatrs=.true.
     235           0 :          elseif(trim(task).eq.'mmn0_unf_to_spn_unf')then
     236           0 :             wann%l_mmn0_unf_to_spn_unf=.true.
     237           0 :          elseif(trim(task).eq.'mmn0_to_spn_unf')then
     238           0 :             wann%l_mmn0_to_spn_unf=.true.
     239           0 :          elseif(trim(task).eq.'mmn0_to_spn')then
     240           0 :             wann%l_mmn0_to_spn=.true.
     241           0 :          elseif(trim(task).eq.'mmn0_to_spn2')then
     242           0 :             wann%l_mmn0_to_spn2=.true.
     243           0 :          elseif(trim(task).eq.'mmn0_unf_to_spn')then
     244           0 :             wann%l_mmn0_unf_to_spn=.true.
     245           0 :          elseif(trim(task).eq.'perpmag_unf_to_tor_unf')then
     246           0 :             wann%l_perpmag_unf_to_tor_unf=.true.
     247           0 :          elseif(trim(task).eq.'perpmag_to_tor_unf')then
     248           0 :             wann%l_perpmag_to_tor_unf=.true.
     249           0 :          elseif(trim(task).eq.'perpmag_to_tor')then
     250           0 :             wann%l_perpmag_to_tor=.true.
     251           0 :          elseif(trim(task).eq.'perpmag_unf_to_tor')then
     252           0 :             wann%l_perpmag_unf_to_tor=.true.
     253           0 :          elseif(trim(task).eq.'hsomtxvec_unf_to_lmpzsoc_unf')then
     254           0 :             wann%l_hsomtxvec_unf_to_lmpzsoc_unf=.true.
     255           0 :          elseif(trim(task).eq.'hsomtxvec_to_lmpzsoc_unf')then
     256           0 :             wann%l_hsomtxvec_to_lmpzsoc_unf=.true.
     257           0 :          elseif(trim(task).eq.'hsomtxvec_to_lmpzsoc')then
     258           0 :             wann%l_hsomtxvec_to_lmpzsoc=.true.
     259           0 :          elseif(trim(task).eq.'hsomtxvec_unf_to_lmpzsoc')then
     260           0 :             wann%l_hsomtxvec_unf_to_lmpzsoc=.true.
     261           0 :          elseif(trim(task).eq.'hsomtx_unf_to_hsoc_unf')then
     262           0 :             wann%l_hsomtx_unf_to_hsoc_unf=.true.
     263           0 :          elseif(trim(task).eq.'hsomtx_to_hsoc_unf')then
     264           0 :             wann%l_hsomtx_to_hsoc_unf=.true.
     265           0 :          elseif(trim(task).eq.'hsomtx_to_hsoc')then
     266           0 :             wann%l_hsomtx_to_hsoc=.true.
     267           0 :          elseif(trim(task).eq.'hsomtx_unf_to_hsoc')then
     268           0 :             wann%l_hsomtx_unf_to_hsoc=.true.
     269             : 
     270           0 :          elseif(trim(task).eq.'perpmagatlres')then
     271           0 :             wann%l_perpmagatlres=.true.
     272           0 :             backspace(916)
     273           0 :             read(916,*,iostat=ios)task,wann%perpmagl
     274           0 :             if (ios /= 0) &
     275             :                CALL juDFT_error ("error reading perpmagl", &
     276           0 :                                calledby="wann_read_inp")
     277             : 
     278           0 :          elseif(trim(task).eq.'socmat')then
     279           0 :             wann%l_socmat=.true.
     280           0 :          elseif(trim(task).eq.'socmatvec')then
     281           0 :             wann%l_socmatvec=.true.
     282           0 :          elseif(trim(task).eq.'socmatrs')then
     283           0 :             wann%l_socmatrs=.true.
     284           0 :          elseif(trim(task).eq.'soctomom')then
     285           0 :             wann%l_soctomom=.true.
     286           0 :          elseif(trim(task).eq.'surfcurr')then
     287           0 :             wann%l_surfcurr=.true.
     288           0 :          elseif(trim(task).eq.'lapw_kpts')then
     289           0 :             wann%l_lapw_kpts=.true.
     290           0 :          elseif(trim(task).eq.'updown')then
     291           0 :             wann%l_updown=.true.
     292           0 :          elseif(trim(task).eq.'stopopt')then
     293           0 :             wann%l_stopopt=.true.
     294           0 :          elseif(trim(task).eq.'projgen')then
     295           0 :             wann%l_projgen=.true.
     296           0 :          elseif(trim(task).eq.'kpointgen')then
     297           0 :             wann%l_kpointgen=.true.
     298           0 :          elseif(trim(task).eq.'potmat')then
     299           0 :             wann%l_potmat=.true.
     300           0 :          elseif(trim(task).eq.'w90kpointgen')then
     301           0 :             wann%l_w90kpointgen=.true.
     302           0 :          elseif(trim(task).eq.'lapw_gfleur')then
     303           0 :             wann%l_lapw_gfleur=.true.
     304           0 :             backspace(916)
     305           0 :             read(916,*,iostat=ios)task,wann%gfthick,wann%gfcut
     306           0 :             if (ios /= 0) CALL juDFT_error ("error reading gfcut", calledby="wann_read_inp")
     307           0 :             if(l_p0)write(oUnit,*)"gfcut=",wann%gfthick,wann%gfcut
     308           0 :          elseif(trim(task).eq.'lapw')then
     309           0 :             wann%l_lapw=.true.
     310           0 :             backspace(916)
     311           0 :             read(916,*,iostat=ios)task,wann%unigrid(:)
     312           0 :             if (ios /= 0) CALL juDFT_error ("error reading unigrid", calledby="wann_read_inp")
     313           0 :             if(l_p0)write(oUnit,*)"unigrid=",wann%unigrid(:)
     314           0 :          elseif(trim(task).eq.'plot_lapw')then
     315           0 :             wann%l_plot_lapw=.true.
     316           0 :          elseif(trim(task).eq.'bzsym')then
     317           0 :             wann%l_bzsym=.true.
     318           0 :             input%l_kpts_fullbz=.false.
     319           0 :          elseif(trim(task).eq.'mmn0')then
     320           0 :             wann%l_mmn0=.true.
     321           0 :          elseif(trim(task).eq.'mmn0at')then
     322           0 :             wann%l_mmn0at=.true.
     323           0 :          elseif(trim(task).eq.'manyfiles')then
     324           0 :             wann%l_manyfiles=.true.
     325           0 :          elseif(trim(task).eq.'collectmanyfiles')then
     326           0 :             wann%l_collectmanyfiles=.true.
     327           0 :          elseif(trim(task).eq.'bestproj')then
     328           0 :             wann%l_bestproj=.true.
     329           0 :          elseif(trim(task).eq.'pauli')then
     330           0 :             wann%l_pauli=.true.
     331           0 :          elseif(trim(task).eq.'pauliat')then
     332           0 :             wann%l_pauliat=.true.
     333           0 :          elseif(trim(task).eq.'proj_plot')then
     334           0 :             wann%l_proj_plot=.true.
     335           0 :          elseif(trim(task).eq.'hopping')then
     336           0 :             wann%l_hopping=.true.
     337           0 :          elseif(trim(task).eq.'plot_symm')then
     338           0 :             wann%l_plot_symm=.true.
     339           0 :          elseif(trim(task).eq.'kptsreduc')then
     340           0 :             wann%l_kptsreduc=.true.
     341           0 :          elseif(trim(task).eq.'fermi')then
     342           0 :             wann%l_fermi=.true.
     343           0 :          elseif(trim(task).eq.'prepwan90')then
     344           0 :             wann%l_prepwan90=.true.
     345           0 :          elseif(trim(task).eq.'plot_umdat')then
     346           0 :             wann%l_plot_umdat=.true.
     347           0 :          elseif(trim(task).eq.'wann_plot')then
     348           0 :             wann%l_wann_plot=.true.
     349           0 :          elseif(trim(task).eq.'bynumber')then
     350           0 :             wann%l_bynumber=.true.
     351           0 :          elseif(trim(task).eq.'matrixmmn')then
     352           0 :             wann%l_matrixmmn=.true.
     353           0 :          elseif(trim(task).eq.'projmethod')then
     354           0 :             wann%l_projmethod=.true.
     355           0 :          elseif(trim(task).eq.'matrixamn')then
     356           0 :             wann%l_matrixamn=.true.
     357           0 :          elseif(trim(task).eq.'wannierize')then
     358           0 :             wann%l_wannierize=.true.
     359           0 :          elseif(trim(task).eq.'plotw90')then
     360           0 :             wann%l_plotw90=.true.
     361           0 :          elseif(trim(task).eq.'dipole')then
     362           0 :             wann%l_dipole=.true.
     363           0 :          elseif(trim(task).eq.'dipole3')then
     364           0 :             wann%l_dipole3=.true.
     365           0 :          elseif(trim(task).eq.'ldauwan')then
     366           0 :             wann%l_ldauwan=.true.
     367           0 :          elseif(trim(task).eq.'byenergy')then
     368           0 :             wann%l_byenergy=.true.
     369           0 :          elseif(trim(task).eq.'finishnocoplot') then
     370           0 :             wann%l_finishnocoplot=.true.
     371           0 :          elseif(trim(task).eq.'finishgwf') then
     372           0 :             wann%l_finishgwf=.true.
     373           0 :          elseif(trim(task).eq.'skipkov') then
     374           0 :             wann%l_skipkov=.true.
     375           0 :          elseif(trim(task).eq.'matrixuhu') then
     376           0 :             wann%l_matrixuHu=.true.
     377           0 :          elseif(trim(task).eq.'matrixuhu-dmi') then
     378           0 :             wann%l_matrixuHu_dmi=.true.
     379           0 :          elseif(trim(task).eq.'wan90version')then
     380           0 :             backspace(916)
     381           0 :             read(916,*,iostat=ios)task,version_real
     382           0 :             if (ios /= 0) CALL judft_error("error reading wan90version", calledby="wann_read_inp")
     383           0 :             if(abs(version_real-1.1).lt.1.e-9)then
     384           0 :                wann%wan90version=1
     385           0 :             elseif(abs(version_real-1.2).lt.1.e-9)then
     386           0 :                wann%wan90version=2
     387           0 :             elseif(abs(version_real-2.0).lt.1.e-9)then
     388           0 :                wann%wan90version=3
     389             :             else
     390           0 :               CALL judft_error ("chosen w90 version unknown", calledby="wann_read_inp")
     391             :             endif
     392           0 :          elseif(trim(task).eq.'atomlist')then
     393           0 :             wann%l_atomlist=.true.
     394           0 :             backspace(916)
     395           0 :             read(916,*,iostat=ios)task,wann%atomlist_num
     396           0 :             if (ios /= 0) CALL judft_error ("error reading atomlist_num", calledby="wann_read_inp")
     397           0 :             if(allocated(wann%atomlist))deallocate(wann%atomlist)
     398           0 :             allocate(wann%atomlist(wann%atomlist_num))
     399           0 :             backspace(916)
     400           0 :             read(916,*,iostat=ios)task,wann%atomlist_num,wann%atomlist
     401           0 :             if (ios /= 0) CALL judft_error ("error reading atomlist", calledby="wann_read_inp")
     402           0 :             if(l_p0)write(oUnit,*)"atomlist_num=",wann%atomlist_num
     403           0 :             if(l_p0)write(oUnit,*)"atomlist=",wann%atomlist
     404           0 :          elseif(trim(task).eq.'byindex')then
     405           0 :             wann%l_byindex=.true.
     406           0 :             backspace(916)
     407           0 :             read(916,*,iostat=ios)task,wann%band_min(1),wann%band_max(1)
     408           0 :             if (ios /= 0) CALL juDFT_error("error reading byindex,band_min,band_max", calledby="wann_read_inp")
     409           0 :             if(l_p0)write(oUnit,*)"band_min=",wann%band_min(1)
     410           0 :             if(l_p0)write(oUnit,*)"band_max=",wann%band_max(1)
     411           0 :             if(wann%band_min(2).eq.-1)then
     412           0 :                wann%band_min(2)=wann%band_min(1)
     413           0 :                wann%band_max(2)=wann%band_max(1)
     414             :             endif
     415           0 :          elseif(trim(task).eq.'byindex2')then
     416           0 :             wann%l_byindex=.true.
     417           0 :             backspace(916)
     418           0 :             read(916,*,iostat=ios)task,wann%band_min(2),wann%band_max(2)
     419           0 :             if (ios /= 0) CALL juDFT_error ("error reading byindex2,band_min2,band_max", calledby="wann_read_inp")
     420           0 :             if(l_p0)write(oUnit,*)"band_min2=",wann%band_min(2)
     421           0 :             if(l_p0)write(oUnit,*)"band_max2=",wann%band_max(2)
     422           0 :             if(wann%band_min(1).eq.-1)then
     423           0 :                wann%band_min(1)=wann%band_min(2)
     424           0 :                wann%band_max(1)=wann%band_max(2)
     425             :             endif
     426           0 :          elseif(trim(task).eq.'ikptstart')then
     427           0 :             wann%l_ikptstart=.true.
     428           0 :             backspace(916)
     429           0 :             read(916,*,iostat=ios)task,wann%ikptstart
     430           0 :             if (ios /= 0) CALL juDFT_error ("error reading ikptstart", calledby="wann_read_inp")
     431           0 :             if(l_p0)write(oUnit,*)"ikptstart=",wann%ikptstart
     432             :          else
     433           0 :             write(oUnit,*)"unrecognized key: ",task
     434           0 :             CALL juDFT_error ("unrecognized key in wann_inp", calledby="wann_read_inp")
     435             :          endif
     436             :       enddo
     437             : 
     438           0 :       if (ios /= 0) CALL juDFT_error ("error reading wann_inp", calledby="wann_read_inp")
     439           0 :       if(l_p0.and.ios.lt.0)write(oUnit,*)"end of wann_inp reached"
     440           0 :       close(916)
     441             : 
     442             :    ELSE
     443             : 
     444             : #ifdef CPP_MPI
     445           0 :       jobListlen=SIZE(wann%jobList)
     446           0 :       CALL MPI_BCAST(jobListlen,1,MPI_INTEGER,0,fmpi%mpi_comm,ierr)
     447           0 :       CALL MPI_BCAST(wann%band_min,2,MPI_INTEGER,0,fmpi%mpi_comm,ierr)
     448           0 :       CALL MPI_BCAST(wann%band_max,2,MPI_INTEGER,0,fmpi%mpi_comm,ierr)
     449           0 :       CALL MPI_BCAST(wann%l_byindex,1,MPI_LOGICAL,0,fmpi%mpi_comm,ierr)
     450           0 :       if(fmpi%irank>0)then
     451           0 :         allocate(wann%jobList(jobListlen))
     452             :       endif
     453             : #endif
     454           0 :       DO i = 1, SIZE(wann%jobList)
     455             : #ifdef CPP_MPI
     456           0 :       CALL MPI_BCAST(wann%jobList(i),20,MPI_CHARACTER,0,fmpi%mpi_comm,ierr)
     457             : #endif
     458           0 :          task = TRIM(ADJUSTL(wann%jobList(i)))
     459           0 :          if(l_p0) write(oUnit,*)"task ",i,":",task
     460           0 :          if(task(1:1).eq.'!')cycle
     461           0 :          if(index(task,'=F').ne.0.or.index(task,'=f').ne.0)cycle
     462           0 :          read(task,*,iostat=ios)task
     463           0 :          if(index(task,'=').ne.0)then
     464           0 :             task=task(1:(index(task,'=')-1))
     465             :          endif
     466           0 :          if(l_p0) write(oUnit,*)"==>key: ",task
     467           0 :          if(trim(task).eq.'endjobs') THEN
     468             :             EXIT
     469           0 :          elseif(trim(task).eq.'nabla')then
     470           0 :             wann%l_nabla=.true.
     471             : !         elseif(trim(task).eq.'kptsreduc2')then
     472             : !            wann%l_kptsreduc2=.true.
     473             : !            backspace(916)
     474             : !            read(916,*,iostat=ios)task,wann%mhp(1),wann%mhp(2),wann%mhp(3)
     475             : !            if (ios /= 0) CALL juDFT_error ("error reading mhp", calledby="wann_read_inp")
     476             : !            if(l_p0)write(oUnit,*)"mhp=",wann%mhp(1),wann%mhp(2),wann%mhp(3)
     477           0 :          elseif(trim(task).eq.'nablars')then
     478           0 :             wann%l_nablars=.true.
     479           0 :          elseif(trim(task).eq.'nablapaulirs')then
     480           0 :             wann%l_nablapaulirs=.true.
     481           0 :          elseif(trim(task).eq.'socspicom')then
     482           0 :             wann%l_socspicom=.true.
     483           0 :          elseif(trim(task).eq.'orbitalmom')then
     484           0 :             wann%l_orbitalmom=.true.
     485           0 :          elseif(trim(task).eq.'anglmom')then
     486           0 :             wann%l_anglmom=.true.
     487           0 :          elseif(trim(task).eq.'ndegen')then
     488           0 :             wann%l_ndegen=.true.
     489           0 :          elseif(trim(task).eq.'unformatted')then
     490           0 :             wann%l_unformatted=.true.
     491           0 :          elseif(trim(task).eq.'eig66')then
     492           0 :            call judft_error("eig66 not supported in wannier")
     493             :             !input%eig66(1)=.true.
     494           0 :          elseif(trim(task).eq.'orbcomp')then
     495           0 :             wann%l_orbcomp=.true.
     496           0 :          elseif(trim(task).eq.'orbcomprs')then
     497           0 :             wann%l_orbcomprs=.true.
     498           0 :          elseif(trim(task).eq.'denmat')then
     499           0 :             wann%l_denmat=.true.
     500           0 :          elseif(trim(task).eq.'nedrho')then
     501           0 :             wann%l_nedrho=.true.
     502           0 :          elseif(trim(task).eq.'perturb')then
     503           0 :             wann%l_perturb=.true.
     504           0 :          elseif(trim(task).eq.'perturbrs')then
     505           0 :             wann%l_perturbrs=.true.
     506           0 :          elseif(trim(task).eq.'rmat')then
     507           0 :             wann%l_rmat=.true.
     508           0 :          elseif(trim(task).eq.'anglmomrs')then
     509           0 :             wann%l_anglmomrs=.true.
     510           0 :          elseif(trim(task).eq.'socspicomrs')then
     511           0 :             wann%l_socspicomrs=.true.
     512           0 :          elseif(trim(task).eq.'she')then
     513           0 :             wann%l_she=.true.
     514           0 :          elseif(trim(task).eq.'berry')then
     515           0 :             wann%l_berry=.true.
     516           0 :          elseif(trim(task).eq.'offdiposop')then
     517           0 :             wann%l_offdiposop=.true.
     518           0 :          elseif(trim(task).eq.'offdiposoprs')then
     519           0 :             wann%l_offdiposoprs=.true.
     520           0 :          elseif(trim(task).eq.'spindisp')then
     521           0 :             wann%l_spindisp=.true.
     522           0 :          elseif(trim(task).eq.'spindisprs')then
     523           0 :             wann%l_spindisprs=.true.
     524           0 :          elseif(trim(task).eq.'torque')then
     525           0 :             wann%l_torque=.true.
     526           0 :          elseif(trim(task).eq.'torquers')then
     527           0 :             wann%l_torquers=.true.
     528           0 :          elseif(trim(task).eq.'perpmag')then
     529           0 :             wann%l_perpmag=.true.
     530           0 :          elseif(trim(task).eq.'perpmagrs')then
     531           0 :             wann%l_perpmagrs=.true.
     532           0 :          elseif(trim(task).eq.'perpmagat')then
     533           0 :             wann%l_perpmagat=.true.
     534           0 :          elseif(trim(task).eq.'perpmagatrs')then
     535           0 :             wann%l_perpmagatrs=.true.
     536           0 :          elseif(trim(task).eq.'mmn0_unf_to_spn_unf')then
     537           0 :             wann%l_mmn0_unf_to_spn_unf=.true.
     538           0 :          elseif(trim(task).eq.'mmn0_to_spn_unf')then
     539           0 :             wann%l_mmn0_to_spn_unf=.true.
     540           0 :          elseif(trim(task).eq.'mmn0_to_spn')then
     541           0 :             wann%l_mmn0_to_spn=.true.
     542           0 :          elseif(trim(task).eq.'mmn0_to_spn2')then
     543           0 :             wann%l_mmn0_to_spn2=.true.
     544           0 :          elseif(trim(task).eq.'mmn0_unf_to_spn')then
     545           0 :             wann%l_mmn0_unf_to_spn=.true.
     546           0 :          elseif(trim(task).eq.'perpmag_unf_to_tor_unf')then
     547           0 :             wann%l_perpmag_unf_to_tor_unf=.true.
     548           0 :          elseif(trim(task).eq.'perpmag_to_tor_unf')then
     549           0 :             wann%l_perpmag_to_tor_unf=.true.
     550           0 :          elseif(trim(task).eq.'perpmag_to_tor')then
     551           0 :             wann%l_perpmag_to_tor=.true.
     552           0 :          elseif(trim(task).eq.'perpmag_unf_to_tor')then
     553           0 :             wann%l_perpmag_unf_to_tor=.true.
     554           0 :          elseif(trim(task).eq.'hsomtxvec_unf_to_lmpzsoc_unf')then
     555           0 :             wann%l_hsomtxvec_unf_to_lmpzsoc_unf=.true.
     556           0 :          elseif(trim(task).eq.'hsomtxvec_to_lmpzsoc_unf')then
     557           0 :             wann%l_hsomtxvec_to_lmpzsoc_unf=.true.
     558           0 :          elseif(trim(task).eq.'hsomtxvec_to_lmpzsoc')then
     559           0 :             wann%l_hsomtxvec_to_lmpzsoc=.true.
     560           0 :          elseif(trim(task).eq.'hsomtxvec_unf_to_lmpzsoc')then
     561           0 :             wann%l_hsomtxvec_unf_to_lmpzsoc=.true.
     562           0 :          elseif(trim(task).eq.'hsomtx_unf_to_hsoc_unf')then
     563           0 :             wann%l_hsomtx_unf_to_hsoc_unf=.true.
     564           0 :          elseif(trim(task).eq.'hsomtx_to_hsoc_unf')then
     565           0 :             wann%l_hsomtx_to_hsoc_unf=.true.
     566           0 :          elseif(trim(task).eq.'hsomtx_to_hsoc')then
     567           0 :             wann%l_hsomtx_to_hsoc=.true.
     568           0 :          elseif(trim(task).eq.'hsomtx_unf_to_hsoc')then
     569           0 :             wann%l_hsomtx_unf_to_hsoc=.true.
     570             : 
     571           0 :          elseif(trim(task).eq.'perpmagatlres')then
     572           0 :             wann%l_perpmagatlres=.true.
     573           0 :             backspace(916)
     574           0 :             read(916,*,iostat=ios)task,wann%perpmagl
     575           0 :             if (ios /= 0) &
     576             :                CALL juDFT_error ("error reading perpmagl", &
     577           0 :                                calledby="wann_read_inp")
     578             : 
     579           0 :          elseif(trim(task).eq.'socmat')then
     580           0 :             wann%l_socmat=.true.
     581           0 :          elseif(trim(task).eq.'socmatvec')then
     582           0 :             wann%l_socmatvec=.true.
     583           0 :          elseif(trim(task).eq.'socmatrs')then
     584           0 :             wann%l_socmatrs=.true.
     585           0 :          elseif(trim(task).eq.'soctomom')then
     586           0 :             wann%l_soctomom=.true.
     587           0 :          elseif(trim(task).eq.'surfcurr')then
     588           0 :             wann%l_surfcurr=.true.
     589           0 :          elseif(trim(task).eq.'lapw_kpts')then
     590           0 :             wann%l_lapw_kpts=.true.
     591           0 :          elseif(trim(task).eq.'updown')then
     592           0 :             wann%l_updown=.true.
     593           0 :          elseif(trim(task).eq.'stopopt')then
     594           0 :             wann%l_stopopt=.true.
     595           0 :          elseif(trim(task).eq.'projgen')then
     596           0 :             wann%l_projgen=.true.
     597           0 :          elseif(trim(task).eq.'kpointgen')then
     598           0 :             wann%l_kpointgen=.true.
     599           0 :          elseif(trim(task).eq.'potmat')then
     600           0 :             wann%l_potmat=.true.
     601           0 :          elseif(trim(task).eq.'w90kpointgen')then
     602           0 :             wann%l_w90kpointgen=.true.
     603             : !         elseif(trim(task).eq.'lapw_gfleur')then
     604             : !            wann%l_lapw_gfleur=.true.
     605             : !            backspace(916)
     606             : !            read(916,*,iostat=ios)task,wann%gfthick,wann%gfcut
     607             : !            if (ios /= 0) CALL juDFT_error ("error reading gfcut", calledby="wann_read_inp")
     608             : !            if(l_p0)write(oUnit,*)"gfcut=",wann%gfthick,wann%gfcut
     609             : !         elseif(trim(task).eq.'lapw')then
     610             : !            wann%l_lapw=.true.
     611             : !            backspace(916)
     612             : !            read(916,*,iostat=ios)task,wann%unigrid(:)
     613             : !            if (ios /= 0) CALL juDFT_error ("error reading unigrid", calledby="wann_read_inp")
     614             : !            if(l_p0)write(oUnit,*)"unigrid=",wann%unigrid(:)
     615           0 :          elseif(trim(task).eq.'plot_lapw')then
     616           0 :             wann%l_plot_lapw=.true.
     617           0 :          elseif(trim(task).eq.'bzsym')then
     618           0 :             wann%l_bzsym=.true.
     619           0 :             input%l_kpts_fullbz=.false.
     620           0 :          elseif(trim(task).eq.'mmn0')then
     621           0 :             wann%l_mmn0=.true.
     622           0 :          elseif(trim(task).eq.'mmn0at')then
     623           0 :             wann%l_mmn0at=.true.
     624           0 :          elseif(trim(task).eq.'manyfiles')then
     625           0 :             wann%l_manyfiles=.true.
     626           0 :          elseif(trim(task).eq.'collectmanyfiles')then
     627           0 :             wann%l_collectmanyfiles=.true.
     628           0 :          elseif(trim(task).eq.'bestproj')then
     629           0 :             wann%l_bestproj=.true.
     630           0 :          elseif(trim(task).eq.'pauli')then
     631           0 :             wann%l_pauli=.true.
     632           0 :          elseif(trim(task).eq.'pauliat')then
     633           0 :             wann%l_pauliat=.true.
     634           0 :          elseif(trim(task).eq.'proj_plot')then
     635           0 :             wann%l_proj_plot=.true.
     636           0 :          elseif(trim(task).eq.'hopping')then
     637           0 :             wann%l_hopping=.true.
     638           0 :          elseif(trim(task).eq.'plot_symm')then
     639           0 :             wann%l_plot_symm=.true.
     640           0 :          elseif(trim(task).eq.'kptsreduc')then
     641           0 :             wann%l_kptsreduc=.true.
     642           0 :          elseif(trim(task).eq.'fermi')then
     643           0 :             wann%l_fermi=.true.
     644           0 :          elseif(trim(task).eq.'prepwan90')then
     645           0 :             wann%l_prepwan90=.true.
     646           0 :          elseif(trim(task).eq.'plot_umdat')then
     647           0 :             wann%l_plot_umdat=.true.
     648           0 :          elseif(trim(task).eq.'wann_plot')then
     649           0 :             wann%l_wann_plot=.true.
     650           0 :          elseif(trim(task).eq.'bynumber')then
     651           0 :             wann%l_bynumber=.true.
     652           0 :          elseif(trim(task).eq.'matrixmmn')then
     653           0 :             wann%l_matrixmmn=.true.
     654           0 :          elseif(trim(task).eq.'projmethod')then
     655           0 :             wann%l_projmethod=.true.
     656           0 :          elseif(trim(task).eq.'matrixamn')then
     657           0 :             wann%l_matrixamn=.true.
     658           0 :          elseif(trim(task).eq.'wannierize')then
     659           0 :             wann%l_wannierize=.true.
     660           0 :          elseif(trim(task).eq.'plotw90')then
     661           0 :             wann%l_plotw90=.true.
     662           0 :          elseif(trim(task).eq.'dipole')then
     663           0 :             wann%l_dipole=.true.
     664           0 :          elseif(trim(task).eq.'dipole3')then
     665           0 :             wann%l_dipole3=.true.
     666           0 :          elseif(trim(task).eq.'ldauwan')then
     667           0 :             wann%l_ldauwan=.true.
     668           0 :          elseif(trim(task).eq.'byenergy')then
     669           0 :             wann%l_byenergy=.true.
     670           0 :          elseif(trim(task).eq.'finishnocoplot') then
     671           0 :             wann%l_finishnocoplot=.true.
     672           0 :          elseif(trim(task).eq.'finishgwf') then
     673           0 :             wann%l_finishgwf=.true.
     674           0 :          elseif(trim(task).eq.'skipkov') then
     675           0 :             wann%l_skipkov=.true.
     676           0 :          elseif(trim(task).eq.'matrixuhu') then
     677           0 :             wann%l_matrixuHu=.true.
     678           0 :          elseif(trim(task).eq.'matrixuhu-dmi') then
     679           0 :             wann%l_matrixuHu_dmi=.true.
     680             : !         elseif(trim(task).eq.'wan90version')then
     681             : !            backspace(916)
     682             : !            read(916,*,iostat=ios)task,version_real
     683             : !            if (ios /= 0) CALL judft_error("error reading wan90version", calledby="wann_read_inp")
     684             : !            if(abs(version_real-1.1).lt.1.e-9)then
     685             : !               wann%wan90version=1
     686             : !            elseif(abs(version_real-1.2).lt.1.e-9)then
     687             : !               wann%wan90version=2
     688             : !            elseif(abs(version_real-2.0).lt.1.e-9)then
     689             : !               wann%wan90version=3
     690             : !            else
     691             : !              CALL judft_error ("chosen w90 version unknown", calledby="wann_read_inp")
     692             : !            endif
     693             : !         elseif(trim(task).eq.'atomlist')then
     694             : !            wann%l_atomlist=.true.
     695             : !            backspace(916)
     696             : !            read(916,*,iostat=ios)task,wann%atomlist_num
     697             : !            if (ios /= 0) CALL judft_error ("error reading atomlist_num", calledby="wann_read_inp")
     698             : !            if(allocated(wann%atomlist))deallocate(wann%atomlist)
     699             : !            allocate(wann%atomlist(wann%atomlist_num))
     700             : !            backspace(916)
     701             : !            read(916,*,iostat=ios)task,wann%atomlist_num,wann%atomlist
     702             : !            if (ios /= 0) CALL judft_error ("error reading atomlist", calledby="wann_read_inp")
     703             : !            if(l_p0)write(oUnit,*)"atomlist_num=",wann%atomlist_num
     704             : !            if(l_p0)write(oUnit,*)"atomlist=",wann%atomlist
     705             : !         elseif(trim(task).eq.'ikptstart')then
     706             : !            wann%l_ikptstart=.true.
     707             : !            backspace(916)
     708             : !            read(916,*,iostat=ios)task,wann%ikptstart
     709             : !            if (ios /= 0) CALL juDFT_error ("error reading ikptstart", calledby="wann_read_inp")
     710             : !            if(l_p0)write(oUnit,*)"ikptstart=",wann%ikptstart
     711             :          else
     712           0 :             write(oUnit,*)"unrecognized key: ",task
     713           0 :             CALL juDFT_error ("unrecognized key in wannier jobList", calledby="wann_read_inp")
     714             :          endif
     715             :       enddo
     716             : 
     717           0 :       IF (wann%l_byindex) THEN
     718           0 :          if(l_p0)write(oUnit,*)"band_min1=",wann%band_min(1)
     719           0 :          if(l_p0)write(oUnit,*)"band_max1=",wann%band_max(1)
     720           0 :          if(l_p0)write(oUnit,*)"band_min2=",wann%band_min(2)
     721           0 :          if(l_p0)write(oUnit,*)"band_max2=",wann%band_max(2)
     722             :       END IF
     723             : 
     724             :    END IF ! l_file
     725             : 
     726             : 
     727             : !-----input file for orbital decomposition
     728           0 :    if(wann%l_orbcomp.or.wann%l_orbcomprs)then
     729           0 :       inquire(file='orbcomp_inp',exist=l_orbcompinp)
     730           0 :       if(l_orbcompinp)then
     731           0 :          open(159,file='orbcomp_inp')
     732           0 :          read(159,*)wann%oc_num_orbs,wann%l_oc_f
     733           0 :          if(allocated(wann%oc_orbs))deallocate(wann%oc_orbs)
     734           0 :          allocate(wann%oc_orbs(wann%oc_num_orbs))
     735           0 :          do n=1,wann%oc_num_orbs
     736           0 :             read(159,*)wann%oc_orbs(n)
     737             :          enddo
     738           0 :          close(159)
     739             :       else !default is all atoms including f
     740             : !         wann%oc_num_orbs=natd
     741           0 :          wann%l_oc_f=.true.
     742           0 :          if(allocated(wann%oc_orbs))deallocate(wann%oc_orbs)
     743           0 :          allocate(wann%oc_orbs(wann%oc_num_orbs))
     744           0 :          do n=1,wann%oc_num_orbs
     745           0 :             wann%oc_orbs(n)=n
     746             :          enddo
     747             :       endif
     748             :    endif
     749             : 
     750             : !-----default atom list: all atoms
     751           0 :    if(.not.wann%l_atomlist)then
     752           0 :      if(allocated(wann%atomlist))deallocate(wann%atomlist)
     753           0 :      allocate(wann%atomlist(wann%atomlist_num))
     754           0 :      do n=1,wann%atomlist_num
     755           0 :        wann%atomlist(n)=n
     756             :      enddo
     757             :    endif
     758             : 
     759             : 
     760             : !---- check if we need to increase the neigd parameter
     761           0 :    if(wann%l_byindex)then
     762           0 :    if(noco%l_soc.OR.noco%l_noco)then
     763           0 :       neigd_min=wann%band_max(1)
     764             :    else
     765           0 :       neigd_min=max(wann%band_max(1),wann%band_max(2))
     766             :    endif !noco,soc?
     767           0 :    if(l_p0)then
     768           0 :       write(*,*)"In wann_read_inp: input-neigd=",input%neig
     769           0 :       write(*,*)"In wann_read_inp: we require at least neigd_min=",neigd_min
     770           0 :       if(neigd_min>input%neig)then
     771           0 :          write(*,*)"we increase neigd..."
     772             :       else
     773           0 :          write(*,*)"we leave neigd unchanged"
     774             :       endif
     775             :    endif !l_p0?
     776           0 :    if(neigd_min>input%neig)then
     777           0 :          input%neig=neigd_min
     778             :    endif
     779           0 :    if(l_p0)then
     780           0 :       write(*,*)"In wann_read_inp: output-neigd=",input%neig
     781             :    endif
     782             : 
     783             :    endif !l_byindex?
     784             : 
     785             : 
     786             : !!! Consistency checks
     787           0 :    if(wann%l_mmn0.and.wann%l_updown)then
     788             : !!! updown-mmn0 makes sense only when wannierspin=2, i.e., the calculation
     789             : !!! needs to be spin-polarized (jspins=2), or, in the case jspins=1 it makes sense when l_soc=true,
     790             : !!! because then wannierspin=2 as well. When spin-orbit coupling is added during Wannier interpolation
     791             : !!! we can construct the matrix elements of the pauli matrix in the case jspins=1 from the WF1.mmn0, and
     792             : !!! we do not need the updown.mmn0 for this.
     793           0 :       if(input%jspins.eq.1 .and. .not. noco%l_soc)then
     794           0 :          call juDFT_error("no updown-mmn0 when soc=F and jspins=1",calledby="wann_read_inp.F90")
     795             :       endif
     796             : 
     797             :    endif
     798           0 :    if(wann%l_socmat.and.input%jspins==1)then
     799           0 :       if(noco%l_soc)then
     800           0 :         call juDFT_error("Not yet implemented: jspins=1&& socmat=T&& soc=T",calledby="wann_read_inp.F90")
     801             :       endif
     802             :    endif
     803             : 
     804             : 
     805           0 : end subroutine wann_read_inp
     806             : 
     807             : end module m_wann_read_inp

Generated by: LCOV version 1.14