Octopus
sternheimer.F90
Go to the documentation of this file.
1!! Copyright (C) 2004-2012 Xavier Andrade, Eugene S. Kadantsev (ekadants@mjs1.phy.queensu.ca), David Strubbe
2!! Copyright (C) 2021 Davis Welakuh
3!!
4!! This program is free software; you can redistribute it and/or modify
5!! it under the terms of the GNU General Public License as published by
6!! the Free Software Foundation; either version 2, or (at your option)
7!! any later version.
8!!
9!! This program is distributed in the hope that it will be useful,
10!! but WITHOUT ANY WARRANTY; without even the implied warranty of
11!! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12!! GNU General Public License for more details.
13!!
14!! You should have received a copy of the GNU General Public License
15!! along with this program; if not, write to the Free Software
16!! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17!! 02110-1301, USA.
18!!
19
20#include "global.h"
21
23 use batch_oct_m
25 use comm_oct_m
26 use debug_oct_m
30 use global_oct_m
31 use grid_oct_m
34 use io_oct_m
35 use, intrinsic :: iso_fortran_env
39 use lda_u_oct_m
42 use math_oct_m
43 use mesh_oct_m
46 use mix_oct_m
47 use mpi_oct_m
50 use parser_oct_m
57 use smear_oct_m
58 use space_oct_m
62 use unit_oct_m
64 use types_oct_m
65 use v_ks_oct_m
67 use xc_oct_m
68 use xc_sic_oct_m
69 use xc_f03_lib_m
72
73 implicit none
74
75 private
76 public :: &
97 swap_sigma, &
100 dcalc_hvar, &
101 zcalc_hvar, &
102 dcalc_kvar, &
104
105 character(len=*), public, parameter :: EM_RESP_PHOTONS_DIR = "em_resp_photons/"
106
107 type sternheimer_t
108 private
109 type(linear_solver_t) :: solver
110 type(mix_t) :: mixer
111 type(mixfield_t), pointer :: mixfield
112 type(scf_tol_t) :: scf_tol
113 real(real64), allocatable :: fxc(:,:,:)
114 real(real64), allocatable :: fxc_grad(:,:,:,:,:)
115 real(real64), allocatable :: fxc_grad_spin(:,:,:,:)
116 logical :: gga = .false.
117 real(real64), allocatable :: kxc(:,:,:,:)
118 real(real64), pointer, contiguous :: drhs(:, :, :, :) => null()
119 complex(real64), pointer, contiguous :: zrhs(:, :, :, :) => null()
120 real(real64), pointer, contiguous :: dinhomog(:, :, :, :, :) => null()
121 complex(real64), pointer, contiguous :: zinhomog(:, :, :, :, :) => null()
122 logical :: add_fxc_kernel
123 logical :: ok
124 logical :: occ_response
125 logical :: last_occ_response
126 logical :: occ_response_by_sternheimer
127 logical :: preorthogonalization
128 logical, public :: has_photons
129 real(real64) :: domega
130 complex(real64) :: zomega
131 real(real64), allocatable, public :: dphoton_coord_q(:, :)
132 complex(real64), allocatable, public :: zphoton_coord_q(:, :)
133 real(real64) :: pt_eta
134 type(photon_mode_t) :: pt_modes
135
136 real(real64) :: coeff_hartree
137 contains
138 procedure :: add_fxc => sternheimer_add_fxc
139 procedure :: add_hartree => sternheimer_add_hartree
140 end type sternheimer_t
141
142
143contains
144
145 !-----------------------------------------------------------
146 subroutine sternheimer_init(this, namespace, space, gr, st, hm, ks, mc, wfs_are_cplx, set_ham_var, set_occ_response, &
147 set_last_occ_response, occ_response_by_sternheimer)
148 type(sternheimer_t), intent(out) :: this
149 type(namespace_t), intent(in) :: namespace
150 class(space_t), intent(in) :: space
151 type(grid_t), intent(inout) :: gr
152 type(states_elec_t), intent(in) :: st
153 type(hamiltonian_elec_t), intent(in) :: hm
154 type(v_ks_t), intent(in) :: ks
155 type(multicomm_t), intent(in) :: mc
156 logical, intent(in) :: wfs_are_cplx
157 integer, optional, intent(in) :: set_ham_var
158 logical, optional, intent(in) :: set_occ_response
159 logical, optional, intent(in) :: set_last_occ_response
160 logical, optional, intent(in) :: occ_response_by_sternheimer
161
162 logical :: add_hartree
163 integer :: ham_var, iunit
164 logical :: default_preorthog
165
166 push_sub(sternheimer_init)
167
168 if (family_is_mgga(ks%xc%family)) then
169 call messages_not_implemented("MGGA functionals with Sternheimer calculation")
170 end if
171 if (family_is_hybrid(ks%xc)) then
172 call messages_not_implemented("Hybrid functionals with Sternheimer calculation")
173 end if
174
175 if (ks%sic%level /= sic_none) then
176 call messages_not_implemented("SIC with Sternheimer calculation")
177 end if
178
179 if (hm%lda_u_level /= dft_u_none) then
180 call messages_not_implemented("DFT+U with Sterheimer calculation")
181 end if
182
183 if (st%smear%method == smear_fixed_occ) then
184 call messages_experimental("Sternheimer equation for arbitrary occupations", namespace=namespace)
185 end if
186 if (st%smear%method == smear_semiconductor .and. &
187 (abs(st%smear%ef_occ) > m_epsilon) .and. abs(st%smear%ef_occ - m_one) > m_epsilon) then
188 write(message(1),'(a,f12.6)') 'Partial occupation at the Fermi level: ', st%smear%ef_occ
189 message(2) = 'Semiconducting smearing cannot be used for Sternheimer in this situation.'
190 call messages_fatal(2, namespace=namespace)
191 end if
192
193 if (wfs_are_cplx) then
194 call mix_init(this%mixer, namespace, space, gr%der, gr%np, st%d%nspin, func_type_= type_cmplx)
195 else
196 call mix_init(this%mixer, namespace, space, gr%der, gr%np, st%d%nspin, func_type_= type_float)
197 end if
198 call mix_get_field(this%mixer, this%mixfield)
199
200 this%occ_response = optional_default(set_occ_response, .false.)
201 this%occ_response_by_sternheimer = optional_default(occ_response_by_sternheimer, .false.)
202 this%last_occ_response = optional_default(set_last_occ_response, .false.)
203
204 !%Variable Preorthogonalization
205 !%Type logical
206 !%Section Linear Response::Sternheimer
207 !%Description
208 !% Whether initial linear-response wavefunctions should be orthogonalized
209 !% or not against the occupied states, at the start of each SCF cycle.
210 !% Default is true only if <tt>SmearingFunction = semiconducting</tt>,
211 !% or if the <tt>Occupations</tt> block specifies all full or empty states,
212 !% and we are not solving for linear response in the occupied subspace too.
213 !%End
214 default_preorthog = (st%smear%method == smear_semiconductor .or. &
215 (st%smear%method == smear_fixed_occ .and. st%smear%integral_occs)) &
216 .and. .not. this%occ_response
217 call parse_variable(namespace, 'Preorthogonalization', default_preorthog, this%preorthogonalization)
219 !%Variable HamiltonianVariation
220 !%Type integer
221 !%Default hartree+fxc
222 !%Section Linear Response::Sternheimer
223 !%Description
224 !% The terms to be considered in the variation of the
225 !% Hamiltonian. The external potential (V_ext) is always considered. The default is to include
226 !% also the exchange-correlation and Hartree terms, which fully
227 !% takes into account local fields.
228 !% Just <tt>hartree</tt> gives you the random-phase approximation (RPA).
229 !% If you want to choose the exchange-correlation kernel, use the variable
230 !% <tt>XCKernel</tt>. For <tt>kdotp</tt> and magnetic <tt>em_resp</tt> modes,
231 !% or if <tt>TheoryLevel = independent_particles</tt>,
232 !% the value <tt>V_ext_only</tt> is used and this variable is ignored.
233 !%Option V_ext_only 0
234 !% Neither Hartree nor XC potentials included.
235 !%Option hartree 1
236 !% The variation of the Hartree potential only.
237 !%Option fxc 2
238 !% The exchange-correlation kernel (the variation of the
239 !% exchange-correlation potential) only.
240 !%End
241 if (present(set_ham_var)) then
242 ham_var = set_ham_var
243 else if (hm%theory_level /= independent_particles) then
244 call parse_variable(namespace, 'HamiltonianVariation', 3, ham_var)
245 else
246 ham_var = 0
247 end if
248
249 if (hm%theory_level /= independent_particles) then
250 this%add_fxc_kernel = ((ham_var / 2) == 1)
251 add_hartree = (mod(ham_var, 2) == 1)
252 else
253 this%add_fxc_kernel = .false.
254 add_hartree = .false.
255 end if
256
257
258 message(1) = "Variation of the Hamiltonian in Sternheimer equation: V_ext"
259 if (add_hartree) write(message(1), '(2a)') trim(message(1)), ' + hartree'
260 if (this%add_fxc_kernel) write(message(1), '(2a)') trim(message(1)), ' + fxc'
261
262 message(2) = "Solving Sternheimer equation for"
263 if (this%occ_response) then
264 write(message(2), '(2a)') trim(message(2)), ' full linear response.'
265 else
266 write(message(2), '(2a)') trim(message(2)), ' linear response in unoccupied subspace only.'
267 end if
268
269 message(3) = "Sternheimer preorthogonalization:"
270 if (this%preorthogonalization) then
271 write(message(3), '(2a)') trim(message(3)), ' yes'
272 else
273 write(message(3), '(2a)') trim(message(3)), ' no'
274 end if
275 call messages_info(3, namespace=namespace)
276
277 call linear_solver_init(this%solver, namespace, gr, states_are_real(st), mc, space)
278
279 ! will not converge for non-self-consistent calculation unless LRTolScheme = fixed
280 if (ham_var == 0) then
281 call scf_tol_init(this%scf_tol, namespace, st%qtot, tol_scheme = 0) ! fixed
282 else
283 call scf_tol_init(this%scf_tol, namespace, st%qtot)
284 end if
285
286 ! Build the fxc from the GS density
287 this%coeff_hartree = m_zero
288 if (this%add_fxc_kernel) then
289 this%coeff_hartree = this%coeff_hartree - ks%xc%lrc%alpha / (m_four * m_pi)
290 end if
291 if (add_hartree) this%coeff_hartree = this%coeff_hartree + m_one
292 if (this%add_fxc_kernel) then
293 call sternheimer_build_fxc(this, namespace, gr, st, ks%xc)
294
295 call messages_print_with_emphasis(msg="XC Kernel level", namespace=namespace)
296 call xc_write_fxc_info(ks%xc, namespace=namespace)
297 call xc_sic_write_info(ks%sic, namespace=namespace)
298 call messages_print_with_emphasis(namespace=namespace)
299 end if
300
301
302 ! This variable is documented in xc_oep_init.
303 call parse_variable(namespace, 'EnablePhotons', .false., this%has_photons)
304 call messages_print_var_value('EnablePhotons', this%has_photons, namespace=namespace)
305
306 if (this%has_photons) then
307 call messages_experimental('EnablePhotons = yes', namespace=namespace)
308 call photon_mode_init(this%pt_modes, namespace, space%dim)
309 call photon_mode_set_n_electrons(this%pt_modes, m_zero)
310 call photon_mode_compute_dipoles(this%pt_modes, gr)
311 call io_mkdir(em_resp_photons_dir, namespace)
312 iunit = io_open(em_resp_photons_dir // 'photon_modes', namespace, action='write')
313 call photon_mode_write_info(this%pt_modes, iunit=iunit)
314 safe_allocate(this%zphoton_coord_q(1:this%pt_modes%nmodes, 1:space%dim))
315 call io_close(iunit)
316 end if
317
318 !%Variable PhotonEta
319 !%Type float
320 !%Default 0.0000367
321 !%Section Linear Response::Sternheimer
322 !%Description
323 !% This variable provides the value for the broadening of the photonic spectra
324 !% when the coupling of electrons to photons is enabled in the frequency-dependent Sternheimer equation
325 !%End
326 call parse_variable(namespace, 'PhotonEta', 0.0000367_real64, this%pt_eta, units_inp%energy)
327 call messages_print_var_value('PhotonEta', this%pt_eta, units_inp%energy, namespace=namespace)
328
329
330 pop_sub(sternheimer_init)
331 end subroutine sternheimer_init
332
333 !-----------------------------------------------------------
334 subroutine sternheimer_end(this)
335 type(sternheimer_t), intent(inout) :: this
336
337 push_sub(sternheimer_end)
338
339 safe_deallocate_a(this%zphoton_coord_q)
340
341 call linear_solver_end(this%solver)
342 call scf_tol_end(this%scf_tol)
343 call mix_end(this%mixer)
344
345 nullify(this%mixfield)
346
347 safe_deallocate_a(this%fxc)
348 safe_deallocate_a(this%fxc_grad)
349 safe_deallocate_a(this%fxc_grad_spin)
350
351 pop_sub(sternheimer_end)
352 end subroutine sternheimer_end
353
354
355 !-----------------------------------------------------------
357 subroutine sternheimer_build_fxc(this, namespace, gr, st, xc)
358 type(sternheimer_t), intent(inout) :: this
359 type(namespace_t), intent(in) :: namespace
360 type(grid_t), intent(in) :: gr
361 type(states_elec_t), intent(in) :: st
362 type(xc_t), intent(in) :: xc
363
364 real(real64), allocatable :: rho(:, :)
365
366 push_sub(sternheimer_build_fxc)
367
368 safe_allocate(this%fxc(1:gr%np, 1:st%d%nspin, 1:st%d%nspin))
369 safe_allocate(rho(1:gr%np_part, 1:st%d%nspin))
370 call states_elec_total_density(st, gr, rho)
371
372 this%gga = in_family(xc%kernel_family, [xc_family_gga])
373 if (this%gga) then
374 safe_allocate(this%fxc_grad(1:gr%np, 1:gr%der%dim, 1:gr%der%dim, 1:st%d%nspin, 1:st%d%nspin))
375 if (st%d%ispin == spin_polarized) then
376 safe_allocate(this%fxc_grad_spin(1:gr%np, 1:gr%der%dim, 1:st%d%nspin, 1:st%d%nspin))
377 else
378 safe_allocate(this%fxc_grad_spin(0, 0, 0, 0))
379 end if
380 call xc_get_fxc(xc, gr, namespace, rho, st%d%ispin, this%fxc, this%fxc_grad, this%fxc_grad_spin)
381 else
382 call xc_get_fxc(xc, gr, namespace, rho, st%d%ispin, this%fxc)
383 end if
384
385 safe_deallocate_a(rho)
386
387 pop_sub(sternheimer_build_fxc)
388 end subroutine sternheimer_build_fxc
389
390
391 !-----------------------------------------------------------
392 subroutine sternheimer_build_kxc(this, namespace, mesh, st, xc)
393 type(sternheimer_t), intent(inout) :: this
394 type(namespace_t), intent(in) :: namespace
395 class(mesh_t), intent(in) :: mesh
396 type(states_elec_t), intent(in) :: st
397 type(xc_t), intent(in) :: xc
398
399 real(real64), allocatable :: rho(:, :)
400
401 push_sub(sternheimer_build_kxc)
402
403 if (this%add_fxc()) then
404 safe_allocate(this%kxc(1:mesh%np, 1:st%d%nspin, 1:st%d%nspin, 1:st%d%nspin))
405 this%kxc = m_zero
406
407 safe_allocate(rho(1:mesh%np, 1:st%d%nspin))
408 call states_elec_total_density(st, mesh, rho)
409 call xc_get_kxc(xc, mesh, namespace, rho, st%d%ispin, this%kxc)
410 safe_deallocate_a(rho)
411 end if
412
413 pop_sub(sternheimer_build_kxc)
414
415 end subroutine sternheimer_build_kxc
416
417 !---------------------------------------------
418 subroutine sternheimer_unset_kxc(this)
419 type(sternheimer_t), intent(inout) :: this
420
421 push_sub(sternheimer_unset_kxc)
422
423 safe_deallocate_a(this%kxc)
424
425 pop_sub(sternheimer_unset_kxc)
426 end subroutine sternheimer_unset_kxc
427
428 !-----------------------------------------------------------
429 pure logical function sternheimer_add_fxc(this) result(rr)
430 class(sternheimer_t), intent(in) :: this
431 rr = this%add_fxc_kernel
432 end function sternheimer_add_fxc
433
434
435 !-----------------------------------------------------------
436 pure logical function sternheimer_add_hartree(this) result(rr)
437 class(sternheimer_t), intent(in) :: this
438 rr = abs(this%coeff_hartree) > m_epsilon
439 end function sternheimer_add_hartree
440
441
442 !-----------------------------------------------------------
443 logical function sternheimer_has_converged(this) result(rr)
444 type(sternheimer_t), intent(in) :: this
445 rr = this%ok
446 end function sternheimer_has_converged
447
448 !-----------------------------------------------------------
449 logical pure function sternheimer_have_rhs(this) result(have)
450 type(sternheimer_t), intent(in) :: this
451 have = associated(this%drhs) .or. associated(this%zrhs)
453
454 !-----------------------------------------------------------
455 subroutine sternheimer_unset_rhs(this)
456 type(sternheimer_t), intent(inout) :: this
457
458 push_sub(sternheimer_unset_rhs)
459
460 nullify(this%drhs)
461 nullify(this%zrhs)
462
463 pop_sub(sternheimer_unset_rhs)
464 end subroutine sternheimer_unset_rhs
465
466 !-----------------------------------------------------------
467 logical pure function sternheimer_have_inhomog(this) result(have)
468 type(sternheimer_t), intent(in) :: this
469 have = associated(this%dinhomog) .or. associated(this%zinhomog)
470 end function sternheimer_have_inhomog
471
472 !-----------------------------------------------------------
473 subroutine sternheimer_unset_inhomog(this)
474 type(sternheimer_t), intent(inout) :: this
475
477
478 nullify(this%dinhomog)
479 nullify(this%zinhomog)
480
482 end subroutine sternheimer_unset_inhomog
483
484 !-----------------------------------------------------------
485 integer pure function swap_sigma(sigma)
486 integer, intent(in) :: sigma
488 if (sigma == 1) then
489 swap_sigma = 2
490 else
491 swap_sigma = 1
492 end if
493
494 end function swap_sigma
495
496! ---------------------------------------------------------
497 character(len=100) function wfs_tag_sigma(namespace, base_name, isigma) result(str)
498 type(namespace_t), intent(in) :: namespace
499 character(len=*), intent(in) :: base_name
500 integer, intent(in) :: isigma
501
502 character :: sigma_char
503
504 push_sub(wfs_tag_sigma)
505
506 select case (isigma)
507 case (1)
508 sigma_char = '+'
509 case (2)
510 sigma_char = '-'
511 case default
512 write(message(1),'(a,i2)') "Illegal integer isigma passed to wfs_tag_sigma: ", isigma
513 call messages_fatal(1, namespace=namespace)
514 end select
515
516 str = trim(base_name) // sigma_char
517
518 pop_sub(wfs_tag_sigma)
519
520 end function wfs_tag_sigma
521
522 ! --------------------------------------------------------
523
524 subroutine sternheimer_obsolete_variables(namespace, old_prefix, new_prefix)
525 type(namespace_t), intent(in) :: namespace
526 character(len=*), intent(in) :: old_prefix
527 character(len=*), intent(in) :: new_prefix
528
530
531 call messages_obsolete_variable(namespace, trim(old_prefix)//'Preorthogonalization', trim(new_prefix)//'Preorthogonalization')
532 call messages_obsolete_variable(namespace, trim(old_prefix)//'HamiltonianVariation', trim(new_prefix)//'HamiltonianVariation')
533
534 call linear_solver_obsolete_variables(namespace, old_prefix, new_prefix)
535 call scf_tol_obsolete_variables(namespace, old_prefix, new_prefix)
536
539
540 !--------------------------------------------------------------
541 subroutine calc_hvar_photons(this, mesh, nspin, lr_rho, nsigma, hvar, idir)
542 type(sternheimer_t), intent(inout) :: this
543 class(mesh_t), intent(in) :: mesh
544 integer, intent(in) :: nspin
545 integer, intent(in) :: nsigma
546 complex(real64), intent(in) :: lr_rho(:,:)
547 complex(real64), intent(inout) :: hvar(:,:,:)
548 integer, intent(in) :: idir
549
550 real(real64), allocatable :: lambda_dot_r(:)
551 complex(real64), allocatable :: s_lr_rho(:), vp_dip_self_ener(:), vp_bilinear_el_pt(:)
552 integer :: nm, is, ii, ip
553 complex(real64) :: first_moments
554
555 push_sub(calc_hvar_photons)
556 call profiling_in('CALC_HVAR_PHOTONS')
557
558 nm = this%pt_modes%nmodes
559
560 ! photonic terms
561 safe_allocate(s_lr_rho(1:mesh%np))
562 safe_allocate(lambda_dot_r(1:mesh%np))
563 safe_allocate(vp_dip_self_ener(1:mesh%np))
564 safe_allocate(vp_bilinear_el_pt(1:mesh%np))
565
566 ! spin summed density
567 s_lr_rho = m_zero
568 do is = 1, nspin
569 s_lr_rho = s_lr_rho + lr_rho(:, is)
570 end do
571
572 ! Compute electron-photon potentials
573 vp_dip_self_ener = m_zero
574 vp_bilinear_el_pt = m_zero
575 do ii = 1, nm
576 !$omp parallel do
577 do ip = 1, mesh%np
578 lambda_dot_r(ip) = this%pt_modes%lambda(ii)*this%pt_modes%pol_dipole(ip, ii)
579 end do
580 !$omp end parallel do
581 first_moments = zmf_integrate(mesh, lambda_dot_r(1:mesh%np)*s_lr_rho(1:mesh%np))
582
583 ! Compute photon displacement coordinate q_{\alpha}s
584 this%zphoton_coord_q(ii, idir) = -m_half * &
585 ((m_one/(this%zomega - cmplx(this%pt_modes%omega(ii),-this%pt_eta, real64))) - &
586 (m_one/(this%zomega + cmplx(this%pt_modes%omega(ii), this%pt_eta, real64)))) *first_moments
587
588 ! Compute potential for bilinear el-pt interaction
589 vp_bilinear_el_pt = vp_bilinear_el_pt - &
590 this%pt_modes%omega(ii)*lambda_dot_r(1:mesh%np)*this%zphoton_coord_q(ii, idir)
591
592 ! Compute potential with dipole-self energy term
593 vp_dip_self_ener = vp_dip_self_ener + first_moments*lambda_dot_r(1:mesh%np)
594 end do
595
596 !$omp parallel do
597 do ip = 1, mesh%np
598 hvar(ip, 1, 1) = hvar(ip, 1, 1) + vp_dip_self_ener(ip) + vp_bilinear_el_pt(ip)
599 end do
600 !$omp end parallel do
601 do ii = 2, nspin
602 hvar(1:mesh%np, ii, 1) = hvar(1:mesh%np, 1, 1)
603 end do
604
605 safe_deallocate_a(s_lr_rho)
606 safe_deallocate_a(lambda_dot_r)
607 safe_deallocate_a(vp_dip_self_ener)
608 safe_deallocate_a(vp_bilinear_el_pt)
609
610 if (nsigma == 2) hvar(1:mesh%np, 1:nspin, 2) = conjg(hvar(1:mesh%np, 1:nspin, 1))
611
612 call profiling_out('CALC_HVAR_PHOTONS')
613 pop_sub(calc_hvar_photons)
614 end subroutine calc_hvar_photons
615
616
617#include "complex.F90"
618#include "sternheimer_inc.F90"
620#include "undef.F90"
621
622#include "real.F90"
623#include "sternheimer_inc.F90"
624
625end module sternheimer_oct_m
626
627!! Local Variables:
628!! mode: f90
629!! coding: utf-8
630!! End:
Prints out to iunit a message in the form: ["InputVariable" = value] where "InputVariable" is given b...
Definition: messages.F90:182
This module implements batches of mesh functions.
Definition: batch.F90:135
This module implements common operations on batches of mesh functions.
Definition: batch_ops.F90:118
This module implements a calculator for the density and defines related functions.
Definition: density.F90:122
subroutine, public states_elec_total_density(st, mesh, total_rho)
This routine calculates the total electronic density.
Definition: density.F90:892
This module calculates the derivatives (gradients, Laplacians, etc.) of a function.
integer, parameter, public spin_polarized
real(real64), parameter, public m_zero
Definition: global.F90:200
real(real64), parameter, public m_four
Definition: global.F90:204
real(real64), parameter, public m_pi
some mathematical constants
Definition: global.F90:198
integer, parameter, public independent_particles
Theory level.
Definition: global.F90:250
real(real64), parameter, public m_epsilon
Definition: global.F90:216
real(real64), parameter, public m_one
Definition: global.F90:201
This module implements the underlying real-space grid.
Definition: grid.F90:119
Definition: io.F90:116
subroutine, public io_close(iunit, grp)
Definition: io.F90:467
subroutine, public io_mkdir(fname, namespace, parents)
Definition: io.F90:361
integer function, public io_open(file, namespace, action, status, form, position, die, recl, grp)
Definition: io.F90:402
A module to handle KS potential, without the external potential.
integer, parameter, public dft_u_none
Definition: lda_u.F90:205
subroutine, public linear_solver_end(this)
subroutine, public linear_solver_init(this, namespace, gr, states_are_real, mc, space)
This module is intended to contain "only mathematical" functions and procedures.
Definition: math.F90:117
This module defines various routines, operating on mesh functions.
This module defines the meshes, which are used in Octopus.
Definition: mesh.F90:120
subroutine, public messages_print_with_emphasis(msg, iunit, namespace)
Definition: messages.F90:898
subroutine, public messages_not_implemented(feature, namespace)
Definition: messages.F90:1068
character(len=512), private msg
Definition: messages.F90:167
character(len=256), dimension(max_lines), public message
to be output by fatal, warning
Definition: messages.F90:162
subroutine, public messages_fatal(no_lines, only_root_writes, namespace)
Definition: messages.F90:410
subroutine, public messages_experimental(name, namespace)
Definition: messages.F90:1040
subroutine, public messages_info(no_lines, iunit, debug_only, stress, all_nodes, namespace)
Definition: messages.F90:594
subroutine, public mix_get_field(this, mixfield)
Definition: mix.F90:838
subroutine, public mix_init(smix, namespace, space, der, d1, d2, def_, func_type_, prefix_)
Initialise mix_t instance.
Definition: mix.F90:269
subroutine, public mix_end(smix)
Definition: mix.F90:568
This module handles the communicators for the various parallelization strategies.
Definition: multicomm.F90:147
subroutine, public photon_mode_compute_dipoles(this, mesh)
Computes the polarization dipole.
subroutine, public photon_mode_write_info(this, iunit, namespace)
subroutine, public photon_mode_set_n_electrons(this, qtot)
subroutine, public photon_mode_init(this, namespace, dim, photon_free)
subroutine, public scf_tol_init(this, namespace, qtot, def_maximumiter, tol_scheme)
Definition: scf_tol.F90:162
subroutine, public scf_tol_end(this)
Definition: scf_tol.F90:363
integer, parameter, public smear_semiconductor
Definition: smear.F90:176
integer, parameter, public smear_fixed_occ
Definition: smear.F90:176
pure logical function, public states_are_real(st)
This module handles reading and writing restart information for the states_elec_t.
subroutine, public zsternheimer_set_inhomog(this, inhomog)
subroutine, public dsternheimer_solve(this, namespace, space, gr, kpoints, st, hm, mc, lr, nsigma, omega, perturbation, restart, rho_tag, wfs_tag, idir, have_restart_rho, have_exact_freq)
This routine calculates the first-order variations of the wavefunctions for an applied perturbation.
subroutine, public zcalc_hvar(namespace, coeff_hartree, gr, hm, lr_rho, nsigma, hvar, fxc, fxc_grad, fxc_grad_spin)
Computes the first-order variation of the Kohn-Sham Hamiltonian.
subroutine, public zsternheimer_calc_hvar(this, namespace, gr, hm, lr, nsigma, hvar, idir)
integer pure function, public swap_sigma(sigma)
subroutine sternheimer_build_fxc(this, namespace, gr, st, xc)
Builds the exchange-correlation kernel for computing the density response.
subroutine, public dsternheimer_calc_hvar(this, namespace, gr, hm, lr, nsigma, hvar, idir)
subroutine, public dcalc_kvar(this, mesh, st, lr_rho1, lr_rho2, nsigma, kvar)
logical function, public sternheimer_has_converged(this)
subroutine, public zsternheimer_set_rhs(this, rhs)
character(len=100) function, public wfs_tag_sigma(namespace, base_name, isigma)
subroutine calc_hvar_photons(this, mesh, nspin, lr_rho, nsigma, hvar, idir)
logical pure function, public sternheimer_have_rhs(this)
subroutine, public dsternheimer_solve_order2(sh1, sh2, sh_2ndorder, namespace, space, gr, kpoints, st, hm, mc, lr1, lr2, nsigma, omega1, omega2, pert1, pert2, lr_2ndorder, pert_2ndorder, restart, rho_tag, wfs_tag, have_restart_rho, have_exact_freq, give_pert1psi2, give_dl_eig1)
subroutine, public dsternheimer_set_rhs(this, rhs)
subroutine, public dcalc_hvar(namespace, coeff_hartree, gr, hm, lr_rho, nsigma, hvar, fxc, fxc_grad, fxc_grad_spin)
Computes the first-order variation of the Kohn-Sham Hamiltonian.
pure logical function sternheimer_add_fxc(this)
subroutine, public zsternheimer_solve_order2(sh1, sh2, sh_2ndorder, namespace, space, gr, kpoints, st, hm, mc, lr1, lr2, nsigma, omega1, omega2, pert1, pert2, lr_2ndorder, pert_2ndorder, restart, rho_tag, wfs_tag, have_restart_rho, have_exact_freq, give_pert1psi2, give_dl_eig1)
subroutine, public sternheimer_unset_kxc(this)
subroutine, public zsternheimer_solve(this, namespace, space, gr, kpoints, st, hm, mc, lr, nsigma, omega, perturbation, restart, rho_tag, wfs_tag, idir, have_restart_rho, have_exact_freq)
This routine calculates the first-order variations of the wavefunctions for an applied perturbation.
pure logical function sternheimer_add_hartree(this)
subroutine, public sternheimer_unset_inhomog(this)
logical pure function, public sternheimer_have_inhomog(this)
subroutine, public zcalc_kvar(this, mesh, st, lr_rho1, lr_rho2, nsigma, kvar)
subroutine, public sternheimer_end(this)
subroutine, public sternheimer_obsolete_variables(namespace, old_prefix, new_prefix)
subroutine, public sternheimer_build_kxc(this, namespace, mesh, st, xc)
subroutine, public dsternheimer_set_inhomog(this, inhomog)
subroutine, public sternheimer_init(this, namespace, space, gr, st, hm, ks, mc, wfs_are_cplx, set_ham_var, set_occ_response, set_last_occ_response, occ_response_by_sternheimer)
subroutine, public sternheimer_unset_rhs(this)
type(type_t), parameter, public type_cmplx
Definition: types.F90:136
type(type_t), parameter, public type_float
Definition: types.F90:135
brief This module defines the class unit_t which is used by the unit_systems_oct_m module.
Definition: unit.F90:134
This module defines the unit system, used for input and output.
type(unit_system_t), public units_inp
the units systems for reading and writing
This module provices a simple timer class which can be used to trigger the writing of a restart file ...
Definition: walltimer.F90:123
subroutine, public xc_get_fxc(xcs, gr, namespace, rho, ispin, fxc, fxc_grad, fxc_grad_spin)
Returns the exchange-correlation kernel.
Definition: xc_kernel.F90:172
subroutine, public xc_get_kxc(xcs, mesh, namespace, rho, ispin, kxc)
Definition: xc_kernel.F90:550
Definition: xc.F90:120
pure logical function, public family_is_mgga(family, only_collinear)
Is the xc function part of the mGGA family.
Definition: xc.F90:715
logical pure function, public family_is_hybrid(xcs)
Returns true if the functional is an hybrid functional.
Definition: xc.F90:749
pure logical function, public in_family(family, xc_families)
Definition: xc.F90:762
subroutine, public xc_write_fxc_info(xcs, iunit, namespace)
Definition: xc.F90:294
integer, parameter, public sic_none
no self-interaction correction
Definition: xc_sic.F90:153
subroutine, public xc_sic_write_info(sic, iunit, namespace)
Definition: xc_sic.F90:259
Description of the grid, containing information on derivatives, stencil, and symmetries.
Definition: grid.F90:171
Describes mesh distribution to nodes.
Definition: mesh.F90:187
The states_elec_t class contains all electronic wave functions.