38 use,
intrinsic :: iso_fortran_env
73 integer :: xc_photon = 0
74 type(xc_photons_t) :: xc_photons
75 type(xc_oep_photon_t) :: oep_photon
76 logical :: has_photons = .false.
77 logical :: include_hartree = .
true.
78 type(photon_mode_t),
pointer :: pt => null()
109 class(v_ks_photon_t),
intent(inout) :: this
110 type(namespace_t),
intent(in) :: namespace
134 call parse_variable(namespace,
'XCPhotonFunctional', option__xcphotonfunctional__none, this%xc_photon)
143 call parse_variable(namespace,
'XCPhotonIncludeHartree', .
true., this%include_hartree)
145 if (.not. this%include_hartree)
then
156 class(v_ks_photon_t),
intent(inout) :: this
157 type(namespace_t),
intent(in) :: namespace
158 class(space_t),
intent(in) :: space
159 type(grid_t),
intent(in) :: gr
160 type(states_elec_t),
intent(in) :: st
164 if (this%xc_photon /= 0)
then
166 call this%xc_photons%init(namespace, this%xc_photon, space, gr, st)
175 subroutine v_ks_photon_setup(this, namespace, modes, gr, st, ions, mc, space, xc, xc_family, oep_level)
185 integer,
intent(in) :: xc_family
186 integer,
intent(in) :: oep_level
193 write(
message(1),
'(a,i5,a)')
'Happy to have ', modes%nmodes,
' photon modes with us.'
195 call mf_init(this%pt_mx, gr, st, ions, this%pt)
198 this%oep_photon%level = oep_level
215 if (this%has_photons)
then
218 if (this%xc_photon /= 0)
then
219 call this%xc_photons%end()
229 type(
grid_t),
intent(inout) :: gr
231 type(
ions_t),
intent(in) :: ions
232 real(real64),
intent(in) :: time
236 call mf_calc(this%pt_mx, gr, st, ions, this%pt, time)
243 subroutine v_ks_photon_add_px(this, namespace, total_density, gr, space, psolver, st, spin_channels, vxc, e_photon_exchange)
246 real(real64),
pointer,
contiguous,
intent(in) :: total_density(:)
247 type(
grid_t),
intent(in) :: gr
248 class(
space_t),
intent(in) :: space
251 integer,
intent(in) :: spin_channels
252 real(real64),
intent(inout) :: vxc(:, :)
253 real(real64),
intent(out) :: e_photon_exchange
259 call this%xc_photons%v_ks(namespace, total_density, gr, space, psolver, st)
262 do ispin = 1, spin_channels
263 call lalg_axpy(gr%np,
m_one, this%xc_photons%vpx(1:gr%np), vxc(1:gr%np, ispin))
267 e_photon_exchange = this%xc_photons%ex
280 type(
xc_t),
intent(inout) :: xc
281 type(
grid_t),
intent(in) :: gr
284 class(
space_t),
intent(in) :: space
285 real(real64),
contiguous,
intent(inout) :: vxc(:, :)
292 hm, st, space, hm%energy%exchange, hm%energy%correlation, vxc = vxc)
295 hm, st, space, hm%energy%exchange, hm%energy%correlation, vxc = vxc)
297 hm%energy%photon_exchange = this%oep_photon%pt%ex
307 type(
grid_t),
intent(in) :: gr
308 real(real64),
intent(inout) :: vhxc(:, :)
309 integer,
intent(in) :: ispin
310 real(real64),
intent(out) :: photon_forces(:)
314 if (
associated(this%pt_mx%vmf))
then
320 photon_forces(:) = this%pt_mx%fmf(1:
size(photon_forces))
329 type(
grid_t),
intent(in) :: gr
330 class(
space_t),
intent(in) :: space
333 real(real64),
intent(in) :: time
334 real(real64),
intent(in) :: dt
338 if (this%xc_photon /= 0)
then
339 call this%xc_photons%add_mean_field(gr, space, kpoints, st, time, dt)
350 type(
grid_t),
intent(in) :: gr
351 real(real64),
intent(in) :: dt
352 integer,
intent(inout) :: ierr
358 if (this%has_photons)
then
360 if (err /= 0) ierr = ierr + 16
362 if (this%xc_photon /= 0)
then
364 call this%xc_photons%mf_dump(restart, err)
365 if (err /= 0) ierr = ierr + 32
376 type(
grid_t),
intent(in) :: gr
377 class(
space_t),
intent(in) :: space
378 integer,
intent(inout) :: ierr
384 if (this%has_photons)
then
386 if (err /= 0) ierr = ierr + 16
388 if (this%xc_photon /= 0)
then
389 call this%xc_photons%mf_load(restart, space, err)
390 if (err /= 0) ierr = ierr + 32
400 integer,
intent(in) :: iunit
405 write(iunit,
'(a)')
'Photon observables:'
406 write(iunit,
'(6x, a, es15.8,a,es15.8,a)')
'Photon number = ', this%oep_photon%pt%number(1)
407 write(iunit,
'(6x, a, es15.8,a,es15.8,a)')
'Photon ex. = ', this%oep_photon%pt%ex
416 logical pure function v_ks_photon_active(this)
418 v_ks_photon_active = this%has_photons
425 logical,
intent(in) :: val
426 this%has_photons = val
431 integer pure function v_ks_photon_functional(this)
438 logical pure function v_ks_photon_include_hartree(this)
445 integer pure function v_ks_photon_nmodes(this)
452 logical pure function v_ks_photon_oep_full(this)
461 real(real64),
pointer :: corr(:)
462 corr => this%oep_photon%pt%correlator(:, 1)
469 type(mf_t),
pointer :: pt_mx
477 type(xc_photons_t),
pointer :: xcp
478 xcp => this%xc_photons
constant times a vector plus a vector
integer, parameter, public unpolarized
Parameters...
real(real64), parameter, public m_one
This module implements the underlying real-space grid.
subroutine, public messages_warning(no_lines, all_nodes, namespace)
character(len=256), dimension(max_lines), public message
to be output by fatal, warning
subroutine, public messages_info(no_lines, iunit, debug_only, stress, all_nodes, namespace)
This module handles the communicators for the various parallelization strategies.
subroutine, public mf_photons_load(restart, this, gr, ierr)
subroutine, public mf_init(this, gr, st, ions, pt_mode)
subroutine, public mf_photons_dump(restart, this, gr, dt, pt_mode, ierr)
subroutine, public mf_end(this)
subroutine, public mf_calc(this, gr, st, ions, pt_mode, time)
subroutine, public photon_mode_set_n_electrons(this, qtot)
pure logical function, public states_are_real(st)
This module handles spin dimensions of the states and the k-point distribution.
QEDFT / electron-photon (cavity) extension of the Kohn-Sham potential.
type(xc_photons_t) function, pointer v_ks_photon_get_xc_photons(this)
Pointer to the photon-free exchange object.
type(mf_t) function, pointer v_ks_photon_get_pt_mx(this)
Pointer to the mean-field photon object (for time-dependent output).
real(real64) function, dimension(:), pointer v_ks_photon_correlator(this)
Pointer to the photon correlator (for output).
subroutine v_ks_photon_oep_calc(this, namespace, xc, gr, hm, st, space, vxc)
Compute the photon OEP potential/energy contribution.
subroutine v_ks_photon_set_active(this, val)
Enable/disable photons (set before v_ks_init).
subroutine v_ks_photon_add_px(this, namespace, total_density, gr, space, psolver, st, spin_channels, vxc, e_photon_exchange)
Add the photon-free photon-exchange potential to vxc and return its energy.
integer pure function v_ks_photon_functional(this)
The selected QEDFT functional (0 = none).
subroutine v_ks_photon_end(this)
Finalize all photon objects.
subroutine v_ks_photon_add_mean_field(this, gr, space, kpoints, st, time, dt)
Add the photon mean field to the paramagnetic-current integral (time propagation).
subroutine v_ks_photon_mf_calc(this, gr, st, ions, time)
Update the mean-field photon quantities (time-dependent run, mean-field QEDFT).
subroutine v_ks_photon_add_mf_potential(this, gr, vhxc, ispin, photon_forces)
Add the mean-field photon potential to vhxc and set the photon forces.
subroutine v_ks_photon_init_xc(this, namespace, space, gr, st)
Initialize the photon-free exchange object when a QEDFT functional is selected.
subroutine v_ks_photon_setup(this, namespace, modes, gr, st, ions, mc, space, xc, xc_family, oep_level)
Set up the photon modes, mean-field object and photon OEP (called after v_ks_init).
integer pure function v_ks_photon_nmodes(this)
Number of photon modes.
subroutine v_ks_photon_restart_dump(this, restart, gr, dt, ierr)
Dump photon restart data; error bits added to ierr (16: mean field, 32: photon-free).
logical pure function v_ks_photon_oep_full(this)
Whether the photon OEP is at the FULL level (controls correlator output).
logical pure function v_ks_photon_active(this)
Whether photons are enabled in this v_ks.
subroutine v_ks_photon_init(this, namespace)
Parse the QEDFT input variables and set photon defaults.
subroutine v_ks_photon_restart_load(this, restart, gr, space, ierr)
Load photon restart data; error bits added to ierr (16: mean field, 32: photon-free).
subroutine v_ks_photon_write_info(this, iunit)
Write the photon observables (number, exchange) to the SCF info output.
logical pure function v_ks_photon_include_hartree(this)
Whether to include the Hartree term (QEDFT).
integer, parameter, public xc_oep_x
Exact exchange.
integer, parameter, public func_x
integer, parameter, public oep_level_none
the OEP levels
integer, parameter, public oep_level_full
integer, parameter, public oep_level_kli
subroutine, public zxc_oep_photon_calc(oep, namespace, xcs, gr, hm, st, space, ex, ec, vxc)
This file handles the evaluation of the OEP potential, in the KLI or full OEP as described in S....
subroutine, public xc_oep_photon_init(oep, namespace, family, gr, st, mc, space)
subroutine, public xc_oep_photon_end(oep)
subroutine, public dxc_oep_photon_calc(oep, namespace, xcs, gr, hm, st, space, ex, ec, vxc)
This file handles the evaluation of the OEP potential, in the KLI or full OEP as described in S....
This module implements the "photon-free" electron-photon exchange-correlation functional.
Description of the grid, containing information on derivatives, stencil, and symmetries.
Stores all communicators and groups.
The states_elec_t class contains all electronic wave functions.
Photon (QEDFT) part of v_ks_t.