cdn_read.F 2.94 KB
Newer Older
1 2 3 4 5 6
!--------------------------------------------------------------------------------
! 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.
!--------------------------------------------------------------------------------

7 8 9 10 11 12 13 14 15 16 17 18 19
      MODULE m_cdnread
      use m_juDFT
!------------------------------------------------------------------------
!     Two subroutines to read in the information stored on the 'eig'-file
!     cdn_read0: reads energy-parameters and number of bands stored/pe
!     cdn_read : reads finally the eigenvalues and vectors
!                                                          gb`04
!------------------------------------------------------------------------
      CONTAINS
      SUBROUTINE cdn_read0(
     >                     eig_id,
     >                     irank,isize,jspin,jspins,
     >                     l_noco,
20
     <                     n_bands,n_size)
21 22
      USE m_eig66_io, ONLY : read_eig
      IMPLICIT NONE
23

24 25 26 27 28 29 30
! Arguments ...
      INTEGER, INTENT (IN) :: eig_id,irank,isize
      INTEGER, INTENT (IN) :: jspin,jspins
      LOGICAL, INTENT (IN) :: l_noco


      INTEGER, INTENT (OUT) :: n_size
31
 
32
      INTEGER, INTENT (OUT) :: n_bands(0:) !n_bands(0:neigd)
33
 
34 35
      INTEGER isp

36 37 38 39
      isp = MERGE(1,jspin,l_noco)

      CALL read_eig(eig_id,1,isp,neig=n_bands(1))

40 41
c n_size is the number of records per k-point,
c n_bands(i) the number of ev's processed on n_rank=0...i-1
42

43 44 45
      n_size = 1

      n_bands(0) = 0
46

47 48 49 50 51 52 53 54 55
      END SUBROUTINE cdn_read0
!
!--------------------------------------------------------------------
!--------------------------------------------------------------------
!
      SUBROUTINE cdn_read(
     >                    eig_id,nvd,jspd,irank,isize,
     >                    ikpt,jspin,nbasfcn,l_ss,l_noco,
     >                    noccbd,n_start,n_end,
56
     <                    nbands,eig,zmat)
57 58

      USE m_eig66_io, ONLY : read_eig
59 60
      USE m_types
 
61 62 63 64 65 66 67 68
      IMPLICIT NONE
!
! Arguments ...
!
      INTEGER, INTENT (IN) :: eig_id,irank,isize,ikpt,nbasfcn
      INTEGER, INTENT (IN) :: nvd,jspd,jspin
      INTEGER, INTENT (IN) :: noccbd,n_start,n_end
      LOGICAL, INTENT (IN) :: l_ss,l_noco
69
      INTEGER, INTENT (OUT) :: nbands
70
   
71
      REAL,    INTENT (OUT) :: eig(:) !bkpt(3),eig(neigd)
72
   
73
      TYPE(t_mat), INTENT (INOUT) :: zmat !z(nbasfcn,noccbd) !can be real/complex
74

75
! Local variables ...
76
      INTEGER :: isp,i
77 78 79 80
#ifdef CPP_MPI
      INCLUDE 'mpif.h'
      INTEGER mpiierr
#endif
81

82
      isp = MERGE(1,jspin,l_noco)
83

84 85
      CALL timestart("cdn_read")

86
      CALL read_eig(eig_id,ikpt,isp,list=[(i,i=n_start,n_end)],
87 88
     <              neig=nbands,eig=eig,zmat=zmat)

89 90 91 92
      CALL timestop("cdn_read")
      
!      IF (nbands>neigd)   CALL juDFT_error("nbands.GT.neigd",calledby
!     +     ="cdn_read")
93
    
94 95
      END SUBROUTINE cdn_read
      END MODULE m_cdnread