types_wannier.f90 14.4 KB
Newer Older
Daniel Wortmann's avatar
Daniel Wortmann committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
!--------------------------------------------------------------------------------
! 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.
!--------------------------------------------------------------------------------

MODULE m_types_wannier
  USE m_juDFT
  USE m_types_fleurinput_base
  IMPLICIT NONE
  PRIVATE
  !
  ! type for wannier-functions
  !
  TYPE,EXTENDS(t_fleurinput_base):: t_wann
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
    !New parameters not handled correctly yet...
    LOGICAL :: l_socmatvec
    LOGICAL :: l_socmatvecrs
    LOGICAL :: l_mmn0_unf_to_spn_unf
      LOGICAL :: l_mmn0_to_spn_unf
      LOGICAL :: l_mmn0_to_spn
      LOGICAL :: l_mmn0_to_spn2
      LOGICAL :: l_mmn0_unf_to_spn
      LOGICAL :: l_perpmag_unf_to_tor_unf
      LOGICAL :: l_perpmag_to_tor_unf
      LOGICAL :: l_perpmag_to_tor
      LOGICAL :: l_perpmag_unf_to_tor
      LOGICAL :: l_hsomtxvec_unf_to_lmpzsoc_unf
      LOGICAL :: l_hsomtxvec_to_lmpzsoc_unf
      LOGICAL :: l_hsomtxvec_to_lmpzsoc
      LOGICAL :: l_hsomtxvec_unf_to_lmpzsoc
      LOGICAL :: l_hsomtx_unf_to_hsoc_unf
      LOGICAL :: l_hsomtx_to_hsoc_unf
      LOGICAL :: l_hsomtx_to_hsoc
      LOGICAL :: l_hsomtx_unf_to_hsoc
      INTEGER :: perpmagl
      LOGICAL :: l_perpmagatlres

Daniel Wortmann's avatar
Daniel Wortmann committed
39 40
     INTEGER :: wan90version =3
     INTEGER :: oc_num_orbs =0
Daniel Wortmann's avatar
Daniel Wortmann committed
41
     INTEGER, ALLOCATABLE :: oc_orbs(:)
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
     LOGICAL :: l_unformatted =.FALSE.
     LOGICAL :: l_oc_f=.FALSE.
     LOGICAL :: l_ndegen=.FALSE.
     LOGICAL :: l_orbitalmom=.FALSE.
     LOGICAL :: l_orbcomp=.FALSE.
     LOGICAL :: l_orbcomprs=.FALSE.
     LOGICAL :: l_denmat=.FALSE.
     LOGICAL :: l_perturbrs=.FALSE.
     LOGICAL :: l_perturb=.FALSE.
     LOGICAL :: l_nedrho=.FALSE.
     LOGICAL :: l_anglmomrs=.FALSE.
     LOGICAL :: l_anglmom=.FALSE.
     LOGICAL :: l_spindisp=.FALSE.
     LOGICAL :: l_spindisprs=.FALSE.
     LOGICAL :: l_socspicom=.FALSE.
     LOGICAL :: l_socspicomrs=.FALSE.
     LOGICAL :: l_offdiposoprs=.FALSE.
     LOGICAL :: l_offdiposop=.FALSE.
     LOGICAL :: l_torque=.FALSE.
     LOGICAL :: l_torquers=.FALSE.
     LOGICAL :: l_atomlist=.FALSE.
Daniel Wortmann's avatar
Daniel Wortmann committed
63
     INTEGER :: atomlist_num=0
Daniel Wortmann's avatar
Daniel Wortmann committed
64
     INTEGER, ALLOCATABLE :: atomlist(:)
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
     LOGICAL :: l_berry=.FALSE.
     LOGICAL :: l_perpmagrs=.FALSE.
     LOGICAL :: l_perpmag=.FALSE.
     LOGICAL :: l_perpmagat=.FALSE.
     LOGICAL :: l_perpmagatrs=.FALSE.
     LOGICAL :: l_socmatrs=.FALSE.
     LOGICAL :: l_socmat=.FALSE.
     LOGICAL :: l_soctomom=.FALSE.
     LOGICAL :: l_kptsreduc2=.FALSE.
     LOGICAL :: l_nablapaulirs=.FALSE.
     LOGICAL :: l_nablars=.FALSE.
     LOGICAL :: l_surfcurr=.FALSE.
     LOGICAL :: l_updown=.FALSE.
     LOGICAL :: l_ahe=.FALSE.
     LOGICAL :: l_she=.FALSE.
     LOGICAL :: l_rmat=.FALSE.
     LOGICAL :: l_nabla=.FALSE.
     LOGICAL :: l_socodi=.FALSE.
     LOGICAL :: l_pauli=.FALSE.
     LOGICAL :: l_pauliat=.FALSE.
     LOGICAL :: l_potmat=.FALSE.
     LOGICAL :: l_projgen=.FALSE.
     LOGICAL :: l_plot_symm=.FALSE.
     LOGICAL :: l_socmmn0=.FALSE.
     LOGICAL :: l_bzsym=.FALSE.
     LOGICAL :: l_hopping=.FALSE.
     LOGICAL :: l_kptsreduc=.FALSE.
     LOGICAL :: l_prepwan90=.FALSE.
     LOGICAL :: l_plot_umdat=.FALSE.
     LOGICAL :: l_wann_plot=.FALSE.
     LOGICAL :: l_bynumber=.FALSE.
     LOGICAL :: l_stopopt=.FALSE.
     LOGICAL :: l_matrixmmn=.FALSE.
     LOGICAL :: l_matrixamn=.FALSE.
     LOGICAL :: l_projmethod=.FALSE.
     LOGICAL :: l_wannierize=.FALSE.
     LOGICAL :: l_plotw90=.FALSE.
     LOGICAL :: l_byindex=.FALSE.
     LOGICAL :: l_byenergy=.FALSE.
     LOGICAL :: l_proj_plot=.FALSE.
     LOGICAL :: l_bestproj=.FALSE.
     LOGICAL :: l_ikptstart=.FALSE.
     LOGICAL :: l_lapw=.FALSE.
     LOGICAL :: l_plot_lapw=.FALSE.
     LOGICAL :: l_fermi=.FALSE.
     LOGICAL :: l_dipole=.FALSE.
     LOGICAL :: l_dipole2=.FALSE.
     LOGICAL :: l_dipole3=.FALSE.
     LOGICAL :: l_mmn0=.FALSE.
     LOGICAL :: l_mmn0at=.FALSE.
     LOGICAL :: l_manyfiles=.FALSE.
     LOGICAL :: l_collectmanyfiles=.FALSE.
     LOGICAL :: l_ldauwan=.FALSE.
     LOGICAL :: l_lapw_kpts=.FALSE.
     LOGICAL :: l_lapw_gfleur=.FALSE.
     LOGICAL :: l_kpointgen=.FALSE.
     LOGICAL :: l_w90kpointgen=.FALSE.
     LOGICAL :: l_finishnocoplot=.FALSE.
     LOGICAL :: l_finishgwf=.FALSE.
     LOGICAL :: l_skipkov=.FALSE.
     LOGICAL :: l_matrixuHu=.FALSE.
     LOGICAL :: l_matrixuHu_dmi=.FALSE.
Daniel Wortmann's avatar
Daniel Wortmann committed
127 128 129 130 131 132 133
     INTEGER :: ikptstart=1
     INTEGER :: band_min(1:2)=-1
     INTEGER :: band_max(1:2)=-1
     INTEGER :: gfthick=0
     INTEGER :: gfcut=0
     INTEGER :: unigrid(6)=0
     INTEGER :: mhp(3)=0
Daniel Wortmann's avatar
Daniel Wortmann committed
134
     !---> gwf
135 136 137 138 139 140 141 142 143
     LOGICAL :: l_ms=.FALSE.
     LOGICAL :: l_sgwf=.FALSE.
     LOGICAL :: l_socgwf=.FALSE.
     LOGICAL :: l_gwf=.FALSE.
     LOGICAL :: l_bs_comf=.FALSE.
     LOGICAL :: l_exist=.FALSE.
     LOGICAL :: l_opened=.FALSE.
     LOGICAL :: l_cleverskip=.FALSE.
     LOGICAL :: l_dim(3)=.FALSE.
Daniel Wortmann's avatar
Daniel Wortmann committed
144 145 146 147 148 149 150
     REAL    :: scale_param=1.0
     REAL    :: aux_latt_const=8.0
     REAL    :: hdwf_t1=0.0
     REAL    :: hdwf_t2=0.0
     INTEGER :: nparampts=0
     CHARACTER(len=20) :: fn_eig=''
     CHARACTER(len=20) :: param_file='qpts'
Daniel Wortmann's avatar
Daniel Wortmann committed
151 152 153 154 155 156
     REAL, ALLOCATABLE :: param_vec(:, :)
     REAL, ALLOCATABLE :: param_alpha(:, :)
     CHARACTER(LEN=20), ALLOCATABLE :: jobList(:)
     !---> gwf
   CONTAINS
     PROCEDURE :: read_xml => read_xml_wannier
157
     PROCEDURE :: mpi_bc => mpi_bc_wannier
Daniel Wortmann's avatar
Daniel Wortmann committed
158
  END TYPE t_wann
159

Daniel Wortmann's avatar
Daniel Wortmann committed
160 161
  PUBLIC t_wann
CONTAINS
162 163 164 165 166 167 168 169 170

  SUBROUTINE mpi_bc_wannier(this,mpi_comm,irank)
    USE m_mpi_bc_tool
    CLASS(t_wann),INTENT(INOUT)::this
    INTEGER,INTENT(IN):: mpi_comm
    INTEGER,INTENT(IN),OPTIONAL::irank
    INTEGER ::rank
    IF (PRESENT(irank)) THEN
       rank=irank
171 172
    ELSE
       rank=0
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 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 296 297 298 299 300 301 302 303 304 305 306
    END IF

    CALL mpi_bc(this%wan90version ,rank,mpi_comm)
    CALL mpi_bc(this%oc_num_orbs ,rank,mpi_comm)
    CALL mpi_bc(this%oc_orbs,rank,mpi_comm)
    CALL mpi_bc(this%l_unformatted ,rank,mpi_comm)
    CALL mpi_bc(this%l_oc_f,rank,mpi_comm)
    CALL mpi_bc(this%l_ndegen,rank,mpi_comm)
    CALL mpi_bc(this%l_orbitalmom,rank,mpi_comm)
    CALL mpi_bc(this%l_orbcomp,rank,mpi_comm)
    CALL mpi_bc(this%l_orbcomprs,rank,mpi_comm)
    CALL mpi_bc(this%l_denmat,rank,mpi_comm)
    CALL mpi_bc(this%l_perturbrs,rank,mpi_comm)
    CALL mpi_bc(this%l_perturb,rank,mpi_comm)
    CALL mpi_bc(this%l_nedrho,rank,mpi_comm)
    CALL mpi_bc(this%l_anglmomrs,rank,mpi_comm)
    CALL mpi_bc(this%l_anglmom,rank,mpi_comm)
    CALL mpi_bc(this%l_spindisp,rank,mpi_comm)
    CALL mpi_bc(this%l_spindisprs,rank,mpi_comm)
    CALL mpi_bc(this%l_socspicom,rank,mpi_comm)
    CALL mpi_bc(this%l_socspicomrs,rank,mpi_comm)
    CALL mpi_bc(this%l_offdiposoprs,rank,mpi_comm)
    CALL mpi_bc(this%l_offdiposop,rank,mpi_comm)
    CALL mpi_bc(this%l_torque,rank,mpi_comm)
    CALL mpi_bc(this%l_torquers,rank,mpi_comm)
    CALL mpi_bc(this%l_atomlist,rank,mpi_comm)
    CALL mpi_bc(this%atomlist_num,rank,mpi_comm)
    CALL mpi_bc(this%atomlist,rank,mpi_comm)
    CALL mpi_bc(this%l_berry,rank,mpi_comm)
    CALL mpi_bc(this%l_perpmagrs,rank,mpi_comm)
    CALL mpi_bc(this%l_perpmag,rank,mpi_comm)
    CALL mpi_bc(this%l_perpmagat,rank,mpi_comm)
    CALL mpi_bc(this%l_perpmagatrs,rank,mpi_comm)
    CALL mpi_bc(this%l_socmatrs,rank,mpi_comm)
    CALL mpi_bc(this%l_socmat,rank,mpi_comm)
    CALL mpi_bc(this%l_soctomom,rank,mpi_comm)
    CALL mpi_bc(this%l_kptsreduc2,rank,mpi_comm)
    CALL mpi_bc(this%l_nablapaulirs,rank,mpi_comm)
    CALL mpi_bc(this%l_nablars,rank,mpi_comm)
    CALL mpi_bc(this%l_surfcurr,rank,mpi_comm)
    CALL mpi_bc(this%l_updown,rank,mpi_comm)
    CALL mpi_bc(this%l_ahe,rank,mpi_comm)
    CALL mpi_bc(this%l_she,rank,mpi_comm)
    CALL mpi_bc(this%l_rmat,rank,mpi_comm)
    CALL mpi_bc(this%l_nabla,rank,mpi_comm)
    CALL mpi_bc(this%l_socodi,rank,mpi_comm)
    CALL mpi_bc(this%l_pauli,rank,mpi_comm)
    CALL mpi_bc(this%l_pauliat,rank,mpi_comm)
    CALL mpi_bc(this%l_potmat,rank,mpi_comm)
    CALL mpi_bc(this%l_projgen,rank,mpi_comm)
    CALL mpi_bc(this%l_plot_symm,rank,mpi_comm)
    CALL mpi_bc(this%l_socmmn0,rank,mpi_comm)
    CALL mpi_bc(this%l_bzsym,rank,mpi_comm)
    CALL mpi_bc(this%l_hopping,rank,mpi_comm)
    CALL mpi_bc(this%l_kptsreduc,rank,mpi_comm)
    CALL mpi_bc(this%l_prepwan90,rank,mpi_comm)
    CALL mpi_bc(this%l_plot_umdat,rank,mpi_comm)
    CALL mpi_bc(this%l_wann_plot,rank,mpi_comm)
    CALL mpi_bc(this%l_bynumber,rank,mpi_comm)
    CALL mpi_bc(this%l_stopopt,rank,mpi_comm)
    CALL mpi_bc(this%l_matrixmmn,rank,mpi_comm)
    CALL mpi_bc(this%l_matrixamn,rank,mpi_comm)
    CALL mpi_bc(this%l_projmethod,rank,mpi_comm)
    CALL mpi_bc(this%l_wannierize,rank,mpi_comm)
    CALL mpi_bc(this%l_plotw90,rank,mpi_comm)
    CALL mpi_bc(this%l_byindex,rank,mpi_comm)
    CALL mpi_bc(this%l_byenergy,rank,mpi_comm)
    CALL mpi_bc(this%l_proj_plot,rank,mpi_comm)
    CALL mpi_bc(this%l_bestproj,rank,mpi_comm)
    CALL mpi_bc(this%l_ikptstart,rank,mpi_comm)
    CALL mpi_bc(this%l_lapw,rank,mpi_comm)
    CALL mpi_bc(this%l_plot_lapw,rank,mpi_comm)
    CALL mpi_bc(this%l_fermi,rank,mpi_comm)
    CALL mpi_bc(this%l_dipole,rank,mpi_comm)
    CALL mpi_bc(this%l_dipole2,rank,mpi_comm)
    CALL mpi_bc(this%l_dipole3,rank,mpi_comm)
    CALL mpi_bc(this%l_mmn0,rank,mpi_comm)
    CALL mpi_bc(this%l_mmn0at,rank,mpi_comm)
    CALL mpi_bc(this%l_manyfiles,rank,mpi_comm)
    CALL mpi_bc(this%l_collectmanyfiles,rank,mpi_comm)
    CALL mpi_bc(this%l_ldauwan,rank,mpi_comm)
    CALL mpi_bc(this%l_lapw_kpts,rank,mpi_comm)
    CALL mpi_bc(this%l_lapw_gfleur,rank,mpi_comm)
    CALL mpi_bc(this%l_kpointgen,rank,mpi_comm)
    CALL mpi_bc(this%l_w90kpointgen,rank,mpi_comm)
    CALL mpi_bc(this%l_finishnocoplot,rank,mpi_comm)
    CALL mpi_bc(this%l_finishgwf,rank,mpi_comm)
    CALL mpi_bc(this%l_skipkov,rank,mpi_comm)
    CALL mpi_bc(this%l_matrixuHu,rank,mpi_comm)
    CALL mpi_bc(this%l_matrixuHu_dmi,rank,mpi_comm)
    CALL mpi_bc(this%ikptstart,rank,mpi_comm)
    CALL mpi_bc(this%band_min(1),rank,mpi_comm)
    CALL mpi_bc(this%band_max(1),rank,mpi_comm)
    CALL mpi_bc(this%band_min(2),rank,mpi_comm)
    CALL mpi_bc(this%band_max(2),rank,mpi_comm)
    CALL mpi_bc(this%gfthick,rank,mpi_comm)
    CALL mpi_bc(this%gfcut,rank,mpi_comm)
    CALL mpi_bc(this%unigrid(1),rank,mpi_comm)
    CALL mpi_bc(this%unigrid(2),rank,mpi_comm)
    CALL mpi_bc(this%unigrid(3),rank,mpi_comm)
    CALL mpi_bc(this%unigrid(4),rank,mpi_comm)
    CALL mpi_bc(this%unigrid(5),rank,mpi_comm)
    CALL mpi_bc(this%unigrid(6),rank,mpi_comm)
    CALL mpi_bc(this%mhp(1),rank,mpi_comm)
    CALL mpi_bc(this%mhp(2),rank,mpi_comm)
    CALL mpi_bc(this%mhp(3),rank,mpi_comm)
    CALL mpi_bc(this%l_ms,rank,mpi_comm)
    CALL mpi_bc(this%l_sgwf,rank,mpi_comm)
    CALL mpi_bc(this%l_socgwf,rank,mpi_comm)
    CALL mpi_bc(this%l_gwf,rank,mpi_comm)
    CALL mpi_bc(this%l_bs_comf,rank,mpi_comm)
    CALL mpi_bc(this%l_exist,rank,mpi_comm)
    CALL mpi_bc(this%l_opened,rank,mpi_comm)
    CALL mpi_bc(this%l_cleverskip,rank,mpi_comm)
    CALL mpi_bc(this%l_dim(1),rank,mpi_comm)
    CALL mpi_bc(this%l_dim(2),rank,mpi_comm)
    CALL mpi_bc(this%l_dim(3),rank,mpi_comm)
    CALL mpi_bc(this%scale_param,rank,mpi_comm)
    CALL mpi_bc(this%aux_latt_const,rank,mpi_comm)
    CALL mpi_bc(this%hdwf_t1,rank,mpi_comm)
    CALL mpi_bc(this%hdwf_t2,rank,mpi_comm)
    CALL mpi_bc(this%nparampts,rank,mpi_comm)
    CALL mpi_bc(this%param_vec,rank,mpi_comm)
    CALL mpi_bc(this%param_alpha,rank,mpi_comm)

    !Not done
    !CHARACTER(len=20) :: fn_eig=''
    !CHARACTER(len=20) :: param_file='qpts'
    !CHARACTER(LEN=20), ALLOCATABLE :: jobList(:)



  END SUBROUTINE mpi_bc_wannier

Daniel Wortmann's avatar
Daniel Wortmann committed
307 308
  SUBROUTINE read_xml_wannier(this,xml)
    USE m_types_xml
Daniel Wortmann's avatar
Daniel Wortmann committed
309
    CLASS(t_wann),INTENT(inout):: this
Daniel Wortmann's avatar
Daniel Wortmann committed
310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370
    TYPE(t_xml),INTENT(in)   :: xml
    ! Read in optional Wannier functions parameters

    CHARACTER(len=100):: xPathA
    CHARACTER(len=255):: valueString

    INTEGER           :: numberNodes,i,n,numtokens
    LOGICAL,ALLOCATABLE:: wannAtomList(:)

    xPathA = '/fleurInput/output/wannier'
    numberNodes = xml%getNumberOfNodes(xPathA)

    IF (numberNodes.EQ.1) THEN
       this%l_ms = evaluateFirstBoolOnly(xml%getAttributeValue(TRIM(ADJUSTL(xPathA))//'/@ms'))
       this%l_sgwf = evaluateFirstBoolOnly(xml%getAttributeValue(TRIM(ADJUSTL(xPathA))//'/@sgwf'))
       this%l_socgwf = evaluateFirstBoolOnly(xml%getAttributeValue(TRIM(ADJUSTL(xPathA))//'/@socgwf'))
       this%l_bs_comf = evaluateFirstBoolOnly(xml%getAttributeValue(TRIM(ADJUSTL(xPathA))//'/@bsComf'))
       this%l_atomlist = evaluateFirstBoolOnly(xml%getAttributeValue(TRIM(ADJUSTL(xPathA))//'/@atomList'))
    END IF

    xPathA = '/fleurInput/output/wannier/bandSelection'
    numberNodes = xml%getNumberOfNodes(xPathA)

    IF (numberNodes.EQ.1) THEN
       this%l_byindex=.TRUE.
       this%band_min(1) = evaluateFirstIntOnly(xml%getAttributeValue(TRIM(ADJUSTL(xPathA))//'/@minSpinUp'))
       this%band_max(1) = evaluateFirstIntOnly(xml%getAttributeValue(TRIM(ADJUSTL(xPathA))//'/@maxSpinUp'))
       xPathA = '/fleurInput/output/wannier/bandSelection/@minSpinDown'
       numberNodes = xml%getNumberOfNodes(xPathA)
       IF (numberNodes.EQ.1) THEN
          this%band_min(2) = evaluateFirstIntOnly(xml%getAttributeValue(TRIM(ADJUSTL(xPathA))))
       ELSE
          this%band_min(2) = this%band_min(1)
       END IF
       xPathA = '/fleurInput/output/wannier/bandSelection/@maxSpinDown'
       numberNodes = xml%getNumberOfNodes(xPathA)
       IF (numberNodes.EQ.1) THEN
          this%band_max(2) = evaluateFirstIntOnly(xml%getAttributeValue(TRIM(ADJUSTL(xPathA))))
       ELSE
          this%band_max(2) = this%band_max(1)
       END IF
       this%l_byindex = .TRUE.
    END IF

    xPathA = '/fleurInput/output/wannier/jobList'
    numberNodes = xml%getNumberOfNodes(xPathA)

    IF (numberNodes.EQ.1) THEN
       xPathA = '/fleurInput/output/wannier/jobList/text()'

       ! Note: At the moment only 255 characters for the text in this node. Maybe this is not enough.
       valueString = xml%getAttributeValue(TRIM(ADJUSTL(xPathA)))
       numTokens = xml%countStringTokens(valueString)
       ALLOCATE(this%jobList(numTokens))
       DO i = 1, numTokens
          this%jobList(i) = xml%popFirstStringToken(valueString)
       END DO
    END IF

    ALLOCATE(wannAtomList(xml%get_nat()))
    DO i=1,xml%get_nat()
371
       wannAtomList(i)= evaluateFirstBoolOnly(xml%getAttributeValue(xml%posPath(i)//'/@wannier'))
Daniel Wortmann's avatar
Daniel Wortmann committed
372 373 374 375 376 377 378 379 380 381 382 383 384 385
    ENDDO
    this%atomlist_num = COUNT(wannAtomList)
    n=0
    DO i=1,xml%get_nat()
       IF (wannAtomList(i)) THEN
          n=n+1
          this%atomlist(n) = i
       ENDIF
    ENDDO

    DEALLOCATE(wannAtomList)

  END SUBROUTINE read_xml_wannier
END MODULE m_types_wannier