Octopus
output_berkeleygw.F90
Go to the documentation of this file.
1!! Copyright (C) 2002-2006 M. Marques, A. Castro, A. Rubio, G. Bertsch
2!!
3!! This program is free software; you can redistribute it and/or modify
4!! it under the terms of the GNU General Public License as published by
5!! the Free Software Foundation; either version 2, or (at your option)
6!! any later version.
7!!
8!! This program is distributed in the hope that it will be useful,
9!! but WITHOUT ANY WARRANTY; without even the implied warranty of
10!! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11!! GNU General Public License for more details.
12!!
13!! You should have received a copy of the GNU General Public License
14!! along with this program; if not, write to the Free Software
15!! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
16!! 02110-1301, USA.
17!!
18
19#include "global.h"
20
22 use cube_oct_m
24 use debug_oct_m
27 use fft_oct_m
30 use global_oct_m
31 use grid_oct_m
33 use io_oct_m
34 use ions_oct_m
37 use mpi_oct_m
40 use parser_oct_m
42 use space_oct_m
49 use v_ks_oct_m
50#if defined(HAVE_BERKELEYGW)
51 use wfn_rho_vxc_io_m
52#endif
53 use xc_oct_m
54
55 implicit none
56
57 private
58 public :: &
61
62contains
63
64 ! ---------------------------------------------------------
65 subroutine output_berkeleygw_init(nst, namespace, bgw, periodic_dim)
66 integer, intent(in) :: nst
67 type(namespace_t), intent(in) :: namespace
68 type(output_bgw_t), intent(out) :: bgw
69 integer, intent(in) :: periodic_dim
70
71 integer :: idir
72 real(real64) :: norm
73 type(block_t) :: blk
74
76
77 call messages_experimental("BerkeleyGW output", namespace=namespace)
78
79#ifndef HAVE_BERKELEYGW
80 message(1) = "Cannot do BerkeleyGW output: the library was not linked."
81 call messages_fatal(1, namespace=namespace)
82#endif
83
84 !%Variable BerkeleyGW_NumberBands
85 !%Type integer
86 !%Default all states
87 !%Section Output::BerkeleyGW
88 !%Description
89 !% Wavefunctions for bands up to this number will be output. Must be between <= number of states.
90 !% If < 1, no wavefunction file will be output.
91 !%End
92 call parse_variable(namespace, 'BerkeleyGW_NumberBands', nst, bgw%nbands)
93
94 ! these cannot be checked earlier, since output is initialized before unocc determines nst
95 if (bgw%nbands > nst) then
96 message(1) = "BerkeleyGW_NumberBands must be <= number of states."
97 call messages_fatal(1, only_root_writes = .true., namespace=namespace)
98 end if
99
100 !%Variable BerkeleyGW_Vxc_diag_nmin
101 !%Type integer
102 !%Default 1
103 !%Section Output::BerkeleyGW
104 !%Description
105 !% Lowest band for which to write diagonal exchange-correlation matrix elements. Must be <= number of states.
106 !% If < 1, diagonals will be skipped.
107 !%End
108 call parse_variable(namespace, 'BerkeleyGW_Vxc_diag_nmin', 1, bgw%vxc_diag_nmin)
109
110 if (bgw%vxc_diag_nmin > nst) then
111 message(1) = "BerkeleyGW_Vxc_diag_nmin must be <= number of states."
112 call messages_fatal(1, only_root_writes = .true., namespace=namespace)
113 end if
115 !%Variable BerkeleyGW_Vxc_diag_nmax
116 !%Type integer
117 !%Default nst
118 !%Section Output::BerkeleyGW
119 !%Description
120 !% Highest band for which to write diagonal exchange-correlation matrix elements. Must be between <= number of states.
121 !% If < 1, diagonals will be skipped.
122 !%End
123 call parse_variable(namespace, 'BerkeleyGW_Vxc_diag_nmax', nst, bgw%vxc_diag_nmax)
124
125 if (bgw%vxc_diag_nmax > nst) then
126 message(1) = "BerkeleyGW_Vxc_diag_nmax must be <= number of states."
127 call messages_fatal(1, only_root_writes = .true., namespace=namespace)
128 end if
129
130 if (bgw%vxc_diag_nmin <= 0 .or. bgw%vxc_diag_nmax <= 0) then
131 bgw%vxc_diag_nmin = 0
132 bgw%vxc_diag_nmax = 0
133 end if
134
135 !%Variable BerkeleyGW_Vxc_offdiag_nmin
136 !%Type integer
137 !%Default 1
138 !%Section Output::BerkeleyGW
139 !%Description
140 !% Lowest band for which to write off-diagonal exchange-correlation matrix elements. Must be <= number of states.
141 !% If < 1, off-diagonals will be skipped.
142 !%End
143 call parse_variable(namespace, 'BerkeleyGW_Vxc_offdiag_nmin', 1, bgw%vxc_offdiag_nmin)
144
145 if (bgw%vxc_offdiag_nmin > nst) then
146 message(1) = "BerkeleyGW_Vxc_offdiag_nmin must be <= number of states."
147 call messages_fatal(1, only_root_writes = .true., namespace=namespace)
148 end if
149
150 !%Variable BerkeleyGW_Vxc_offdiag_nmax
151 !%Type integer
152 !%Default nst
153 !%Section Output::BerkeleyGW
154 !%Description
155 !% Highest band for which to write off-diagonal exchange-correlation matrix elements. Must be <= number of states.
156 !% If < 1, off-diagonals will be skipped.
157 !%End
158 call parse_variable(namespace, 'BerkeleyGW_Vxc_offdiag_nmax', nst, bgw%vxc_offdiag_nmax)
159
160 if (bgw%vxc_offdiag_nmax > nst) then
161 message(1) = "BerkeleyGW_Vxc_offdiag_nmax must be <= number of states."
162 call messages_fatal(1, only_root_writes = .true., namespace=namespace)
163 end if
164
165 if (bgw%vxc_offdiag_nmin <= 0 .or. bgw%vxc_offdiag_nmax <= 0) then
166 bgw%vxc_offdiag_nmin = 0
167 bgw%vxc_offdiag_nmax = 0
168 end if
169
170 !!%Variable BerkeleyGW_Complex
171 !!%Type logical
172 !!%Default false
173 !!%Section Output::BerkeleyGW
174 !!%Description
175 !!% Even when wavefunctions, density, and XC potential could be real in reciprocal space,
176 !!% they will be output as complex.
177 !!%End
178 !call parse_variable(namespace, 'BerkeleyGW_Complex', .false., bgw%complex)
179
180 bgw%complex = .true.
181 ! real output not implemented, so currently this is always true
182
183 !%Variable BerkeleyGW_WFN_filename
184 !%Type string
185 !%Default WFN
186 !%Section Output::BerkeleyGW
187 !%Description
188 !% Filename for the wavefunctions.
189 !%End
190 call parse_variable(namespace, 'BerkeleyGW_WFN_filename', 'WFN', bgw%wfn_filename)
191
192 !%Variable BerkeleyGW_CalcExchange
193 !%Type logical
194 !%Default false
195 !%Section Output::BerkeleyGW
196 !%Description
197 !% Whether to calculate exchange matrix elements, to be written in <tt>x.dat</tt>.
198 !% These will be calculated anyway by BerkeleyGW <tt>Sigma</tt>, so this is useful
199 !% mainly for comparison and testing.
200 !%End
201 call parse_variable(namespace, 'BerkeleyGW_CalcExchange', .false., bgw%calc_exchange)
202
203 !%Variable BerkeleyGW_CalcDipoleMtxels
204 !%Type logical
205 !%Default false
206 !%Section Output::BerkeleyGW
207 !%Description
208 !% Whether to calculate dipole matrix elements, to be written in <tt>vmtxel</tt>.
209 !% This should be done when calculating <tt>WFN_fi</tt> for Bethe-Salpeter calculations
210 !% with light polarization in a finite direction. In that case, a shifted grid
211 !% <tt>WFNq_fi</tt> cannot be calculated, but we can instead use matrix elements of
212 !% <math>r</math> in a more exact scheme. In <tt>absorption.inp</tt>, set <tt>read_vmtxel</tt>
213 !% and <tt>use_momentum</tt>. Specify the number of conduction and valence bands you will
214 !% use in BSE here with <tt>BerkeleyGW_VmtxelNumCondBands</tt> and <tt>BerkeleyGW_VmtxelNumValBands</tt>.
215 !%End
216 call parse_variable(namespace, 'BerkeleyGW_CalcDipoleMtxels', .false., bgw%calc_vmtxel)
217
218 !%Variable BerkeleyGW_VmtxelPolarization
219 !%Type block
220 !%Default (1, 0, 0)
221 !%Section Output::BerkeleyGW
222 !%Description
223 !% Polarization, <i>i.e.</i> direction vector, for which to calculate <tt>vmtxel</tt>, if you have set
224 !% <tt>BerkeleyGW_CalcDipoleMtxels = yes</tt>. May not have any component in a periodic direction.
225 !% The vector will be normalized.
226 !%End
227
228 bgw%vmtxel_polarization(1:3) = m_zero
229 bgw%vmtxel_polarization(1) = m_one
230
231 if (bgw%calc_vmtxel .and. parse_block(namespace, 'BerkeleyGW_VmtxelPolarization', blk) == 0) then
232 do idir = 1, 3
233 call parse_block_float(blk, 0, idir - 1, bgw%vmtxel_polarization(idir))
234
235 if (idir <= periodic_dim .and. abs(bgw%vmtxel_polarization(idir)) > m_epsilon) then
236 message(1) = "You cannot calculate vmtxel with polarization in a periodic direction. Use WFNq_fi instead."
237 call messages_fatal(1, only_root_writes = .true., namespace=namespace)
238 end if
239 end do
240 call parse_block_end(blk)
241 norm = sum(abs(bgw%vmtxel_polarization(1:3))**2)
242 if (norm < m_epsilon) then
243 message(1) = "A non-zero value must be set for BerkeleyGW_VmtxelPolarization when BerkeleyGW_CalcDipoleMtxels = yes."
244 call messages_fatal(1, namespace=namespace)
245 end if
246 bgw%vmtxel_polarization(1:3) = bgw%vmtxel_polarization(1:3) / sqrt(norm)
247 end if
248
249 !%Variable BerkeleyGW_VmtxelNumCondBands
250 !%Type integer
251 !%Default 0
252 !%Section Output::BerkeleyGW
253 !%Description
254 !% Number of conduction bands for which to calculate <tt>vmtxel</tt>, if you have set
255 !% <tt>BerkeleyGW_CalcDipoleMtxels = yes</tt>. This should be equal to the number to be
256 !% used in BSE.
257 !%End
258 if (bgw%calc_vmtxel) call parse_variable(namespace, 'BerkeleyGW_VmtxelNumCondBands', 0, bgw%vmtxel_ncband)
259 ! The default should be the minimum number of occupied states on any k-point or spin.
260
261 !%Variable BerkeleyGW_VmtxelNumValBands
262 !%Type integer
263 !%Default 0
264 !%Section Output::BerkeleyGW
265 !%Description
266 !% Number of valence bands for which to calculate <tt>vmtxel</tt>, if you have set
267 !% <tt>BerkeleyGW_CalcDipoleMtxels = yes</tt>. This should be equal to the number to be
268 !% used in BSE.
269 !%End
270 if (bgw%calc_vmtxel) call parse_variable(namespace, 'BerkeleyGW_VmtxelNumValBands', 0, bgw%vmtxel_nvband)
271 ! The default should be the minimum number of unoccupied states on any k-point or spin.
272
274 end subroutine output_berkeleygw_init
275
276
277 ! ---------------------------------------------------------
278 subroutine output_berkeleygw(bgw, namespace, space, dir, st, gr, ks, hm, ions)
279 type(output_bgw_t), intent(in) :: bgw
280 type(namespace_t), intent(in) :: namespace
281 class(space_t), intent(in) :: space
282 character(len=*), intent(in) :: dir
283 type(states_elec_t), intent(in) :: st
284 type(grid_t), target, intent(in) :: gr
285 type(v_ks_t), intent(inout) :: ks
286 type(hamiltonian_elec_t), intent(inout) :: hm
287 type(ions_t), intent(in) :: ions
288
289#ifdef HAVE_BERKELEYGW
290 integer :: ik, is, ikk, ist, itran, iunit, iatom, mtrx(3, 3, 48), fftgrid(3), ngkmax
291 integer, pointer :: atyp(:)
292 integer, allocatable :: ifmin(:,:), ifmax(:,:), ngk(:)
293 character(len=3) :: sheader
294 real(real64) :: adot(3,3), bdot(3,3), recvol, tnp(3, 48), ecutrho, ecutwfc
295 real(real64), allocatable :: energies(:,:,:), occupations(:,:,:)
296 real(real64), pointer :: apos(:,:)
297 real(real64), allocatable :: vxc(:,:), dpsi(:,:)
298 complex(real64), allocatable :: field_g(:,:), zpsi(:,:)
299 type(cube_t) :: cube
300 type(cube_function_t) :: cf
301 type(fourier_shell_t) :: shell_density, shell_wfn
302#endif
303
304 push_sub(output_berkeleygw)
305
306 if (space%dim /= 3) then
307 message(1) = "BerkeleyGW output only available in 3D."
308 call messages_fatal(1, namespace=namespace)
309 end if
310
311 if (st%d%ispin == spinors) call messages_not_implemented("BerkeleyGW output for spinors", namespace=namespace)
312
313 if (st%parallel_in_states) call messages_not_implemented("BerkeleyGW output parallel in states", namespace=namespace)
314
315 if (st%d%kpt%parallel) call messages_not_implemented("BerkeleyGW output parallel in k-points", namespace=namespace)
316
317 if (ks%theory_level == hartree .or. ks%theory_level == hartree_fock .or. xc_is_orbital_dependent(ks%xc)) then
318 call messages_not_implemented("BerkeleyGW output with orbital-dependent functionals", namespace=namespace)
319 end if
320
321 if (hm%ep%nlcc) call messages_not_implemented("BerkeleyGW output with NLCC", namespace=namespace)
322
323#ifdef HAVE_BERKELEYGW
324
325 safe_allocate(vxc(1:gr%np, 1:st%d%nspin))
326 vxc(:,:) = m_zero
327 ! we should not include core rho here. that is why we do not just use hm%vxc
328 call xc_get_vxc(gr, ks%xc, st, hm%kpoints, hm%psolver, namespace, space, st%rho, st%d%ispin, &
329 hm%ions%latt%rcell_volume, vxc)
330
331 message(1) = "BerkeleyGW output: vxc.dat"
332 if (bgw%calc_exchange) message(1) = trim(message(1)) // ", x.dat"
333 call messages_info(1, namespace=namespace)
334
335 if (states_are_real(st)) then
336 call dbgw_vxc_dat(bgw, namespace, space, dir, st, gr, hm, vxc)
337 else
338 call zbgw_vxc_dat(bgw, namespace, space, dir, st, gr, hm, vxc)
339 end if
340
341 call cube_init(cube, gr%idx%ll, namespace, space, gr%spacing, gr%coord_system, &
342 fft_type = fft_complex, dont_optimize = .true., nn_out = fftgrid)
343 call cube_init_cube_map(cube, gr)
344 if (any(gr%idx%ll(1:3) /= fftgrid(1:3))) then ! paranoia check
345 message(1) = "Cannot do BerkeleyGW output: FFT grid has been modified."
346 call messages_fatal(1, namespace=namespace)
347 end if
348 call zcube_function_alloc_rs(cube, cf)
349 call cube_function_alloc_fs(cube, cf)
350
351 ! NOTE: in BerkeleyGW, no G-vector may have coordinate equal to the half the FFT grid size.
352 call fourier_shell_init(shell_density, namespace, space, cube, gr)
353 ecutrho = shell_density%ekin_cutoff
354 safe_allocate(field_g(1:shell_density%ngvectors, 1:st%d%nspin))
355
356 call bgw_setup_header()
357
358
359 if (bgw%calc_vmtxel) then
360 write(message(1),'(a,3f12.6)') "BerkeleyGW output: vmtxel. Polarization = ", bgw%vmtxel_polarization(1:3)
361 call messages_info(1, namespace=namespace)
362
363 if (states_are_real(st)) then
364 call dbgw_vmtxel(bgw, namespace, dir, st, gr, ifmax)
365 else
366 call zbgw_vmtxel(bgw, namespace, dir, st, gr, ifmax)
367 end if
368 end if
369
370 message(1) = "BerkeleyGW output: VXC"
371 call messages_info(1, namespace=namespace)
372
373 sheader = 'VXC'
374 if (mpi_grp_is_root(mpi_world)) then
375 iunit = io_open(trim(dir) // 'VXC', namespace, form = 'unformatted', action = 'write')
376 call bgw_write_header(sheader, iunit)
377 end if
378 ! convert from Ha to Ry, make usable with same processing as RHO
379 vxc(:,:) = vxc(:,:) * m_two / (product(cube%rs_n_global(1:3)) * gr%volume_element)
380 call dbgw_write_fs(namespace, iunit, vxc, field_g, shell_density, st%d%nspin, gr, cube, cf, is_wfn = .false.)
381 if (mpi_grp_is_root(mpi_world)) call io_close(iunit)
382 safe_deallocate_a(vxc)
383
384
385 message(1) = "BerkeleyGW output: RHO"
386 call messages_info(1, namespace=namespace)
387
388 sheader = 'RHO'
389 if (mpi_grp_is_root(mpi_world)) then
390 iunit = io_open(trim(dir) // 'RHO', namespace, form = 'unformatted', action = 'write')
391 call bgw_write_header(sheader, iunit)
392 end if
393 call dbgw_write_fs(namespace, iunit, st%rho, field_g, shell_density, st%d%nspin, gr, cube, cf, is_wfn = .false.)
394 if (mpi_grp_is_root(mpi_world)) call io_close(iunit)
395
396 message(1) = "BerkeleyGW output: WFN"
397 write(message(2),'(a,f12.6,a)') "Wavefunction cutoff for BerkeleyGW: ", &
398 fourier_shell_cutoff(space, cube, gr, .true.) * m_two, " Ry"
399 call messages_info(2, namespace=namespace)
400
401 if (states_are_real(st)) then
402 safe_allocate(dpsi(1:gr%np, 1:st%d%nspin))
403 else
404 safe_allocate(zpsi(1:gr%np, 1:st%d%nspin))
405 end if
406
407 sheader = 'WFN'
408 if (mpi_grp_is_root(mpi_world)) then
409 iunit = io_open(trim(dir) // bgw%wfn_filename, namespace, form = 'unformatted', action = 'write')
410 call bgw_write_header(sheader, iunit)
411 end if
412
413 call fourier_shell_end(shell_density)
414
415 ! FIXME: is parallelization over k-points possible?
416 do ik = st%d%kpt%start, st%d%kpt%end, st%d%nspin
417 call fourier_shell_init(shell_wfn, namespace, space, cube, gr, kk = hm%kpoints%reduced%red_point(:, ik))
418
419 if (mpi_grp_is_root(mpi_world)) then
420 call write_binary_gvectors(iunit, shell_wfn%ngvectors, shell_wfn%ngvectors, shell_wfn%red_gvec)
421 end if
422 do ist = 1, st%nst
423 do is = 1, st%d%nspin
424 ikk = ik + is - 1
425 if (states_are_real(st)) then
426 call states_elec_get_state(st, gr, 1, ist, ikk, dpsi(:, is))
427 else
428 call states_elec_get_state(st, gr, 1, ist, ikk, zpsi(:, is))
429 end if
430 end do
431 if (states_are_real(st)) then
432 call dbgw_write_fs(namespace, iunit, dpsi, field_g, shell_wfn, st%d%nspin, gr, cube, cf, is_wfn = .true.)
433 else
434 call zbgw_write_fs(namespace, iunit, zpsi, field_g, shell_wfn, st%d%nspin, gr, cube, cf, is_wfn = .true.)
435 end if
436 end do
437 call fourier_shell_end(shell_wfn)
438 end do
439
440 if (mpi_grp_is_root(mpi_world)) call io_close(iunit)
441
442 ! deallocate everything
443 call cube_function_free_fs(cube, cf)
444 call zcube_function_free_rs(cube, cf)
445 call cube_end(cube)
446
447 if (states_are_real(st)) then
448 safe_deallocate_a(dpsi)
449 else
450 safe_deallocate_a(zpsi)
451 end if
452 safe_deallocate_a(vxc)
453 safe_deallocate_a(field_g)
454 safe_deallocate_a(ifmin)
455 safe_deallocate_a(ifmax)
456 safe_deallocate_a(ngk)
457 safe_deallocate_a(energies)
458 safe_deallocate_a(occupations)
459 safe_deallocate_p(atyp)
460 safe_deallocate_p(apos)
461
462#else
463 message(1) = "Cannot do BerkeleyGW output: the library was not linked."
464 call messages_fatal(1, namespace=namespace)
465#endif
466
467 pop_sub(output_berkeleygw)
468
469#ifdef HAVE_BERKELEYGW
470 contains
471
472 subroutine bgw_setup_header()
474
475 if (space%periodic_dim /= 3) then
476 message(1) = "BerkeleyGW for mixed-periodicity is currently not implemented."
477 call messages_fatal(1, namespace=namespace)
478 end if
479
480 ! The rlattice, klattice and rcell_volume used here are not correct for
481 ! mixid periodicity. Note also that the BerkeleyGW treats the z direction
482 ! as periodic for wires, while in Octopus it is the x direction that is
483 ! periodic.
484 adot(1:3, 1:3) = matmul(ions%latt%rlattice(1:3, 1:3), ions%latt%rlattice(1:3, 1:3))
485 bdot(1:3, 1:3) = matmul(ions%latt%klattice(1:3, 1:3), ions%latt%klattice(1:3, 1:3))
486 recvol = (m_two * m_pi)**3 / ions%latt%rcell_volume
487
488 ! symmetry is not analyzed by Octopus for finite systems, but we only need it for periodic ones
489 do itran = 1, symmetries_number(gr%symm)
490 mtrx(:,:, itran) = symm_op_rotation_matrix_red(gr%symm%ops(itran))
491 tnp(:, itran) = symm_op_translation_vector_red(gr%symm%ops(itran))
492 end do
493 ! some further work on conventions of mtrx and tnp is required!
494
495 safe_allocate(ifmin(1:hm%kpoints%reduced%npoints, 1:st%d%nspin))
496 safe_allocate(ifmax(1:hm%kpoints%reduced%npoints, 1:st%d%nspin))
497 safe_allocate(energies(1:st%nst, 1:hm%kpoints%reduced%npoints, 1:st%d%nspin))
498 safe_allocate(occupations(1:st%nst, 1:hm%kpoints%reduced%npoints, 1:st%d%nspin))
499
500 ifmin(:,:) = 1
501! This is how semiconducting smearing "should" work, but not in our implementation.
502! if (smear_is_semiconducting(st%smear)) then
503! ifmax(:,:) = nint(st%qtot / st%smear%el_per_state)
504! end if
505 do ik = 1, st%nik
506 is = st%d%get_spin_index(ik)
507 ikk = st%d%get_kpoint_index(ik)
508 energies(1:st%nst, ikk, is) = st%eigenval(1:st%nst,ik) * m_two
509 occupations(1:st%nst, ikk, is) = st%occ(1:st%nst, ik) / st%smear%el_per_state
510 do ist = 1, st%nst
511 ! M_EPSILON needed since e_fermi is top of valence band for fixed_occ and semiconducting smearing
512 if (st%eigenval(ist, ik) < st%smear%e_fermi + m_epsilon) then
513 ifmax(ikk, is) = ist
514 else
515 exit
516 end if
517 end do
518 end do
519
520 safe_allocate(ngk(1:hm%kpoints%reduced%npoints))
521 do ik = 1, st%nik, st%d%nspin
522 call fourier_shell_init(shell_wfn, namespace, space, cube, gr, kk = hm%kpoints%reduced%red_point(:, ik))
523 if (ik == 1) ecutwfc = shell_wfn%ekin_cutoff ! should be the same for all, anyway
524 ngk(ik) = shell_wfn%ngvectors
525 call fourier_shell_end(shell_wfn)
526 end do
527 ngkmax = maxval(ngk)
528
529 safe_allocate(atyp(1:ions%natoms))
530 safe_allocate(apos(1:3, 1:ions%natoms))
531 do iatom = 1, ions%natoms
532 atyp(iatom) = ions%atom(iatom)%species%get_index()
533 apos(1:3, iatom) = ions%pos(1:3, iatom)
534 end do
535
536 if (any(hm%kpoints%nik_axis(1:3) == 0)) then
537 message(1) = "KPointsGrid has a zero component. Set KPointsGrid appropriately,"
538 message(2) = "or this WFN will only be usable in BerkeleyGW's inteqp."
539 call messages_warning(1, namespace=namespace)
540 end if
541
543 end subroutine bgw_setup_header
544
545 ! ---------------------------------------------------------
546 subroutine bgw_write_header(sheader, iunit)
547 character(len=3), intent(inout) :: sheader
548 integer, intent(in) :: iunit
549
551
552 call write_binary_header(iunit, sheader, 2, st%d%nspin, shell_density%ngvectors, &
553 symmetries_number(gr%symm), 0, ions%natoms, &
554 hm%kpoints%reduced%npoints, st%nst, ngkmax, ecutrho * m_two, &
555 ecutwfc * m_two, fftgrid, hm%kpoints%nik_axis, hm%kpoints%full%shifts, &
556 ions%latt%rcell_volume, m_one, ions%latt%rlattice, adot, recvol, &
557 m_one, ions%latt%klattice, bdot, mtrx, tnp, atyp, &
558 apos, ngk, hm%kpoints%reduced%weight, hm%kpoints%reduced%red_point, &
559 ifmin, ifmax, energies, occupations, warn = .false.)
560
561 call write_binary_gvectors(iunit, shell_density%ngvectors, shell_density%ngvectors, shell_density%red_gvec)
562
564 end subroutine bgw_write_header
566#endif
567
568 end subroutine output_berkeleygw
569
570#include "undef.F90"
571#include "complex.F90"
572#ifdef HAVE_BERKELEYGW
573#include "output_berkeleygw_inc.F90"
574#endif
575
576#include "undef.F90"
577#include "real.F90"
578#ifdef HAVE_BERKELEYGW
579#include "output_berkeleygw_inc.F90"
580#endif
581
583
584!! Local Variables:
585!! mode: f90
586!! coding: utf-8
587!! End:
double sqrt(double __x) __attribute__((__nothrow__
subroutine, public zcube_function_free_rs(cube, cf)
Deallocates the real space grid.
subroutine, public zcube_function_alloc_rs(cube, cf, in_device, force_alloc)
Allocates locally the real space grid, if PFFT library is not used. Otherwise, it assigns the PFFT re...
subroutine, public cube_init(cube, nn, namespace, space, spacing, coord_system, fft_type, fft_library, dont_optimize, nn_out, mpi_grp, need_partition, tp_enlarge, blocksize)
Definition: cube.F90:202
subroutine, public cube_end(cube)
Definition: cube.F90:378
subroutine, public cube_init_cube_map(cube, mesh)
Definition: cube.F90:823
integer, parameter, public spinors
Fast Fourier Transform module. This module provides a single interface that works with different FFT ...
Definition: fft.F90:118
integer, parameter, public fft_complex
Definition: fft.F90:177
real(real64) function, public fourier_shell_cutoff(space, cube, mesh, is_wfn, dg)
subroutine, public fourier_shell_init(this, namespace, space, cube, mesh, kk)
subroutine, public fourier_shell_end(this)
subroutine, public cube_function_free_fs(cube, cf)
Deallocates the Fourier space grid.
subroutine, public cube_function_alloc_fs(cube, cf, force_alloc)
Allocates locally the Fourier space grid, if PFFT library is not used. Otherwise, it assigns the PFFT...
real(real64), parameter, public m_two
Definition: global.F90:189
real(real64), parameter, public m_zero
Definition: global.F90:187
real(real64), parameter, public m_pi
some mathematical constants
Definition: global.F90:185
real(real64), parameter, public m_epsilon
Definition: global.F90:203
real(real64), parameter, public m_one
Definition: global.F90:188
This module implements the underlying real-space grid.
Definition: grid.F90:117
integer, parameter, public hartree
integer, parameter, public hartree_fock
Definition: io.F90:114
subroutine, public io_close(iunit, grp)
Definition: io.F90:468
integer function, public io_open(file, namespace, action, status, form, position, die, recl, grp)
Definition: io.F90:395
This module defines various routines, operating on mesh functions.
subroutine, public messages_not_implemented(feature, namespace)
Definition: messages.F90:1125
subroutine, public messages_warning(no_lines, all_nodes, namespace)
Definition: messages.F90:543
character(len=256), dimension(max_lines), public message
to be output by fatal, warning
Definition: messages.F90:160
subroutine, public messages_fatal(no_lines, only_root_writes, namespace)
Definition: messages.F90:420
subroutine, public messages_experimental(name, namespace)
Definition: messages.F90:1097
subroutine, public messages_info(no_lines, iunit, debug_only, stress, all_nodes, namespace)
Definition: messages.F90:624
logical function mpi_grp_is_root(grp)
Is the current MPI process of grpcomm, root.
Definition: mpi.F90:430
type(mpi_grp_t), public mpi_world
Definition: mpi.F90:266
subroutine zbgw_write_fs(namespace, iunit, field_r, field_g, shell, nspin, gr, cube, cf, is_wfn)
subroutine zbgw_vmtxel(bgw, namespace, dir, st, gr, ifmax)
Calculate 'vmtxel' file of dipole matrix elements for BerkeleyGW BSE.
subroutine dbgw_vmtxel(bgw, namespace, dir, st, gr, ifmax)
Calculate 'vmtxel' file of dipole matrix elements for BerkeleyGW BSE.
subroutine dbgw_write_fs(namespace, iunit, field_r, field_g, shell, nspin, gr, cube, cf, is_wfn)
subroutine, public output_berkeleygw(bgw, namespace, space, dir, st, gr, ks, hm, ions)
subroutine, public output_berkeleygw_init(nst, namespace, bgw, periodic_dim)
subroutine zbgw_vxc_dat(bgw, namespace, space, dir, st, gr, hm, vxc)
subroutine dbgw_vxc_dat(bgw, namespace, space, dir, st, gr, hm, vxc)
this module contains the output system
Definition: output_low.F90:115
integer function, public parse_block(namespace, name, blk, check_varinfo_)
Definition: parser.F90:618
pure logical function, public states_are_real(st)
This module handles spin dimensions of the states and the k-point distribution.
real(real64) function, dimension(1:this%dim), public symm_op_translation_vector_red(this)
Definition: symm_op.F90:324
integer function, dimension(1:this%dim, 1:this%dim), public symm_op_rotation_matrix_red(this)
Definition: symm_op.F90:303
integer pure function, public symmetries_number(this)
Definition: symmetries.F90:540
Definition: xc.F90:114
subroutine, public xc_get_vxc(gr, xcs, st, kpoints, psolver, namespace, space, rho, ispin, rcell_volume, vxc, ex, ec, deltaxc, vtau, ex_density, ec_density, stress_xc, force_orbitalfree)
Definition: xc.F90:754
logical pure function, public xc_is_orbital_dependent(xcs)
Is the xc family orbital dependent.
Definition: xc.F90:541
subroutine bgw_setup_header()
subroutine bgw_write_header(sheader, iunit)
Description of the grid, containing information on derivatives, stencil, and symmetries.
Definition: grid.F90:168
The states_elec_t class contains all electronic wave functions.
int true(void)