LCOV - code coverage report
Current view: top level - src/70_gw - m_read_plowannier.F90 (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 58 0
Test Date: 2026-11-08 04:19:34 Functions: 0.0 % 1 0
Branches: 0.0 % 188 0

             Branch data     Line data    Source code
       1                 :             : !!****m* ABINIT/m_read_plowannier
       2                 :             : !! NAME
       3                 :             : !!  m_read_plowannier
       4                 :             : !!
       5                 :             : !! FUNCTION
       6                 :             : !!  Read Wannier coefficient in the file forlb.ovlp for ucrpa calculation
       7                 :             : !!  this file was typically created in a DFT run with usedmft=1 and nbandkss -1
       8                 :             : !!
       9                 :             : !! COPYRIGHT
      10                 :             : !! Copyright (C) 2006-2026 ABINIT group (BAmadon)
      11                 :             : !! This file is distributed under the terms of the
      12                 :             : !! GNU General Public License, see ~abinit/COPYING
      13                 :             : !! or http://www.gnu.org/copyleft/gpl.txt .
      14                 :             : !!
      15                 :             : !! INPUTS
      16                 :             : !!
      17                 :             : !! OUTPUT
      18                 :             : !!
      19                 :             : !! SOURCE
      20                 :             : 
      21                 :             : #if defined HAVE_CONFIG_H
      22                 :             : #include "config.h"
      23                 :             : #endif
      24                 :             : 
      25                 :             : #include "abi_common.h"
      26                 :             : 
      27                 :             : MODULE m_read_plowannier
      28                 :             : 
      29                 :             :  use defs_basis
      30                 :             :  use m_abicore
      31                 :             :  use m_errors
      32                 :             : 
      33                 :             :  use m_io_tools,      only : open_file
      34                 :             :  use m_crystal,       only : crystal_t
      35                 :             :  use m_bz_mesh,       only : kmesh_t
      36                 :             :  use m_pawang,        only : pawang_type
      37                 :             : 
      38                 :             :  implicit none
      39                 :             : 
      40                 :             :  private
      41                 :             : 
      42                 :             :  public :: read_plowannier
      43                 :             : !!***
      44                 :             : 
      45                 :             : contains
      46                 :             : 
      47                 :             : !!****m* m_read_plowannier/read_plowannier
      48                 :             : !! NAME
      49                 :             : !! read_plowannier
      50                 :             : !!
      51                 :             : !! FUNCTION
      52                 :             : !!  Read Wannier coefficient in the file forlb.ovlp for ucrpa calculation
      53                 :             : !!  this file was typically created in a DFT run with usedmft=1 and nbandkss -1
      54                 :             : !!
      55                 :             : !! COPYRIGHT
      56                 :             : !! Copyright (C) 2006-2026 ABINIT group (BAmadon)
      57                 :             : !! This file is distributed under the terms of the
      58                 :             : !! GNU General Public License, see ~abinit/COPYING
      59                 :             : !! or http://www.gnu.org/copyleft/gpl.txt .
      60                 :             : !!
      61                 :             : !!
      62                 :             : !! INPUTS
      63                 :             : !! Cryst<cryst_t>= data type gathering info on symmetries and unit cell
      64                 :             : !!    %natom=number of atoms
      65                 :             : !!    %nsym=number of symmetries
      66                 :             : !!    %xred(3,natom)=reduced coordinated of atoms
      67                 :             : !!    %typat(natom)=type of each atom
      68                 :             : !!    %rprimd(3,3)=dimensional primitive translations in real space (bohr)
      69                 :             : !!    %timrev= 2 if time reversal can be used, 1 otherwise
      70                 :             : !! Kmesh <kmesh_t>= datatype gathering parameters related to the k-point sampling
      71                 :             : !!    %nibz=number of k-points in the IBZ
      72                 :             : !!    %nbz=number of k-points in the BZ
      73                 :             : !!    %bz(3,nbz)=reduced coordinates for k-points in the full Brillouin zone
      74                 :             : !!    %ibz(3,nibz)=reduced coordinates for k-points in the irreducible wedge
      75                 :             : !!    %tab(nbz)=mapping between a kpt in the BZ (array bz) and the irred point in the array ibz
      76                 :             : !!    %tabi(nbz)= -1 if inversion is needed to obtain this particular kpt in the BZ, 1 means identity
      77                 :             : !!    %tabo(nbz)= for each point in the BZ, the index of the symmetry operation S in reciprocal
      78                 :             : !!      space which rotates k_IBZ onto \pm k_BZ (depending on tabi)
      79                 :             : !!    %tabp(nbz)= For each k_BZ, it gives the phase factors associated to non-symmorphic operations, i.e
      80                 :             : !!      e^{-i 2 \pi k_IBZ \cdot R{^-1}t} == e{-i 2\pi k_BZ cdot t} where :
      81                 :             : !!      \transpose R{-1}=S and (S k_IBZ) = \pm k_BZ (depending on ktabi)
      82                 :             : !!    %tabr(nfftot,nbz) For each point r on the real mesh and for each k-point in the BZ, tabr
      83                 :             : !!      gives the index of (R^-1 (r-t)) in the FFT array where R=\transpose S^{-1} and k_BZ=S k_IBZ.
      84                 :             : !!      t is the fractional translation associated to R
      85                 :             : !!  luwindow: T if ucrpa_window is activated, F if not.
      86                 :             : !!  prtvol: integer to give the amount of printing.
      87                 :             : !! nsppol : number of spin polarization.
      88                 :             : !! Pawang<pawang_type> angular mesh discretization and related data:
      89                 :             : !!
      90                 :             : !! OUTPUT
      91                 :             : !! bandinf, bandsup : lower and upper bands for define Wannier functions
      92                 :             : !! coeffW_BZ(nsppol,bandinf:bandsup,nvz,2*lcor+1)
      93                 :             : !! lcor : angular momentum for correlated orbitals
      94                 :             : !! itypatcor : correlated species
      95                 :             : !!
      96                 :             : !! SOURCE
      97                 :             : 
      98                 :           0 : subroutine read_plowannier(cryst,bandinf,bandsup,coeffW_BZ,itypatcor,Kmesh,lcor,luwindow,nspinor,nsppol,pawang,prtvol,ucrpa_bands)
      99                 :             : 
     100                 :             : !Arguments ------------------------------------
     101                 :             : !types and arrays
     102                 :             :  type(kmesh_t),intent(in) :: Kmesh
     103                 :             :  type(crystal_t),intent(in) :: Cryst
     104                 :             :  complex(dp), allocatable, intent(inout) :: coeffW_BZ(:,:,:,:,:,:)
     105                 :             :  type(Pawang_type),intent(in) :: Pawang
     106                 :             : !scalars
     107                 :             :  logical, intent(inout) :: luwindow
     108                 :             :  integer, intent(out) :: bandinf,bandsup,itypatcor,lcor
     109                 :             :  integer, intent(in) :: nspinor,nsppol,prtvol
     110                 :             :  integer, intent(in) :: ucrpa_bands(2)
     111                 :             : 
     112                 :             : !Local variables-------------------------------
     113                 :             :  character(len=500) :: message,msg
     114                 :             :  integer :: at_indx,ik_ibz,band1,m1,m2,spin,ik_bz,dummy,isym,itim,iat,indx,ispinor,unt
     115                 :             :  real(dp) :: xx,yy
     116                 :             :  real(dp) :: kbz(3)
     117                 :           0 :  complex(dp), allocatable :: coeffW_IBZ(:,:,:,:,:,:)
     118                 :             : ! *********************************************************************
     119                 :           0 :  write(message,*) "Read wannier in iBZ"
     120                 :           0 :  call wrtout(std_out,message,'COLL')
     121                 :             : 
     122         [ #  # ]:           0 :  if (open_file('forlb.ovlp',msg,newunit=unt,form='formatted',status='unknown') /= 0) then
     123                 :           0 :    ABI_ERROR(msg)
     124                 :             :  end if
     125                 :           0 :  rewind(unt)
     126                 :           0 :  read(unt,*) message
     127                 :           0 :  read(unt,*) message, lcor,itypatcor
     128                 :           0 :  read(unt,*) message, bandinf,bandsup
     129                 :           0 :  write(std_out,*) 'read from forlb.ovlp',lcor, bandinf,bandsup
     130                 :           0 :  write(std_out,*) "for wannier", bandinf,bandsup
     131                 :             :  if(prtvol>0) then
     132                 :             :  endif
     133                 :             : 
     134   [ #  #  #  #  :           0 :  if(.not.luwindow.and.(ucrpa_bands(1)/=bandinf.or.ucrpa_bands(2)/=bandsup)) then
                   #  # ]
     135                 :           0 :    write(msg,'(a,a)')' Bands used for Wannier construction and cRPA construction differ',&
     136                 :           0 : & 'It might be physically correct and it is possible with the current implementation'
     137                 :           0 :    call wrtout(std_out,msg,'COLL')
     138                 :           0 :    call wrtout(ab_out,msg,'COLL')
     139                 :             : !   ABI_ERROR(msg)
     140                 :             :  end if
     141                 :             : 
     142                 :             : !Do not dead the bandinf, bandinf redondance information
     143                 :             : 
     144   [ #  #  #  #  :           0 :  ABI_MALLOC(coeffW_IBZ,(Cryst%nattyp(itypatcor),nsppol,bandinf:bandsup,Kmesh%nibz,nspinor,2*lcor+1))
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
             #  #  #  #  
                      # ]
     145   [ #  #  #  #  :           0 :  coeffW_IBZ=czero
          #  #  #  #  #  
                #  #  # ]
     146         [ #  # ]:           0 :  do spin=1,nsppol
     147         [ #  # ]:           0 :    do ik_ibz=1,Kmesh%nibz
     148                 :             :      !read k
     149                 :           0 :       read(unt,*)
     150         [ #  # ]:           0 :       do band1=bandinf,bandsup
     151                 :             :      !read band
     152                 :           0 :         read(unt,*)
     153                 :             :      !read projection
     154         [ #  # ]:           0 :         do ispinor=1,nspinor
     155         [ #  # ]:           0 :           do iat=1,Cryst%nattyp(itypatcor)
     156         [ #  # ]:           0 :             do m1=1,2*lcor+1
     157                 :           0 :               read(unt,*) dummy,dummy,dummy,dummy,xx,yy
     158                 :           0 :               coeffW_IBZ(iat,spin,band1,ik_ibz,ispinor,m1)=cmplx(xx,yy)
     159                 :             :             end do
     160                 :             :           end do
     161                 :             :         end do
     162                 :             :       end do
     163                 :             :    end do
     164                 :             :  end do
     165                 :           0 :  close(unt)
     166                 :             : 
     167   [ #  #  #  #  :           0 :  ABI_MALLOC(coeffW_BZ,(Cryst%nattyp(itypatcor),nsppol,bandinf:bandsup,Kmesh%nbz,nspinor,2*lcor+1))
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
                   #  # ]
     168   [ #  #  #  #  :           0 :  coeffW_BZ=czero
          #  #  #  #  #  
                #  #  # ]
     169                 :             : 
     170         [ #  # ]:           0 :  if (Kmesh%nbz==Kmesh%nibz) then
     171   [ #  #  #  #  :           0 :    coeffW_BZ=coeffW_IBZ
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
                   #  # ]
     172         [ #  # ]:           0 :  else if (Cryst%nsym==1) then
     173                 :           0 :    write(message,*) "Reconstruct in full BZ"
     174                 :           0 :    call wrtout(std_out,message,'COLL')
     175                 :           0 :    call wrtout(ab_out,message,'COLL')
     176         [ #  # ]:           0 :    do ik_bz=1,Kmesh%nbz
     177                 :             : !     if(prtvol>=10) write(6,*) "ik",ik_bz,Kmesh%tab(ik_bz),Kmesh%tabi(ik_bz),Kmesh%tabo(ik_bz)
     178         [ #  # ]:           0 :      if(Kmesh%tabi(ik_bz)==1) then
     179   [ #  #  #  #  :           0 :        coeffW_BZ(:,:,:,ik_bz,:,:)=coeffW_IBZ(:,:,:,Kmesh%tab(ik_bz),:,:)
          #  #  #  #  #  
                      # ]
     180         [ #  # ]:           0 :      else if(Kmesh%tabi(ik_bz)==-1) then
     181   [ #  #  #  #  :           0 :        coeffW_BZ(:,:,:,ik_bz,:,:)=conjg(coeffW_IBZ(:,:,:,Kmesh%tab(ik_bz),:,:))
          #  #  #  #  #  
                      # ]
     182                 :             :      endif
     183                 :             : !     if(prtvol>=10)write(6,*) "coeffW 21",coeffW_BZ(1,1,bandinf,ik_bz,:)
     184                 :             : !     if(prtvol>=10)write(6,*) "coeffW 21",coeffW_BZ(1,1,bandinf+1,ik_bz,:)
     185                 :             : !     if(prtvol>=10)write(6,*) "coeffW 25",coeffW_BZ(1,1,bandsup,ik_bz,:)
     186                 :             :    enddo
     187         [ #  # ]:           0 :  else if (Cryst%nsym>1) then
     188                 :           0 :    write(message,*) "Reconstruct in full BZ (nsym=0)"
     189                 :           0 :    call wrtout(std_out,message,'COLL')
     190         [ #  # ]:           0 :    do ik_bz=1,Kmesh%nbz
     191                 :             :    !write(6,*) ik_bz,Kmesh%nbz
     192                 :           0 :      call kmesh%get_BZ_item(ik_bz,kbz,ik_ibz,isym,itim)
     193         [ #  # ]:           0 :      do indx=1,cryst%nattyp(itypatcor)
     194                 :           0 :        iat=cryst%atindx1(indx) ! correct index for the full atom list
     195                 :           0 :        at_indx=cryst%indsym(4,isym,iat) !! see eg sym_matlu and m_crystal
     196         [ #  # ]:           0 :        do spin=1,nsppol
     197         [ #  # ]:           0 :          do ispinor=1,nspinor
     198         [ #  # ]:           0 :            do m1=1,2*lcor+1
     199         [ #  # ]:           0 :              do m2=1,2*lcor+1
     200                 :             :              coeffW_BZ(indx,spin,:,ik_bz,ispinor,m1)= coeffW_BZ(indx,spin,:,ik_bz,ispinor,m1)&
     201         [ #  # ]:           0 : &                     +coeffW_IBZ(at_indx,spin,:,ik_ibz,ispinor,m2)*pawang%zarot(m2,m1,lcor+1,isym)
     202                 :             :              enddo
     203                 :             : !             write(6,'(20f7.3)') (pawang%zarot(m1,m2,lcor+1,isym),m2=1,2*lcor+1)
     204                 :             :            enddo
     205                 :             :          enddo
     206                 :             :        enddo
     207                 :             :      enddo
     208                 :             : !     do m1=1,2*lcor+1
     209                 :             : !      write(6,*) "coeffW_IBZ",coeffW_IBZ(1,8,ik_ibz,m1)
     210                 :             : !     enddo
     211                 :             : !     do m1=1,2*lcor+1
     212                 :             : !      write(6,*) "coeffW_ BZ",coeffW_BZ(1,8,ik_bz,m1)
     213                 :             : !     enddo
     214                 :             :    enddo
     215                 :             :  end if
     216         [ #  # ]:           0 :  ABI_FREE(coeffW_IBZ)
     217                 :             : 
     218                 :             : 
     219                 :           0 : end subroutine read_plowannier
     220                 :             : !!***
     221                 :             : 
     222                 :             : END MODULE m_read_plowannier
     223                 :             : !!***
        

Generated by: LCOV version 2.3-1