westpp_setup.f90 2.58 KB
Newer Older
Marco Govoni's avatar
Marco Govoni committed
1
!
Marco Govoni's avatar
Marco Govoni committed
2
! Copyright (C) 2015-2021 M. Govoni 
Marco Govoni's avatar
Marco Govoni committed
3
4
5
6
7
8
9
10
11
12
13
14
15
16
! 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 westpp_setup
  !-----------------------------------------------------------------------
  !
17
  USE westcom,                ONLY : alphapv_dfpt,npwq,west_prefix,westpp_save_dir,&
Marco Govoni's avatar
Marco Govoni committed
18
                                   & n_imfreq,nbnd_occ,l_macropol,macropol_calculation,&
19
                                   & n_refreq,qp_bandrange,westpp_calculation,westpp_n_pdep_eigen_to_use
Marco Govoni's avatar
Marco Govoni committed
20
21
  USE mp,                     ONLY : mp_max
  USE mp_global,              ONLY : intra_bgrp_comm
Govoni's avatar
Govoni committed
22
  USE pwcom,                  ONLY : nbnd
Marco Govoni's avatar
Marco Govoni committed
23
  USE kinds,                  ONLY : DP
24
  USE gvect,                  ONLY : gstart,g
Marco Govoni's avatar
Marco Govoni committed
25
26
27
28
29
30
  USE io_files,               ONLY : tmp_dir
  USE distribution_center,    ONLY : pert,macropert,ifr,rfr,aband
  USE class_idistribute,      ONLY : idistribute
  USE wavefunctions_module,   ONLY : evc
  USE mod_mpiio,              ONLY : set_io_comm
  USE pdep_db,                ONLY : pdep_db_read
31
  USE types_coulomb,          ONLY : pot3D
Marco Govoni's avatar
Marco Govoni committed
32
33
34
35
36
37
38
39
40
41
  !
  IMPLICIT NONE
  !
  REAL(DP) :: q(3)
  REAL(DP) :: qq
  COMPLEX(DP),EXTERNAL :: get_alpha_pv
  INTEGER :: ig, i
  !
  CALL do_setup ( ) 
  !
42
  CALL set_npwq()
Marco Govoni's avatar
Marco Govoni committed
43
  !
44
45
!  CALL pot3D%init('Wave',.FALSE.,'default')
!  CALL pot3D%print_divergence()
Marco Govoni's avatar
Marco Govoni committed
46
47
48
  !
  CALL set_nbndocc()
  !
49
  CALL my_mkdir( westpp_save_dir )
Marco Govoni's avatar
Marco Govoni committed
50
51
52
53
54
55
56
57
58
59
60
61
62
  !
  DO i = 1, 8
     IF( westpp_calculation(i:i) == 'r' .OR. westpp_calculation(i:i) == 'R' ) THEN 
        aband = idistribute()
        CALL aband%init(nbnd,'i','nbnd',.TRUE.)
     ENDIF  
     IF( westpp_calculation(i:i) == 'w' .OR. westpp_calculation(i:i) == 'W' ) THEN 
        aband = idistribute()
        CALL aband%init(nbnd,'i','nbnd',.TRUE.)
     ENDIF  
     IF( westpp_calculation(i:i) == 'e' .OR. westpp_calculation(i:i) == 'E' ) THEN
        pert = idistribute()
        CALL pert%init(westpp_n_pdep_eigen_to_use,'i','npdep',.TRUE.)
63
        !CALL pdep_db_read(westpp_n_pdep_eigen_to_use)
Marco Govoni's avatar
Marco Govoni committed
64
65
66
67
     ENDIF 
     IF( westpp_calculation(i:i) == 's' .OR. westpp_calculation(i:i) == 'S' ) THEN
        pert = idistribute()
        CALL pert%init(westpp_n_pdep_eigen_to_use,'i','npdep',.TRUE.)
68
        !CALL pdep_db_read(westpp_n_pdep_eigen_to_use)
Marco Govoni's avatar
Marco Govoni committed
69
70
71
72
73
74
     ENDIF 
  ENDDO
  !
  CALL set_io_comm( ) ! this defines communicator between heads of each image (me_bgrp==0) 
  !
END SUBROUTINE