westcom.f90 6.83 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
! 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
!
!-----------------------------------------------------------------------
MODULE scratch_area
  !-----------------------------------------------------------------------
  !
  USE kinds, ONLY :  DP
  !
  SAVE
  !
21
  ! COULOMB
22
  INTEGER              :: npwq,npwqx,npwq_g
Marco Govoni's avatar
Marco Govoni committed
23
24
25
26
27
28
29
30
31
32
33
34
35
  CHARACTER(LEN=6)     :: fftdriver
  INTEGER,ALLOCATABLE  :: iks_l2g(:)
  !
  ! DBS
  REAL(DP),ALLOCATABLE    :: ev(:)
  REAL(DP),ALLOCATABLE    :: ev_distr(:)
  COMPLEX(DP),ALLOCATABLE :: dng(:,:)
  COMPLEX(DP),ALLOCATABLE :: dvg(:,:)
  LOGICAL,ALLOCATABLE     :: conv(:)
  !
  ! BANDS
  INTEGER,ALLOCATABLE :: nbnd_occ(:) 
  !
36
  ! Q-POINTS
Marco Govoni's avatar
Marco Govoni committed
37
38
39
  INTEGER, ALLOCATABLE :: ngq(:)            ! equivalent of ngk(:) --> ex. ngq(iq) = LOCAL number of PW for (q+G) (global in iq)
  INTEGER, ALLOCATABLE :: igq_q(:,:)        ! equivalent of igk_k(:,:) --> ex. igq_q(ig,iq) = map for FFT (global in iq ) 
  INTEGER, ALLOCATABLE :: ngq_g(:)          ! equivalent of ngk_g(:) --> ex. ngk_g(iq) = TOTAL number of PW for (q+G) (global in iq)  
40
  ! INTEGER, ALLOCATABLE :: igq_l2g(:,:)      ! equivalent of igk_l2g(:,:) --> ex. iqq_l2g(ig,iq) => correspondence between the local (q+G) index and the global G index 
41
  ! INTEGER, ALLOCATABLE :: igq_l2g_kdip(:,:) ! equivalent of igk_l2g_kdip(:,:) --> ex. iqq_l2g_kdip(ig,iq) => correspondence between the global order of (q+G) and the local index for (q+G).
42
  !
Marco Govoni's avatar
Marco Govoni committed
43
44
45
46
47
  ! EPSILON
  REAL(DP),ALLOCATABLE    :: d_epsm1_ifr(:,:,:)
  COMPLEX(DP),ALLOCATABLE :: z_epsm1_ifr(:,:,:)
  COMPLEX(DP),ALLOCATABLE :: z_epsm1_rfr(:,:,:)
  !
48
  ! EPSILON with q-points
Marco Govoni's avatar
Marco Govoni committed
49
50
  COMPLEX(DP), ALLOCATABLE :: z_epsm1_ifr_q(:,:,:,:) ! EPSILON + iq  (global in iq) 
  COMPLEX(DP), ALLOCATABLE :: z_epsm1_rfr_q(:,:,:,:) ! EPSILON + iq  (global in iq) 
51
  !
Marco Govoni's avatar
Marco Govoni committed
52
53
54
55
56
57
58
59
60
61
62
  ! CORRELATION
  REAL(DP),ALLOCATABLE    :: d_head_ifr(:)
  COMPLEX(DP),ALLOCATABLE :: z_head_ifr(:)
  REAL(DP),ALLOCATABLE    :: d_body1_ifr(:,:,:,:)
  COMPLEX(DP),ALLOCATABLE :: z_body1_ifr(:,:,:,:)
  REAL(DP),ALLOCATABLE    :: d_body2_ifr(:,:,:,:,:)
  COMPLEX(DP),ALLOCATABLE :: z_body2_ifr(:,:,:,:,:)
  REAL(DP),ALLOCATABLE    :: d_diago(:,:,:,:)
  COMPLEX(DP),ALLOCATABLE :: z_head_rfr(:)
  COMPLEX(DP),ALLOCATABLE :: z_body_rfr(:,:,:,:) 
  !
63
  ! CORRELATION with q-points
Marco Govoni's avatar
Marco Govoni committed
64
65
66
67
  COMPLEX(DP), ALLOCATABLE :: z_body1_ifr_q(:,:,:,:,:)   ! CORRELATION + iq  (global in iq)
  COMPLEX(DP), ALLOCATABLE :: z_body2_ifr_q(:,:,:,:,:,:) ! CORRELATION + iq  (global in iq)
  REAL(DP),    ALLOCATABLE :: d_diago_q(:,:,:,:,:)       ! CORRELATION + iq  (global in iq)
  COMPLEX(DP), ALLOCATABLE :: z_body_rfr_q (:,:,:,:,:)   ! CORRELATION + iq  (global in iq)
68
  !
Marco Govoni's avatar
Marco Govoni committed
69
70
71
72
73
74
75
76
77
78
79
80
81
  ! I/O 
  !INTEGER :: io_comm ! communicator for head of images (me_bgrp==0)
  !
  !
END MODULE
!
!
MODULE westin
  !
  USE kinds, ONLY :  DP
  !
  SAVE
  !
82
83
84
85
86
87
  CHARACTER(LEN=512) :: outdir             ! main directory 
  CHARACTER(LEN=512) :: west_prefix
  CHARACTER(LEN=512) :: qe_prefix
  CHARACTER(LEN=512) :: savedir            ! outdir/west_prefix.code.save
  CHARACTER(LEN=512) :: main_input_file    ! input file (json format)
  CHARACTER(LEN=512) :: logfile            ! savedir/logfile.json 
88
  !
Marco Govoni's avatar
Marco Govoni committed
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
END MODULE  
!
!
MODULE wstat_center
  !
  USE kinds, ONLY :  DP
  !
  SAVE
  !
  ! INPUT FOR wstat_control
  !
  CHARACTER(LEN=1) :: wstat_calculation 
  INTEGER :: n_pdep_basis
  INTEGER :: n_pdep_times
  INTEGER :: n_pdep_eigen
  INTEGER :: n_pdep_maxiter
  INTEGER :: n_dfpt_maxiter
  INTEGER :: n_steps_write_restart
  INTEGER :: n_pdep_restart_from_itr
  INTEGER :: n_pdep_read_from_file
  REAL(DP) :: trev_pdep
  REAL(DP) :: trev_pdep_rel
  REAL(DP) :: tr2_dfpt
  LOGICAL :: l_deflate
  LOGICAL :: l_kinetic_only
  LOGICAL :: l_minimize_exx_if_active
  LOGICAL :: l_use_ecutrho
Marco Govoni's avatar
Marco Govoni committed
116
117
  !INTEGER :: nq(3)  
  INTEGER, ALLOCATABLE :: qlist(:)
Marco Govoni's avatar
Marco Govoni committed
118
119
120
121
  !
  ! Common workspace
  !
  COMPLEX(DP) :: alphapv_dfpt
122
123
  CHARACTER(LEN=512) :: wstat_save_dir
  CHARACTER(LEN=512) :: wstat_restart_dir
Marco Govoni's avatar
Marco Govoni committed
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
  LOGICAL :: l_is_wstat_converged
  !
END MODULE 
!
!
MODULE wfreq_center
  !
  USE kinds, ONLY : DP
  !
  SAVE
  !
  ! INPUT FOR wfreq_control
  !
  CHARACTER(LEN=8) :: wfreq_calculation
  INTEGER :: n_lanczos
  INTEGER :: n_pdep_eigen_to_use
  INTEGER :: n_imfreq
  INTEGER :: n_refreq
  INTEGER :: qp_bandrange(2)
  REAL(DP) :: ecut_imfreq
  REAL(DP) :: ecut_refreq
  REAL(DP) :: wfreq_eta
  INTEGER :: n_secant_maxiter
  REAL(DP) :: trev_secant
  LOGICAL :: l_enable_lanczos
  CHARACTER(LEN=1) :: macropol_calculation
  LOGICAL :: l_enable_gwetot
  REAL(DP) :: exx_etot
  REAL(DP) :: o_restart_time
  REAL(DP) :: ecut_spectralf(2)
  INTEGER :: n_spectralf
  !
  ! Common workspace
  !
158
159
  CHARACTER(LEN=512) :: wfreq_save_dir
  CHARACTER(LEN=512) :: wfreq_restart_dir
Marco Govoni's avatar
Marco Govoni committed
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
  LOGICAL,PARAMETER :: l_skip_nl_part_of_hcomr=.FALSE.
  LOGICAL :: l_macropol
  !
  ! re freq 
  !
  REAL(DP),ALLOCATABLE :: refreq_list(:)
  !
  ! im freq
  !
  REAL(DP),ALLOCATABLE :: imfreq_list(:)
  REAL(DP),ALLOCATABLE :: imfreq_list_integrate(:,:)
  REAL(DP),PARAMETER :: frequency_list_power = 2._DP
  !
  ! gw_etot 
  !
  REAL(DP) :: dft_etot
  REAL(DP) :: dft_exc
  REAL(DP) :: gw_ecorr
  REAL(DP) :: gw_exx
  REAL(DP) :: gw_exc
  !
  ! output
  !
  REAL(DP),ALLOCATABLE    :: sigma_exx       (:,:)
  REAL(DP),ALLOCATABLE    :: sigma_vxcl      (:,:)
  REAL(DP),ALLOCATABLE    :: sigma_vxcnl     (:,:)
  REAL(DP),ALLOCATABLE    :: sigma_hf        (:,:)
  REAL(DP),ALLOCATABLE    :: sigma_z         (:,:)
  REAL(DP),ALLOCATABLE    :: sigma_eqplin    (:,:)
  REAL(DP),ALLOCATABLE    :: sigma_eqpsec    (:,:)
  COMPLEX(DP),ALLOCATABLE :: sigma_sc_eks    (:,:)
  COMPLEX(DP),ALLOCATABLE :: sigma_sc_eqplin (:,:)
  COMPLEX(DP),ALLOCATABLE :: sigma_sc_eqpsec (:,:)
Govoni's avatar
Govoni committed
193
  REAL(DP),ALLOCATABLE     :: sigma_diff      (:,:)
Marco Govoni's avatar
Marco Govoni committed
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
  COMPLEX(DP),ALLOCATABLE :: sigma_spectralf (:,:,:)
  REAL(DP),ALLOCATABLE    :: sigma_freq      (:)
  !
END MODULE
!
!
MODULE westpp_center
  !
  USE kinds, ONLY : DP
  !
  SAVE
  !
  ! INPUT FOR wfreq_control
  !
  CHARACTER(LEN=8) :: westpp_calculation
  CHARACTER(LEN=7) :: westpp_format
  INTEGER :: westpp_n_pdep_eigen_to_use
  INTEGER :: westpp_range(2)
  LOGICAL :: westpp_sign
  REAL(DP) :: westpp_r0(3)
  INTEGER :: westpp_nr
  REAL(DP) :: westpp_rmax
  REAL(DP) :: westpp_epsinfty
  !
  ! Common workspace
  !
220
  CHARACTER(LEN=512) :: westpp_save_dir
Marco Govoni's avatar
Marco Govoni committed
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
  !
END MODULE
!
!
MODULE wan_center
  !
  USE kinds, ONLY : DP
  !
  SAVE
  !
  REAL(DP),ALLOCATABLE :: wanc(:,:)
  REAL(DP),ALLOCATABLE :: wanu(:,:)
  INTEGER :: wantot
  !
END MODULE
!
!
MODULE io_unit_numbers
  !
  SAVE
  !
  INTEGER,PARAMETER :: iuwfc=20
  INTEGER :: lrwfc 
  !
END MODULE 
!
!
MODULE westcom
  !
  USE scratch_area
  USE westin
  USE wstat_center
  USE wfreq_center
  USE westpp_center
  USE wan_center
  USE io_unit_numbers
  !
END MODULE