set_nbndocc.f90 1.44 KB
Newer Older
Marco Govoni's avatar
Marco Govoni committed
1
!
2
! Copyright (C) 2015-2017 M. Govoni 
Marco Govoni's avatar
Marco Govoni committed
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
! This file is distributed under the terms of the
! GNU General Public License. See the file `License'
! in the root directory of the present distribution,
! or http://www.gnu.org/copyleft/gpl.txt .
!
! This file is part of WEST.
!
! Contributors to this file: 
! Marco Govoni
!
!-----------------------------------------------------------------------
SUBROUTINE set_nbndocc( )
  !-----------------------------------------------------------------------
  !
  ! current_spin is needed
  !
  USE kinds,                  ONLY : DP
  USE pwcom,                  ONLY : nbnd,nelup,neldw,isk,nelec,nspin,lsda,nks
  USE constants,              ONLY : degspin
  USE noncollin_module,       ONLY : noncolin,npol
  USE io_global,              ONLY : stdout
  USE westcom,                ONLY : nbnd_occ
25
  USE types_bz_grid,          ONLY : k_grid
Marco Govoni's avatar
Marco Govoni committed
26
27
28
29
30
31
32
33
  !
  IMPLICIT NONE
  !
  INTEGER :: spin,iks
  !
  ! Calculate NBNDVAL
  !
  IF(ALLOCATED(nbnd_occ)) DEALLOCATE(nbnd_occ)
34
  ALLOCATE( nbnd_occ(k_grid%nps) )
Marco Govoni's avatar
Marco Govoni committed
35
36
37
  !
  IF(lsda) THEN  
     !
38
     DO iks = 1, k_grid%nps
Marco Govoni's avatar
Marco Govoni committed
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
        spin = isk(iks)
        !
        SELECT CASE(spin)
        CASE(1)
           nbnd_occ(iks) = NINT (nelup) 
        CASE(2)
           nbnd_occ(iks) = NINT (neldw)
        END SELECT
        !
     ENDDO
     !
  ELSEIF(noncolin) THEN
     !
     nbnd_occ(:) = NINT( nelec )
     !
  ELSE
     !
     nbnd_occ(:) = NINT( nelec ) / degspin
     !
  ENDIF
  !
END SUBROUTINE