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