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